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

#include <UserDatabase.h>

Inheritance diagram for pool::PersistencySvc::UserDatabase:
Collaboration diagram for pool::PersistencySvc::UserDatabase:

Public Types

enum  OpenMode { CLOSED, READ, UPDATE }
 Current open mode enumeration. More...
 

Public Member Functions

 UserDatabase (TechnologyDispatcher &technologyDispatcher, const DatabaseConnectionPolicy &policy, IFileCatalog &fileCatalog, ITransaction &transaction, DatabaseRegistry &registry, const std::string &name, DatabaseSpecification::NameType nameType)
 Constructor. More...
 
virtual ~UserDatabase ()
 Destructor. More...
 
DatabaseHandlerdatabaseHandler ()
 Returns the database handler. More...
 
virtual void connectForRead () override
 Connects explicitly to the database for read operations. More...
 
virtual void connectForRead (const DatabaseConnectionPolicy &policy) override
 
virtual void connectForWrite () override
 Connects explicitly to the database for write/update operations. More...
 
virtual void connectForWrite (const DatabaseConnectionPolicy &policy) override
 
virtual void disconnect () override
 Disconnects from the database. More...
 
virtual IDatabase::OpenMode openMode () const override
 Returns the opening mode. It can be used to check whether the database is connected. More...
 
virtual const std::string & fid () override
 Returns the file identifier of this database. More...
 
virtual const std::string & pfn () override
 Returns the physical file name of this database. More...
 
virtual bool setTechnology (long technology) override
 Sets the technology identifier for this database. More...
 
virtual long technology () const override
 Returns the technology identifier for this database. More...
 
virtual std::vector< std::string > containers () override
 Returns the names of the containers in this database. More...
 
virtual IContainercontainerHandle (const std::string &name) override
 Returns a pointer to a container object. The user acquires ownership of that object. More...
 
virtual const ITechnologySpecificAttributestechnologySpecificAttributes () const override
 Returns the object holding the technology specific attributes. More...
 
virtual ITechnologySpecificAttributestechnologySpecificAttributes () override
 
template<class T >
attribute (const std::string &attributeName, const std::string &option="")
 Templated method to retrieve an attribute. More...
 
template<class T >
bool setAttribute (const std::string &attributeName, const T &atttibuteValue, const std::string &option="")
 Templated method to set an attribute. More...
 

Protected Member Functions

virtual bool attributeOfType (const std::string &attributeName, void *data, const std::type_info &typeInfo, const std::string &option) override
 The actual method returning the attribute data given a name. More...
 
virtual bool setAttributeOfType (const std::string &attributeName, const void *data, const std::type_info &typeInfo, const std::string &option) override
 The actual method setting the attribute data given a name. More...
 

Private Member Functions

bool checkInRegistry ()
 Checks in the registry if the database handler already exists. More...
 
void setTechnologyIdentifier (const std::string &sTechnology)
 Converts a technology string to the technology (long) identifier. More...
 

Private Attributes

TechnologyDispatcherm_technologyDispatcher
 Reference to the technology dispatcher. More...
 
const DatabaseConnectionPolicym_policy
 Reference to the policy. More...
 
IFileCatalogm_catalog
 Reference to the file catalog. More...
 
ITransactionm_transaction
 Reference to the global transaction. More...
 
DatabaseRegistrym_registry
 Reference to the database registry. More...
 
std::string m_name
 The database name. More...
 
DatabaseSpecification::NameType m_nameType
 The database name spacification. More...
 
long m_technology
 The technology identifier of the database. More...
 
bool m_technologySet
 Checks if the technology identifier has been set. More...
 
DatabaseHandlerm_databaseHandler
 The underlying database handler. More...
 
IDatabase::OpenMode m_openMode
 Current open mode. More...
 
bool m_alreadyConnected
 Flag indicating whether a connection has been already made once. More...
 
std::string m_the_fid
 Other names used. More...
 
std::string m_the_pfn
 

Detailed Description

UserDatabase is an implementation of the IDatabase interface.

Definition at line 31 of file UserDatabase.h.

Member Enumeration Documentation

◆ OpenMode

enum pool::IDatabase::OpenMode
inherited

Current open mode enumeration.

Enumerator
CLOSED 
READ 
UPDATE 

Definition at line 28 of file IDatabase.h.

28  { CLOSED,
29  READ,
30  UPDATE } OpenMode;

Constructor & Destructor Documentation

◆ UserDatabase()

pool::PersistencySvc::UserDatabase::UserDatabase ( TechnologyDispatcher technologyDispatcher,
const DatabaseConnectionPolicy policy,
IFileCatalog fileCatalog,
ITransaction transaction,
DatabaseRegistry registry,
const std::string &  name,
DatabaseSpecification::NameType  nameType 
)

