ATLAS Offline Software
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
pool::DbDatabase Class Reference

#include <StorageSvc/DbDatabase.h>

Inheritance diagram for pool::DbDatabase:
Collaboration diagram for pool::DbDatabase:

Public Member Functions

 DbDatabase (const DbType &typ=POOL_StorageType)
 Constructor with initializing arguments. More...
 
 DbDatabase (const DbDatabase &cp)
 Copy constructor. More...
 
 DbDatabase (DbDatabaseObj *obj)
 Constructor. More...
 
virtual ~DbDatabase ()
 Standard destructor. More...
 
DbDatabaseoperator= (const DbDatabase &copy)
 Assignment (copy) operator. More...
 
DbDatabaseoperator= (const int)
 Assignment operator to reset handle using 0. More...
 
int refCount () const
 Access reference counter. More...
 
DbAccessMode openMode () const
 Access to access mode member. More...
 
const std::string & name () const
 Access to db name (FID) More...
 
void setName (const std::string &nam)
 Set db name (FID) after opening in case opening happened by PFN. More...
 
const std::string & logon () const
 Access to db logon string. More...
 
long long int size ()
 Access the size of the database: May be undefined for some technologies. More...
 
IOODatabasedb ()
 Allow access to the Database implementation. More...
 
const IOODatabasedb () const
 
DbStatus add (const std::string &name, DbContainerObj *cnt)
 Add domain to session. More...
 
DbStatus remove (const DbContainerObj *cnt)
 Find domain in session. More...
 
const DbContainerObjfind (const std::string &nam) const
 Select container object in Database. More...
 
DbContainerObjfind (const std::string &nam)
 Select container object in Database. More...
 
const Tokentoken () const
 Access the token of the database object. More...
 
const DbDomaincontainedIn () const
 Access to domain object. More...
 
DbDomaincontainedIn ()
 
bool exist (DbDomain &domH, const std::string &nam) const
 Check for existence of Database within domain. More...
 
DbStatus open (DbDomain &domH, const std::string &pfn, const std::string &fid, DbAccessMode mode=pool::READ)
 Open Database using given domain. More...
 
DbStatus reopen (DbAccessMode mode=pool::READ)
 Re-open database with changing access permissions. More...
 
DbStatus close ()
 Close Database. More...
 
DbStatus retire ()
 End database access, but still leave database accessible. More...
 
bool isOpen () const
 Check if the database was opened. More...
 
DbStatus transAct (Transaction::Action action)
 Commit/Rollback Database Transaction. More...
 
DbStatus setOption (const DbOption &refOpt)
 Set options. More...
 
DbStatus getOption (DbOption &refOpt)
 Access options. More...
 
DbStatus addParam (const std::string &nam, const std::string &val)
 Add a persistent parameter to the file. More...
 
int nParam ()
 Retrieve the number of user parameters. More...
 
DbStatus param (const std::string &nam, std::string &val)
 Retrieve existing parameter by name. More...
 
DbStatus params (Parameters &vals)
 Retrieve all parameters. More...
 
DbStatus read (const Token &token, ShapeH shape, void **object)
 read an object referenced by the token More...
 
DbStatus getLink (const Token::OID_t &oid, Token *pTok)
 Expand OID into a full Token, based on the Links table. More...
 
std::string cntName (Token &token)
 Retrieve container name from link container (using token oid, rather than contID) More...
 
DbStatus makeLink (Token *pToken, Token::OID_t &linkH)
 Add association link to link container. More...
 
DbStatus addShape (const DbTypeInfo *pShape)
 Add persistent shape to the Database. More...
 
const DbTypeInfoobjectShape (const RootType &typeH)
 Retrieve persistent type information by class handle. More...
 
const DbTypeInfoobjectShape (const Guid &nam)
 Retrieve persistent type information by name. More...
 
const DbTypeInfocontShape (const std::string &nam)
 Retrieve persistent type information by container. More...
 
const TokencntToken (const std::string &cntName)
 Access local container token (if container exists) More...
 
DbStatus containers (std::vector< const Token * > &conts, bool intern=false)
 Allow access to all known containers. More...
 
DbStatus containers (std::vector< IDbContainer * > &conts, bool intern=false)
 
DbStatus associations (std::vector< const Token * > &assocs)
 Allow access to all known associations between containers. More...
 
DbStatus shapes (std::vector< const DbTypeInfo * > &shaps)
 Allow access to all known shapes used by the database. More...
 
IDbDatabaseinfo ()
 Let the implementation access the internals. More...
 
const IDbDatabaseinfo () const
 
