ATLAS Offline Software
Loading...
Searching...
No Matches
pool::Container Class Reference

Container is an implementation of the IContainer interface. More...

#include <Container.h>

Inheritance diagram for pool::Container:
Collaboration diagram for pool::Container:

Public Member Functions

 Container (FileDescriptor &fileDescriptor, long technology, const std::string &name)
virtual ~Container ()=default
 destructor
virtual const std::string & name () const override final
 Returns the name of this container.
virtual long technology () const override final
 Returns the technology identifier for this container.
virtual ITokenIteratortokens () override
 Starts an iteration over the tokens in the container.
virtual ITechnologySpecificAttributestechnologySpecificAttributes () override final
 Returns the object holding the technology specific attributes for a given technology domain.
template<class T>
attribute (const std::string &attributeName, const std::string &option="")
 Templated method to retrieve an attribute.
template<class T>
bool setAttribute (const std::string &attributeName, const T &atttibuteValue, const std::string &option="")
 Templated method to set an attribute.

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.
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.

Private Attributes

std::string m_name
 The name of the container.
FileDescriptorm_fileDescriptor
 Reference to file descriptor of the parent database.
long m_technology
 The technology identifier.

Detailed Description

Container is an implementation of the IContainer interface.

Definition at line 23 of file Container.h.

Constructor & Destructor Documentation

◆ Container()

pool::Container::Container ( FileDescriptor & fileDescriptor,
long technology,
const std::string & name )

Definition at line 13 of file Container.cxx.

15 :
16 m_name( name ),
17 m_fileDescriptor( fileDescriptor ),
19{}
virtual long technology() const override final
Returns the technology identifier for this container.
Definition Container.h:37
long m_technology
The technology identifier.
Definition Container.h:70
virtual const std::string & name() const override final
Returns the name of this container.
Definition Container.h:34
FileDescriptor & m_fileDescriptor
Reference to file descriptor of the parent database.
Definition Container.h:67
std::string m_name
The name of the container.
Definition Container.h:64

◆ ~Container()

virtual pool::Container::~Container ( )
virtualdefault

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 25 of file ITechnologySpecificAttributes.h.

26 {
27 T data;
28 const std::type_info& typeInfo = typeid(T);
29 if ( ! this->attributeOfType( attributeName,
30 static_cast< void* >( &data ),
31 typeInfo,
32 option ) ) {
33 std::ostringstream error;
34 error << "Failed to retrieve attribute " << attributeName << " of type " << typeInfo.name();
35 throw std::runtime_error( error.str() + " (APR: \" ITechnologySpecificAttributes \" from \" PersistencySvc \")");
36 }
37 return data;
38 }
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.
unsigned long long T

◆ attributeOfType()

bool pool::Container::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.

Definition at line 29 of file Container.cxx.

33{
34 if( !m_fileDescriptor.dbc() ) return false;
35
36 pool::DbOption containerOption( attributeName, option );
37
38 DbDatabase dbH( m_fileDescriptor.dbc()->handle() );
39 DbContainer cntH( dbH.find(name()) );
40 if( !cntH.isValid() and !cntH.open(dbH, name(), 0, dbH.type(), Io::READ).isSuccess() ) {
41 return false;
42 }
43 if( !cntH.getOption(containerOption).isSuccess() ) return false;
44 return containerOption.i_getValue(typeInfo, data).isSuccess();
45}

◆ name()

virtual const std::string & pool::Container::name ( ) const
inlinefinaloverridevirtual

Returns the name of this container.

Implements pool::IContainer.

Definition at line 34 of file Container.h.

34{ return m_name; }

◆ 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 41 of file ITechnologySpecificAttributes.h.

43 {
44 return this->setAttributeOfType( attributeName,
45 static_cast< const void* >( &atttibuteValue ),
46 typeid(T),
47 option );
48 }
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.

◆ setAttributeOfType()

bool pool::Container::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.

Definition at line 49 of file Container.cxx.

53{
54 if( !m_fileDescriptor.dbc() ) return false;
55
56 pool::DbOption containerOption( attributeName, option );
57 if( !containerOption.i_setValue(typeInfo, const_cast<void*>( data )).isSuccess() ) return false;
58
59 DbDatabase dbH( m_fileDescriptor.dbc()->handle() );
60 DbContainer cntH( dbH.find(name()) );
61 if( !cntH.isValid() and !cntH.open(dbH, name(), 0, dbH.type(), Io::READ).isSuccess() ) {
62 return false;
63 }
64 return cntH.setOption(containerOption).isSuccess();
65}

◆ technology()

virtual long pool::Container::technology ( ) const
inlinefinaloverridevirtual

Returns the technology identifier for this container.

Implements pool::IContainer.

Definition at line 37 of file Container.h.

37{ return m_technology; }

◆ technologySpecificAttributes()

virtual ITechnologySpecificAttributes & pool::Container::technologySpecificAttributes ( )
inlinefinaloverridevirtual

Returns the object holding the technology specific attributes for a given technology domain.

Implements pool::IContainer.

Definition at line 45 of file Container.h.

45{ return *this; }

◆ tokens()

pool::ITokenIterator * pool::Container::tokens ( )
overridevirtual

Starts an iteration over the tokens in the container.

Returns a token iterator whose ownership is passed to the user.

Implements pool::IContainer.

Definition at line 22 of file Container.cxx.

23{
24 return new pool::TokenIterator( m_fileDescriptor,
25 this->name() );
26}

Member Data Documentation

◆ m_fileDescriptor

FileDescriptor& pool::Container::m_fileDescriptor
private

Reference to file descriptor of the parent database.

Definition at line 67 of file Container.h.

◆ m_name

std::string pool::Container::m_name
private

The name of the container.

Definition at line 64 of file Container.h.

◆ m_technology

long pool::Container::m_technology
private

The technology identifier.

Definition at line 70 of file Container.h.


The documentation for this class was generated from the following files: