Analysis Software
Documentation for sPHENIX simulation 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 // boost stacktrace header causes a shadow warning
10 #pragma GCC diagnostic push
11 #pragma GCC diagnostic ignored "-Wshadow"
12 #include <boost/stacktrace.hpp>
13 #pragma GCC diagnostic pop
14 
15 #include <iostream>
16 
18  : PHNode(n, "")
19 {
20 }
21 
23  : objecttype(typ)
24 {
25  int badnode = 0;
26  if (n.find('.') != std::string::npos)
27  {
28  std::cout << PHWHERE << " No nodenames containing decimal point possible: "
29  << n << std::endl;
30  badnode = 1;
31  }
32  if (n.empty())
33  {
34  std::cout << PHWHERE << "Empty string as nodename given" << std::endl;
35  badnode = 1;
36  }
37  if (n.find(' ') != std::string::npos)
38  {
39  badnode = 1;
40  std::cout << PHWHERE << "No nodenames with spaces" << std::endl;
41  }
42  if (badnode)
43  {
44  std::cout << "Here is the stacktrace: " << std::endl;
45  std::cout << boost::stacktrace::stacktrace();
46  std::cout << "Check the stacktrace for the guilty party (typically #2)" << std::endl;
47  gSystem->Exit(1);
48  }
49  name = n;
50  return;
51 }
52 
54 {
55  if (parent)
56  {
57  parent->forgetMe(this);
58  }
59 }
60 
61 // Implementation of external functions.
62 std::ostream&
63 operator<<(std::ostream& stream, const PHNode& node)
64 {
65  stream << node.getType() << " : " << node.getName() << " class " << node.getClass();
66 
67  return stream;
68 }