Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
Generator
src
Framework
Registry
RegistryItem.cxx
Go to the documentation of this file.
1
//____________________________________________________________________________
2
/*
3
Copyright (c) 2003-2020, The GENIE Collaboration
4
For the full text of the license visit http://copyright.genie-mc.org
5
6
Costas Andreopoulos <constantinos.andreopoulos \at cern.ch>
7
University of Liverpool & STFC Rutherford Appleton Laboratory
8
*/
9
//____________________________________________________________________________
10
11
#include <string>
12
#include <iostream>
13
14
#include "
Framework/Registry/RegistryItem.h
"
15
16
using
std::string
;
17
using
std::endl
;
18
19
namespace
genie
{
20
21
//____________________________________________________________________________
22
template
ostream &
operator
<<
23
(ostream &
stream
,
const
RegistryItem<RgBool> &
r
);
24
template
ostream &
operator
<<
25
(ostream &
stream
,
const
RegistryItem<RgInt> &
r
);
26
template
ostream &
operator
<<
27
(ostream &
stream
,
const
RegistryItem<RgDbl> &
r
);
28
template
ostream &
operator
<<
29
(ostream &
stream
,
const
RegistryItem<RgStr> &
r
);
30
template
ostream &
operator
<<
31
(ostream &
stream
,
const
RegistryItem<RgAlg> &
r
);
32
template
ostream &
operator
<<
33
(ostream &
stream
,
const
RegistryItem<RgH1F> &
r
);
34
template
ostream &
operator
<<
35
(ostream &
stream
,
const
RegistryItem<RgH2F> &
r
);
36
template
ostream &
operator
<<
37
(ostream &
stream
,
const
RegistryItem<RgTree> &
r
);
38
//____________________________________________________________________________
39
template
<
typename
T>
40
ostream & operator << (ostream & stream, const RegistryItem<T> &
rec
)
41
{
42
rec
.Print(stream);
43
return
stream
;
44
}
45
//____________________________________________________________________________
46
template
<
typename
T>
47
RegistryItem<T>::RegistryItem
(
T
item,
bool
locked,
bool
local)
48
{
49
fItem = item;
50
fIsLocked = locked;
51
fIsLocal = local;
52
}
53
//____________________________________________________________________________
54
template
<
typename
T>
RegistryItem<T>::RegistryItem
(
const
RegistryItem
* ri)
55
{
56
fItem = ri->
fItem
;
57
fIsLocked = ri->
fIsLocked
;
58
fIsLocal = ri->
fIsLocal
;
59
}
60
//____________________________________________________________________________
61
template
<
typename
T>
RegistryItem<T>::~RegistryItem
()
62
{
63
64
}
65
//____________________________________________________________________________
66
template
<>
RegistryItem<RgH1F>::~RegistryItem
()
67
{
68
if
(fItem)
delete
fItem;
69
}
70
//____________________________________________________________________________
71
template
<>
RegistryItem<RgH2F>::~RegistryItem
()
72
{
73
if
(fItem)
delete
fItem;
74
}
75
//____________________________________________________________________________
76
template
<>
RegistryItem<RgTree>::~RegistryItem
()
77
{
78
if
(fItem)
delete
fItem;
79
}
80
//____________________________________________________________________________
81
template
<
typename
T>
RegistryItemI
*
RegistryItem<T>::Clone
(
void
)
const
82
{
83
RegistryItemI
* item =
new
RegistryItem<T>
(fItem,fIsLocked);
84
return
item;
85
}
86
//____________________________________________________________________________
87
template
<>
RgType_t
RegistryItem<RgBool>::TypeInfo
(
void
)
const
88
{
89
return
kRgBool
;
90
}
91
//____________________________________________________________________________
92
template
<>
RgType_t
RegistryItem<RgInt>::TypeInfo
(
void
)
const
93
{
94
return
kRgInt
;
95
}
96
//____________________________________________________________________________
97
template
<>
RgType_t
RegistryItem<RgDbl>::TypeInfo
(
void
)
const
98
{
99
return
kRgDbl
;
100
}
101
//____________________________________________________________________________
102
template
<>
RgType_t
RegistryItem<RgStr>::TypeInfo
(
void
)
const
103
{
104
return
kRgStr
;
105
}
106
//____________________________________________________________________________
107
template
<>
RgType_t
RegistryItem<RgAlg>::TypeInfo
(
void
)
const
108
{
109
return
kRgAlg
;
110
}
111
//____________________________________________________________________________
112
template
<>
RgType_t
RegistryItem<RgH1F>::TypeInfo
(
void
)
const
113
{
114
return
kRgH1F
;
115
}
116
//____________________________________________________________________________
117
template
<>
RgType_t
RegistryItem<RgH2F>::TypeInfo
(
void
)
const
118
{
119
return
kRgH2F
;
120
}
121
//____________________________________________________________________________
122
template
<>
RgType_t
RegistryItem<RgTree>::TypeInfo
(
void
)
const
123
{
124
return
kRgTree
;
125
}
126
//____________________________________________________________________________
127
template
<
typename
T>
void
RegistryItem<T>::Print
(ostream & stream)
const
128
{
129
stream << ((fIsLocked) ?
"[ locked]"
:
"[unlocked]"
)
130
<<
" "
131
<< ((fIsLocal) ?
"[l]"
:
"[g]"
)
132
<<
" : "
133
<< (fItem);
134
}
135
//____________________________________________________________________________
136
template
<>
void
RegistryItem<RgAlg>::Print
(ostream & stream)
const
137
{
138
stream << ((fIsLocked) ?
"[ locked]"
:
"[unlocked]"
)
139
<<
" "
140
<< ((fIsLocal) ?
"[l]"
:
"[g]"
)
141
<<
" : "
142
<< (fItem);
143
}
144
//____________________________________________________________________________
145
template
<>
void
RegistryItem<RgH1F>::Print
(ostream & stream)
const
146
{
147
TH1F * histo =
dynamic_cast<
TH1F *
>
(fItem);
148
if
(!histo) stream <<
"*** NULL RgH1F ***"
;
149
150
stream << ((fIsLocked) ?
"[ locked]"
:
"[unlocked]"
)
151
<<
" "
152
<< ((fIsLocal) ?
"[l]"
:
"[g]"
)
153
<<
" : "
154
<< (histo ? histo->GetName() :
"NULL"
);
155
}
156
//____________________________________________________________________________
157
template
<>
void
RegistryItem<RgH2F>::Print
(ostream & stream)
const
158
{
159
TH2F * histo =
dynamic_cast<
TH2F *
>
(fItem);
160
if
(!histo) stream <<
"*** NULL RgH2F ***"
;
161
162
stream << ((fIsLocked) ?
"[ locked]"
:
"[unlocked]"
)
163
<<
" "
164
<< ((fIsLocal) ?
"[l]"
:
"[g]"
)
165
<<
" : "
166
<< (histo ? histo->GetName() :
"NULL"
);
167
}
168
//____________________________________________________________________________
169
template
<>
void
RegistryItem<RgTree>::Print
(ostream & stream)
const
170
{
171
TTree *
tree
=
dynamic_cast<
TTree *
>
(fItem);
172
if
(!tree) stream <<
"*** NULL RgTree ***"
;
173
174
stream << ((fIsLocked) ?
"[ locked]"
:
"[unlocked]"
)
175
<<
" "
176
<< ((fIsLocal) ?
"[l]"
:
"[g]"
)
177
<<
" : "
178
<< (tree ? tree->GetName() :
"NULL"
);
179
}
180
//____________________________________________________________________________
181
182
// Declare all template specializations.
183
// They need to be added at the end of the implementation file as described at
184
// http://www.comeaucomputing.com/techtalk/templates/#whylinkerror
185
// The need for them arises from the export C++ keyword not being properly
186
// implemented at most C++ compilers. See http://gcc.gnu.org/bugs.html#known
187
//
188
template
class
RegistryItem<RgBool>
;
189
template
class
RegistryItem<RgInt>
;
190
template
class
RegistryItem<RgDbl>
;
191
template
class
RegistryItem<RgStr>
;
192
template
class
RegistryItem<RgAlg>
;
193
template
class
RegistryItem<RgH1F>
;
194
template
class
RegistryItem<RgH2F>
;
195
template
class
RegistryItem<RgTree>
;
196
197
//____________________________________________________________________________
198
199
}
// genie namespace
tracks.rec
rec
Definition:
tracks.py:88
genie::kRgStr
Definition:
RegistryItemTypeId.h:33
genie::kRgH2F
Definition:
RegistryItemTypeId.h:36
genie
THE MAIN GENIE PROJECT NAMESPACE
Definition:
AlgCmp.h:25
genie::kRgBool
Definition:
RegistryItemTypeId.h:30
string
std::string string
Definition:
nybbler.cc:12
genie::kRgAlg
Definition:
RegistryItemTypeId.h:34
genie::RegistryItem::~RegistryItem
~RegistryItem()
Definition:
RegistryItem.cxx:61
genie::kRgTree
Definition:
RegistryItemTypeId.h:37
genie::RegistryItem::fIsLocal
bool fIsLocal
Definition:
RegistryItem.h:62
ValidateOpDetSimulation.T
T
Definition:
ValidateOpDetSimulation.py:52
genie::RegistryItemI
Registry item pABC.
Definition:
RegistryItemI.h:29
genie::kRgDbl
Definition:
RegistryItemTypeId.h:32
genie::RegistryItem::fIsLocked
bool fIsLocked
Definition:
RegistryItem.h:61
genie::RgType_t
enum genie::ERgType RgType_t
generate_datataset.stream
stream
Definition:
generate_datataset.py:30
genie::RegistryItem::Print
void Print(ostream &stream) const
Definition:
RegistryItem.cxx:127
genie::RegistryItem::TypeInfo
RgType_t TypeInfo(void) const
genie::kRgH1F
Definition:
RegistryItemTypeId.h:35
genie::kRgInt
Definition:
RegistryItemTypeId.h:31
genie::RegistryItem::Clone
RegistryItemI * Clone(void) const
Definition:
RegistryItem.cxx:81
genie::RegistryItem::RegistryItem
RegistryItem()
Definition:
RegistryItem.h:39
genie::RegistryItem
A templated concrete implementation of the RegistryItemI interface. Provides an arbitrary basic type ...
Definition:
RegistryItem.h:32
RegistryItem.h
genie::RegistryItem::fItem
T fItem
Definition:
RegistryItem.h:60
make_resolution.tree
tree
Definition:
make_resolution.py:22
plot_model.r
r
Definition:
plot_model.py:57
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
Generated by
1.8.11