ATLAS Offline Software
Loading...
Searching...
No Matches
RootReaderD3PDBase.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
5// $Id: RootReaderD3PDBase.cxx 595600 2014-05-06 12:18:26Z ssnyder $
6
7// ROOT include(s):
8#include <Rtypes.h>
9
10// Gaudi/Athena include(s):
11#include "GaudiKernel/System.h"
13
14// Local include(s):
15#include "RootReaderD3PDBase.h"
16
18#if 0
19namespace {
20
22 bool isPrimitive( const std::type_info& ti ) {
23
24 if( ( ti == typeid( char* ) ) ||
25 ( ti == typeid( Char_t ) ) ||
26 ( ti == typeid( UChar_t ) ) ||
27 ( ti == typeid( Short_t ) ) ||
28 ( ti == typeid( UShort_t ) ) ||
29 ( ti == typeid( Int_t ) ) ||
30 ( ti == typeid( UInt_t ) ) ||
31 ( ti == typeid( Float_t ) ) ||
32 ( ti == typeid( Double_t ) ) ||
33 ( ti == typeid( Long64_t ) ) ||
34 ( ti == typeid( ULong64_t ) ) ||
35 ( ti == typeid( Bool_t ) ) ) {
36
37 return true;
38 }
39
40 return false;
41 }
42
44 const char* rootPrimitiveType( const std::type_info& ti ) {
45
46 if( ti == typeid( char* ) ) {
47 return "char*";
48 } else if( ti == typeid( Char_t ) ) {
49 return "Char_t";
50 } else if( ti == typeid( UChar_t ) ) {
51 return "UChar_t";
52 } else if( ti == typeid( Short_t ) ) {
53 return "Short_t";
54 } else if( ti == typeid( UShort_t ) ) {
55 return "UShort_t";
56 } else if( ti == typeid( Int_t ) ) {
57 return "Int_t";
58 } else if( ti == typeid( UInt_t ) ) {
59 return "UInt_t";
60 } else if( ti == typeid( Float_t ) ) {
61 return "Float_t";
62 } else if( ti == typeid( Double_t ) ) {
63 return "Double_t";
64 } else if( ti == typeid( Long64_t ) ) {
65 return "Long64_t";
66 } else if( ti == typeid( ULong64_t ) ) {
67 return "ULong64_t";
68 } else if( ti == typeid( Bool_t ) ) {
69 return "Bool_t";
70 }
71
72 return "\0";
73 }
74
75} // namespace
76#endif
77
78namespace D3PD {
79
84
85 StatusCode RootReaderD3PDBase::addVariable( const std::string& name,
86 const std::type_info& ti,
87 void*& ptr,
88 const std::string& docstring,
89 const void* defval ) {
90
91 CHECK( m_metadata.addVariable( name, ti, ptr, docstring, defval ) );
92 return StatusCode::SUCCESS;
93 }
94
95 StatusCode RootReaderD3PDBase::addDimensionedVariable( const std::string& name,
96 const std::type_info& ti,
97 void*& ptr,
98 const std::string& dim,
99 const std::string& docstring,
100 const void* defval ) {
101
102 CHECK( m_metadata.addDimensionedVariable( name, ti, ptr, dim, docstring,
103 defval ) );
104 return StatusCode::SUCCESS;
105 }
106
107 StatusCode RootReaderD3PDBase::addMetadata( const std::string&,
108 const void*,
109 const std::type_info& ) {
110
111 REPORT_MESSAGE_WITH_CONTEXT( MSG::ERROR, "RootReaderD3PDBase" )
112 << "addMetadata(...) not implemented";
113 return StatusCode::FAILURE;
114 }
115
117
118 REPORT_MESSAGE_WITH_CONTEXT( MSG::ERROR, "RootReaderD3PDBase" )
119 << "capture() not implemented";
120 return StatusCode::FAILURE;
121 }
122
124
125 REPORT_MESSAGE_WITH_CONTEXT( MSG::ERROR, "RootReaderD3PDBase" )
126 << "clear() not implemented";
127 return StatusCode::FAILURE;
128 }
129
130 StatusCode RootReaderD3PDBase::redim( const Dim_t* ) {
131
132 REPORT_MESSAGE_WITH_CONTEXT( MSG::ERROR, "RootReaderD3PDBase" )
133 << "redim(...) not implemented";
134 return StatusCode::FAILURE;
135 }
136
138
139 m_metadata.setContainer( isContainer );
140 return;
141 }
142
144
145 return m_metadata.container();
146 }
147
148 void RootReaderD3PDBase::setPrefix( const std::string& prefix ) {
149
150 m_metadata.setPrefix( prefix );
151 return;
152 }
153
154 const std::string& RootReaderD3PDBase::prefix() const {
155
156 return m_metadata.prefix();
157 }
158
167 void RootReaderD3PDBase::addSTLHeader( std::ostream& out, const char* name ) const {
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 }
189
190} // namespace D3PD
Helpers for checking error return status codes and reporting errors.
#define REPORT_MESSAGE_WITH_CONTEXT(LVL, CONTEXT_NAME)
Report a message, with an explicitly specified context name.
#define CHECK(...)
Evaluate an expression and check for errors.
unsigned int Dim_t
Currently unimplemented — see design note.
Definition ID3PD.h:52
virtual StatusCode redim(const Dim_t *ptr)
Function currently not used by the D3PDMaker code.
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.
virtual bool isContainer() const
Get the "isCollection" parameter of the object.
virtual StatusCode addMetadata(const std::string &key, const void *obj, const std::type_info &ti)
Function adding metadata to the D3PD. Not implemented here!
void addSTLHeader(std::ostream &out, const char *name) const
Function adding STL include statements to the header when needed.
virtual void setPrefix(const std::string &prefix)
Set the common prefix of the variables.
virtual const std::string & prefix() const
Get the common prefix of the variables.
virtual StatusCode clear()
Function clearing the D3PD variables. Not implemented here!
RootReaderD3PDBase()
Quite empty constructor.
virtual void setIsContainer(bool isContainer)
Set the "isCollection" parameter of the object.
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.
virtual StatusCode capture()
Function capturing the current value of the D3PD variables. Not implemented here!
ObjectMetadata m_metadata
Object holding the information about the variables.
Block filler tool for noisy FEB information.
bool isPrimitive(const std::string &type)
This function is used in the code generator to determine from a type name if it's a primitive type or...