ATLAS Offline Software
|
Common interface for adding a variable to a tuple. More...
#include <IAddVariable.h>
Public Member Functions | |
virtual | ~IAddVariable () |
Destructor. 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... | |
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 | addVariable (const std::string &name, const std::type_info &ti, void *&ptr, const std::string &docstring="", const void *defval=0)=0 |
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... | |
Common interface for adding a variable to a tuple.
This defines the interface used to add variables to a tuple. Generally, each filler tool will define this interface. Each of these tools will have a parent that also implements this interface; the tool will then implement this interface by adding an appropriate prefix/suffix to the variable name and passing it to the parent. This terminates when we reach the ID3PD
object representing the actual tuple. This simple case of adding a prefix and forwarding can be implemented using AddVariable
. Tools may do more complicated transformations as well; for example, VectorFillerTool
changes a T
to a vector<T>
.
The interface to add a variable takes the variable name, the variable type, and a reference to a pointer to the variable. Users will generally use the templated version, for which the variable type is specified implicitly via the pointer type. The D3PD software will arrange that when the fill()
method is called, the supplied pointer will be set to point at a valid instance of the variable.
The variable type used must be known to CINT. Between events, the variable is cleared to the (optional) default value specified in the addVariable
call. If it hasn't been specified, the variable is cleared as follows:
A documentation string may also be specified along with a variable.
If any of the addVariable()
methods are called during the constructor of the tool, then the only effect will be that the pointer to the variable gets cleared. This allows one to call the book()
method from the constructor to prevent coverity warnings about uninitialized pointers.
NOTE: The dim argument is currently unimplemented.
Definition at line 69 of file IAddVariable.h.
|
inlinevirtual |
|
pure virtual |
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
.
Implemented in D3PD::RootD3PD, D3PD::VectorFillerToolBase, D3PD::AddVariable, D3PD::ObjectMetadata, and D3PD::RootReaderD3PDBase.
StatusCode D3PD::IAddVariable::addDimensionedVariable | ( | const std::string & | name, |
T *& | ptr, | ||
const std::string & | dim, | ||
const std::string & | docstring, | ||
const U & | defval | ||
) |
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
.
StatusCode D3PD::IAddVariable::addDimensionedVariable | ( | const std::string & | name, |
T *& | ptr, | ||
const std::string & | dim, | ||
const std::string & | docstring = "" |
||
) |
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
.
|
pure virtual |
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() . |
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
.
Implemented in D3PD::RootD3PD, D3PD::VectorFillerToolBase, D3PD::AddVariable, D3PD::ObjectMetadata, and D3PD::RootReaderD3PDBase.
StatusCode D3PD::IAddVariable::addVariable | ( | const std::string & | name, |
T *& | ptr, | ||
const std::string & | docstring, | ||
const U & | defval | ||
) |
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
.
StatusCode D3PD::IAddVariable::addVariable | ( | const std::string & | name, |
T *& | ptr, | ||
const std::string & | docstring = "" |
||
) |
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
.