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

CdbRooRoFileUtils Class Reference

The utility class to help with file system operations. More...

#include <CdbRooRoFileUtils.hh>

List of all members.

Public Member Functions

void reset ()
 Reset the context.

void setLocalOrigin (const std::string &theOriginName, UShort_t theOriginId)
 Set up the local origin name.

void setBootFileLocation (const std::string &theFileName)
 Set up a location of this.

void setDatabase2LocationMap (const std::map< std::string, std::string > &theMap)
 Set up a mapping between databases and their locations.

void setObject2DatabaseMap (const std::map< std::string, std::string > &theMap)
 Set up a mapping between persistent objects and their databases.

void setRegistry (const CdbCPtr< CdbRooRoRegistry > &theRegistry)
 Set/update a cached pointer to the specified registry.

const std::string & localOriginName () const
 Get local origin name.

UShort_t localOriginId () const
 Get local origin identifier.

const std::string & bootFileLocation () const
 Get the boot file location.

const std::string & baseLocation () const
 Get the base location of database files.

CdbCPtr< CdbRooRoRegistryregistry (UShort_t theOriginId) const
 Get a cached value of a registry for the specified origin if it exists.

CdbCPtr< CdbRooRoRegistryregistry (const std::string &theOriginName) const
 Get a cached value of a registry for the specified origin if it exists.

CdbStatus findMetaData (CdbCPtr< CdbRooRoMetaDataR > &theMetaDataPtr, UShort_t theConditionId, bool isPartitionableFlag, UShort_t thePartitionId, UShort_t theClusterId, UShort_t theIncrementNumber, UShort_t theOriginId)
 Find a MetaData object with specified parameters.

CdbStatus findDatabase (CdbCPtr< TFile > &theDatabasePtr, const std::string &theName, const std::string &theOpenMode="read")
 Find the specified database file by its logical name (not a path!).

CdbStatus findDatabase (CdbCPtr< TFile > &theDatabasePtr, const CdbRooRoCollectionAddressR &theCollectionAddress, const std::string &theOpenMode="read")
 Find or create a database file for the specified "Collection Address".

CdbStatus findDatabase (CdbCPtr< TFile > &theDatabasePtr, UShort_t theOriginId, const std::string &theOpenMode="read")
 Find or create the specified "Registry" database file for the specified origin.

CdbStatus findDatabase (CdbCPtr< TFile > &theDatabasePtr, bool isPartitionableFlag, UShort_t thePartitionId, UShort_t theClusterId, UShort_t theIncrementNumber, UShort_t theOriginId, const std::string &theOpenMode="read")
 Find or create the specified database file for "MetaData." containers.

CdbStatus findObjectsDatabase (CdbCPtr< TFile > &theDatabasePtr, bool isPartitionableFlag, UShort_t thePartitionId, UShort_t theClusterId, UShort_t theIncrementNumber, UShort_t theOriginId, const std::string &theOpenMode="read")
 Find or create the specified database file for "Objects." containers.

CdbStatus findTree (CdbCPtr< TTree > &theTreePtr, const std::string &theFileName, const std::string &theTreeName, const std::string &theOpenMode="read")
 Find a ROOT "tree".

CdbStatus findTree (CdbCPtr< TTree > &theTreePtr, const CdbRooRoCollectionAddressR &theCollectionAddress, const std::string &theTreeName, const std::string &theOpenMode="read")
 Find a ROOT "tree".

void dump (std::ostream &theStream) const
 Dumnp the statistics.


Static Public Member Functions

CdbRooRoFileUtils & instance ()
 The singlenton constructor/accessor.

std::string nameOfMetaDataContainer (UShort_t theConditionId, bool isPartitionableFlag, UShort_t thePartitionId, UShort_t theClusterId, UShort_t theIncrementNumber, UShort_t theOriginId)
 Build a name for the specified "MetaData" container.

std::string nameOfObjectsContainer (UShort_t theConditionId, bool isPartitionableFlag, UShort_t thePartitionId, UShort_t theClusterId, UShort_t theIncrementNumber, UShort_t theOriginId)
 Build a name for the specified "Objects" container.

std::string nameOfSystemContainer (UShort_t theOriginId, const std::string &theContainerName)
 Build a name for the specified "Objects" container.


Detailed Description

The utility class to help with file system operations.

