ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
PHDataNodeIterator.h
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file PHDataNodeIterator.h
1
#ifndef PHOOL_PHDATANODEITERATOR_H
2
#define PHOOL_PHDATANODEITERATOR_H
3
4
#include "
PHIODataNode.h
"
5
#include "
PHNodeIterator.h
"
6
7
#include <cstddef>
8
19
class
PHDataNodeIterator
:
public
PHNodeIterator
20
{
21
public
:
23
PHDataNodeIterator
(
PHCompositeNode
* node);
24
26
~PHDataNodeIterator
()
override
{}
34
template
<
class
T>
35
PHIODataNode<T>
*
FindIODataNode
(
PHIODataNode<T>
* node,
36
const
char
*
name
);
37
44
template
<
class
T>
45
PHBoolean
AddIODataNode
(
T
*
data
,
const
char
*
name
);
46
};
47
48
inline
PHDataNodeIterator::PHDataNodeIterator
(
PHCompositeNode
* node)
49
:
PHNodeIterator
(node)
50
{
51
}
52
53
template
<
class
T>
54
PHIODataNode<T>
*
55
PHDataNodeIterator::FindIODataNode
(
PHIODataNode<T>
* node,
56
const
char
*
name
)
57
{
58
// TODO: also check that "name" is not a null string!
59
if
(!name)
60
{
61
return
0;
62
}
63
// Can't do dynamic_cast here; it fails if node was created as
64
// PHIODataNode<X> instead of PHIODataNode<T>, even if T is a
65
// derived class of X!
66
// In general, T -> X does not imply A<T> -> A<X>.
67
// ("->" denotes "derives from", and "A" is any template class)
68
node =
static_cast<
PHIODataNode<T>
*
>
(
findFirst
(
"PHIODataNode"
,
69
name));
70
return
node;
71
}
72
73
template
<
class
T>
74
PHBoolean
75
PHDataNodeIterator::AddIODataNode
(
T
*
data
,
const
char
*
name
)
76
{
77
// TODO: also check that "name" is not a null string!
78
if
(!name)
79
{
80
return
false
;
81
}
82
// For IODataNode, ought to check (if possible) that T derives
83
// from TObject. Will typeid() give us this info?
84
85
PHIODataNode<T>
*
n
=
new
PHIODataNode<T>
(
data
,
name
);
86
if
(!n)
87
{
88
return
false
;
// problem creating node?
89
}
90
return
addNode
(n);
91
}
92
93
#endif
coresoftware
blob
master
offline
framework
phool
PHDataNodeIterator.h
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:33
using
1.8.2 with
ECCE GitHub integration