Constructor.

◆ ~UserDatabase()

virtual pool::PersistencySvc::UserDatabase::~UserDatabase ( )
virtual

Destructor.

Member Function Documentation

◆ attribute()

template<class T >
T pool::ITechnologySpecificAttributes::attribute ( const std::string &  attributeName,
const std::string &  option = "" 
)
inlineinherited

Templated method to retrieve an attribute.

Definition at line 37 of file ITechnologySpecificAttributes.h.

38  {
39  T data;
40  const std::type_info& typeInfo = typeid(T);
41  if ( ! this->attributeOfType( attributeName,
42  static_cast< void* >( &data ),
43  typeInfo,
44  option ) ) {
45  std::ostringstream error;
46  error << "Failed to retrieve attribute " << attributeName << " of type " << typeInfo.name();
47  throw Exception( error.str() );
48  }
49  return data;
50  }

◆ attributeOfType()

virtual bool pool::PersistencySvc::UserDatabase::attributeOfType ( const std::string &  attributeName,
void *  data,
const std::type_info &  typeInfo,
const std::string &  option 
)
overrideprotectedvirtual

The actual method returning the attribute data given a name.

Implements pool::ITechnologySpecificAttributes.

◆ checkInRegistry()

bool pool::PersistencySvc::UserDatabase::checkInRegistry ( )
private

Checks in the registry if the database handler already exists.

◆ connectForRead() [1/2]

virtual void pool::PersistencySvc::UserDatabase::connectForRead ( )
overridevirtual

Connects explicitly to the database for read operations.

Implements pool::IDatabase.

◆ connectForRead() [2/2]

virtual void pool::PersistencySvc::UserDatabase::connectForRead ( const DatabaseConnectionPolicy policy)
overridevirtual

Implements pool::IDatabase.

◆ connectForWrite() [1/2]

virtual void pool::PersistencySvc::UserDatabase::connectForWrite ( )
overridevirtual

Connects explicitly to the database for write/update operations.

Implements pool::IDatabase.

◆ connectForWrite() [2/2]

virtual void pool::PersistencySvc::UserDatabase::connectForWrite ( const DatabaseConnectionPolicy policy)
overridevirtual

Implements pool::IDatabase.

◆ containerHandle()

virtual IContainer* pool::PersistencySvc::UserDatabase::containerHandle ( const std::string &  name)
overridevirtual

Returns a pointer to a container object. The user acquires ownership of that object.

Implements pool::IDatabase.

◆ containers()

virtual std::vector< std::string > pool::PersistencySvc::UserDatabase::containers ( )
overridevirtual

Returns the names of the containers in this database.

Implements pool::IDatabase.

◆ databaseHandler()

DatabaseHandler& pool::PersistencySvc::UserDatabase::databaseHandler ( )

Returns the database handler.

◆ disconnect()

virtual void pool::PersistencySvc::UserDatabase::disconnect ( )
overridevirtual

Disconnects from the database.

Implements pool::IDatabase.

◆ fid()

virtual const std::string& pool::PersistencySvc::UserDatabase::fid ( )
overridevirtual

Returns the file identifier of this database.

Implements pool::IDatabase.

◆ openMode()

virtual IDatabase::OpenMode pool::PersistencySvc::UserDatabase::openMode ( ) const
overridevirtual

Returns the opening mode. It can be used to check whether the database is connected.

Implements pool::IDatabase.

◆ pfn()

virtual const std::string& pool::PersistencySvc::UserDatabase::pfn ( )
overridevirtual

Returns the physical file name of this database.

Implements pool::IDatabase.

◆ setAttribute()

template<class T >
bool pool::ITechnologySpecificAttributes::setAttribute ( const std::string &  attributeName,
const T &  atttibuteValue,
const std::string &  option = "" 
)
inlineinherited

Templated method to set an attribute.

Definition at line 53 of file ITechnologySpecificAttributes.h.

55  {
56  return this->setAttributeOfType( attributeName,
57  static_cast< const void* >( &atttibuteValue ),
58  typeid(T),
59  option );
60  }

◆ setAttributeOfType()

virtual bool pool::PersistencySvc::UserDatabase::setAttributeOfType ( const std::string &  attributeName,
const void *  data,
const std::type_info &  typeInfo,
const std::string &  option 
)
overrideprotectedvirtual

The actual method setting the attribute data given a name.

Implements pool::ITechnologySpecificAttributes.

◆ setTechnology()

virtual bool pool::PersistencySvc::UserDatabase::setTechnology ( long  technology)
overridevirtual

