RAIDA  1.9.0
Public Member Functions | List of all members
AIDA::ITree Class Referenceabstract

class IManagedObject; More...

#include <ITree.h>

Inheritance diagram for AIDA::ITree:
AIDA::ITreeROOT

Public Member Functions

virtual ~ITree ()
 Destructor.
 
virtual std::string storeName () const =0
 Get the name of the store. More...
 
virtual bool cd (const std::string &path)=0
 Get the IManagedObject at a given path in the ITree. More...
 
virtual std::string pwd () const =0
 Get the path of the current working directory. More...
 
virtual bool ls (const std::string &path=".", bool recursive=false, std::ostream &os=std::cout) const =0
 List, into a given output stream, all the IManagedObjects, including directories (but not "." and ".."), in a given path. More...
 
virtual bool mkdir (const std::string &path)=0
 Get the list of names of the IManagedObjects under a given path, including directories (but not "." and ".."). More...
 
virtual bool commit ()=0
 Create a directory recursively. More...
 
virtual bool close ()=0
 Set the strategy of what should happen if two objects have the same path. More...
 

Detailed Description

class IManagedObject;

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/)

Member Function Documentation

virtual bool AIDA::ITree::cd ( 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
pathThe path.
Returns
The corresponding IManagedObject.virtual IManagedObject * find(const std::string & path) = 0; Get a mounted ITree at a given path in the current ITree. The path can either be absolute or relative to the current working directory.
Parameters
pathThe path.
Returns
The corresponding ITree.virtual ITree * findTree(const std::string & path) = 0; Change to a given directory.
Parameters
pathThe absolute or relative path of the directory we are changing to.
Returns
false If the path does not exist.

Implemented in AIDA::ITreeROOT.

Referenced by AIDA::IHistogramFactoryROOT::createCloud1D(), AIDA::IHistogramFactoryROOT::createCloud2D(), AIDA::IHistogramFactoryROOT::createCloud3D(), AIDA::IHistogramFactoryROOT::createCopy(), AIDA::IHistogramFactoryROOT::createHistogram1D(), AIDA::IHistogramFactoryROOT::createHistogram2D(), AIDA::IHistogramFactoryROOT::createHistogram3D(), AIDA::IHistogramFactoryROOT::createProfile1D(), AIDA::IHistogramFactoryROOT::createProfile2D(), AIDA::ICloud1DROOT::myConvert(), AIDA::ICloud1DROOT::scale(), AIDA::ICloud2DROOT::scale(), AIDA::ICloud3DROOT::scale(), AIDA::IHistogramFactoryROOT::sliceX(), AIDA::IHistogramFactoryROOT::sliceXY(), AIDA::IHistogramFactoryROOT::sliceXZ(), AIDA::IHistogramFactoryROOT::sliceY(), and AIDA::IHistogramFactoryROOT::sliceYZ().

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

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

Default is overwrite.

Parameters
overwritetrue to enable overwriting.virtual void setOverwrite(bool overwrite = true) = 0; Copy an object from a path to another.
oldPathThe path of the object to be copied.
newPathThe path where the object is to be copied.
recursivetrue if a recursive copy has to be performed.
Returns
false If either path does not exist.virtual bool cp(const std::string & oldPath, const std::string & newPath, bool recursive = false) = 0; Create a symbolic link to an object in the ITree.
Parameters
pathThe absolute or relative path of the object to be linked.
aliasThe absolute or relative name of the link.
Returns
false If path or any subidrectory within path does not exist.virtual bool symlink(const std::string & path, const std::string & alias) = 0; Mounts a tree within another (target) tree. A tree can only be mounted once. Example:
    target.mount("/home/tonyj",tree,"/");
Parameters
pathThe path in the target tree
treeThe tree to mount within the target tree
treePathThe mount point within the tree to be mounted.
Returns
false If something does not exist.virtual bool mount(const std::string & path, ITree & tree, const std::string & treePath) = 0; Unmount a subtree at a given path (mount point). Whenever a tree is destroyed it first unmounts all dependent trees.
Parameters
pathThe path of the subtree to be unmounted.
Returns
false If path does not exist.virtual bool unmount(const std::string & path) = 0; Closes the underlying store. Changes will be saved only if commit() has been called before. The call is propagated to the dependent mounted trees.
false If there are problems writing out the underlying store.

Implemented in AIDA::ITreeROOT.

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

Create a directory recursively.

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

Parameters
pathThe absolute or relative path of the new directory.
Returns
false If an intermediate subdirectory is not a directory, or if the directory already exists.virtual bool mkdirs(const std::string & path) = 0; Remove a directory and all the contents underneeth.
Parameters
pathThe absolute or relative path of the directory to be removed.
Returns
false If path does not exist or if it is not a directory.virtual bool rmdir(const std::string & path) = 0; 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
pathThe absolute or relative path of the IManagedObject to be removed.
Returns
false If path does not exist.virtual bool rm(const std::string & path) = 0; Get the full path of an IManagedObject.
Parameters
objectThe 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.virtual std::string findPath(const IManagedObject & object) const = 0; Move an IManagedObject or a directory from one directory to another.
Parameters
oldPathThe path of the IManagedObject or direcoty to be moved.
newPathThe path of the diretory in which the object has to be moved to.
Returns
false If either path does not exist.virtual bool mv(const std::string & oldPath, const std::string & newPath) = 0; Commit any open transaction to the underlying store(s). It flushes objects into the disk for non-memory-mapped stores.
false If the underlying store cannot be written out.

Implemented in AIDA::ITreeROOT.

virtual 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
pathThe path where the list has to be performed (by default the current directory ".").
recursiveIf true the list is extended recursively in all the directories under path (the default is false.
osThe output stream into which the list is dumped (by default the standard output).
Returns
false If the path does not exist.

Implemented in AIDA::ITreeROOT.

virtual bool AIDA::ITree::mkdir ( const std::string &  path)
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
pathThe path where the list has to be performed (by default the current directory ".").
recursiveIf true the list is extended recursively in all the directories under path (the default is false.virtual std::vector<std::string> listObjectNames(const std::string & path = ".", bool recursive = false) const = 0; 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.
pathThe path where the list has to be performed (by default the current directory ".").
recursiveIf true the list is extended recursively in all the directories under path (the default is false.virtual std::vector<std::string> listObjectTypes(const std::string & path = ".", bool recursive = false) const = 0; Create a new directory. Given a path only the last directory in it is created if all the intermediate subdirectories already exist.
pathThe 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.

Implemented in AIDA::ITreeROOT.

virtual std::string AIDA::ITree::pwd ( ) const
pure virtual
virtual std::string AIDA::ITree::storeName ( ) const
pure virtual

The documentation for this class was generated from the following file: