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

CdbDatabase Class Reference

The transient representation for the persistent database and its smart pointer type. More...

#include <CdbDatabase.hh>

Inheritance diagram for CdbDatabase:

CdbStateControl CdbHistoryProvider CdbCloneable< CdbDatabase > CdbBdbSDatabase CdbBdbWDatabase CdbRooRoDatabase CdbSQLApiDatabase List of all members.

Public Member Functions

const CdbPtrparent () const
 Return a pointer to the parent object.

const char * name () const
 Obtain the current name of the database.

virtual BdbTime id ()=0
 Obtain the unique identifier of the database.

virtual BdbTime created ()=0
 Obtain the creation time of the database.

virtual std::string description ()=0
 Obtain the database description.

virtual CdbStatus partitionIterator (CdbItr< unsigned short > &theItr)=0
 Set up an iterator of partitions at the MASTER.

virtual CdbStatus partitionIterator (CdbItr< unsigned short > &theItr, unsigned int theOriginId)=0
 Set up an iterator of partitions at specified (by ID) origin.

virtual CdbStatus partitionIterator (CdbItr< unsigned short > &theItr, const char *theOriginName)=0
 Set up an iterator of partitions at specified (by NAME) origin.

virtual CdbStatus findPartition (CdbPartitionPtr &thePtr, unsigned short thePartition)=0
 Find a partition.

virtual CdbStatus findPartition (CdbPartitionPtr &thePtr, unsigned short thePartition, unsigned int theOriginId)=0
 Find a partition at the specified (by ID) origin.

virtual CdbStatus findPartition (CdbPartitionPtr &thePtr, unsigned short thePartition, const char *theOriginName)=0
 Find a partition at the specified (by NAME) origin.

virtual CdbOriginPtr localOrigin ()=0
 Return a pointer to the database's "origin" object.

virtual CdbStatus originIterator (CdbItr< unsigned short > &theItr)=0
 Set up an iterator of origins.

virtual CdbStatus findOrigin (CdbOriginPtr &thePtr, const char *theName)=0
 Find an origin (by name).

virtual CdbStatus findOrigin (CdbOriginPtr &thePtr, unsigned short theId)=0
 Find an origin (by id).

virtual std::string defaultView () const=0
 Default view name.

virtual CdbStatus findView (CdbViewPtr &thePtr, const char *theName=0)=0
 Find the specified view.

virtual CdbStatus findView (CdbViewPtr &thePtr, const CdbId &theId)=0
 Find the specified view.

virtual CdbStatus viewIterator (CdbViewItr &theItr)=0
 Initialize an instance of an iterator for the known views names.

virtual CdbStatus physicalConditionIterator (CdbItr< CdbId > &theItr)=0
 Initialize an instance of an iterator for the known 'physical' conditions.

CdbStatus physicalConditionName2Id (CdbId &theId, const CdbCompositeName &theName)
 Translate a string with a name of a 'physical' condition into its identifier.

CdbStatus physicalConditionId2Name (CdbCompositeName &theName, const CdbId &theId)
 Translate an identifier of a 'physical' condition into its name.

virtual CdbStatus findCondition (CdbConditionPtr &thePtr, const CdbId &theId)=0
 Find the specified condition by its 'physical address'.

virtual CdbStatus findCondition (CdbConditionPtr &thePtr, const CdbCompositeName &thePhysicalName)=0
 Find the specified condition by its 'physical name'.


Static Public Member Functions

CdbStatus instance (CdbDatabasePtr &theDatabasePtr, const char *theDatabaseName=0, const char *theImplementationName=0, const char *theTechnologyName=0)
 Static locator for a database object.


Protected Member Functions

 CdbDatabase (const CdbPtr &theCdbPtr, const char *theName)
 CdbDatabase (const CdbDatabase &theDatabase)
 The copy constructor.

virtual ~CdbDatabase ()
 The destructor.

CdbDatabase & operator= (const CdbDatabase &theDatabase)
 The assignment operator.


Friends

class CdbCPtrBase< CdbDatabase >

Detailed Description