This utility class is implemented as a singleton. It provides a simplified interface to an underlying file system.

Definition at line 29 of file CdbRooRoFileUtils.hh.


Member Function Documentation

const std::string& CdbRooRoFileUtils::baseLocation   const [inline]
 

Get the base location of database files.

This value is derived from the boot file location.

Definition at line 186 of file CdbRooRoFileUtils.hh.

Referenced by findDatabase().

const std::string& CdbRooRoFileUtils::bootFileLocation   const [inline]
 

Get the boot file location.

Definition at line 180 of file CdbRooRoFileUtils.hh.

void CdbRooRoFileUtils::dump std::ostream &    theStream const
 

Dumnp the statistics.

Definition at line 551 of file CdbRooRoFileUtils.cc.

CdbStatus CdbRooRoFileUtils::findDatabase CdbCPtr< TFile > &    theDatabasePtr,
bool    isPartitionableFlag,
UShort_t    thePartitionId,
UShort_t    theClusterId,
UShort_t    theIncrementNumber,
UShort_t    theOriginId,
const std::string &    theOpenMode = "read"
 

Find or create the specified database file for "MetaData." containers.

NOTE: The operation may also populate an internal cache of the current facility to speed up further operations.

The behavior of the operation will depend on a value of the optional "open mode" parameter. See the documentation on the TFile class to get more idea on this.

Definition at line 432 of file CdbRooRoFileUtils.cc.

References findDatabase(), and CdbStatus::IllegalParameters.

CdbStatus CdbRooRoFileUtils::findDatabase CdbCPtr< TFile > &    theDatabasePtr,
UShort_t    theOriginId,
const std::string &    theOpenMode = "read"
 

Find or create the specified "Registry" database file for the specified origin.

NOTE: The operation may also populate an internal cache of the current facility to speed up further operations.

The behavior of the operation will depend on a value of the optional "open mode" parameter. See the documentation on the TFile class to get more idea on this.

Definition at line 418 of file CdbRooRoFileUtils.cc.

References findDatabase(), and CdbStatus::IllegalParameters.

CdbStatus CdbRooRoFileUtils::findDatabase CdbCPtr< TFile > &    theDatabasePtr,
const CdbRooRoCollectionAddressR   theCollectionAddress,
const std::string &    theOpenMode = "read"
 

Find or create a database file for the specified "Collection Address".

NOTE: The operation may also populate an internal cache of the current facility to speed up further operations.

The behavior of the operation will depend on a value of the optional "open mode" parameter. See the documentation on the TFile class to get more idea on this.

Definition at line 378 of file CdbRooRoFileUtils.cc.

References CdbRooRoCollectionAddressR::cluster(), findDatabase(), CdbStatus::IllegalParameters, CdbRooRoCollectionAddressR::increment(), CdbRooRoCollectionAddressR::isValid(), CdbRooRoCollectionAddressR::origin(), CdbRooRoCollectionAddressR::partition(), CdbRooRoCollectionAddressR::schema(), CdbRooRoCollectionAddressR::SCHEMA_PARTITIONABLE, CdbRooRoCollectionAddressR::SCHEMA_REGISTRY, and CdbRooRoCollectionAddressR::SCHEMA_REGULAR.

CdbStatus CdbRooRoFileUtils::findDatabase CdbCPtr< TFile > &    theDatabasePtr,
const std::string &    theName,
const std::string &    theOpenMode = "read"
 

Find the specified database file by its logical name (not a path!).

The common accepts only logical names of database files, not their relative or absolute locations in a database installation. Failure to do so would result at the CdbStatus::IllegalParameters status returned. The operation will return CdbStatus::NotFound if no object matching the specified criteria will be found. Other satus values are returned as usually.

See also:
CdbRooRoFileUtils::baseLocation()
NOTE: The operation may also populate an internal cache of the current facility to speed up further operations.
Parameters:
theDatabasePtr  the daabase pointer to be initialized
theName  the logical name of a database

Definition at line 328 of file CdbRooRoFileUtils.cc.

References baseLocation(), CdbStatus::IllegalParameters, CdbStatus::NotFound, and CdbStatus::Success.

Referenced by CdbRooRoRegistry::findByOrigin(), findDatabase(), findMetaData(), findObjectsDatabase(), and findTree().

