Common Analysis Framework » QFRAMEWORK » TQPathManager

class TQPathManager

Function Members (Methods)

public:
virtual~TQPathManager()
static TClass*Class()
booldeleteLocalFile(TString filename)
stringfindConfigPath(TString filename, bool errorMessageIfNotFound = true, bool searchExecutionDir = true)
static stringfindFileFromEnvVar(const TString& filename, const string& envVar, bool printWarnings = true)
static stringfindFileFromEnvVarWithoutExecDir(const TString& filename, const string& envVar, bool printWarnings = true)
static stringfindFileFromList(TString filename, const string& searchPathList, bool printWarnings = true)
static stringfindFileFromListWithoutExecDir(TString filename, const string& searchPathList, bool printWarnings = true)
vector<TString>getAllTargetPaths()
TStringgetLocalDirectory() const
stringgetLocalPath(TString filename)
static TQPathManager*getPathManager()
stringgetTargetPath(TString filename, bool printWarnings = true)
boolgetUseTemporaryStorage() const
virtual TClass*IsA() const
TQPathManager&operator=(const TQPathManager&)
voidregisterLocalPath(TString targetFile)
boolsetLocalDirectory(TString localDirectory)
voidsetUseTemporaryStorage(bool useTemporaryStorage)
voidsetVerbose(bool verbose)
voidsetWorkingDirectory(TString dir)
virtual voidShowMembers(TMemberInspector& insp) const
virtual voidStreamer(TBuffer&)
voidStreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b)
TQPathManager(bool useTemporaryStorage = gUseTemporaryStorageDefault)
TQPathManager(const TQPathManager&)
TQPathManager(TString localDirectory, bool useTemporaryStorage = gUseTemporaryStorageDefault)
voidunregisterLocalPath(TString targetFile)
private:
virtual Bool_tCheckTObjectHashConsistency() const
voiddeleteTargetPathEntry(const TString& filePath)
TStringdetermineTargetDir() const
static stringfindFileFromEnvVar_internal(const TString& filename, const string& envVar, bool printWarnings, bool searchExecutionDir)
static stringfindFileFromList_internal(TString filename, const string& searchPathList, bool printWarnings, bool searchExecutionDir)
TStringgetTargetPathName(TString targetFile) const
voidinitialize(const TString& localDirectory, bool useTemporaryStorage)
boolisInLocalPaths_local(const TString& filePath) const
boolisInLocalPaths_target(TString filename) const
boolisInTargetPaths(const TString& filePath) const

Data Members

private:
map<TString,bool>alwaysReturnLocalPath
static intfilenameIndex
static TQPathManagergPathManager
static boolgPathManagerExists
static const boolgUseTemporaryStorageDefault
TStringlocalDirectory
map<TString,TString>localPaths
boolpathsRequested
TStringpwd
vector<TString>targetPaths
booluseTemporaryStorage
boolverbose

Class Charts

Inheritance Chart:
TQPathManager

Function documentation

std::string findFileFromEnvVar(const TString& filename, const string& envVar, bool printWarnings = true)
std::string findFileFromEnvVarWithoutExecDir(const TString& filename, const string& envVar, bool printWarnings = true)
std::string findFileFromEnvVar_internal(const TString& filename, const string& envVar, bool printWarnings, bool searchExecutionDir)
 Take value of envVar and use it to call findFileFromList
std::string findFileFromList(TString filename, const string& searchPathList, bool printWarnings = true)
std::string findFileFromListWithoutExecDir(TString filename, const string& searchPathList, bool printWarnings = true)
void setWorkingDirectory(TString dir)
 changes the working directory to the given path
 WARNING: this change affects the reading and writing location of files
          in many places, some of which the person calling this function
          (i.e., you) might not be aware of. Only call this function if
          you know *exactly* what you are doing and why!
std::string findFileFromList_internal(TString filename, const string& searchPathList, bool printWarnings, bool searchExecutionDir)
 Largely copied from Athena's more sophisticated PathResolver
 1. if filename is given as absolute path,
 1.1 if it exists, return absolute path
 1.2 if it doesn't exist, return ""
 2. if filename is local file and searchExecutionDir, return absolute path
 3. if filename is in searchPathList, return absolute path
 4. otherwise return ""
TQPathManager* getPathManager()
bool getUseTemporaryStorage() const
void setUseTemporaryStorage(bool useTemporaryStorage)
TString getLocalDirectory() const
bool setLocalDirectory(TString localDirectory)
void setVerbose(bool verbose)
void registerLocalPath(TString targetFile)
void unregisterLocalPath(TString targetFile)
std::string getTargetPath(TString filename, bool printWarnings = true)
std::string getLocalPath(TString filename)
 1. If temporary storage is disabled, return target path.
 2. If target filename is on record, return corresponding local filename.
 3. If target filename does not have a local equivalent, create the file
    and return the its path.

 Local files are saved in
 "/tmp/<username>/<processNumber>_<filenameIndex>_<filename>".
std::string findConfigPath(TString filename, bool errorMessageIfNotFound = true, bool searchExecutionDir = true)
 Filenames with TQFolder syntax e.g. folder.root:objectinside>>::label are supported
 in these cases, only folder.root will be used for finding the config
 and the absolute path including :objectinside>>::label will be returned.
 You can ignore looking for configs in the execution directory with
 setting ignoreExecutionDirectory to true.
bool deleteLocalFile(TString filename)
 1. If temporary storage is disabled,
 1.1 if target path is on record, delete it instead of local path and return true,
 1.2 else return false
 2. If file is not on record, return false.
 3. Otherwise delete the file, erase the entry from localPaths and return true.

 Returns true if the file is on record (either in local or target location),
 otherwise returns false. This does not necessarily say that a file has been
 deleted.

 This method does not work properly if the variables useTemporaryStorage or
 localDirectory are changed after paths have been requested.
TQPathManager(bool useTemporaryStorage = gUseTemporaryStorageDefault)
 Construct local output directory.
TQPathManager(TString localDirectory, bool useTemporaryStorage = gUseTemporaryStorageDefault)
~TQPathManager()
 1. Loop over all pairs of local and target files. Copy all local files to
    their target location.
std::vector<TString> getAllTargetPaths()
TString getTargetPathName(TString targetFile) const
bool isInLocalPaths_target(TString filename) const
 Find out if filename is already in list of target files (i.e. if there is
 a local file associated with this target file).
bool isInLocalPaths_local(const TString& filePath) const
 Find out if filePath is already in list of local paths (i.e. if there is
 a target file associated with this local file).
bool isInTargetPaths(const TString& filePath) const
void deleteTargetPathEntry(const TString& filePath)
TString determineTargetDir() const
@env:[CAFOUTPUTDIR] Directory which outputs produced by various CAF classes and tools should end up in
void initialize(const TString& localDirectory, bool useTemporaryStorage)
TQPathManager(bool useTemporaryStorage = gUseTemporaryStorageDefault)
 Constructor: Show a warning if environment variable CAFOUTPUTDIR cannot
 be read.
 gUseTemporaryStrageDefault is read from env vars "CAFUSETEMPDIR" or
 (at lower priority) "CAFUSELOCALSTORAGE" upon loading the library