ATLAS Offline Software
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
D3PD::RootReaderD3PD_v2 Class Reference

D3PD class used for generating ROOT D3PDReader classes. More...

#include <RootReaderD3PD_v2.h>

Inheritance diagram for D3PD::RootReaderD3PD_v2:
Collaboration diagram for D3PD::RootReaderD3PD_v2:

Public Types

typedef unsigned int Dim_t
 Currently unimplemented — see design note. More...
 

Public Member Functions

 RootReaderD3PD_v2 ()
 Constructor specifying whether it's a container's D3PD. More...
 
StatusCode createReader (const std::string &classname, const std::string &dir="./") const
 Function creating the D3PDReader C++ code. More...
 
virtual StatusCode addVariable (const std::string &name, const std::type_info &ti, void *&ptr, const std::string &docstring="", const void *defval=0)
 Main function for adding a variable to the D3PD. 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)
 Function currently not used by the D3PDMaker code. 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 addMetadata (const std::string &key, const void *obj, const std::type_info &ti)
 Function adding metadata to the D3PD. Not implemented here! More...
 
template<class T >
StatusCode addMetadata (const std::string &key, const T *obj)
 Add a new piece of metadata to the tuple. More...
 
virtual StatusCode capture ()
 Function capturing the current value of the D3PD variables. Not implemented here! More...
 
virtual StatusCode clear ()
 Function clearing the D3PD variables. Not implemented here! More...
 
virtual StatusCode redim (const Dim_t *ptr)
 Function currently not used by the D3PDMaker code. More...
 
virtual void setIsContainer (bool isContainer)
 Set the "isCollection" parameter of the object. More...
 
virtual bool isContainer () const
 Get the "isCollection" parameter of the object. More...
 
virtual void setPrefix (const std::string &prefix)
 Set the common prefix of the variables. More...
 
virtual const std::string & prefix () const
 Get the common prefix of the variables. More...
 

Protected Member Functions

void addSTLHeader (std::ostream &out, const char *name) const
 Function adding STL include statements to the header when needed. More...
 

Protected Attributes

ObjectMetadata m_metadata
 Object holding the information about the variables. More...
 

Detailed Description

D3PD class used for generating ROOT D3PDReader classes.

   Version 2 of the D3PDReader implementation.
Author
Attila Krasznahorkay Attil.nosp@m.a.Kr.nosp@m.aszna.nosp@m.hork.nosp@m.ay@ce.nosp@m.rn.c.nosp@m.h
Revision
462802
Date
2011-10-12 18:06:24 +0200 (Wed, 12 Oct 2011)

$

Definition at line 26 of file RootReaderD3PD_v2.h.

Member Typedef Documentation

◆ Dim_t

typedef unsigned int D3PD::ID3PD::Dim_t
inherited

Currently unimplemented — see design note.

Definition at line 52 of file ID3PD.h.

Constructor & Destructor Documentation

◆ RootReaderD3PD_v2()

D3PD::RootReaderD3PD_v2::RootReaderD3PD_v2 ( )

Constructor specifying whether it's a container's D3PD.

Definition at line 16 of file RootReaderD3PD_v2.cxx.

16  {
17 
18  }

Member Function Documentation

◆ addDimensionedVariable() [1/3]

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

Function currently not used by the D3PDMaker code.

Implements D3PD::IAddVariable.

Definition at line 95 of file RootReaderD3PDBase.cxx.

100  {
101 
102  CHECK( m_metadata.addDimensionedVariable( name, ti, ptr, dim, docstring,
103  defval ) );
104  return StatusCode::SUCCESS;
105  }

◆ 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 
)
inherited

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 = "" 
)
inherited

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.

◆ addMetadata() [1/2]

template<class T >
StatusCode D3PD::ID3PD::addMetadata ( const std::string &  key,
const T *  obj 
)
inherited

Add a new piece of metadata to the tuple.

Parameters
key- The key for this object. Any existing object will be overwritten.
obj- Pointer to the object to write.

The interpretation of the key parameter is up to the concrete D3PD implementation. However, a key name with a trailing slash NAME/ indicates that all metadata items with this name should be grouped together in a collection called NAME (for example, in a Root directory with that name).

◆ addMetadata() [2/2]

StatusCode D3PD::RootReaderD3PDBase::addMetadata ( const std::string &  key,
const void *  obj,
const std::type_info &  ti 
)
virtualinherited

Function adding metadata to the D3PD. Not implemented here!

Implements D3PD::ID3PD.

Definition at line 107 of file RootReaderD3PDBase.cxx.

109  {
110 
111  REPORT_MESSAGE_WITH_CONTEXT( MSG::ERROR, "RootReaderD3PDBase" )
112  << "addMetadata(...) not implemented";
113  return StatusCode::FAILURE;
114  }

