Go to the documentation of this file.
11 #ifndef GAUDIALG_TUPLEPUT_H
12 #define GAUDIALG_TUPLEPUT_H 1
46 template <
class VALUE>
63 if (
m_map.
end() != ifound )
return ifound->second.get();
65 if ( !tuple )
return nullptr;
68 tuple->
Error(
"ItemStore::getItem('" +
key +
"') item name is not unique" ).
ignore();
74 tuple->
Error(
"ItemStore::getItem('" +
key +
"') invalid NTuple::Tuple*" ).
ignore();
80 if ( !stored.second ) {
81 tuple->
Warning(
"ItemStore::getItem('" +
key +
"') item already exists, new one not inserted!" ).
ignore();
84 auto& item = stored.first->second;
88 tuple->
Error(
"ItemStore::getItem('" +
key +
"') cannot addItem", sc ).
ignore();
94 tuple->
Warning(
"ItemStore::getItem('" +
key +
"') the item not unique " ).
ignore();
122 template <
class TYPE>
128 static bool s_fail =
false;
129 static TClass* s_type =
nullptr;
134 else if ( !s_type ) {
135 s_type = TClass::GetClass(
typeid( TYPE ) );
148 ( *item ) =
const_cast<TYPE*
>( obj );
157 #endif // GAUDIALG_TUPLEPUT_H
iterator find(const key_type &key)
const NTuple::Tuple * tuple() const
provide the access to underlying Gaudi N-tuple
virtual StatusCode Error(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
Store m_map
the underlying map
ItemStore & operator=(const ItemStore &)=delete
bool evtColType() const
Event collection ?
bool goodItem(const std::string &name) const
check the uniqueness of the name
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
A simple wrapper class over standard Gaudi NTuple::Tuple facility.
NTuple::Item< VALUE > * getItem(const std::string &key, Tuples::TupleObj *tuple)
the only one method:
StatusCode addItem(const std::string &name, Item< TYPE > &itm)
Add a scalar data item a N tuple.
iterator erase(const_iterator pos)
const StatusCode & ignore() const
Allow discarding a StatusCode without warning.
bool addItem(std::string name, std::string type)
add the item name into the list of known items
virtual StatusCode Warning(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
constexpr static const auto SUCCESS
bool invalid() const
invalid pointer to tuple ?
Abstract base class which allows the user to interact with the actual N tuple implementation.
StatusCode put(const std::string &name, const TYPE *obj)
The function allows to add almost arbitrary object into N-tuple.
ItemStore(const ItemStore &)=delete
GaudiUtils::HashMap< std::string, std::unique_ptr< NTuple::Item< VALUE > > > Store
ItemStore()=default
constructor : create empty map
std::pair< iterator, bool > emplace(Args &&... args)
const std::string & name() const
get the name