|
ATLAS Offline Software
|
Go to the documentation of this file.
38 for(
const std::string&
key :
keys) {
48 detailsMustSetList<T>().insert(
key);
64 return hasDetail<TrigFeatureLink>(
key);
68 return getDetail<TrigFeatureLink>(
key);
91 throw std::invalid_argument(
"The format of TrigComposite object has been locked, addDetails can not be used anymore, see unlockFormat or setDetail");
92 if ( hasDetail<T>(
key) )
93 throw std::invalid_argument(
"The TrigCompositeObejct already has key: "+
key);
102 if ( hasDetail<T>(
key) ==
false )
103 throw std::invalid_argument(
"The TrigCompositeObejct does not have key: "+
key);
107 detailsMustSetList<T>().erase(
key);
113 return detailsMap<T>().find(
key) != detailsMap<T>().end();
122 if ( hasDetail<T>(
key) )
123 return detailsMap<T>().find(
key)->second;
124 return specimen<T>();
130 detailsMap<T>().erase(
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&);
170 GEN_(
float, m_floats)
172 GEN_(std::string, m_strings)
175 GEN_(std::vector<float>, m_v_floats)
176 GEN_(std::vector<int>, m_v_ints)
177 GEN_(std::vector<std::string>, m_v_strings)
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;
200 print<float> (
log,
d,
"floats");
201 print<int> (
log,
d,
"ints");
202 print<std::string> (
log,
d,
"strings");
205 print<std::vector<float> > (
log,
d,
"vector of floats") ;
206 print<std::vector<int> > (
log,
d,
"vector of ints");
207 print<std::vector<string> > (
log,
d,
"vector of strings");
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;
MustSetList m_v_stringsToBeSet
const T & getDetail(const std::string &key) const
return the value of the detail, if the key is absent the default is returned
MustSetList m_linksToBeSet
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 ...
bool hasObject(const std::string &key) const
checks if the object has link to the object under the key
#define GEN_(type, varaible)
std::vector< ALFA_RawDataCollection_p1 > t1
bool isFormatLocked() const
return true if the format can not be further changed (no addDetail can be called)
bool isValid() const
Checks the validity of the format, i.e.
const TrigFeatureLink & getObject(const std::string &key) const
returns
MsgStream & operator<<(MsgStream &log, const TrigComposite &d)
Prints the content of the object.
std::map< std::string, T > & detailsMap()
void setObject(const std::string &key, TrigFeatureLink link)
sets the link
~TrigComposite()
Destructor, does nothing special in fact, no links are touched.
MustSetList m_v_floatsToBeSet
MustSetList m_stringsToBeSet
void print(char *figname, TCanvas *c1)
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...
MustSetList m_floatsToBeSet
TrigComposite()
Deafault constructor, should not be normally used, needed by the persistency layer.
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.
std::vector< ALFA_RawDataContainer_p1 > t2
void addObject(const std::string &key, TrigFeatureLink link)
adds the link
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 m_v_intsToBeSet
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.
MustSetList m_intsToBeSet
void mustSet(const std::string &key)