ATLAS Offline Software
Loading...
Searching...
No Matches
IAddVariable.icc
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$
6/**
7 * @file D3PDMakerInterfaces/IAddVariable.icc
8 * @author scott snyder <snyder@bnl.gov>
9 * @date Jul, 2009
10 * @brief Template implementations for IAddVariable.
11 */
12
13
14namespace D3PD {
15
16
17/**
18 * @brief Add a variable to the tuple.
19 * @param name The name of the variable.
20 * @param ptr Pointer to the type of the variable.
21 * The pointer need not be initialized;
22 * the D3PD software will set the pointer
23 * prior to calling @c fill().
24 * @param docstring Documentation string for this variable.
25 * (Presently unimplemented!)
26 *
27 * If called from the constructor, the only effect is to clear @c ptr.
28 */
29template <class T>
30StatusCode IAddVariable::addVariable (const std::string& name,
31 T* & ptr,
32 const std::string& docstring /*= ""*/)
33{
34 return addVariable (name,
35 typeid (T),
36 reinterpret_cast<void*&>(ptr),
37 docstring);
38}
39
40
41/**
42 * @brief Add a variable to the tuple.
43 * @param name The name of the variable.
44 * @param ptr Pointer to the type of the variable.
45 * The pointer need not be initialized;
46 * the D3PD software will set the pointer
47 * prior to calling @c fill().
48 * @param docstring Documentation string for this variable.
49 * (Presently unimplemented!)
50 * @param defval Pointer to the default value to use for this variable.
51 * Only works for basic types.
52 *
53 * If called from the constructor, the only effect is to clear @c ptr.
54 */
55template <class T, class U>
56StatusCode IAddVariable::addVariable (const std::string& name,
57 T* & ptr,
58 const std::string& docstring,
59 const U& defval)
60{
61 T d = defval;
62 return addVariable (name,
63 typeid (T),
64 reinterpret_cast<void*&>(ptr),
65 docstring,
66 &d);
67}
68
69
70/**
71 * @brief Add a variable to the tuple.
72 * @param name The name of the variable.
73 * @param ptr Pointer to the type of the variable.
74 * The pointer need not be initialized;
75 * the D3PD software will set the pointer
76 * prior to calling @c fill().
77 * @param dim Dimension for the variable.
78 * (Presently unimplemented!)
79 * @param docstring Documentation string for this variable.
80 * (Presently unimplemented!)
81 *
82 * If called from the constructor, the only effect is to clear @c ptr.
83 */
84template <class T>
85StatusCode
86IAddVariable::addDimensionedVariable (const std::string& name,
87 T* & ptr,
88 const std::string& dim,
89 const std::string& docstring /*= ""*/)
90{
91 return addDimensionedVariable (name,
92 typeid (T),
93 reinterpret_cast<void*&>(ptr),
94 dim,
95 docstring);
96}
97
98
99/**
100 * @brief Add a variable to the tuple.
101 * @param name The name of the variable.
102 * @param ptr Pointer to the type of the variable.
103 * The pointer need not be initialized;
104 * the D3PD software will set the pointer
105 * prior to calling @c fill().
106 * @param dim Dimension for the variable.
107 * (Presently unimplemented!)
108 * @param docstring Documentation string for this variable.
109 * (Presently unimplemented!)
110 * @param defval Pointer to the default value to use for this variable.
111 * Only works for basic types.
112 *
113 * If called from the constructor, the only effect is to clear @c ptr.
114 */
115template <class T, class U>
116StatusCode
117IAddVariable::addDimensionedVariable (const std::string& name,
118 T* & ptr,
119 const std::string& dim,
120 const std::string& docstring,
121 const U& defval)
122{
123 T d = defval;
124 return addDimensionedVariable (name,
125 typeid (T),
126 reinterpret_cast<void*&>(ptr),
127 dim,
128 docstring,
129 &d);
130}
131
132
133} // namespace D3PD