ATLAS Offline Software
|
Extension of the ObjectMetadata class for reading D3PD files. More...
#include <RootObjectMetadata.h>
Public Member Functions | |
RootObjectMetadata () | |
Default constructor. More... | |
RootObjectMetadata (const RootObjectMetadata &parent) | |
Copy constructor. More... | |
StatusCode | addVariable (const std::string &name, const std::string &type, const std::string &docstring) |
Function adding a variable, when the exact type_info is not available. More... | |
StatusCode | checkPrefixes () |
Remove possibly overlooked prefixes in the variable names. More... | |
virtual StatusCode | addVariable (const std::string &name, const std::type_info &ti, void *&ptr, const std::string &docstring="", const void *defval=0) |
Make the implementation from ObjectMetadata visible. More... | |
bool | operator== (const ObjectMetadata &rhs) const |
Equality operator. More... | |
bool | operator< (const ObjectMetadata &rhs) const |
Operator needed to use such objects in ordered STL containers. More... | |
virtual StatusCode | addVariable (const std::string &name, const std::type_info &ti, void *&ptr, const std::string &docstring="", const void *defval=0) |
This function can be used to save the metadata about a D3PD variable. More... | |
template<class T > | |
StatusCode | addVariable (const std::string &name, T *&ptr, const std::string &docstring="") |
Make the template implementation from IAddVariable visible. More... | |
template<class T , class U > | |
StatusCode | addVariable (const std::string &name, T *&ptr, const std::string &docstring, const U &defval) |
Make the template implementation from IAddVariable visible. More... | |
template<class T > | |
StatusCode | addVariable (const std::string &name, T *&ptr, const std::string &docstring="") |
Add a variable to the tuple. More... | |
template<class T , class U > | |
StatusCode | addVariable (const std::string &name, T *&ptr, const std::string &docstring, const U &defval) |
Add a variable to the tuple. More... | |
virtual StatusCode | addDimensionedVariable (const std::string &name, const std::type_info &ti, void *&ptr, const std::string &dim, const std::string &docstring="", const void *defval=0) |
The object doesn't support dimensioned variables at the moment, like most of the D3PDMaker code doesn't. More... | |
template<class T > | |
StatusCode | addDimensionedVariable (const std::string &name, T *&ptr, const std::string &dim, const std::string &docstring="") |
Add a variable to the tuple. More... | |
template<class T , class U > | |
StatusCode | addDimensionedVariable (const std::string &name, T *&ptr, const std::string &dim, const std::string &docstring, const U &defval) |
Add a variable to the tuple. More... | |
virtual StatusCode | addDimensionedVariable (const std::string &name, const std::type_info &ti, void *&ptr, const std::string &dim, const std::string &docstring="", const void *defval=0)=0 |
Add a variable to the tuple. More... | |
template<class T > | |
StatusCode | addDimensionedVariable (const std::string &name, T *&ptr, const std::string &dim, const std::string &docstring="") |
Add a variable to the tuple. More... | |
template<class T , class U > | |
StatusCode | addDimensionedVariable (const std::string &name, T *&ptr, const std::string &dim, const std::string &docstring, const U &defval) |
Add a variable to the tuple. More... | |
const std::string & | name () const |
Get the name of the D3PDObject that this object describes. More... | |
void | setName (const std::string &name) |
Set the name of the D3PDObject that this object describes. More... | |
std::string metadataName | ATLAS_NOT_THREAD_SAFE () const |
Get the name for the metadata object that should be created. More... | |
const std::string & | prefix () const |
Get the prefix given to variables in this D3PDObject. More... | |
void | setPrefix (const std::string &prefix) |
Set the prefix given to variables in this D3PDObject. More... | |
bool | container () const |
Get whether the D3PDObject describes a container or not. More... | |
void | setContainer (bool container) |
Set whether the D3PDObject describes a container or not. More... | |
std::string | toString () const |
Function "serializing" the stored information into a string. More... | |
StatusCode | read (const std::string &data) |
Function "de-serializing" the stored information from a string. More... | |
void | clear () |
Function clearing the object. More... | |
ObjectMetadata & | operator+= (const ObjectMetadata &obj) |
Operator merging the contents of two objects. More... | |
ObjectMetadata & | merge (const ObjectMetadata &obj) |
Function merging the contents of two objects. More... | |
const std::set< Variable > & | variables () const |
Function for accessing all the variables of the D3PDObject. More... | |
Static Public Member Functions | |
static bool | isObjectMetadata (const std::string &name) |
Function guessing if an object with a given name is object metadata. More... | |
static std::string | objectName (const std::string &metaName) |
Get the D3PDObject's name from the name of the metadata object. More... | |
Static Public Attributes | |
static const size_t | RANDOM_NAME_POSTFIX_LENGTH = 6 |
Length of the random string appended to the object name. More... | |
static const char *const | STRING_SEPARATOR = "@" |
Character separating parts of the object's metadata. More... | |
static const unsigned int | SERIALIZER_VERSION = 1 |
"Version number" of the serialized information More... | |
Protected Attributes | |
std::set< Variable > | m_variables |
The list of variables created by a D3PDObject. More... | |
std::string | m_name |
Name of the D3PDObject that this object describes. More... | |
std::string | m_prefix |
Prefix used by the D3PDObject. More... | |
bool | m_container |
The D3PDObject describes a container. More... | |
Private Member Functions | |
RootObjectMetadata & | operator= (const RootObjectMetadata &) |
Static Private Member Functions | |
static std::string genSuffix | ATLAS_NOT_THREAD_SAFE (const std::string &name, size_t length) |
Generate a unique suffix for a metadata object name. More... | |
Extension of the ObjectMetadata class for reading D3PD files.
The base D3PD::ObjectMetadata class needs to get some extra features for interpreting the metadata found in D3PD ROOT files correctly. Instead of putting all the frunctionality into the base class, it is only put here.
Definition at line 32 of file RootObjectMetadata.h.
D3PD::RootObjectMetadata::RootObjectMetadata | ( | ) |
Default constructor.
Definition at line 20 of file RootObjectMetadata.cxx.
D3PD::RootObjectMetadata::RootObjectMetadata | ( | const RootObjectMetadata & | parent | ) |
Copy constructor.
Definition at line 25 of file RootObjectMetadata.cxx.
|
virtualinherited |
The object doesn't support dimensioned variables at the moment, like most of the D3PDMaker code doesn't.
Still, we might implement something like this later on.
Implements D3PD::IAddVariable.
Definition at line 157 of file ObjectMetadata.cxx.
|
inherited |
Add a variable to the tuple.
name | The name of the variable. |
type | The type of the variable. |
ptr | Pointer to the type of the variable. The pointer need not be initialized; the D3PD software will set the pointer prior to calling fill() . |
dim | Dimension for the variable. (Presently unimplemented!) |
docstring | Documentation string for this variable. |
defval | Pointer to the default value to use for this variable. Null for no default (generally means to fill with zeros). Of the type given by ti . Only works for basic types. |
If called from the constructor, the only effect is to clear ptr
.
|
inherited |
Add a variable to the tuple.
name | The name of the variable. |
ptr | Pointer to the type of the variable. The pointer need not be initialized; the D3PD software will set the pointer prior to calling fill() . |
dim | Dimension for the variable. (Presently unimplemented!) |
docstring | Documentation string for this variable. |
defval | Pointer to the default value to use for this variable. Only works for basic types. |
If called from the constructor, the only effect is to clear ptr
.
|
inherited |
Add a variable to the tuple.
name | The name of the variable. |
ptr | Pointer to the type of the variable. The pointer need not be initialized; the D3PD software will set the pointer prior to calling fill() . |
dim | Dimension for the variable. (Presently unimplemented!) |
docstring | Documentation string for this variable. |
defval | Pointer to the default value to use for this variable. Only works for basic types. |
If called from the constructor, the only effect is to clear ptr
.
|
inherited |
Add a variable to the tuple.
name | The name of the variable. |
ptr | Pointer to the type of the variable. The pointer need not be initialized; the D3PD software will set the pointer prior to calling fill() . |
dim | Dimension for the variable. (Presently unimplemented!) |
docstring | Documentation string for this variable. |
If called from the constructor, the only effect is to clear ptr
.
|
inherited |
Add a variable to the tuple.
name | The name of the variable. |
ptr | Pointer to the type of the variable. The pointer need not be initialized; the D3PD software will set the pointer prior to calling fill() . |
dim | Dimension for the variable. (Presently unimplemented!) |
docstring | Documentation string for this variable. |
If called from the constructor, the only effect is to clear ptr
.
StatusCode D3PD::RootObjectMetadata::addVariable | ( | const std::string & | name, |
const std::string & | type, | ||
const std::string & | docstring | ||
) |
Function adding a variable, when the exact type_info is not available.
Definition at line 30 of file RootObjectMetadata.cxx.
StatusCode D3PD::ObjectMetadata::addVariable |
Make the implementation from ObjectMetadata visible.
Definition at line 59 of file ObjectMetadata.cxx.
|
virtualinherited |
This function can be used to save the metadata about a D3PD variable.
Note that this class doesn't implement the full might of an ID3PD object, so no new object is created as a result of this function call. This means that it should always be followed by calling the addVariable(...) function of a proper IAddVariable object.
Implements D3PD::IAddVariable.
Definition at line 109 of file ObjectMetadata.cxx.
|
inherited |
Make the template implementation from IAddVariable
visible.
|
inherited |
Add a variable to the tuple.
name | The name of the variable. |
ptr | Pointer to the type of the variable. The pointer need not be initialized; the D3PD software will set the pointer prior to calling fill() . |
docstring | Documentation string for this variable. |
defval | Pointer to the default value to use for this variable. Only works for basic types. |
If called from the constructor, the only effect is to clear ptr
.
|
inherited |
Make the template implementation from IAddVariable
visible.
|
inherited |
Add a variable to the tuple.
name | The name of the variable. |
ptr | Pointer to the type of the variable. The pointer need not be initialized; the D3PD software will set the pointer prior to calling fill() . |
docstring | Documentation string for this variable. |
If called from the constructor, the only effect is to clear ptr
.
|
inherited |
Get the name for the metadata object that should be created.
|
staticprivateinherited |
Generate a unique suffix for a metadata object name.
name | The metadata object name. |
length | The length of the suffix to add. |
We used to do this by generating a random string. However, this is very bad for regression testing, as adding or removing one variable can then change the names of all subsequent variables. Instead, we generate the suffix based on a count of the number of times we've seen a particular name.
StatusCode D3PD::RootObjectMetadata::checkPrefixes | ( | ) |
Remove possibly overlooked prefixes in the variable names.
By mistake some of the variable names in the D3PDs produced by AtlasPhysics-17.0.5.5.2 did not get their prefix removed when they were saved into the metadata.
(Still need to investigate why.)
This function remedies this by fixing the variable names manually.
StatusCode::SUCCESS
if everything went fine Definition at line 78 of file RootObjectMetadata.cxx.
|
inherited |
|
inherited |
Get whether the D3PDObject describes a container or not.
Definition at line 230 of file ObjectMetadata.cxx.
|
static |
Function guessing if an object with a given name is object metadata.
Metadata objects are saved with a name like "Something_XXXXXX".
This function makes a very simple check whether the name given to it follows this format.
name | The name of a metadata object |
true
if it appears to be an object metadata object Definition at line 118 of file RootObjectMetadata.cxx.
|
inherited |
Function merging the contents of two objects.
This merging function was implemented in the anticipation that it might come in handy later on.
But no guarantees...
obj | The object that should be merged with this one |
Definition at line 375 of file ObjectMetadata.cxx.
|
inherited |
Get the name of the D3PDObject that this object describes.
Definition at line 170 of file ObjectMetadata.cxx.
|
staticinherited |
Get the D3PDObject's name from the name of the metadata object.
This function should be used by the client code to "decode" the name of the original D3PDObject from the name of the metadata object.
This way the client code doesn't have to know how this class works internally.
metaName | The name of the metadata object in the D3PD file |
Definition at line 213 of file ObjectMetadata.cxx.
|
inherited |
Operator merging the contents of two objects.
Definition at line 363 of file ObjectMetadata.cxx.
|
inherited |
Operator needed to use such objects in ordered STL containers.
Definition at line 91 of file ObjectMetadata.cxx.
|
private |
|
inherited |
Equality operator.
Definition at line 85 of file ObjectMetadata.cxx.
|
inherited |
Get the prefix given to variables in this D3PDObject.
Definition at line 219 of file ObjectMetadata.cxx.
|
inherited |
Function "de-serializing" the stored information from a string.
This function can be used to read in information from a serialized form.
Note that the function doesn't clear the contents of the object. So it can be used to merge information from multiple metadata objects / files.
data | The string that should be decoded |
StatusCode::SUCCESS
if the operation was successful, StatusCode::FAILURE
otherwise Definition at line 276 of file ObjectMetadata.cxx.
|
inherited |
Set whether the D3PDObject describes a container or not.
Definition at line 235 of file ObjectMetadata.cxx.
|
inherited |
Set the name of the D3PDObject that this object describes.
Definition at line 175 of file ObjectMetadata.cxx.
|
inherited |
Set the prefix given to variables in this D3PDObject.
Definition at line 224 of file ObjectMetadata.cxx.
|
inherited |
Function "serializing" the stored information into a string.
This function translates the contents of the entire object into a single string.
The different parts of the configuration string are separated by "@" character. (So variable names and variable descriptions can't have this character in them.)
Definition at line 249 of file ObjectMetadata.cxx.
|
inherited |
Function for accessing all the variables of the D3PDObject.
Definition at line 577 of file ObjectMetadata.cxx.
|
protectedinherited |
The D3PDObject describes a container.
Definition at line 175 of file ObjectMetadata.h.
|
protectedinherited |
Name of the D3PDObject that this object describes.
Definition at line 173 of file ObjectMetadata.h.
|
protectedinherited |
Prefix used by the D3PDObject.
Definition at line 174 of file ObjectMetadata.h.
|
protectedinherited |
The list of variables created by a D3PDObject.
Definition at line 172 of file ObjectMetadata.h.
|
staticinherited |
Length of the random string appended to the object name.
Definition at line 109 of file ObjectMetadata.h.
|
staticinherited |
"Version number" of the serialized information
While I don't plan to change this class any time soon, we should be able to clearly decide later on if the format of the metadata serialization changed, which version was used to write the metadata found in a given file.
Definition at line 119 of file ObjectMetadata.h.
Character separating parts of the object's metadata.
Definition at line 111 of file ObjectMetadata.h.