ATLAS Offline Software
|
A class that manages meta-data to be associated with an object. More...
#include <MetaObject.h>
Public Types | |
enum | CastMode { CAST_ERROR_THROW, CAST_ERROR_DEFAULT, CAST_NOCAST_THROW, CAST_NOCAST_DEFAULT } |
the different modes for casts More... | |
Public Member Functions | |
void | testInvariant () const |
test the invariant of this object More... | |
MetaObject () | |
standard constructor More... | |
MetaObject (const MetaObject &that) | |
standard copy constructor More... | |
virtual | ~MetaObject () |
standard destructor More... | |
MetaObject & | operator= (const MetaObject &that) |
standard assignment operator More... | |
void | swap (MetaObject &that) |
standard swap More... | |
void | remove (const std::string &name) |
remove all meta-information with the given name More... | |
void | addReplace (TNamed *meta_swallow) |
add a meta-data object and remove any existing meta-data with the same name More... | |
TObject * | get (const std::string &name) |
the meta-data object with the given name More... | |
const TObject * | get (const std::string &name) const |
double | getDouble (const std::string &name, double def_val=0) const |
the meta-data double with the given name More... | |
std::string | getString (const std::string &name, const std::string &def_val="") const |
the meta-data string with the given name More... | |
template<class T > | |
T | castT (const std::string &name, T def_val, CastMode mode) const |
the meta-data element with the given name More... | |
double | castDouble (const std::string &name, double def_val=0, CastMode mode=CAST_ERROR_THROW) const |
the meta-data double with the given name More... | |
std::string | castString (const std::string &name, const std::string &def_val="", CastMode mode=CAST_ERROR_THROW) const |
the meta-data string with the given name More... | |
int | castInteger (const std::string &name, int def_val=0, CastMode mode=CAST_ERROR_THROW) const |
the meta-data integer with the given name More... | |
bool | castBool (const std::string &name, bool def_val=false, CastMode mode=CAST_ERROR_THROW) const |
the meta-data boolean with the given name More... | |
void | setDouble (const std::string &name, double value) |
set the meta-data double with the given name More... | |
void | setString (const std::string &name, const std::string &value) |
set the meta-data string with the given name More... | |
void | setInteger (const std::string &name, int value) |
set the meta-data integer with the given name More... | |
void | setBool (const std::string &name, bool value) |
set the meta-data boolean with the given name More... | |
template<class T > | |
void | setT (const std::string &name, T value) |
set the meta-data element with the given name More... | |
void | fetch (const MetaObject &source) |
fetch the meta-data from the given sample. More... | |
void | fetchDefaults (const MetaObject &source) |
fetch the meta-data from the given sample not present in this sample. More... | |
void | fetchFromString (const std::string &source) |
fetch the meta-data from a given string More... | |
std::string | dumpToString () |
dump the meta-data to a string More... | |
virtual void | Add (TObject *meta_swallow) |
add another object to the collection More... | |
virtual void | Clear (Option_t *option="") |
clear out the content of the collection More... | |
virtual void | Delete (Option_t *option="") |
clear out the content of the collection More... | |
virtual Int_t | GetEntries () const |
return the number of entries of this collection More... | |
virtual TObject ** | GetObjectRef (const TObject *meta) const |
return pointer to pointer of object meta More... | |
virtual TIterator * | MakeIterator (Bool_t dir=kIterForward) const |
make a new iterator for this collection More... | |
virtual TObject * | Remove (TObject *meta) |
remove the given object from the list More... | |
Private Member Functions | |
ClassDef (MetaObject, 1) | |
Private Attributes | |
TList * | m_dataList |
the actual meta-data list More... | |
Related Functions | |
(Note that these are not member functions.) | |
std::string | dbg (const MetaObject &obj, unsigned verbosity=0) |
the debugging info of this object More... | |
void | swap (MetaObject &a, MetaObject &b) |
standard swap More... | |
A class that manages meta-data to be associated with an object.
Originally this was just to be used for meta-data of a sample, but it is now also used for specifying the options for an EventLoop job.
Definition at line 55 of file MetaObject.h.
the different modes for casts
Definition at line 63 of file MetaObject.h.
SH::MetaObject::MetaObject | ( | ) |
standard constructor
SH::MetaObject::MetaObject | ( | const MetaObject & | that | ) |
standard copy constructor
|
virtual |
standard destructor
|
virtual |
add another object to the collection
void SH::MetaObject::addReplace | ( | TNamed * | meta_swallow | ) |
add a meta-data object and remove any existing meta-data with the same name
meta_swallow | the meta-object to add |
bool SH::MetaObject::castBool | ( | const std::string & | name, |
bool | def_val = false , |
||
CastMode | mode = CAST_ERROR_THROW |
||
) | const |
the meta-data boolean with the given name
name | the name of the meta-data object |
dev_val | the value to return if no meta-data object of the given name exists, or if it does not have the right type |
double SH::MetaObject::castDouble | ( | const std::string & | name, |
double | def_val = 0 , |
||
CastMode | mode = CAST_ERROR_THROW |
||
) | const |
the meta-data double with the given name
name | the name of the meta-data object |
dev_val | the value to return if no meta-data object of the given name exists, or if it does not have the right type |
int SH::MetaObject::castInteger | ( | const std::string & | name, |
int | def_val = 0 , |
||
CastMode | mode = CAST_ERROR_THROW |
||
) | const |
the meta-data integer with the given name
name | the name of the meta-data object |
dev_val | the value to return if no meta-data object of the given name exists, or if it does not have the right type |
std::string SH::MetaObject::castString | ( | const std::string & | name, |
const std::string & | def_val = "" , |
||
CastMode | mode = CAST_ERROR_THROW |
||
) | const |
the meta-data string with the given name
name | the name of the meta-data object |
dev_val | the value to return if no meta-data object of the given name exists, or if it does not have the right type |
T SH::MetaObject::castT | ( | const std::string & | name, |
T | def_val, | ||
CastMode | mode | ||
) | const |
the meta-data element with the given name
name | the name of the meta-data object |
dev_val | the value to return if no meta-data object of the given name exists, or if it does not have the right type |
|
private |
|
virtual |
clear out the content of the collection
|
virtual |
clear out the content of the collection
std::string SH::MetaObject::dumpToString | ( | ) |
dump the meta-data to a string
string will be suitable for fetchFromString
void SH::MetaObject::fetch | ( | const MetaObject & | source | ) |
fetch the meta-data from the given sample.
fields that have a name that starts with "nc_" are not copied.
void SH::MetaObject::fetchDefaults | ( | const MetaObject & | source | ) |
fetch the meta-data from the given sample not present in this sample.
ignores any meta-data without name.
void SH::MetaObject::fetchFromString | ( | const std::string & | source | ) |
fetch the meta-data from a given string
individual pieces of data may be given as key=value, key='value', key="value" spurious spaces will be ignored, commas inside values are not allowed
TObject* SH::MetaObject::get | ( | const std::string & | name | ) |
the meta-data object with the given name
name | the name of the meta-data object |
double SH::MetaObject::getDouble | ( | const std::string & | name, |
double | def_val = 0 |
||
) | const |
the meta-data double with the given name
name | the name of the meta-data object |
dev_val | the value to return if no meta-data object of the given name exists, or if it does not have the right type |
|
virtual |
return the number of entries of this collection
|
virtual |
return pointer to pointer of object meta
std::string SH::MetaObject::getString | ( | const std::string & | name, |
const std::string & | def_val = "" |
||
) | const |
the meta-data string with the given name
name | the name of the meta-data object |
dev_val | the value to return if no meta-data object of the given name exists, or if it does not have the right type |
|
virtual |
make a new iterator for this collection
MetaObject& SH::MetaObject::operator= | ( | const MetaObject & | that | ) |
standard assignment operator
void SH::MetaObject::remove | ( | const std::string & | name | ) |
remove all meta-information with the given name
name | the meta-data name to remove |
|
virtual |
remove the given object from the list
void SH::MetaObject::setBool | ( | const std::string & | name, |
bool | value | ||
) |
set the meta-data boolean with the given name
name | the name of the meta-data |
value | the value to which it is set |
void SH::MetaObject::setDouble | ( | const std::string & | name, |
double | value | ||
) |
set the meta-data double with the given name
name | the name of the meta-data |
value | the value to which it is set |
void SH::MetaObject::setInteger | ( | const std::string & | name, |
int | value | ||
) |
set the meta-data integer with the given name
name | the name of the meta-data |
value | the value to which it is set |
set the meta-data string with the given name
name | the name of the meta-data |
value | the value to which it is set |
|
inline |
set the meta-data element with the given name
name | the name of the meta-data |
value | the value to which it is set |
Definition at line 339 of file MetaObject.h.
void SH::MetaObject::swap | ( | MetaObject & | that | ) |
standard swap
void SH::MetaObject::testInvariant | ( | ) | const |
test the invariant of this object
|
related |
the debugging info of this object
obj | the object to be presented |
verbosity | the level of verbosity (higher number -> more information) |
|
related |
standard swap
|
private |
the actual meta-data list
Definition at line 477 of file MetaObject.h.