File indexing completed on 2025-08-05 08:16:19
0001
0002
0003 #include "PHNode.h"
0004
0005 #include "phool.h"
0006
0007 #include <TSystem.h>
0008
0009 #include <boost/stacktrace.hpp>
0010
0011 #include <iostream>
0012
0013 PHNode::PHNode(const std::string& n)
0014 : PHNode(n, "")
0015 {
0016 }
0017
0018 PHNode::PHNode(const std::string& n, const std::string& typ)
0019 : objecttype(typ)
0020 {
0021 int badnode = 0;
0022 if (n.find('.') != std::string::npos)
0023 {
0024 std::cout << PHWHERE << " No nodenames containing decimal point possible: "
0025 << n << std::endl;
0026 badnode = 1;
0027 }
0028 if (n.empty())
0029 {
0030 std::cout << PHWHERE << "Empty string as nodename given" << std::endl;
0031 badnode = 1;
0032 }
0033 if (n.find(' ') != std::string::npos)
0034 {
0035 badnode = 1;
0036 std::cout << PHWHERE << "No nodenames with spaces" << std::endl;
0037 }
0038 if (badnode)
0039 {
0040 std::cout << "Here is the stacktrace: " << std::endl;
0041 std::cout << boost::stacktrace::stacktrace();
0042 std::cout << "Check the stacktrace for the guilty party (typically #2)" << std::endl;
0043 gSystem->Exit(1);
0044 }
0045 name = n;
0046 return;
0047 }
0048
0049 PHNode::~PHNode()
0050 {
0051 if (parent)
0052 {
0053 parent->forgetMe(this);
0054 }
0055 }
0056
0057
0058 std::ostream&
0059 operator<<(std::ostream& stream, const PHNode& node)
0060 {
0061 stream << node.getType() << " : " << node.getName() << " class " << node.getClass();
0062
0063 return stream;
0064 }