◆ addSTLHeader()

void D3PD::RootReaderD3PDBase::addSTLHeader ( std::ostream &  out,
const char *  name 
) const
protectedinherited

Function adding STL include statements to the header when needed.

This function is used internally to decide if specific STL headers are needed for the generated code or not.

The code just checks if the header name appears in the variable types somewhere, and if it does, it adds the requested header.

Parameters
outOutput stream where the include statement has to be written
nameName of the STL header that the code should process

Definition at line 167 of file RootReaderD3PDBase.cxx.

167  {
168 
169  // Check if the STL name appears in the variable type names:
170  bool header_needed = false;
171  std::set< D3PD::ObjectMetadata::Variable >::const_iterator itr =
172  m_metadata.variables().begin();
173  std::set< D3PD::ObjectMetadata::Variable >::const_iterator end =
174  m_metadata.variables().end();
175  for( ; itr != end; ++itr ) {
176  if( itr->type().find( name ) != std::string::npos ) {
177  header_needed = true;
178  break;
179  }
180  }
181 
182  // If it does, let's include it:
183  if( header_needed ) {
184  out << "#include <" << name << ">" << std::endl;
185  }
186 
187  return;
188  }

◆ addVariable() [1/3]

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

Main function for adding a variable to the D3PD.

Implements D3PD::IAddVariable.

Definition at line 85 of file RootReaderD3PDBase.cxx.

89  {
90 
91  CHECK( m_metadata.addVariable( name, ti, ptr, docstring, defval ) );
92  return StatusCode::SUCCESS;
93  }

◆ 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 
)
inherited

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 = "" 
)
inherited

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.

◆ capture()

StatusCode D3PD::RootReaderD3PDBase::capture ( )
virtualinherited

Function capturing the current value of the D3PD variables. Not implemented here!

Implements D3PD::ID3PD.

Definition at line 116 of file RootReaderD3PDBase.cxx.

116  {
117 
118  REPORT_MESSAGE_WITH_CONTEXT( MSG::ERROR, "RootReaderD3PDBase" )
119  << "capture() not implemented";
120  return StatusCode::FAILURE;
121  }

◆ clear()

StatusCode D3PD::RootReaderD3PDBase::clear ( )
virtualinherited

Function clearing the D3PD variables. Not implemented here!

Implements D3PD::ID3PD.

Definition at line 123 of file RootReaderD3PDBase.cxx.

123  {
124 
125  REPORT_MESSAGE_WITH_CONTEXT( MSG::ERROR, "RootReaderD3PDBase" )
126  << "clear() not implemented";
127  return StatusCode::FAILURE;
128  }

◆ createReader()

StatusCode D3PD::RootReaderD3PD_v2::createReader ( const std::string &  classname,
const std::string &  dir = "./" 
) const
virtual

Function creating the D3PDReader C++ code.

Implements D3PD::IReaderD3PD.

Definition at line 20 of file RootReaderD3PD_v2.cxx.

21  {
22 
23  //
24  // Create the source files:
25  //
28  if( m_metadata.container() ) {
30  }
35  CHECK( Version2::writeHeader( classname, dir, m_metadata ) );
36  CHECK( Version2::writeSource( classname, dir, m_metadata ) );
37 
38  return StatusCode::SUCCESS;
39  }

◆ isContainer()

bool D3PD::RootReaderD3PDBase::isContainer ( ) const
virtualinherited

Get the "isCollection" parameter of the object.

Implements D3PD::IReaderD3PD.

Definition at line 143 of file RootReaderD3PDBase.cxx.

143  {
144 
145  return m_metadata.container();
146  }

◆ prefix()

const std::string & D3PD::RootReaderD3PDBase::prefix ( ) const
virtualinherited

Get the common prefix of the variables.

Implements D3PD::IReaderD3PD.

Definition at line 154 of file RootReaderD3PDBase.cxx.

154  {
155 
156  return m_metadata.prefix();
157  }

◆ redim()

StatusCode D3PD::RootReaderD3PDBase::redim ( const Dim_t ptr)
virtualinherited

Function currently not used by the D3PDMaker code.

Implements D3PD::ID3PD.

Definition at line 130 of file RootReaderD3PDBase.cxx.

130  {
131 
132  REPORT_MESSAGE_WITH_CONTEXT( MSG::ERROR, "RootReaderD3PDBase" )
133  << "redim(...) not implemented";
134  return StatusCode::FAILURE;
135  }

◆ setIsContainer()

void D3PD::RootReaderD3PDBase::setIsContainer ( bool  isContainer)
virtualinherited

Set the "isCollection" parameter of the object.

Implements D3PD::IReaderD3PD.

Definition at line 137 of file RootReaderD3PDBase.cxx.

137  {
138 
140  return;
141  }