CdbStatus CdbRooRoFileUtils::findMetaData CdbCPtr< CdbRooRoMetaDataR > &    theMetaDataPtr,
UShort_t    theConditionId,
bool    isPartitionableFlag,
UShort_t    thePartitionId,
UShort_t    theClusterId,
UShort_t    theIncrementNumber,
UShort_t    theOriginId
 

Find a MetaData object with specified parameters.

NOTE: The operation may also populate an internal cache of the current facility to speed up further operations.

The operation will return CdbStatus::NotFound if no object matching the specified criteria will be found. Other satus values are returned as usually.

Parameters:
theMetaDataPtr  the pointer to be initialized

Definition at line 242 of file CdbRooRoFileUtils.cc.

References CdbStatus::Error, findDatabase(), nameOfMetaDataContainer(), CdbStatus::NotFound, and CdbStatus::Success.

CdbStatus CdbRooRoFileUtils::findObjectsDatabase CdbCPtr< TFile > &    theDatabasePtr,
bool    isPartitionableFlag,
UShort_t    thePartitionId,
UShort_t    theClusterId,
UShort_t    theIncrementNumber,
UShort_t    theOriginId,
const std::string &    theOpenMode = "read"
 

Find or create the specified database file for "Objects." containers.

NOTE: The operation may also populate an internal cache of the current facility to speed up further operations.

The behavior of the operation will depend on a value of the optional "open mode" parameter. See the documentation on the TFile class to get more idea on this.

Definition at line 453 of file CdbRooRoFileUtils.cc.

References findDatabase(), and CdbStatus::IllegalParameters.

Referenced by CdbRooRoObject::getPersistentObject().

CdbStatus CdbRooRoFileUtils::findTree CdbCPtr< TTree > &    theTreePtr,
const CdbRooRoCollectionAddressR   theCollectionAddress,
const std::string &    theTreeName,
const std::string &    theOpenMode = "read"
 

Find a ROOT "tree".

See also:
CdbRooRoFileUtils::doFindTree()

Definition at line 513 of file CdbRooRoFileUtils.cc.

References CdbStatus::Error, findDatabase(), CdbStatus::IllegalParameters, CdbRooRoCollectionAddressR::isValid(), and CdbStatus::Success.

CdbStatus CdbRooRoFileUtils::findTree CdbCPtr< TTree > &    theTreePtr,
const std::string &    theFileName,
const std::string &    theTreeName,
const std::string &    theOpenMode = "read"
 

Find a ROOT "tree".

See also:
CdbRooRoFileUtils::doFindTree()

Definition at line 475 of file CdbRooRoFileUtils.cc.

References CdbStatus::Error, findDatabase(), CdbStatus::IllegalParameters, and CdbStatus::Success.

CdbRooRoFileUtils & CdbRooRoFileUtils::instance   [static]
 

The singlenton constructor/accessor.

Definition at line 86 of file CdbRooRoFileUtils.cc.

Referenced by CdbRooRoRegistry::findByOrigin(), CdbRooRoRegistry::findLocal(), CdbRooRoObject::getPersistentObject(), and main().

UShort_t CdbRooRoFileUtils::localOriginId   const [inline]
 

Get local origin identifier.

Definition at line 176 of file CdbRooRoFileUtils.hh.

Referenced by CdbRooRoRegistry::findLocal().

const std::string& CdbRooRoFileUtils::localOriginName   const [inline]
 

Get local origin name.

Definition at line 172 of file CdbRooRoFileUtils.hh.

Referenced by CdbRooRoRegistry::findByOrigin(), and CdbRooRoRegistry::findLocal().

std::string CdbRooRoFileUtils::nameOfMetaDataContainer UShort_t    theConditionId,
bool    isPartitionableFlag,
UShort_t    thePartitionId,
UShort_t    theClusterId,
UShort_t    theIncrementNumber,
UShort_t    theOriginId
[static]
 

Build a name for the specified "MetaData" container.

Note, that the method will produce a unique fully qualified name of the metadata object in the global scope of CDB. This allows placing these objects into any file of a database installation w/o being worried about namespace conflicts.

Here are example of names:

"o0.c0.i1.MetaData.145" "o257.c0.p18.i0.MetaData.32"

The rest of the current CDB API implementation has to be written in terms of names produced by this method.

Definition at line 93 of file CdbRooRoFileUtils.cc.

Referenced by findMetaData().

