| The Gaudi Framework v27r1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
Tuples::ItemStore< VALUE > Class Template Referencefinal

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]

## Public Member Functions
| ItemStore ()=default
| constructor : create empty map More...

## Private Types
typedef GaudiUtils::HashMap< std::string, std::unique_ptr< NTuple::Item< VALUE > > > | Store

## Private Member Functions
NTuple::Item< VALUE > * | getItem (const std::string &key, Tuples::TupleObj *tuple)
| the only one method: More...
| ItemStore (const ItemStore &)=delete
ItemStore & | operator= (const ItemStore &)=delete

## Private Attributes
Store | m_map
| the underlying map More...

## 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 ibely.nosp@m.aev@.nosp@m.physi.nosp@m.cs.s.nosp@m.yr.ed.nosp@m.u

Date
  2007-04-08

Definition at line 38 of file TuplePut.h.

## Member Typedef Documentation

template<class VALUE>

typedef GaudiUtils::HashMap<std::string,std::unique_ptr<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 | ( |  | ) |
| default

constructor : create empty map

template<class VALUE>

Tuples::ItemStore< VALUE >::ItemStore | ( | const ItemStore< VALUE > & |  | ) |
| private delete

## Member Function Documentation

template<class VALUE>

NTuple::Item<VALUE>* Tuples::ItemStore< VALUE >::getItem | ( | const std::string & | key,
|  | Tuples::TupleObj * | tuple
| ) |  |
| inline private

the only one method:

Definition at line 49 of file TuplePut.h.

50 {
51 // find the item by name
52 auto ifound = m_map.find( key ) ;
53 // existing item?
54 if ( m_map.end() != ifound ) { return ifound->second.get() ; } // RETURN
55 // check the tuple for booking:
56 if ( !tuple ) { return nullptr ; }
57 // check the existence of the name
58 if ( !tuple->goodItem ( key ) )
59 {
60 tuple -> Error ( "ItemStore::getItem('" + key
61 + "') item name is not unique").ignore() ;
62 return nullptr ; // RETURN
63 }
64 // get the underlying object
65 NTuple::Tuple* tup = tuple->tuple() ;
66 if ( !tup )
67 {
68 tuple -> Error ( "ItemStore::getItem('" + key
69 + "') invalid NTuple::Tuple*" ).ignore() ;
70 return nullptr ; // RETURN
71 }
72 // create new item:
73 // add the newly created item into the store:
74 auto stored = m_map.emplace( key , std::unique_ptr<NTuple::Item<VALUE>>{ new NTuple::Item<VALUE>() });
75 if ( !stored.second )
76 {
77 tuple -> Warning ( "ItemStore::getItem('" + key
78 + "') item already exists, new one not inserted!" ).ignore() ;
79 return nullptr;
80 }
81 auto& item = stored.first->second;
82 // add it into N-tuple
83 StatusCode sc = tup->addItem( key , *item ) ; // ATTENTION!
84 if ( sc.isFailure() )
85 {
86 tuple -> Error ( "ItemStore::getItem('" + key
87 + "') cannot addItem" , sc ).ignore() ;
88 m_map.erase(stored.first);
89 return nullptr ; // RETURN
90 }
91 // check the name again
92 if ( !tuple->addItem( key , System::typeinfoName ( typeid ( VALUE ) ) ) )
93 {
94 tuple -> Warning ( "ItemStore::getItem('" + key
95 + "') the item not unique " ).ignore() ;
96 m_map.erase(stored.first);
97 return nullptr;
98 }
99 //
100 return item.get() ; // RETURN
101 }
Tuples::TupleObj::tuple
const NTuple::Tuple * tuple() const
provide the access to underlying Gaudi N-tuple
Definition: TupleObj.h:1988
GaudiUtils::Map::emplace
std::pair< iterator, bool > emplace(Args &&...args)
Definition: Map.h:166
Tuples::TupleObj::goodItem
bool goodItem(const std::string &name) const
check the uniqueness of the name
Definition: TupleObj.h:2047
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:297
merge_files.sc
int sc
Definition: merge_files.py:167
StatusCode::isFailure
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
Tuples::TupleObj::addItem
bool addItem(std::string name, std::string type)
add the item name into the list of known items
Definition: TupleObj.h:2039
GaudiUtils::Map::end
iterator end()
Definition: Map.h:132
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
Tuples::ItemStore::m_map
Store m_map
the underlying map
Definition: TuplePut.h:108
GaudiUtils::Map::find
iterator find(const key_type &key)
Definition: Map.h:149
NTuple::Tuple
Abstract base class which allows the user to interact with the actual N tuple implementation.
Definition: NTuple.h:370
std::unique_ptr
STL class.
GaudiUtils::Map::erase
iterator erase(const_iterator pos)
Definition: Map.h:175
ana.item
tuple item
print s1,s2
Definition: ana.py:146
NTuple::Tuple::addItem
StatusCode addItem(const std::string &name, Item< TYPE > &itm)
Add a scalar data item a N tuple.
Definition: NTuple.h:554
NTuple::Item< VALUE >
template<class VALUE>

ItemStore& Tuples::ItemStore< VALUE >::operator= | ( | const ItemStore< VALUE > & |  | ) |
| private delete

## 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 108 of file TuplePut.h.

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

- GaudiAlg/GaudiAlg/TuplePut.h