void setAge (int value)
 Update database age. More...
 
int age () const
 Access age value. More...
 
T * operator-> ()
 Dereference operator. More...
 
const T * operator-> () const
 
bool operator! () const
 Validity check through operator NOT. More...
 
const T * ptr () const
 Access to underlying object. More...
 
T * ptr ()
 
bool isValid () const
 Validity check (Objy like) More...
 
const DbTypetype () const
 Inquire storage type of the handle. More...
 

Protected Types

typedef std::pair< std::string, std::string > Parameter
 Parameter definition. More...
 
typedef std::vector< ParameterParameters
 Parameter container definition. More...
 
typedef T _DataType
 Data type definition. More...
 
typedef DbHandleBase< _DataTypeBase
 Data type definition. More...
 

Protected Member Functions

void switchPtr (DbDatabaseObj *obj)
 Assign transient object properly (including reference counting) More...
 
void setType (const DbType &typ)
 Set handle type. More...
 
void setPtr (T *ptr)
 Set data pointer. More...
 

Protected Attributes

T * m_ptr
 Data member: Object pointer. Sub-classes need access on re-assignment. More...
 
DbType m_type
 Data member: Technology type. Sub-classes need access on re-assignment. More...
 

Detailed Description

Description: Handle managing a DbDatabaseObj, a generic Database object.

Author
M.Frank
Version
1.0

Definition at line 53 of file DbDatabase.h.

Member Typedef Documentation

◆ _DataType

typedef T pool::DbHandleBase::_DataType
protectedinherited

Data type definition.

Definition at line 37 of file DbHandleBase.h.

◆ Base

typedef DbHandleBase<_DataType> pool::DbHandleBase::Base
protectedinherited

Data type definition.

Definition at line 39 of file DbHandleBase.h.

◆ Parameter

typedef std::pair<std::string, std::string> pool::DbDatabase::Parameter
protected

Parameter definition.

Definition at line 56 of file DbDatabase.h.

◆ Parameters

typedef std::vector< Parameter > pool::DbDatabase::Parameters
protected

Parameter container definition.

Definition at line 58 of file DbDatabase.h.

Constructor & Destructor Documentation

◆ DbDatabase() [1/3]

pool::DbDatabase::DbDatabase ( const DbType typ = POOL_StorageType)
inline

Constructor with initializing arguments.

Definition at line 64 of file DbDatabase.h.

64 { m_type = typ; }

◆ DbDatabase() [2/3]

pool::DbDatabase::DbDatabase ( const DbDatabase cp)
inline

Copy constructor.

Definition at line 66 of file DbDatabase.h.

66 : Base() { switchPtr(cp.m_ptr); }

◆ DbDatabase() [3/3]

pool::DbDatabase::DbDatabase ( DbDatabaseObj obj)
inline

Constructor.

Definition at line 68 of file DbDatabase.h.

68 { switchPtr(obj); }

◆ ~DbDatabase()

virtual pool::DbDatabase::~DbDatabase ( )
inlinevirtual

Standard destructor.

Definition at line 70 of file DbDatabase.h.

70 { switchPtr(0); }

Member Function Documentation

◆ add()

DbStatus pool::DbDatabase::add ( const std::string &  name,
DbContainerObj cnt 
)

Add domain to session.

◆ addParam()

DbStatus pool::DbDatabase::addParam ( const std::string &  nam,
const std::string &  val 
)

Add a persistent parameter to the file.

◆ addShape()

DbStatus pool::DbDatabase::addShape ( const DbTypeInfo pShape)

Add persistent shape to the Database.

◆ age()

int pool::DbDatabase::age ( ) const

Access age value.

◆ associations()

DbStatus pool::DbDatabase::associations ( std::vector< const Token * > &  assocs)

Allow access to all known associations between containers.

◆ close()

DbStatus pool::DbDatabase::close ( )

Close Database.

◆ cntName()

std::string pool::DbDatabase::cntName ( Token token)

Retrieve container name from link container (using token oid, rather than contID)

◆ cntToken()

const Token* pool::DbDatabase::cntToken ( const std::string &  cntName)

Access local container token (if container exists)

◆ containedIn() [1/2]

DbDomain& pool::DbDatabase::containedIn ( )

◆ containedIn() [2/2]

const DbDomain& pool::DbDatabase::containedIn ( ) const

Access to domain object.

◆ containers() [1/2]

DbStatus pool::DbDatabase::containers ( std::vector< const Token * > &  conts,
bool  intern = false 
)

Allow access to all known containers.

◆ containers() [2/2]

DbStatus pool::DbDatabase::containers ( std::vector< IDbContainer * > &  conts,
bool  intern = false 
)

◆ contShape()

const DbTypeInfo* pool::DbDatabase::contShape ( const std::string &  nam)

Retrieve persistent type information by container.

◆ db() [1/2]

IOODatabase* pool::DbDatabase::db ( )

Allow access to the Database implementation.

◆ db() [2/2]

const IOODatabase* pool::DbDatabase::db ( ) const

◆ exist()

bool pool::DbDatabase::exist ( DbDomain domH,
const std::string &  nam 
) const

Check for existence of Database within domain.

◆ find() [1/2]

DbContainerObj* pool::DbDatabase::find ( const std::string &  nam)

Select container object in Database.

◆ find() [2/2]

const DbContainerObj* pool::DbDatabase::find ( const std::string &  nam) const

Select container object in Database.

◆ getLink()

DbStatus pool::DbDatabase::getLink ( const Token::OID_t oid,
Token pTok 
)

Expand OID into a full Token, based on the Links table.

◆ getOption()

DbStatus pool::DbDatabase::getOption ( DbOption refOpt)

Access options.

Parameters
refOpt[IN] Reference to option object.
Returns
Status code indicating success or failure.

◆ info() [1/2]

IDbDatabase* pool::DbDatabase::info ( )

Let the implementation access the internals.

◆ info() [2/2]

const IDbDatabase* pool::DbDatabase::info ( ) const

◆ isOpen()

bool pool::DbDatabase::isOpen ( ) const

Check if the database was opened.

◆ isValid()

bool pool::DbHandleBase::isValid
inlineinherited

Validity check (Objy like)

Definition at line 64 of file DbHandleBase.h.

64 { return 0 != m_ptr; }

◆ logon()

const std::string& pool::DbDatabase::logon ( ) const

Access to db logon string.

◆ makeLink()

DbStatus pool::DbDatabase::makeLink ( Token pToken,
Token::OID_t linkH 
)

Add association link to link container.

◆ name()

const std::string& pool::DbDatabase::name ( ) const

Access to db name (FID)

◆ nParam()

int pool::DbDatabase::nParam ( )

Retrieve the number of user parameters.

◆ objectShape() [1/2]

const DbTypeInfo* pool::DbDatabase::objectShape ( const Guid nam)

Retrieve persistent type information by name.

◆ objectShape() [2/2]

const DbTypeInfo* pool::DbDatabase::objectShape ( const RootType typeH)

Retrieve persistent type information by class handle.

◆ open()

DbStatus pool::DbDatabase::open ( DbDomain domH,
const std::string &  pfn,
const std::string &  fid,
DbAccessMode  mode = pool::READ 
)

Open Database using given domain.

Parameters
domH[IN] Valid handle to domain object.
pfn[IN] Physical file name of the database.
lfn[IN] Logical file name of the database.
mode[IN] Open mode (Default=READ).
Returns
Status code indicating success or failure.

◆ openMode()

DbAccessMode pool::DbDatabase::openMode ( ) const

Access to access mode member.

◆ operator!()

bool pool::DbHandleBase::operator!
inlineinherited

Validity check through operator NOT.

Definition at line 59 of file DbHandleBase.h.

59 { return !isValid(); }

◆ operator->() [1/2]

T* pool::DbHandleBase::operator->
inlineinherited

Dereference operator.

Definition at line 56 of file DbHandleBase.h.

56 { return m_ptr; }

◆ operator->() [2/2]

const T* pool::DbHandleBase::operator->
inlineinherited

Definition at line 57 of file DbHandleBase.h.

57 { return m_ptr; }

◆ operator=() [1/2]

DbDatabase& pool::DbDatabase::operator= ( const DbDatabase copy)
inline

Assignment (copy) operator.

Definition at line 72 of file DbDatabase.h.

72  {
73  if ( &copy != this ) {
74  m_type = copy.m_type;
75  switchPtr( copy.m_ptr );
76  }
77  return *this;
78  }

◆ operator=() [2/2]

DbDatabase& pool::DbDatabase::operator= ( const int  )
inline

Assignment operator to reset handle using 0.

Definition at line 80 of file DbDatabase.h.

80  {
81  switchPtr(0);
82  return *this;
83  }

◆ param()

DbStatus pool::DbDatabase::param ( const std::string &  nam,
std::string &  val 
)

Retrieve existing parameter by name.

◆ params()

DbStatus pool::DbDatabase::params ( Parameters vals)

Retrieve all parameters.

◆ ptr() [1/2]