Sets the technology identifier for this database.

This can only be called for newly created databases before the connect method is called. Otherwise false is returned.

Implements pool::IDatabase.

◆ setTechnologyIdentifier()

void pool::PersistencySvc::UserDatabase::setTechnologyIdentifier ( const std::string &  sTechnology)
private

Converts a technology string to the technology (long) identifier.

◆ technology()

virtual long pool::PersistencySvc::UserDatabase::technology ( ) const
overridevirtual

Returns the technology identifier for this database.

Implements pool::IDatabase.

◆ technologySpecificAttributes() [1/2]

virtual const ITechnologySpecificAttributes& pool::PersistencySvc::UserDatabase::technologySpecificAttributes ( ) const
overridevirtual

Returns the object holding the technology specific attributes.

Implements pool::IDatabase.

◆ technologySpecificAttributes() [2/2]

virtual ITechnologySpecificAttributes& pool::PersistencySvc::UserDatabase::technologySpecificAttributes ( )
overridevirtual

Implements pool::IDatabase.

Member Data Documentation

◆ m_alreadyConnected

bool pool::PersistencySvc::UserDatabase::m_alreadyConnected
private

Flag indicating whether a connection has been already made once.

Definition at line 125 of file UserDatabase.h.

◆ m_catalog

IFileCatalog& pool::PersistencySvc::UserDatabase::m_catalog
private

Reference to the file catalog.

Definition at line 107 of file UserDatabase.h.

◆ m_databaseHandler

DatabaseHandler* pool::PersistencySvc::UserDatabase::m_databaseHandler
private

The underlying database handler.

Definition at line 121 of file UserDatabase.h.

◆ m_name

std::string pool::PersistencySvc::UserDatabase::m_name
private

The database name.

Definition at line 113 of file UserDatabase.h.

◆ m_nameType

DatabaseSpecification::NameType pool::PersistencySvc::UserDatabase::m_nameType
private

The database name spacification.

Definition at line 115 of file UserDatabase.h.

◆ m_openMode

IDatabase::OpenMode pool::PersistencySvc::UserDatabase::m_openMode
private

Current open mode.

Definition at line 123 of file UserDatabase.h.

◆ m_policy

const DatabaseConnectionPolicy& pool::PersistencySvc::UserDatabase::m_policy
private

Reference to the policy.

Definition at line 105 of file UserDatabase.h.

◆ m_registry

DatabaseRegistry& pool::PersistencySvc::UserDatabase::m_registry
private

Reference to the database registry.

Definition at line 111 of file UserDatabase.h.

◆ m_technology

long pool::PersistencySvc::UserDatabase::m_technology
private

The technology identifier of the database.

Definition at line 117 of file UserDatabase.h.

◆ m_technologyDispatcher

TechnologyDispatcher& pool::PersistencySvc::UserDatabase::m_technologyDispatcher
private

Reference to the technology dispatcher.

Definition at line 103 of file UserDatabase.h.

◆ m_technologySet

bool pool::PersistencySvc::UserDatabase::m_technologySet
private

Checks if the technology identifier has been set.

Definition at line 119 of file UserDatabase.h.

◆ m_the_fid

std::string pool::PersistencySvc::UserDatabase::m_the_fid
private

Other names used.

Definition at line 127 of file UserDatabase.h.

◆ m_the_pfn

std::string pool::PersistencySvc::UserDatabase::m_the_pfn
private

Definition at line 128 of file UserDatabase.h.

◆ m_transaction

ITransaction& pool::PersistencySvc::UserDatabase::m_transaction
private

Reference to the global transaction.

Definition at line 109 of file UserDatabase.h.


The documentation for this class was generated from the following file:
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
pool::IDatabase::OpenMode
OpenMode
Current open mode enumeration.
Definition: IDatabase.h:28
pool::ITechnologySpecificAttributes::setAttributeOfType
virtual bool setAttributeOfType(const std::string &attributeName, const void *data, const std::type_info &typeInfo, const std::string &option)=0
The actual method setting the attribute data given a name.
pool::ITechnologySpecificAttributes::attributeOfType
virtual bool attributeOfType(const std::string &attributeName, void *data, const std::type_info &typeInfo, const std::string &option)=0
The actual method returning the attribute data given a name.
pool::IDatabase::CLOSED
@ CLOSED
Definition: IDatabase.h:28
pool::IDatabase::READ
@ READ
Definition: IDatabase.h:29
pool::IDatabase::UPDATE
@ UPDATE
Definition: IDatabase.h:30
get_generator_info.error
error
Definition: get_generator_info.py:40
error
Definition: IImpactPoint3dEstimator.h:70
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35