| # Gaudi Framework, version v22r2 |

Home |  | Generated: Tue May 10 2011

Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | Friends

# Tuples::ItemStore< VALUE > Class Template Reference

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

`#include <GaudiAlg/TuplePut.h>`

Collaboration diagram for Tuples::ItemStore< VALUE >:
[legend]

List of all members.

## 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 assignment is allowed
## Private Attributes
Store | m_map
## Friends
class | TupleObj

## 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.

## 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.

    : m_map() {}

template<class VALUE>

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

destructor : delete all known entries

Definition at line 47 of file TuplePut.h.

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

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.

        {
          // find the item by name
          typename Store::iterator ifound = m_map.find( key ) ;
          // existing item?
          if ( m_map.end() != ifound ) { return ifound->second ; }        // RETURN
          // check the tuple for booking:
          if ( 0 == tuple ) { return 0 ; }
          // check the existence of the name
          if ( !tuple->goodItem ( key ) )
          {
            tuple -> Error ( "ItemStore::getItem('" + key
                             + "') item name is not unique").ignore() ;
            return 0 ;                                                    // RETURN
          }
          // get the underlying object
          NTuple::Tuple* tup = tuple->tuple() ;
          if ( 0 == tup )
          {
            tuple -> Error ( "ItemStore::getItem('" + key
                             + "') invalid NTuple::Tuple*" ).ignore() ;
            return 0 ;                                                   // RETURN
          }
          // create new item:
          NTuple::Item<VALUE>* item = new NTuple::Item<VALUE>() ;
          // add it into N-tuple
          StatusCode sc = tup->addItem( key , *item ) ;                 // ATTENTION!
          if ( sc.isFailure() )
          {
            tuple -> Error   ( "ItemStore::getItem('" + key
                               + "') cannot addItem" , sc ).ignore() ;
            return 0 ;                                                  // RETURN
          }
          // check the name again
          if ( !tuple->addItem( key , System::typeinfoName ( typeid ( VALUE ) ) ) )
          {
            tuple -> Warning ( "ItemStore::getItem('" + key
                               + "') the item not unique " ).ignore() ;
          }
          // add the newly created item into the store:
          if ( !m_map.insert ( std::make_pair ( key , item ) ).second )
          {
            tuple -> Warning ( "ItemStore::getItem('" + key
                               + "') item is not inserted!" ).ignore() ;
          }
          //
          return item ;                                                  // RETURN
        }

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

Definition at line 111 of file TuplePut.h.

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

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

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines