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 | |
MetaObject () | |
standard constructor | |
MetaObject (const MetaObject &that) | |
standard copy constructor | |
virtual | ~MetaObject () |
standard destructor | |
MetaObject & | operator= (const MetaObject &that) |
standard assignment operator | |
void | swap (MetaObject &that) |
standard swap | |
void | remove (const std::string &name) |
remove all meta-information with the given name | |
void | addReplace (TNamed *meta_swallow) |
add a meta-data object and remove any existing meta-data with the same name | |
TObject * | get (const std::string &name) |
the meta-data object with the given name | |
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 | |
std::string | getString (const std::string &name, const std::string &def_val="") const |
the meta-data string with the given name | |
template<class T > | |
T | castT (const std::string &name, T def_val, CastMode mode) const |
the meta-data element with the given name | |
double | castDouble (const std::string &name, double def_val=0, CastMode mode=CAST_ERROR_THROW) const |
the meta-data double with the given name | |
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 | |
int | castInteger (const std::string &name, int def_val=0, CastMode mode=CAST_ERROR_THROW) const |
the meta-data integer with the given name | |
bool | castBool (const std::string &name, bool def_val=false, CastMode mode=CAST_ERROR_THROW) const |
the meta-data boolean with the given name | |
void | setDouble (const std::string &name, double value) |
set the meta-data double with the given name | |
void | setString (const std::string &name, const std::string &value) |
set the meta-data string with the given name | |
void | setInteger (const std::string &name, int value) |
set the meta-data integer with the given name | |
void | setBool (const std::string &name, bool value) |
set the meta-data boolean with the given name | |
template<class T > | |
void | setT (const std::string &name, T value) |
set the meta-data element with the given name | |
void | fetch (const MetaObject &source) |
fetch the meta-data from the given sample. | |
void | fetchDefaults (const MetaObject &source) |
fetch the meta-data from the given sample not present in this sample. ignores any meta-data without name. | |
void | fetchFromString (const std::string &source) |
fetch the meta-data from a given string | |
std::string | dumpToString () |
dump the meta-data to a string | |
virtual void | Add (TObject *meta_swallow) |
add another object to the collection | |
virtual void | Clear (Option_t *option="") |
clear out the content of the collection | |
virtual void | Delete (Option_t *option="") |
clear out the content of the collection | |
virtual Int_t | GetEntries () const |
return the number of entries of this collection | |
virtual TObject ** | GetObjectRef (const TObject *meta) const |
return pointer to pointer of object meta | |
virtual TIterator * | MakeIterator (Bool_t dir=kIterForward) const |
make a new iterator for this collection | |
virtual TObject * | Remove (TObject *meta) |
remove the given object from the list |
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.
the different modes for casts
SH::MetaObject::MetaObject | ( | ) |
standard constructor
SH::MetaObject::MetaObject | ( | const MetaObject & | that | ) |
standard copy constructor
virtual SH::MetaObject::~MetaObject | ( | ) | [virtual] |
standard destructor
virtual void SH::MetaObject::Add | ( | TObject * | meta_swallow | ) | [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 [inline] |
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 |
virtual void SH::MetaObject::Clear | ( | Option_t * | option = "" |
) | [virtual] |
clear out the content of the collection
virtual void SH::MetaObject::Delete | ( | Option_t * | option = "" |
) | [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 Int_t SH::MetaObject::GetEntries | ( | ) | const [virtual] |
return the number of entries of this collection
virtual TObject** SH::MetaObject::GetObjectRef | ( | const TObject * | meta | ) | const [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 TIterator* SH::MetaObject::MakeIterator | ( | Bool_t | dir = kIterForward |
) | const [virtual] |
make a new iterator for this collection
MetaObject& SH::MetaObject::operator= | ( | const MetaObject & | that | ) |
standard assignment operator
virtual TObject* SH::MetaObject::Remove | ( | TObject * | meta | ) | [virtual] |
remove the given object from the list
void SH::MetaObject::remove | ( | const std::string & | name | ) |
remove all meta-information with the given name
name | the meta-data name to remove |
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 |
void SH::MetaObject::setString | ( | const std::string & | name, | |
const std::string & | value | |||
) |
set the meta-data string with the given name
name | the name of the meta-data | |
value | the value to which it is set |
void SH::MetaObject::setT | ( | const std::string & | name, | |
T | value | |||
) | [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 |
void SH::MetaObject::swap | ( | MetaObject & | that | ) |
standard swap
void SH::MetaObject::testInvariant | ( | ) | const |
test the invariant of this object