| # Gaudi Framework, version v20r4
Generated: 8 Jan 2009

# Tuples::ItemStore< VALUE > Class Template Reference

`#include <TuplePut.h>`

Collaboration diagram for Tuples::ItemStore< VALUE >:

[legend]

List of all members.

## Detailed Description

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

Simple class, which represents the local storage of N-tupel 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 40 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
ItemStore & | operator= (const ItemStore &)
| no assignement 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 44 of file TuplePut.h.

## Constructor & Destructor Documentation

template<class VALUE>

Tuples::ItemStore< VALUE >::ItemStore | ( |  | ) | `[inline]`

constructor : create empty map

Definition at line 47 of file TuplePut.h.

    00047 : m_map() {}

template<class VALUE>

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     } ;

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 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     }

template<class VALUE>

ItemStore& Tuples::ItemStore< VALUE >::operator= | ( | const ItemStore< VALUE > & |  | ) | `[private]`

no assignement is allowed

## Friends And Related Function Documentation

template<class VALUE>

friend class TupleObj`[friend]`

Definition at line 42 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 113 of file TuplePut.h.

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v20r4/GaudiAlg/GaudiAlg/TuplePut.h