#include <TuplePut.h>
Collaboration diagram for Tuples::ItemStore< VALUE >:
Public Member Functions | |
ItemStore () | |
constructor : create empty map | |
~ItemStore () | |
destructor : delete all known entries | |
Protected Member Functions | |
NTuple::Item< VALUE > * | getItem (const std::string &key, Tuples::TupleObj *tuple) |
the only one method: | |
Private Types | |
typedef GaudiUtils::HashMap< std::string, NTuple::Item< VALUE > * > | Store |
Private Member Functions | |
ItemStore (const ItemStore &) | |
no copy is allowed | |
ItemStore & | operator= (const ItemStore &) |
no assignement is allowed | |
Private Attributes | |
Store | m_map |
the underlying map the underlying map | |
Friends | |
class | TupleObj |
Essentially it is a restricted GaudiUtils::HashMap with the ownership of the newly created entries
Definition at line 40 of file TuplePut.h.
typedef GaudiUtils::HashMap<std::string,NTuple::Item<VALUE>*> Tuples::ItemStore< VALUE >::Store [private] |
Definition at line 44 of file TuplePut.h.
Tuples::ItemStore< VALUE >::ItemStore | ( | ) | [inline] |
Tuples::ItemStore< VALUE >::~ItemStore | ( | ) | [inline] |
destructor : delete all known entries
Definition at line 49 of file TuplePut.h.
00050 { 00051 for ( typename Store::iterator ientry = m_map.begin() ; 00052 m_map.end() != ientry ; ++ientry ) 00053 { if ( 0 != ientry->second ) { delete ientry->second ; } } 00054 } ;
Tuples::ItemStore< VALUE >::ItemStore | ( | const ItemStore< VALUE > & | ) | [private] |
no copy is allowed
NTuple::Item<VALUE>* Tuples::ItemStore< VALUE >::getItem | ( | const std::string & | key, | |
Tuples::TupleObj * | tuple | |||
) | [inline, protected] |
the only one method:
Definition at line 58 of file TuplePut.h.
00059 { 00060 // find the item by name 00061 typename Store::iterator ifound = m_map.find( key ) ; 00062 // existing item? 00063 if ( m_map.end() != ifound ) { return ifound->second ; } // RETURN 00064 // check the tuple for booking: 00065 if ( 0 == tuple ) { return 0 ; } 00066 // check the existrence of the name 00067 if ( !tuple->goodItem ( key ) ) 00068 { 00069 tuple -> Error ( "ItemStore::getItem('" + key 00070 + "') item name is not unique").ignore() ; 00071 return 0 ; // RETURN 00072 } 00073 // get the underlying object 00074 NTuple::Tuple* tup = tuple->tuple() ; 00075 if ( 0 == tup ) 00076 { 00077 tuple -> Error ( "ItemStore::getItem('" + key 00078 + "') invalid NTuple::Tuple*" ).ignore() ; 00079 return 0 ; // RETURN 00080 } 00081 // create new item: 00082 NTuple::Item<VALUE>* item = new NTuple::Item<VALUE>() ; 00083 // add it into N-tuple 00084 StatusCode sc = tup->addItem( key , *item ) ; // ATTENTION! 00085 if ( sc.isFailure() ) 00086 { 00087 tuple -> Error ( "ItemStore::getItem('" + key 00088 + "') cannot addItem" , sc ).ignore() ; 00089 return 0 ; // RETURN 00090 } 00091 // check the name again 00092 if ( !tuple->addItem( key , System::typeinfoName ( typeid ( VALUE ) ) ) ) 00093 { 00094 tuple -> Warning ( "ItemStore::getItem('" + key 00095 + "') the item not unique " ).ignore() ; 00096 } 00097 // add the newly created item into the store: 00098 if ( !m_map.insert ( std::make_pair ( key , item ) ).second ) 00099 { 00100 tuple -> Warning ( "ItemStore::getItem('" + key 00101 + "') item is not inserted!" ).ignore() ; 00102 } 00103 // 00104 return item ; // RETURN 00105 }
ItemStore& Tuples::ItemStore< VALUE >::operator= | ( | const ItemStore< VALUE > & | ) | [private] |
no assignement is allowed
friend class TupleObj [friend] |
Definition at line 42 of file TuplePut.h.
Store Tuples::ItemStore< VALUE >::m_map [private] |