std::string CdbRooRoFileUtils::nameOfObjectsContainer UShort_t    theConditionId,
bool    isPartitionableFlag,
UShort_t    thePartitionId,
UShort_t    theClusterId,
UShort_t    theIncrementNumber,
UShort_t    theOriginId
[static]
 

Build a name for the specified "Objects" container.

Also see notes on the naming convention for the similar "MetaData" method:

See also:
CdbRooRoFileUtils::nameOfMetaDataContainer()

Definition at line 110 of file CdbRooRoFileUtils.cc.

Referenced by CdbRooRoObject::getPersistentObject().

std::string CdbRooRoFileUtils::nameOfSystemContainer UShort_t    theOriginId,
const std::string &    theContainerName
[static]
 

Build a name for the specified "Objects" container.

Note, that the method will produce a unique fully qualified name of the system object in the global scope of CDB. This allows placing these objects into any file of a database installation w/o being worried about namespace conflicts.

Here are example of names:

"o0.System.Registry" "o0.System.ConditionCollection" "o256.System.ViewCollection"

The rest of the current CDB API implementation has to be written in terms of names produced by this method.

Definition at line 127 of file CdbRooRoFileUtils.cc.

References CdbStringUtils::toString().

Referenced by CdbRooRoRegistry::findByOrigin(), and main().

CdbCPtr< CdbRooRoRegistry > CdbRooRoFileUtils::registry const std::string &    theOriginName const
 

Get a cached value of a registry for the specified origin if it exists.

Return a 0 pointer of the cache isn't populated.

Definition at line 234 of file CdbRooRoFileUtils.cc.

CdbCPtr< CdbRooRoRegistry > CdbRooRoFileUtils::registry UShort_t    theOriginId const
 

Get a cached value of a registry for the specified origin if it exists.

Return a 0 pointer of the cache isn't populated.

Definition at line 226 of file CdbRooRoFileUtils.cc.

Referenced by CdbRooRoRegistry::findByOrigin().

void CdbRooRoFileUtils::reset  
 

Reset the context.

Definition at line 152 of file CdbRooRoFileUtils.cc.

void CdbRooRoFileUtils::setBootFileLocation const std::string &    theFileName
 

Set up a location of this.

A value passed as a parameter will be used to locate database images in a proximity of the bootfile. The location can be represented either by an absolute file system path or a relative one (in the respect to a value of the 'CWD' parameter).

Definition at line 188 of file CdbRooRoFileUtils.cc.

Referenced by main().

void CdbRooRoFileUtils::setDatabase2LocationMap const std::map< std::string, std::string > &    theMap
 

Set up a mapping between databases and their locations.

The mapping will be used to implement a catalog of a persistent store.

The locations for database names can be either absolute (begining with the "/" symbol) or relative ones. The absolute locations will be used "as is" w/ no extra interpretations. The relative locations are assumed to be related to a base location of the database installation (where the boot file is found).

See also:
CdbRooRoFileUtils::baseLocation()

Definition at line 206 of file CdbRooRoFileUtils.cc.

void CdbRooRoFileUtils::setLocalOrigin const std::string &    theOriginName,
UShort_t    theOriginId
 

Set up the local origin name.

The values set by this method would affect results of some operations of this class.

A valid string is expected as a parameter of the method.

Definition at line 179 of file CdbRooRoFileUtils.cc.

Referenced by main().

void CdbRooRoFileUtils::setObject2DatabaseMap const std::map< std::string, std::string > &    theMap
 

Set up a mapping between persistent objects and their databases.

This is an optional map allowing persistent objects be found in non-standard locations. The feature is there for an extra flexibility. The key of the map is an object name and the value - is a logical name of the corresponding database.

If an object's name is not found in the map then a standard location is assumed.

See also:
CdbRooRoFileUtils::setDatabase2LocationMap()

Definition at line 212 of file CdbRooRoFileUtils.cc.

void CdbRooRoFileUtils::setRegistry const CdbCPtr< CdbRooRoRegistry > &    theRegistry
 

Set/update a cached pointer to the specified registry.

Definition at line 218 of file CdbRooRoFileUtils.cc.

References CdbCPtr< CdbRooRoRegistry >::isNull().

Referenced by CdbRooRoRegistry::findByOrigin().


The documentation for this class was generated from the following files:
Generated on Mon Dec 5 18:22:24 2005 for CDB by doxygen1.3-rc3