5#ifndef TRIGCOMBINEDEVENT_TRIGCOMPOSITE_H
6#define TRIGCOMBINEDEVENT_TRIGCOMPOSITE_H
9#include "GaudiKernel/ClassID.h"
66 void setFormat(
const std::vector<std::string>& keys,
bool mustBeSet=
false);
106 bool hasObject(
const std::string& key)
const;
119 std::vector<TrigFeatureLink>
getObjectsByType(
const std::string& keypart=
"")
const;
128 void addDetail(
const std::string& key,
const T& value=T());
135 void setDetail(
const std::string& key,
const T& value);
143 bool hasDetail(
const std::string& key)
const;
150 const T&
getDetail(
const std::string& key)
const;
175 void mustSet(
const std::string& key);
179 std::map<std::string, TrigFeatureLink >
m_links;
204 const std::map<std::string, T>&
detailsMap()
const;
228 std::vector<TrigFeatureLink> result;
229 for ( std::map<std::string, TrigFeatureLink>::const_iterator i =
m_links.begin(); i !=
m_links.end(); ++i ) {
230 if ( i->second.clid() == requested_clid and i->first.find(keypart) != std::string::npos)
231 result.push_back(i->second);
macros to associate a CLID to a type
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
uint32_t CLID
The Class ID type.
MsgStream & operator<<(MsgStream &m, const TrigComposite &d)
Prints the content of the object.
The class is meant to store links (of type TrigFeatureLink) to trigger objects and arbitrary details ...
TrigComposite(TrigComposite &&) noexcept=default
MustSetList m_linksToBeSet
const std::map< std::string, T > & allDetails() const
return the map of all the details Notie that the non-const version is not provided because it would a...
bool hasDetail(const std::string &key) const
Checks if the object contains detail of the type T No verification is made if it is set.
void eraseDetail(const std::string &key)
erases the detail if it existed If the details inder that key did not exist, no action is performed.
MustSetList m_intsToBeSet
std::map< std::string, std::vector< int > > m_v_ints
void setFormat(const std::vector< std::string > &keys, bool mustBeSet=false)
defines the content (details which must to be stored) The method can be used to enforce certain conte...
const T & specimen() const
void mustSet(const std::string &key)
bool isValid() const
Checks the validity of the format, i.e.
bool hasObject(const std::string &key) const
checks if the object has link to the object under the key
void lockFormat()
makes further addition of the details impossible
std::vector< TrigFeatureLink > getObjectsByType(const std::string &keypart="") const
get all links which point to objects of given type
MustSetList m_stringsToBeSet
void unlockFormat()
makes addition of further details possible again
std::map< std::string, std::vector< std::string > > m_v_strings
void setObject(const std::string &key, TrigFeatureLink link)
sets the link
std::map< std::string, float > m_floats
bool isFormatLocked() const
return true if the format can not be further changed (no addDetail can be called)
const TrigFeatureLink & getObject(const std::string &key) const
returns
TrigComposite()=default
Default constructor should not be normally used, needed by the persistency layer.
const T & getDetail(const std::string &key) const
return the value of the detail, if the key is absent the default is returned
void setDetail(const std::string &key, const T &value)
sets the value user the key, if they detail under that key already exists it's value is overwritten,...
MustSetList & detailsMustSetList()
MustSetList m_v_intsToBeSet
MustSetList m_v_stringsToBeSet
std::map< std::string, int > m_ints
void addDetail(const std::string &key, const T &value=T())
adds the value user the key, if they detail under that key already exists the exception is thrown If ...
const std::string & name() const
MustSetList m_v_floatsToBeSet
std::map< std::string, TrigFeatureLink > m_links
std::map< std::string, T > & detailsMap()
std::set< std::string > MustSetList
std::map< std::string, std::string > m_strings
MustSetList m_floatsToBeSet
std::map< std::string, std::vector< float > > m_v_floats
TrigComposite(const std::string &name)
Constructs empty composite, no objects no details.
void addObject(const std::string &key, TrigFeatureLink link)
adds the link
static constexpr CLID ID()