ATLAS Offline Software
Public Member Functions | List of all members
D3PD::IAddVariable Class Referenceabstract

Common interface for adding a variable to a tuple. More...

#include <IAddVariable.h>

Inheritance diagram for D3PD::IAddVariable:
Collaboration diagram for D3PD::IAddVariable:

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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ~IAddVariable()

virtual D3PD::IAddVariable::~IAddVariable ( )
inlinevirtual

Destructor.

Definition at line 73 of file IAddVariable.h.

73 {}

Member Function Documentation

◆ addDimensionedVariable() [1/3]

virtual StatusCode D3PD::IAddVariable::addDimensionedVariable ( const std::string &  name,
const std::type_info &  ti,
void *&  ptr,
const std::string &  dim,
const std::string &  docstring = "",
const void *  defval = 0 
)
pure virtual

Add a variable to the tuple.

Parameters
nameThe name of the variable.
typeThe type of the variable.
ptrPointer to the type of the variable. The pointer need not be initialized; the D3PD software will set the pointer prior to calling fill().
dimDimension for the variable. (Presently unimplemented!)
docstringDocumentation string for this variable.
defvalPointer 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.

◆ addDimensionedVariable() [2/3]

template<class T , class U >
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.

Parameters
nameThe name of the variable.
ptrPointer to the type of the variable. The pointer need not be initialized; the D3PD software will set the pointer prior to calling fill().
dimDimension for the variable. (Presently unimplemented!)
docstringDocumentation string for this variable.
defvalPointer 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.

◆ addDimensionedVariable() [3/3]

template<class T >
StatusCode D3PD::IAddVariable::addDimensionedVariable ( const std::string &  name,
T *&  ptr,
const std::string &  dim,
const std::string &  docstring = "" 
)

Add a variable to the tuple.

Parameters
nameThe name of the variable.
ptrPointer to the type of the variable. The pointer need not be initialized; the D3PD software will set the pointer prior to calling fill().
dimDimension for the variable. (Presently unimplemented!)
docstringDocumentation string for this variable.

If called from the constructor, the only effect is to clear ptr.

◆ addVariable() [1/3]

virtual StatusCode D3PD::IAddVariable::addVariable ( const std::string &  name,
const std::type_info &  ti,
void *&  ptr,
const std::string &  docstring = "",
const void *  defval = 0 
)
pure virtual

Add a variable to the tuple.

Parameters
nameThe name of the variable.
typeThe type of the variable.
ptrPointer to the type of the variable. The pointer need not be initialized; the D3PD software will set the pointer prior to calling fill().
docstringDocumentation string for this variable.
defvalPointer 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.

◆ addVariable() [2/3]

template<class T , class U >
StatusCode D3PD::IAddVariable::addVariable ( const std::string &  name,
T *&  ptr,
const std::string &  docstring,
const U &  defval 
)

Add a variable to the tuple.

Parameters
nameThe name of the variable.
ptrPointer to the type of the variable. The pointer need not be initialized; the D3PD software will set the pointer prior to calling fill().
docstringDocumentation string for this variable.
defvalPointer 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.

◆ addVariable() [3/3]

template<class T >
StatusCode D3PD::IAddVariable::addVariable ( const std::string &  name,
T *&  ptr,
const std::string &  docstring = "" 
)

Add a variable to the tuple.

Parameters
nameThe name of the variable.
ptrPointer to the type of the variable. The pointer need not be initialized; the D3PD software will set the pointer prior to calling fill().
docstringDocumentation string for this variable.

If called from the constructor, the only effect is to clear ptr.


The documentation for this class was generated from the following file: