CERN Accelerating science

This website is no longer maintained. Its content may be obsolete. Please visit http://home.cern/ for current CERN information.

Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

AIDA::ITree Class Reference

#include <ITree.h>

List of all members.

Public Methods

virtual ~ITree ()
 Destructor. More...

virtual const std::string& storeName () const=0
virtual IManagedObjectfind (const std::string &path)=0
virtual bool cd (const std::string &path)=0
virtual const std::string& pwd () const=0
virtual bool ls (const std::string &path=".", bool recursive=false, std::ostream &os=std::cout) const=0
virtual std::vector<std::string> listObjectNames (const std::string &path=".", bool recursive=false) const=0
virtual std::vector<std::string> listObjectTypes (const std::string &path=".", bool recursive=false) const=0
virtual bool mkdir (const std::string &path)=0
virtual bool mkdirs (const std::string &path)=0
virtual bool rmdir (const std::string &path)=0
virtual bool rm (const std::string &path)=0
virtual std::string findPath (const IManagedObject &object) const=0
virtual bool mv (const std::string &oldPath, const std::string &newPath)=0
virtual bool commit ()=0
virtual void setOverwrite (bool overwrite=true)=0
virtual bool cp (const std::string &oldPath, const std::string &newPath, bool recursive=false)=0
virtual bool symlink (const std::string &path, const std::string &alias)=0
virtual bool mount (const std::string &path, ITree &tree, const std::string &treePath)=0
virtual bool unmount (const std::string &path)=0
virtual bool close ()=0


Detailed Description

User level interface to a Tree.

All paths follow unix convention .., ., /, backslash is the escape character. Relative paths are allowed.

NOTE: - this tree keeps a current position(pwd) within the tree. This may be implemented on a per-thread basis.

Author:
The AIDA team (http://aida.freehep.org/)

Definition at line 37 of file ITree.h.


Constructor & Destructor Documentation

AIDA::ITree::~ITree ( ) [inline, virtual]
 

Definition at line 41 of file ITree.h.


Member Function Documentation

bool AIDA::ITree::cd ( const std::string & path ) [pure virtual]
 

Change to a given directory.

Parameters:
path   The absolute or relative path of the directory we are changing to.
Returns:
false If the path does not exist.

bool AIDA::ITree::close ( ) [pure virtual]
 

Closes the underlying store. Changes will be saved only if commit() has been called before. The call is propagated to the dependent mounted trees.

Returns:
false If there are problems writing out the underlying store.

bool AIDA::ITree::commit ( ) [pure virtual]
 

Commit any open transaction to the underlying store(s). It flushes objects into the disk for non-memory-mapped stores.

Returns:
false If the underlying store cannot be written out.

bool AIDA::ITree::cp ( const std::string & oldPath,
const std::string & newPath,
bool recursive = false ) [pure virtual]
 

Copy an object from a path to another.

Parameters:
oldPath   The path of the object to be copied.
newPath   The path where the object is to be copied.
recursive   true if a recursive copy has to be performed.
Returns:
false If either path does not exist.

IManagedObject * AIDA::ITree::find ( const std::string & path ) [pure virtual]
 

Get the IManagedObject at a given path in the ITree. The path can either be absolute or relative to the current working directory.

Parameters:
path   The path.
Returns:
The corresponding IManagedObject.

std::string AIDA::ITree::findPath ( const IManagedObject & object ) const [pure virtual]
 

Get the full path of an IManagedObject.

Parameters:
object   The IManagedObject whose path is to be returned.
Returns:
The object's absolute path. In C++ if the object does not exist, an empty string is returned.

std::vector< std::string > AIDA::ITree::listObjectNames ( const std::string & path = ".",
bool recursive = false ) const [pure virtual]
 

Get the list of names of the IManagedObjects under a given path, including directories (but not "." and ".."). Directories end with "/". The returned names are appended to the given path unless the latter is ".".

Parameters:
path   The path where the list has to be performed (by default the current directory ".").
recursive   If true the list is extended recursively in all the directories under path (the default is false.

std::vector< std::string > AIDA::ITree::listObjectTypes ( const std::string & path = ".",
bool recursive = false ) const [pure virtual]
 

Get the list of types of the IManagedObjects under a given path. The types are the leaf class of the Interface, e.g. "IHistogram1D", "ITuple", etc. Directories are marked with "dir". The order of the types is the same as the order for the listObjectNames() method to achieve a one-to-one correspondance between object names and types.

Parameters:
path   The path where the list has to be performed (by default the current directory ".").
recursive   If true the list is extended recursively in all the directories under path (the default is false.

bool AIDA::ITree::ls ( const std::string & path = ".",
bool recursive = false,
std::ostream & os = std::cout ) const [pure virtual]
 

List, into a given output stream, all the IManagedObjects, including directories (but not "." and ".."), in a given path. Directories end with "/". The list can be recursive.

Parameters:
path   The path where the list has to be performed (by default the current directory ".").
recursive   If true the list is extended recursively in all the directories under path (the default is false.
os   The output stream into which the list is dumped (by default the standard output).
Returns:
false If the path does not exist.

bool AIDA::ITree::mkdir ( const std::string & path ) [pure virtual]
 

Create a new directory. Given a path only the last directory in it is created if all the intermediate subdirectories already exist.

Parameters:
path   The absolute or relative path of the new directory.
Returns:
false If a subdirectory within the path does not exist or it is not a directory. Also if the directory already exists.

bool AIDA::ITree::mkdirs ( const std::string & path ) [pure virtual]
 

Create a directory recursively. Given a path the last directory and all the intermediate non-existing subdirectories are created.

Parameters:
path   The absolute or relative path of the new directory.
Returns:
false If an intermediate subdirectory is not a directory, or if the directory already exists.

bool AIDA::ITree::mount ( const std::string & path,
ITree & tree,
const std::string & treePath ) [pure virtual]
 

Mounts a tree within another (target) tree. A tree can only be mounted once. Example:

     target.mount("/home/tonyj",tree,"/");
 
Parameters:
path   The path in the target tree
tree   The tree to mount within the target tree
treePath   The mount point within the tree to be mounted.
Returns:
false If something does not exist.

bool AIDA::ITree::mv ( const std::string & oldPath,
const std::string & newPath ) [pure virtual]
 

Move an IManagedObject or a directory from one directory to another.

Parameters:
oldPath   The path of the IManagedObject or direcoty to be moved.
newPath   The path of the diretory in which the object has to be moved to.
Returns:
false If either path does not exist.

const std::string & AIDA::ITree::pwd ( ) const [pure virtual]
 

Get the path of the current working directory.

Returns:
The path of the current working directory.

bool AIDA::ITree::rm ( const std::string & path ) [pure virtual]
 

Remove an IManagedObject by specifying its path. If the path points to a mount point, the mount point should first commit, then close and delete the tree object.

Parameters:
path   The absolute or relative path of the IManagedObject to be removed.
Returns:
false If path does not exist.

bool AIDA::ITree::rmdir ( const std::string & path ) [pure virtual]
 

Remove a directory and all the contents underneeth.

Parameters:
path   The absolute or relative path of the directory to be removed.
Returns:
false If path does not exist or if it is not a directory.

void AIDA::ITree::setOverwrite ( bool overwrite = true ) [pure virtual]
 

Set the strategy of what should happen if two objects have the same path. Default is overwrite.

Parameters:
overwrite   true to enable overwriting.

const std::string & AIDA::ITree::storeName ( ) const [pure virtual]
 

Get the name of the store.

Returns:
The store's name.

bool AIDA::ITree::symlink ( const std::string & path,
const std::string & alias ) [pure virtual]
 

Create a symbolic link to an object in the ITree.

Parameters:
path   The absolute or relative path of the object to be linked.
alias   The absolute or relative name of the link.
Returns:
false If path or any subidrectory within path does not exist.

bool AIDA::ITree::unmount ( const std::string & path ) [pure virtual]
 

Unmount a subtree at a given path (mount point). Whenever a tree is destroyed it first unmounts all dependent trees.

Parameters:
path   The path of the subtree to be unmounted.
Returns:
false If path does not exist.


The documentation for this class was generated from the following file:
Generated at Tue Feb 18 15:48:24 2003 for AIDA_Interfaces by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001