ATLAS Offline Software
Loading...
Searching...
No Matches
Container Class Referencefinal

#include <Container.h>

Collaboration diagram for Container:

Public Member Functions

 Container (pool::FileDescriptor &fileDescriptor, const std::string &name)
 ~Container ()=default
 destructor
const std::string & name () const
 Returns the name of this container.
TokenIterator * tokens ()
 Starts an iteration over the tokens in the container.
bool attributeOfType (const std::string &attributeName, void *data, const std::type_info &typeInfo, const std::string &option)
 The method returning the attribute data given a name.
bool setAttributeOfType (const std::string &attributeName, const void *data, const std::type_info &typeInfo, const std::string &option)
 The method setting the attribute data given a name.

Private Attributes

std::string m_name
 The name of the container.
pool::FileDescriptor & m_fileDescriptor
 Reference to file descriptor of the parent database.

Detailed Description

Definition at line 20 of file Container.h.

Constructor & Destructor Documentation

◆ Container()

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

Definition at line 14 of file Container.cxx.

14 :
15 m_name( name ),
16 m_fileDescriptor( fileDescriptor )
17{}
const std::string & name() const
Returns the name of this container.
Definition Container.h:28
std::string m_name
The name of the container.
Definition Container.h:49
pool::FileDescriptor & m_fileDescriptor
Reference to file descriptor of the parent database.
Definition Container.h:52

◆ ~Container()

Container::~Container ( )
default

destructor

Member Function Documentation

◆ attributeOfType()

bool Container::attributeOfType ( const std::string & attributeName,
void * data,
const std::type_info & typeInfo,
const std::string & option )

The method returning the attribute data given a name.

Definition at line 26 of file Container.cxx.

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

◆ name()

const std::string & Container::name ( ) const
inline

Returns the name of this container.

Definition at line 28 of file Container.h.

28{ return m_name; }

◆ setAttributeOfType()

bool Container::setAttributeOfType ( const std::string & attributeName,
const void * data,
const std::type_info & typeInfo,
const std::string & option )

The method setting the attribute data given a name.

Definition at line 46 of file Container.cxx.

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

◆ tokens()

TokenIterator * Container::tokens ( )

Starts an iteration over the tokens in the container.

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

Definition at line 20 of file Container.cxx.

21{
22 return new TokenIterator( m_fileDescriptor, this->name() );
23}

Member Data Documentation

◆ m_fileDescriptor

pool::FileDescriptor& Container::m_fileDescriptor
private

Reference to file descriptor of the parent database.

Definition at line 52 of file Container.h.

◆ m_name

std::string Container::m_name
private

The name of the container.

Definition at line 49 of file Container.h.


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