T* pool::DbHandleBase::ptr
inlineinherited

Definition at line 62 of file DbHandleBase.h.

62 { return m_ptr; }

◆ ptr() [2/2]

const T* pool::DbHandleBase::ptr
inlineinherited

Access to underlying object.

Definition at line 61 of file DbHandleBase.h.

61 { return m_ptr; }

◆ read()

DbStatus pool::DbDatabase::read ( const Token token,
ShapeH  shape,
void **  object 
)

read an object referenced by the token

◆ refCount()

int pool::DbDatabase::refCount ( ) const

Access reference counter.

◆ remove()

DbStatus pool::DbDatabase::remove ( const DbContainerObj cnt)

Find domain in session.

◆ reopen()

DbStatus pool::DbDatabase::reopen ( DbAccessMode  mode = pool::READ)

Re-open database with changing access permissions.

Parameters
mode[IN] Open mode (Valid modes are READ, UPDATE).
Returns
Status code indicating success or failure.

◆ retire()

DbStatus pool::DbDatabase::retire ( )

End database access, but still leave database accessible.

◆ setAge()

void pool::DbDatabase::setAge ( int  value)

Update database age.

◆ setName()

void pool::DbDatabase::setName ( const std::string &  nam)

Set db name (FID) after opening in case opening happened by PFN.

◆ setOption()

DbStatus pool::DbDatabase::setOption ( const DbOption refOpt)

Set options.

Parameters
refOpt[IN] Reference to option object.
Returns
Status code indicating success or failure.

◆ setPtr()

void pool::DbHandleBase::setPtr ( T *  ptr)
inlineprotectedinherited

Set data pointer.

Definition at line 52 of file DbHandleBase.h.

52 { m_ptr=ptr; }

◆ setType()

void pool::DbHandleBase::setType ( const DbType typ)
inlineprotectedinherited

Set handle type.

Definition at line 50 of file DbHandleBase.h.

50 { m_type=typ; }

◆ shapes()

DbStatus pool::DbDatabase::shapes ( std::vector< const DbTypeInfo * > &  shaps)

Allow access to all known shapes used by the database.

◆ size()

long long int pool::DbDatabase::size ( )

Access the size of the database: May be undefined for some technologies.

◆ switchPtr()

void pool::DbDatabase::switchPtr ( DbDatabaseObj obj)
protected

Assign transient object properly (including reference counting)

◆ token()

const Token* pool::DbDatabase::token ( ) const

Access the token of the database object.

◆ transAct()

DbStatus pool::DbDatabase::transAct ( Transaction::Action  action)

Commit/Rollback Database Transaction.

Parameters
action[IN] action to perform
Returns
Status code indicating success or failure.

◆ type()

const DbType& pool::DbHandleBase::type
inlineinherited

Inquire storage type of the handle.

Definition at line 66 of file DbHandleBase.h.

66 { return m_type; }

Member Data Documentation

◆ m_ptr

T* pool::DbHandleBase::m_ptr
protectedinherited

Data member: Object pointer. Sub-classes need access on re-assignment.

Definition at line 41 of file DbHandleBase.h.

◆ m_type

DbType pool::DbHandleBase::m_type
protectedinherited

Data member: Technology type. Sub-classes need access on re-assignment.

Definition at line 43 of file DbHandleBase.h.


The documentation for this class was generated from the following file:
pool::DbDatabase::switchPtr
void switchPtr(DbDatabaseObj *obj)
Assign transient object properly (including reference counting)
pool::DbHandleBase< DbDatabaseObj >::ptr
const T * ptr() const
Access to underlying object.
Definition: DbHandleBase.h:61
pool::DbHandleBase< DbDatabaseObj >::m_type
DbType m_type
Data member: Technology type. Sub-classes need access on re-assignment.
Definition: DbHandleBase.h:43
LArNewCalib_PedestalAutoCorr.cp
cp
Definition: LArNewCalib_PedestalAutoCorr.py:188
pool::DbHandleBase< DbDatabaseObj >::Base
DbHandleBase< _DataType > Base
Data type definition.
Definition: DbHandleBase.h:39
pool::DbHandleBase< DbDatabaseObj >::m_ptr
T * m_ptr
Data member: Object pointer. Sub-classes need access on re-assignment.
Definition: DbHandleBase.h:41
pool::DbHandleBase< DbDatabaseObj >::isValid
bool isValid() const
Validity check (Objy like)
Definition: DbHandleBase.h:64
calibdata.copy
bool copy
Definition: calibdata.py:27
python.PyAthena.obj
obj
Definition: PyAthena.py:132