#include <Tree.h>
Public Types | |
typedef std::vector< std::string > | Path |
A path is a vector of directory names. | |
typedef std::set< Path > | PathSet |
A set of paths. | |
typedef std::map< std::string, IManagedObject * > | ObjMap |
Map of paths to objects. | |
Public Member Functions | |
Tree (std::string storename, bool xml=true) | |
The standard constructor. | |
Tree () | |
The default constructor. | |
Tree (const Tree &dt) | |
The copy constructor. | |
virtual | ~Tree () |
Destructor. | |
std::string | storeName () const |
Get the name of the store. | |
IManagedObject * | find (const std::string &path) |
Get the IManagedObject at a given path in the ITree. | |
ITree * | findTree (const std::string &) |
LWH cannot get a mounted ITree at a given path in the current ITree. | |
bool | cd (const std::string &dir) |
Change to a given directory. | |
bool | insert (std::string str, IManagedObject *o) |
Insert the ManagedObject o in the tree with the path str. | |
std::string | pwd () const |
Get the path of the current working directory. | |
bool | ls (const std::string &=".", bool=false, std::ostream &=std::cout) const |
Not implemented in LWH. | |
std::vector< std::string > | listObjectNames (const std::string &=".", bool=false) const |
Not implemented in LWH. | |
std::vector< std::string > | listObjectTypes (const std::string &=".", bool=false) const |
Not implemented in LWH. | |
bool | mkdir (const std::string &dir) |
Create a new directory. | |
bool | mkdirs (const std::string &dir) |
Create a directory recursively. | |
bool | mkdirs (Path p) |
Create a directory recursively. | |
bool | rmdir (const std::string &dir) |
Remove a directory and all the contents underneeth. | |
bool | rm (const std::string &path) |
Remove and delete an IManagedObject by specifying its path. | |
std::string | findPath (const IManagedObject &o) const |
Get the full path of an IManagedObject. | |
bool | mv (const std::string &oldp, const std::string &newp) |
Move an IManagedObject or a directory from one directory to another. | |
bool | commit () |
Print all histograms to the current filename. | |
void | setOverwrite (bool o=true) |
Not implemented in LWH. | |
bool | cp (const std::string &, const std::string &, bool=false) |
Not implemented in LWH. | |
bool | symlink (const std::string &, const std::string &) |
Not implemented in LWH. | |
bool | mount (const std::string &, ITree &, const std::string &) |
Not implemented in LWH. | |
bool | unmount (const std::string &) |
Not implemented in LWH. | |
bool | close () |
Calls commit(). | |
void * | cast (const std::string &) const |
Not implemented in LWH. | |
Protected Member Functions | |
std::string | sts (std::string s) const |
Strip trailing slash. | |
std::string | stn (std::string s) const |
Strip trailing name. | |
std::string | fullpath (std::string d) const |
Get proper full path from possibly relative path. | |
Path | str2pth (std::string s) const |
Convert a string containing a path to a Path object. | |
std::string | pth2str (const Path &pth) const |
Convert a Path object to a corresponding string. | |
Path | purgepath (const Path &pth) const |
Remove '. | |
Private Attributes | |
std::string | name |
The filename to print histograms to. | |
bool | flat |
If true write histograms in FLAT format, otherwise in XML. | |
PathSet | dirs |
The set of defined directories. | |
ObjMap | objs |
The set of defined objects. | |
std::string | cwd |
The current working directory. | |
bool | overwrite |
Overwrite strategy. | |
Friends | |
class | AnalysisFactory |
The AnalysisFactory is a friend. |
Definition at line 32 of file Tree.h.
typedef std::vector<std::string> LWH::Tree::Path |
typedef std::map<std::string, IManagedObject *> LWH::Tree::ObjMap |
std::string LWH::Tree::storeName | ( | ) | const [inline] |
IManagedObject* LWH::Tree::find | ( | const std::string & | path | ) | [inline] |
ITree* LWH::Tree::findTree | ( | const std::string & | ) | [inline] |
bool LWH::Tree::cd | ( | const std::string & | dir | ) | [inline] |
Change to a given directory.
dir | The absolute or relative path of the directory we are changing to. |
Definition at line 111 of file Tree.h.
References cwd, dirs, fullpath(), pth2str(), purgepath(), str2pth(), and sts().
std::string LWH::Tree::pwd | ( | ) | const [inline] |
bool LWH::Tree::ls | ( | const std::string & | = "." , |
|
bool | = false , |
|||
std::ostream & | = std::cout | |||
) | const [inline] |
bool LWH::Tree::mkdir | ( | const std::string & | dir | ) | [inline] |
Create a new directory.
Given a path only the last directory in it is created if all the intermediate subdirectories already exist.
dir | The absolute or relative path of the new directory. |
Definition at line 182 of file Tree.h.
References dirs, fullpath(), purgepath(), str2pth(), and sts().
bool LWH::Tree::mkdirs | ( | const std::string & | dir | ) | [inline] |
Create a directory recursively.
Given a path the last directory and all the intermediate non-existing subdirectories are created.
dir | The absolute or relative path of the new directory. |
Definition at line 198 of file Tree.h.
References fullpath(), purgepath(), str2pth(), and sts().
Referenced by mkdirs().
bool LWH::Tree::mkdirs | ( | Path | p | ) | [inline] |
Create a directory recursively.
Given a Path the last directory and all the intermediate non-existing subdirectories are created.
p | The full Path of the new directory. |
bool LWH::Tree::rmdir | ( | const std::string & | dir | ) | [inline] |
Remove a directory and all the contents underneeth.
dir | The absolute or relative path of the directory to be removed. |
Definition at line 222 of file Tree.h.
References dirs, fullpath(), objs, purgepath(), str2pth(), and sts().
bool LWH::Tree::rm | ( | const std::string & | path | ) | [inline] |
Remove and delete an IManagedObject by specifying its path.
path | The absolute or relative path of the IManagedObject to be removed. |
Definition at line 237 of file Tree.h.
References fullpath(), and objs.
Referenced by LWH::HistogramFactory::destroy(), and LWH::DataPointSetFactory::destroy().
std::string LWH::Tree::findPath | ( | const IManagedObject & | o | ) | const [inline] |
Get the full path of an IManagedObject.
o | The IManagedObject whose path is to be returned. |
Definition at line 251 of file Tree.h.
References objs.
Referenced by LWH::HistogramFactory::destroy(), and LWH::DataPointSetFactory::destroy().
bool LWH::Tree::mv | ( | const std::string & | oldp, | |
const std::string & | newp | |||
) | [inline] |
Move an IManagedObject or a directory from one directory to another.
oldp | The path of the IManagedObject [not direcoty] to be moved. | |
newp | The path of the diretory in which the object has to be moved to. |
Definition at line 264 of file Tree.h.
References dirs, fullpath(), insert(), objs, pth2str(), purgepath(), str2pth(), and sts().
bool LWH::Tree::commit | ( | ) | [inline] |
Print all histograms to the current filename.
Definition at line 281 of file Tree.h.
References flat, name, objs, LWH::ManagedObject::writeFLAT(), and LWH::ManagedObject::writeXML().
Referenced by close().
bool LWH::Tree::cp | ( | const std::string & | , | |
const std::string & | , | |||
bool | = false | |||
) | [inline] |
bool LWH::Tree::symlink | ( | const std::string & | , | |
const std::string & | ||||
) | [inline] |
bool LWH::Tree::mount | ( | const std::string & | , | |
ITree & | , | |||
const std::string & | ||||
) | [inline] |
bool LWH::Tree::unmount | ( | const std::string & | ) | [inline] |
void* LWH::Tree::cast | ( | const std::string & | ) | const [inline] |
std::string LWH::Tree::sts | ( | std::string | s | ) | const [inline, protected] |
std::string LWH::Tree::fullpath | ( | std::string | d | ) | const [inline, protected] |
Path LWH::Tree::str2pth | ( | std::string | s | ) | const [inline, protected] |
std::string LWH::Tree::pth2str | ( | const Path & | pth | ) | const [inline, protected] |
friend class AnalysisFactory [friend] |
std::string LWH::Tree::name [private] |
The filename to print histograms to.
Definition at line 413 of file Tree.h.
Referenced by commit(), and storeName().
bool LWH::Tree::flat [private] |
PathSet LWH::Tree::dirs [private] |
ObjMap LWH::Tree::objs [private] |
std::string LWH::Tree::cwd [private] |
The current working directory.
Definition at line 425 of file Tree.h.
Referenced by cd(), fullpath(), and pwd().
bool LWH::Tree::overwrite [private] |
Overwrite strategy.
Definition at line 428 of file Tree.h.
Referenced by insert(), and setOverwrite().