38 for(
const std::string& key : keys) {
91 throw std::invalid_argument(
"The format of TrigComposite object has been locked, addDetails can not be used anymore, see unlockFormat or setDetail");
93 throw std::invalid_argument(
"The TrigCompositeObejct already has key: "+ key);
103 throw std::invalid_argument(
"The TrigCompositeObejct does not have key: "+ key);
139 sizeof(
struct TrigComposite_does_not_support_that_type_as_a_detail);
148 sizeof(
struct TrigComposite_does_not_support_that_type_as_a_detail);
154#define GEN_(type, varaible) \
155 template<> std::map<std::string, type>& TrigComposite::detailsMap() { return varaible; } \
156 template<> const std::map<std::string, type>& TrigComposite::detailsMap() const { return varaible; } \
157 template<> std::set<std::string>& TrigComposite::detailsMustSetList<type>() { return varaible##ToBeSet; } \
158 template<> const type& TrigComposite::specimen<type>() const { static const type x{}; return x;} \
159 template void TrigComposite::addDetail<type>(const std::string&, const type&); \
160 template void TrigComposite::setDetail<type>(const std::string&, const type&); \
161 template bool TrigComposite::hasDetail<type>(const std::string& ) const; \
162 template const type& TrigComposite::getDetail<type>(const std::string& ) const; \
163 template void TrigComposite::eraseDetail<type>(const std::string& ); \
164 template void TrigComposite::setFormat<type>(const std::vector<std::string>&, bool ); \
165 template void TrigComposite::mustSet<type>(const std::string&);
172GEN_(std::string, m_strings)
175GEN_(std::vector<float>, m_v_floats)
176GEN_(std::vector<int>, m_v_ints)
177GEN_(std::vector<std::string>, m_v_strings)
182MsgStream&
print(MsgStream& log,
const TrigComposite& d,
const std::string& detailsName ) {
183 if ( ! d.allDetails<T>().empty() ) {
184 log <<
"TrigComposite: Details stored as " << detailsName <<
" are (key, value): ";
186 typedef typename std::map<std::string, T>::value_type key_value;
187 for(
const key_value& kv : d.allDetails<T>()) {
188 log <<
"(" << kv.first <<
", " << kv.second <<
") ";
199 log <<
"TrigComposite object: " << d.name() <<
endmsg;
210 typedef std::map<std::string, TrigFeatureLink>::value_type key_value;
212 log <<
"(" << kv.first <<
", " <<
"CLID:" << kv.second.clid() <<
") ";
216 log <<
"There are no objects assocuiated with this TrigComposite object" <<
endmsg;
void print(char *figname, TCanvas *c1)
#define GEN_(type, varaible)
The class is meant to store links (of type TrigFeatureLink) to trigger objects and arbitrary details ...
MustSetList m_linksToBeSet
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.
~TrigComposite()
Destructor, does nothing special in fact, no links are touched.
MustSetList m_intsToBeSet
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
TrigComposite()
Deafault constructor, should not be normally used, needed by the persistency layer.
MustSetList m_stringsToBeSet
void setObject(const std::string &key, TrigFeatureLink link)
sets the link
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
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
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, T > & detailsMap()
MustSetList m_floatsToBeSet
void addObject(const std::string &key, TrigFeatureLink link)
adds the link
ostream & operator<<(ostream &s, const SG::VarHandleKey &m)