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

#include <Container.h>

Collaboration diagram for Container:

Public Member Functions

 Container (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.
FileDescriptor & m_fileDescriptor
 Reference to file descriptor of the parent database.

Detailed Description

Definition at line 17 of file Container.h.

Constructor & Destructor Documentation

◆ Container()

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{}
const std::string & name() const
Returns the name of this container.
Definition Container.h:25
FileDescriptor & m_fileDescriptor
Reference to file descriptor of the parent database.
Definition Container.h:49
std::string m_name
The name of the container.
Definition Container.h:46

◆ ~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 23 of file Container.cxx.

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

◆ name()

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

Returns the name of this container.

Definition at line 25 of file Container.h.

25{ 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 38 of file Container.cxx.

41 {
42 if( !m_fileDescriptor.dbc() ) return false;
43 DbOption containerOption( attributeName, option );
44 if( !containerOption.i_setValue(typeInfo, const_cast<void*>( data )).isSuccess() ) return false;
45 DbDatabase dbH( m_fileDescriptor.dbc()->handle() );
46 DbContainer cntH( dbH.find(name()) );
47 if( !cntH.isValid() && !cntH.open(dbH, name(), 0, dbH.type(), Io::READ).isSuccess() ) {
48 return false;
49 }
50 return cntH.setOption(containerOption).isSuccess();
51}

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

19 {
20 return new TokenIterator( m_fileDescriptor, this->name() );
21}

Member Data Documentation

◆ m_fileDescriptor

FileDescriptor& Container::m_fileDescriptor
private

Reference to file descriptor of the parent database.

Definition at line 49 of file Container.h.

◆ m_name

std::string Container::m_name
private

The name of the container.

Definition at line 46 of file Container.h.


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