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, const std::string &name)
virtual ~Container ()=default
 destructor
virtual const std::string & name () const override final
 Returns the name of this container.
virtual ITokenIterator * tokens () override
 Starts an iteration over the tokens in the container.
virtual bool attributeOfType (const std::string &attributeName, void *data, const std::type_info &typeInfo, const std::string &option) override
 The 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 method setting the attribute data given a name.

Private Attributes

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

Detailed Description

Container is an implementation of the IContainer interface.

Definition at line 22 of file Container.h.

Constructor & Destructor Documentation

◆ Container()

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

Definition at line 14 of file Container.cxx.

14 :
15 m_name( name ),
16 m_fileDescriptor( fileDescriptor )
17{}
virtual const std::string & name() const override final
Returns the name of this container.
Definition Container.h:30
FileDescriptor & m_fileDescriptor
Reference to file descriptor of the parent database.
Definition Container.h:56
std::string m_name
The name of the container.
Definition Container.h:53

◆ ~Container()

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

destructor

Member Function Documentation

◆ attributeOfType()

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

The method returning the attribute data given a name.

Implements pool::IContainer.

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 DbDatabase dbH( m_fileDescriptor.dbc()->handle() );
36 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()

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

Returns the name of this container.

Implements pool::IContainer.

Definition at line 30 of file Container.h.

30{ return m_name; }

◆ setAttributeOfType()

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

The method setting the attribute data given a name.

Implements pool::IContainer.

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 DbDatabase dbH( m_fileDescriptor.dbc()->handle() );
57 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()

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 20 of file Container.cxx.

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

Member Data Documentation

◆ m_fileDescriptor

FileDescriptor& pool::Container::m_fileDescriptor
private

Reference to file descriptor of the parent database.

Definition at line 56 of file Container.h.

◆ m_name

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

The name of the container.

Definition at line 53 of file Container.h.


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