Gaudi Framework, version v21r6

Home   Generated: 11 Nov 2009

Tuples::ItemStore< VALUE > Class Template Reference

#include <GaudiAlg/TuplePut.h>

Collaboration diagram for Tuples::ItemStore< VALUE >:

Collaboration graph
[legend]

List of all members.


Detailed Description

template<class VALUE>
class Tuples::ItemStore< VALUE >

Simple class, which represents the local storage of N-tuple items of the given type.

Essentially it is a restricted GaudiUtils::HashMap with the ownership of the newly created entries

Author:
Vanya BELYAEV ibelyaev@physics.syr.edu
Date:
2007-04-08

Definition at line 38 of file TuplePut.h.


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
ItemStoreoperator= (const ItemStore &)
 no assignment is allowed

Private Attributes

Store m_map
 the underlying map

Friends

class TupleObj

Member Typedef Documentation

template<class VALUE>
typedef GaudiUtils::HashMap<std::string,NTuple::Item<VALUE>*> Tuples::ItemStore< VALUE >::Store [private]

Definition at line 42 of file TuplePut.h.


Constructor & Destructor Documentation

template<class VALUE>
Tuples::ItemStore< VALUE >::ItemStore (  )  [inline]

constructor : create empty map

Definition at line 45 of file TuplePut.h.

00045 : m_map() {}

template<class VALUE>
Tuples::ItemStore< VALUE >::~ItemStore (  )  [inline]

destructor : delete all known entries

Definition at line 47 of file TuplePut.h.

00048     {
00049       for ( typename Store::iterator ientry  = m_map.begin() ;
00050             m_map.end() != ientry ; ++ientry )
00051       { if ( 0 != ientry->second ) { delete ientry->second ; } }
00052     }

template<class VALUE>
Tuples::ItemStore< VALUE >::ItemStore ( const ItemStore< VALUE > &   )  [private]

no copy is allowed


Member Function Documentation

template<class VALUE>
NTuple::Item<VALUE>* Tuples::ItemStore< VALUE >::getItem ( const std::string key,
Tuples::TupleObj tuple 
) [inline, protected]

the only one method:

Definition at line 56 of file TuplePut.h.

00057     {
00058       // find the item by name
00059       typename Store::iterator ifound = m_map.find( key ) ;
00060       // existing item?
00061       if ( m_map.end() != ifound ) { return ifound->second ; }        // RETURN
00062       // check the tuple for booking:
00063       if ( 0 == tuple ) { return 0 ; }
00064       // check the existence of the name
00065       if ( !tuple->goodItem ( key ) )
00066       {
00067         tuple -> Error ( "ItemStore::getItem('" + key
00068                          + "') item name is not unique").ignore() ;
00069         return 0 ;                                                    // RETURN
00070       }
00071       // get the underlying object
00072       NTuple::Tuple* tup = tuple->tuple() ;
00073       if ( 0 == tup )
00074       {
00075         tuple -> Error ( "ItemStore::getItem('" + key
00076                          + "') invalid NTuple::Tuple*" ).ignore() ;
00077         return 0 ;                                                   // RETURN
00078       }
00079       // create new item:
00080       NTuple::Item<VALUE>* item = new NTuple::Item<VALUE>() ;
00081       // add it into N-tuple
00082       StatusCode sc = tup->addItem( key , *item ) ;                 // ATTENTION!
00083       if ( sc.isFailure() )
00084       {
00085         tuple -> Error   ( "ItemStore::getItem('" + key
00086                            + "') cannot addItem" , sc ).ignore() ;
00087         return 0 ;                                                  // RETURN
00088       }
00089       // check the name again
00090       if ( !tuple->addItem( key , System::typeinfoName ( typeid ( VALUE ) ) ) )
00091       {
00092         tuple -> Warning ( "ItemStore::getItem('" + key
00093                            + "') the item not unique " ).ignore() ;
00094       }
00095       // add the newly created item into the store:
00096       if ( !m_map.insert ( std::make_pair ( key , item ) ).second )
00097       {
00098         tuple -> Warning ( "ItemStore::getItem('" + key
00099                            + "') item is not inserted!" ).ignore() ;
00100       }
00101       //
00102       return item ;                                                  // RETURN
00103     }

template<class VALUE>
ItemStore& Tuples::ItemStore< VALUE >::operator= ( const ItemStore< VALUE > &   )  [private]

no assignment is allowed


Friends And Related Function Documentation

template<class VALUE>
friend class TupleObj [friend]

Definition at line 40 of file TuplePut.h.


Member Data Documentation

template<class VALUE>
Store Tuples::ItemStore< VALUE >::m_map [private]

the underlying map

the underlying map

Definition at line 111 of file TuplePut.h.


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

Generated at Wed Nov 11 16:37:39 2009 for Gaudi Framework, version v21r6 by Doxygen version 1.5.6 written by Dimitri van Heesch, © 1997-2004