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
PHDataNode.h
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file PHDataNode.h
1
#ifndef PHOOL_PHDATANODE_H
2
#define PHOOL_PHDATANODE_H
3
4
// Declaration of class PHDataNode
5
// Purpose: a node which can hold a data object (template)
6
7
#include "
PHNode.h
"
8
9
#include <iostream>
10
class
TObject
;
11
12
template
<
class
T>
13
class
PHDataNode
:
public
PHNode
14
{
15
public
:
16
PHDataNode
(
T
*,
const
std::string&);
17
PHDataNode
(
T
*,
const
std::string&,
const
std::string&);
18
~PHDataNode
()
override
;
19
20
public
:
21
T
*
getData
() {
return
data
.data; }
22
void
setData
(
T
*
d
) {
data
.data =
d
; }
23
void
prune
()
override
{}
24
void
forgetMe
(
PHNode
*)
override
{}
25
void
print
(
const
std::string&)
override
;
26
bool
write
(
PHIOManager
*,
const
std::string& =
""
)
override
27
{
28
return
true
;
29
}
30
31
protected
:
32
union
tobjcast
{
33
T
*
data
;
34
TObject
*
tobj
;
35
};
36
tobjcast
data
;
37
PHDataNode
() =
delete
;
38
};
39
40
template
<
class
T>
41
PHDataNode<T>::PHDataNode
(
T
*
d
,
42
const
std::string&
name
)
43
:
PHNode
(name)
44
{
45
type
=
"PHDataNode"
;
46
setData
(d);
47
}
48
49
template
<
class
T>
50
PHDataNode<T>::PHDataNode
(
T
*
d
,
51
const
std::string&
name
,
52
const
std::string& objtype)
53
:
PHNode
(name, objtype)
54
{
55
type
=
"PHDataNode"
;
56
setData
(d);
57
}
58
59
template
<
class
T>
60
PHDataNode<T>::~PHDataNode
()
61
{
62
// This means that the node has complete responsibility for the
63
// data it contains. Check for null pointer just in case some
64
// joker adds a node with a null pointer
65
if
(
data
.data)
66
{
67
delete
data
.data;
68
data
.data = 0;
69
}
70
}
71
72
template
<
class
T>
73
void
PHDataNode<T>::print
(
const
std::string& path)
74
{
75
std::cout << path <<
name
<<
" ("
;
76
if
(!this->objectclass.empty())
77
{
78
if
(type.find(
"IO"
) != std::string::npos)
79
{
80
std::cout <<
"IO"
;
81
}
82
else
83
{
84
std::cout <<
"Data"
;
85
}
86
std::cout <<
","
<< this->objectclass;
87
}
88
else
89
{
90
std::cout << type;
91
}
92
std::cout <<
")"
<< std::endl;
93
}
94
95
#endif
coresoftware
blob
master
offline
framework
phool
PHDataNode.h
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:33
using
1.8.2 with
ECCE GitHub integration