The transient representation for the persistent database and its smart pointer type.

Notes:

See also:
CdbtateControl

CdbHistoryProvider

CdbCloneable

Definition at line 47 of file CdbDatabase.hh.


Constructor & Destructor Documentation

CdbDatabase::CdbDatabase const CdbPtr   theCdbPtr,
const char *    theName
[protected]
 

Initialize the context of the database with specified set of parameters. This will also validate the internal state of the object.

The database name must not be a 0 pointer.

Parameters:
theCdbPtr  the back link to the parent object
theName  the database name

Definition at line 59 of file CdbDatabase.cc.

CdbDatabase::CdbDatabase const CdbDatabase &    theDatabase [protected]
 

The copy constructor.

Details...

Definition at line 65 of file CdbDatabase.cc.

References _myName, and _myParentPtr.

CdbDatabase::~CdbDatabase   [protected, virtual]
 

The destructor.

Is only available for the derived classes and friends to prevent accidental deletion of objects.

Definition at line 71 of file CdbDatabase.cc.


Member Function Documentation

virtual BdbTime CdbDatabase::created   [pure virtual]
 

Obtain the creation time of the database.

This is the actual creation time of this particular instance of the underlying database. Note, that this value may differ (in fact it's equal or newer) from the database identification timestampt.

This method is supposed to be implemented by the corresponding subclass.

Returns:
a string with the object's description

Implemented in CdbBdbWDatabase, CdbBdbSDatabase, CdbRooRoDatabase, and CdbSQLApiDatabase.

virtual std::string CdbDatabase::defaultView   const [pure virtual]
 

Default view name.

This method is supposed to be implemented by the corresponding subclass.

This name is delivered when a client is relying on this default.

Implemented in CdbBdbWDatabase, CdbBdbSDatabase, CdbRooRoDatabase, and CdbSQLApiDatabase.

virtual std::string CdbDatabase::description   [pure virtual]
 

Obtain the database description.

This method is supposed to be implemented by the corresponding subclass.

Returns:
a string with the object's description

Implemented in CdbBdbWDatabase, CdbBdbSDatabase, CdbRooRoDatabase, and CdbSQLApiDatabase.

virtual CdbStatus CdbDatabase::findCondition CdbConditionPtr   thePtr,
const CdbCompositeName   thePhysicalName
[pure virtual]
 

Find the specified condition by its 'physical name'.

This method is supposed to be implemented by the corresponding subclass.

This method would locate a condition by its 'physical name'. See the description of the constructor of the CdbCondition class for the implications of this method.

See also:
CdbCompositeName
Parameters:
thePtr  a smart pointer to an object to be initialized
thePhysicalName  the object specifications

Implemented in CdbBdbWDatabase, CdbBdbSDatabase, CdbRooRoDatabase, and CdbSQLApiDatabase.

virtual CdbStatus CdbDatabase::findCondition CdbConditionPtr   thePtr,
const CdbId   theId
[pure virtual]
 

Find the specified condition by its 'physical address'.

This method is supposed to be implemented by the corresponding subclass.

This method would locate a condition by its 'physical address'. See the description of the constructor of the CdbCondition class for the implications of this method.

See also:
CdbId
Parameters:
thePtr  a smart pointer to an object to be initialized
theId  the object specifications

Implemented in CdbBdbWDatabase, CdbBdbSDatabase, CdbRooRoDatabase, and CdbSQLApiDatabase.

Referenced by physicalConditionId2Name(), and physicalConditionName2Id().

virtual CdbStatus CdbDatabase::findOrigin CdbOriginPtr   thePtr,
unsigned short    theId
[pure virtual]
 

Find an origin (by id).

This method is supposed to be implemented by the corresponding subclass.

Returns:
CdbStatus::Success if the origin was found
Parameters:
thePtr  the smart pointer to set up
theId  the identifier of an origin

Implemented in CdbBdbWDatabase, CdbBdbSDatabase, CdbRooRoDatabase, and CdbSQLApiDatabase.

virtual CdbStatus CdbDatabase::findOrigin CdbOriginPtr   thePtr,
const char *    theName
[pure virtual]
 

Find an origin (by name).

This method is supposed to be implemented by the corresponding subclass.

Returns:
CdbStatus::Success if the origin was found
Parameters:
thePtr  the smart pointer to set up
theName  the name of an origin

Implemented in CdbBdbWDatabase, CdbBdbSDatabase, CdbRooRoDatabase, and CdbSQLApiDatabase.

virtual CdbStatus CdbDatabase::findPartition CdbPartitionPtr   thePtr,
unsigned short    thePartition,
const char *    theOriginName
[pure virtual]
 

Find a partition at the specified (by NAME) origin.

Unlike the default algorithm (when no explicit origin specified) this one would use partition directly from the specified origin.

This method is supposed to be implemented by the corresponding subclass.

Returns:
CdbStatus::Success if the partition was found
Parameters:
thePtr  the smart pointer to set up
thePartition  the partition identifier
theOriginName  the origin in question

Implemented in CdbBdbWDatabase, CdbBdbSDatabase, CdbRooRoDatabase, and CdbSQLApiDatabase.

virtual CdbStatus CdbDatabase::findPartition CdbPartitionPtr   thePtr,
unsigned short    thePartition,
unsigned int    theOriginId
[pure virtual]
 

Find a partition at the specified (by ID) origin.

Unlike the default algorithm (when no explicit origin specified) this one would use partition directly from the specified origin.

This method is supposed to be implemented by the corresponding subclass.

Returns:
CdbStatus::Success if the partition was found
Parameters:
thePtr  the smart pointer to set up
thePartition  the partition identifier
theOriginId  the origin in question

Implemented in CdbBdbWDatabase, CdbBdbSDatabase, CdbRooRoDatabase, and CdbSQLApiDatabase.

virtual CdbStatus CdbDatabase::findPartition CdbPartitionPtr   thePtr,
unsigned short    thePartition
[pure virtual]
 

Find a partition.

IMPORTANT NOTE:

This algorithm will use partition object from the local P-Layout if it will discover that the partition belongs to the current origin. This is a typical scenario for the SLAVE type origins.

This method is supposed to be implemented by the corresponding subclass.

Returns:
CdbStatus::Success if the partition was found
Parameters:
thePtr  the smart pointer to set up
thePartition  the partition identifier

Implemented in CdbBdbWDatabase, CdbBdbSDatabase, CdbRooRoDatabase, and CdbSQLApiDatabase.

virtual CdbStatus CdbDatabase::findView CdbViewPtr   thePtr,
const CdbId   theId
[pure virtual]
 

Find the specified view.

This method is supposed to be implemented by the corresponding subclass.

Unlike the previous method, this one uses "extended" identifier of a view to find the corresponding object.

See also:
CdbId
Parameters:
thePtr  a smart pointer to an object to be initialized
theId  the object specifications

Implemented in CdbBdbWDatabase, CdbBdbSDatabase, CdbRooRoDatabase, and CdbSQLApiDatabase.

virtual CdbStatus CdbDatabase::findView CdbViewPtr   thePtr,
const char *    theName = 0
[pure virtual]
 

Find the specified view.

This method is supposed to be implemented by the corresponding subclass.

This method initializes a smart pointer to a transient object of the CdbView class representing the found view. It will initialize the smart pointer to point onto 0 and return the corresponding error status when specified object is not found or is not awailable for some other reason.

The only parameter to be specified when looking for a view is its name. If a 0 pointer is passed instead of the name then a default view will be open.

See also:
CdbView

CdbViewPtr

CdbStatus

Returns:
a completion status of the operation
Parameters:
thePtr  a smart pointer to an object to be initialized
theName  the object specifications

Implemented in CdbBdbWDatabase, CdbBdbSDatabase, CdbRooRoDatabase, and CdbSQLApiDatabase.

virtual BdbTime CdbDatabase::id   [pure virtual]
 

Obtain the unique identifier of the database.

All databases in a distributed installation should have the same identifier to distinguish them from other installations.

This method is supposed to be implemented by the corresponding subclass.

Returns:
the value of the identifier

Implemented in CdbBdbWDatabase, CdbBdbSDatabase, CdbRooRoDatabase, and CdbSQLApiDatabase.

CdbStatus CdbDatabase::instance CdbDatabasePtr   theDatabasePtr,
const char *    theDatabaseName = 0,
const char *    theImplementationName = 0,
const char *    theTechnologyName = 0
[static]
 

Static locator for a database object.

Locates specified database object and returns a smart pointer to the transient object of the current class. This "shortcut" allows to avoid the complicated multi-staged process of the object location, which is useless when the intermediate objects are not needed.

If the database name is omitted then the default one is assumed.

The last parameter (a pointer to the top-level Cdb singleton) is optional. If 0 is passed then a default instance is used.

Note, that if specified object is not found then a smart pointer is initialized to point to 0.

See also:
Cdb

CdbatabasePtr

CdbStatus

Returns:
a completion status
Parameters:
theDatabasePtr  the smart pointer to be initialized
theDatabaseName  the database name
theImplementationName  the implementation name
theTechnologyName  the technology name

Definition at line 21 of file CdbDatabase.cc.

References CdbStatus::Error, Cdb::instance(), and CdbCPtr< Cdb, CdbDoNotClosePolicy< Cdb > >::isNull().

Referenced by CdbRooInit::beginJob(), CdbBdbInit::beginJob(), CdbBdb2RooPayloadConversionFwk::doConversion(), CdbView::instance(), CdbOrigin::instance(), CdbCondition::instance(), and main().

virtual CdbOriginPtr CdbDatabase::localOrigin   [pure virtual]
 

Return a pointer to the database's "origin" object.

This method is supposed to be implemented by the corresponding subclass.

See also:
CdbOrigin

CdbOriginPtr

Implemented in CdbBdbWDatabase, CdbBdbSDatabase, CdbRooRoDatabase, and CdbSQLApiDatabase.

const char * CdbDatabase::name   const
 

Obtain the current name of the database.

Returns:
a const non 0 pointer onto a database name

Definition at line 91 of file CdbDatabase.cc.

Referenced by CdbSQLApiDatabase::clone(), CdbRooRoDatabase::clone(), CdbBdbWDatabase::clone(), CdbBdbSDatabase::clone(), CdbSQLApiDatabase::defaultView(), CdbRooRoDatabase::defaultView(), CdbBdbWDatabase::defaultView(), CdbBdbSDatabase::defaultView(), and CdbSQLApiDatabase::viewIterator().

CdbDatabase & CdbDatabase::operator= const CdbDatabase &    theDatabase [protected]
 

The assignment operator.

Details...

Definition at line 75 of file CdbDatabase.cc.

References _myName, and _myParentPtr.

virtual CdbStatus CdbDatabase::originIterator CdbItr< unsigned short > &    theItr [pure virtual]
 

Set up an iterator of origins.

This method is supposed to be implemented by the corresponding subclass.

Returns:
CdbStatus::Success if the iterator is set up
Parameters:
theItr  the iterator to set up

Implemented in CdbBdbWDatabase, CdbBdbSDatabase, CdbRooRoDatabase, and CdbSQLApiDatabase.

const CdbPtr & CdbDatabase::parent   const
 

Return a pointer to the parent object.

See also:
Cdb

CdbPtr

Definition at line 85 of file CdbDatabase.cc.

Referenced by CdbSQLApiDatabase::clone(), CdbBdbWDatabase::clone(), CdbBdbSDatabase::clone(), CdbSQLApiDatabase::defaultView(), CdbRooRoDatabase::defaultView(), CdbBdbWDatabase::defaultView(), and CdbBdbSDatabase::defaultView().

virtual CdbStatus CdbDatabase::partitionIterator CdbItr< unsigned short > &    theItr,
const char *    theOriginName
[pure virtual]
 

Set up an iterator of partitions at specified (by NAME) origin.

This method is supposed to be implemented by the corresponding subclass.

Returns:
CdbStatus::Success if the iterator is set up, CdbStatus::NotFound if the specified origin does not have Partitions Layout.
Parameters:
theItr  the iterator to set up
theOriginName  the origin in question

Implemented in CdbBdbWDatabase, CdbBdbSDatabase, CdbRooRoDatabase, and CdbSQLApiDatabase.

virtual CdbStatus CdbDatabase::partitionIterator CdbItr< unsigned short > &    theItr,
unsigned int    theOriginId
[pure virtual]
 

Set up an iterator of partitions at specified (by ID) origin.

This method is supposed to be implemented by the corresponding subclass.

Returns:
CdbStatus::Success if the iterator is set up, CdbStatus::NotFound if the specified origin does not have Partitions Layout.
Parameters:
theItr  the iterator to set up
theOriginId  the origin in question

Implemented in CdbBdbWDatabase, CdbBdbSDatabase, CdbRooRoDatabase, and CdbSQLApiDatabase.

virtual CdbStatus CdbDatabase::partitionIterator CdbItr< unsigned short > &    theItr [pure virtual]
 

Set up an iterator of partitions at the MASTER.

This method is supposed to be implemented by the corresponding subclass.

Returns:
CdbStatus::Success if the iterator is set up
Parameters:
theItr  the iterator to set up

Implemented in CdbBdbWDatabase, CdbBdbSDatabase, CdbRooRoDatabase, and CdbSQLApiDatabase.

CdbStatus CdbDatabase::physicalConditionId2Name CdbCompositeName   theName,
const CdbId   theId
 

Translate an identifier of a 'physical' condition into its name.

The operation will return CdbStatus::Success and set up a valid identifier if the input name has a correct format and if the corresponding condition is known to CDB.

If an input name is valid but the condition doesn't exist in the database then CdbStatus::NotFound will be returned.

Other status values returned will depend on what exactly is wrong.

Definition at line 122 of file CdbDatabase.cc.

References CdbStatus::Error, findCondition(), CdbStatus::NotFound, and CdbStatus::Success.

virtual CdbStatus CdbDatabase::physicalConditionIterator CdbItr< CdbId > &    theItr [pure virtual]
 

Initialize an instance of an iterator for the known 'physical' conditions.

The iterator will produce a sequence of 'physical address' of found conditions in a scope of all origins of the dataase. Use the "CdbDatabase::findCondition()" method defined below to open actual conditions.

This method is supposed to be implemented by the corresponding subclass.

The iterator will be set into a "valid" state upon successfull completion.

See also:
CdbIItr::isValid()

CdbView

CdbViewItr

CdbStatus

Returns:
completion status

Implemented in CdbBdbWDatabase, CdbBdbSDatabase, CdbRooRoDatabase, and CdbSQLApiDatabase.

CdbStatus CdbDatabase::physicalConditionName2Id CdbId   theId,
const CdbCompositeName   theName
 

Translate a string with a name of a 'physical' condition into its identifier.

The operation will return CdbStatus::Success and set up a valid identifier if the input name has a correct format and if the corresponding condition is known to CDB.

If an input name is valid but the condition doesn't exist in the database then CdbStatus::NotFound will be returned.

Other status values returned will depend on what exactly is wrong.

Definition at line 97 of file CdbDatabase.cc.

References CdbStatus::Error, findCondition(), CdbCompositeName::getName(), CdbStatus::IllegalParameters, CdbCompositeName::isValid(), CdbStatus::NotFound, and CdbStatus::Success.

virtual CdbStatus CdbDatabase::viewIterator CdbViewItr   theItr [pure virtual]
 

Initialize an instance of an iterator for the known views names.

This method is supposed to be implemented by the corresponding subclass.

The iterator will be set into a "valid" state upon successfull completion.

See also:
CdbIItr::isValid()

CdbView

CdbViewItr

CdbStatus

Returns:
completion status

Implemented in CdbBdbWDatabase, CdbBdbSDatabase, CdbRooRoDatabase, and CdbSQLApiDatabase.


Friends And Related Function Documentation

friend class CdbCPtrBase< CdbDatabase > [friend]
 

Definition at line 51 of file CdbDatabase.hh.


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