◆ setPrefix()

void D3PD::RootReaderD3PDBase::setPrefix ( const std::string &  prefix)
virtualinherited

Set the common prefix of the variables.

Implements D3PD::IReaderD3PD.

Definition at line 148 of file RootReaderD3PDBase.cxx.

148  {
149 
151  return;
152  }

Member Data Documentation

◆ m_metadata

ObjectMetadata D3PD::RootReaderD3PDBase::m_metadata
protectedinherited

Object holding the information about the variables.

Definition at line 84 of file RootReaderD3PDBase.h.


The documentation for this class was generated from the following files:
D3PD::Version2::writeD3PDPerfStats
StatusCode writeD3PDPerfStats(const std::string &dir)
This function can be used to create the D3PDReader::D3PDPerfStats class's source files.
Definition: CodeGenerator_v2.cxx:528
D3PD::ObjectMetadata::variables
const std::set< Variable > & variables() const
Function for accessing all the variables of the D3PDObject.
Definition: ObjectMetadata.cxx:577
D3PD::Version2::writeUserD3PDObject
StatusCode writeUserD3PDObject(const std::string &dir)
This function can be used to create the D3PDReader::UserD3PDObject class's source files.
Definition: CodeGenerator_v2.cxx:411
D3PD::ObjectMetadata::addDimensionedVariable
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...
Definition: ObjectMetadata.cxx:157
D3PD::Version2::writeSource
StatusCode writeSource(const std::string &classname, const std::string &dir, const ObjectMetadata &metadata)
This function is used to generate the source file of a D3PDReader class.
Definition: CodeGenerator_v2.cxx:967
yodamerge_tmp.dim
dim
Definition: yodamerge_tmp.py:239
D3PD::Version2::writeD3PDObjectBase
StatusCode writeD3PDObjectBase(const std::string &dir)
This function can be used to create the D3PDReader::D3PDObjectBase class's source files.
Definition: CodeGenerator_v2.cxx:265
D3PD::RootReaderD3PDBase::m_metadata
ObjectMetadata m_metadata
Object holding the information about the variables.
Definition: RootReaderD3PDBase.h:84
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
D3PD::ObjectMetadata::setPrefix
void setPrefix(const std::string &prefix)
Set the prefix given to variables in this D3PDObject.
Definition: ObjectMetadata.cxx:224
D3PD::Version2::writeVarHandle
StatusCode writeVarHandle(const std::string &dir)
This function can be used to create the D3PDReader::VarHandle class's source files.
Definition: CodeGenerator_v2.cxx:298
dbg::ptr
void * ptr(T *p)
Definition: SGImplSvc.cxx:74
D3PD::ObjectMetadata::container
bool container() const
Get whether the D3PDObject describes a container or not.
Definition: ObjectMetadata.cxx:230
D3PD::Version2::writeUtils
StatusCode writeUtils(const std::string &dir)
This function can be used to create source files containing some utility functions.
Definition: CodeGenerator_v2.cxx:577
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
D3PD::RootReaderD3PDBase::isContainer
virtual bool isContainer() const
Get the "isCollection" parameter of the object.
Definition: RootReaderD3PDBase.cxx:143
beamspotman.dir
string dir
Definition: beamspotman.py:623
REPORT_MESSAGE_WITH_CONTEXT
#define REPORT_MESSAGE_WITH_CONTEXT(LVL, CONTEXT_NAME)
Report a message, with an explicitly specified context name.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:345
D3PD::ObjectMetadata::setContainer
void setContainer(bool container)
Set whether the D3PDObject describes a container or not.
Definition: ObjectMetadata.cxx:235
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
D3PD::Version2::writeD3PDReadStats
StatusCode writeD3PDReadStats(const std::string &dir)
This function can be used to create the D3PDReader::D3PDReadStats class's source files.
Definition: CodeGenerator_v2.cxx:478
D3PD::ObjectMetadata::addVariable
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.
Definition: ObjectMetadata.cxx:109
D3PD::ObjectMetadata::prefix
const std::string & prefix() const
Get the prefix given to variables in this D3PDObject.
Definition: ObjectMetadata.cxx:219
D3PD::RootReaderD3PDBase::prefix
virtual const std::string & prefix() const
Get the common prefix of the variables.
Definition: RootReaderD3PDBase.cxx:154
D3PD::Version2::writeHeader
StatusCode writeHeader(const std::string &classname, const std::string &dir, const ObjectMetadata &metadata)
This function is used to create the header of the class describing a set of D3PD variables.
Definition: CodeGenerator_v2.cxx:632
D3PD::Version2::writeVarProxy
StatusCode writeVarProxy(const std::string &dir)
This function can be used to create the D3PDReader::VarProxy class's source files.
Definition: CodeGenerator_v2.cxx:363