ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHNode.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHNode.cc
1 // Author: Matthias Messer
2 
3 #include "PHNode.h"
4 
5 #include "phool.h"
6 
7 #include <TSystem.h>
8 
9 #include <boost/stacktrace.hpp>
10 
11 #include <iostream>
12 
13 using namespace std;
14 
15 PHNode::PHNode(const string& n)
16  : PHNode(n, "")
17 {
18 }
19 
20 PHNode::PHNode(const string& n, const string& typ)
21  : parent(nullptr)
22  , persistent(true)
23  , type("PHNode")
24  , objecttype(typ)
25  , reset_able(true)
26 {
27  int badnode = 0;
28  if (n.find(".") != string::npos)
29  {
30  cout << PHWHERE << " No nodenames containing decimal point possible: "
31  << n << endl;
32  badnode = 1;
33  }
34  if (n.empty())
35  {
36  cout << PHWHERE << "Empty string as nodename given" << endl;
37  badnode = 1;
38  }
39  if (n.find(" ") != string::npos)
40  {
41  badnode = 1;
42  cout << PHWHERE << "No nodenames with spaces" << endl;
43  }
44  if (badnode)
45  {
46  cout << "Here is the stacktrace: " << endl;
47  cout << boost::stacktrace::stacktrace();
48  cout << "Check the stacktrace for the guilty party (typically #2)" << endl;
49  gSystem->Exit(1);
50  }
51  name = n;
52  return;
53 }
54 
56 {
57  if (parent)
58  {
59  parent->forgetMe(this);
60  }
61 }
62 
63 // Implementation of external functions.
64 std::ostream&
65 operator<<(std::ostream& stream, const PHNode& node)
66 {
67  stream << node.getType() << " : " << node.getName() << " class " << node.getClass();
68 
69  return stream;
70 }