Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

ITree Class Reference

#include <ITree.h>

List of all members.


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.


Public Member Functions

virtual ~ITree ()
 Destructor.
virtual std::string storeName () const =0
virtual IManagedObject * find (const std::string &path)=0
virtual ITreefindTree (const std::string &path)=0
virtual bool cd (const std::string &path)=0
virtual 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
virtual void * cast (const std::string &className) const =0

Constructor & Destructor Documentation

virtual ~ITree  )  [inline, virtual]
 

Destructor.

Definition at line 41 of file ITree.h.


Member Function Documentation

virtual void* cast const std::string &  className  )  const [pure virtual]
 

See IManagedObject for a description.

Parameters:
className The name of the class to cast on.
Returns:
The right pointer. Return 0 if failure.

virtual bool 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.

virtual bool 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.

virtual bool 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.

Referenced by AnalysisHandler::finalize(), and main().

virtual bool 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.

virtual IManagedObject* 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.

virtual std::string 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.

virtual ITree* findTree const std::string &  path  )  [pure virtual]
 

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:
path The path.
Returns:
The corresponding ITree.

virtual std::vector<std::string> 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.

virtual std::vector<std::string> 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.

virtual bool 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.

virtual bool 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.

virtual bool 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.

virtual bool 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.

virtual bool 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.

virtual std::string pwd  )  const [pure virtual]
 

Get the path of the current working directory.

Returns:
The path of the current working directory.

virtual bool 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.

virtual bool 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.

virtual void 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.

virtual std::string storeName  )  const [pure virtual]
 

Get the name of the store.

Returns:
The store's name.

virtual bool 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.

virtual bool 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: