Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHNode.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHNode.h
1 #ifndef PHOOL_PHNODE_H
2 #define PHOOL_PHNODE_H
3 
4 // Declaration of class PHNode
5 // Purpose: abstract base class for all node classes
6 
7 #include <iosfwd>
8 #include <string>
9 
10 class PHIOManager;
11 
12 class PHNode
13 {
14  public:
15  // Note that the constructor makes a node transient by default.
16  PHNode(const std::string &);
17  PHNode(const std::string &, const std::string &);
18  virtual ~PHNode();
19 
20  public:
21  PHNode *getParent() const { return parent; }
22  bool isPersistent() const { return persistent; }
23  void makePersistent() { persistent = true; }
24  const std::string getObjectType() const { return objecttype; }
25  const std::string getType() const { return type; }
26  const std::string getName() const { return name; }
27  const std::string getClass() const { return objectclass; }
28  void setParent(PHNode *p) { parent = p; }
29  void setName(const std::string &n) { name = n; }
30  void setObjectType(const std::string &n) { objecttype = n; }
31  virtual void prune() = 0;
32  virtual void print(const std::string &) = 0;
33  virtual void forgetMe(PHNode *) = 0;
34  virtual bool write(PHIOManager *, const std::string & = "") = 0;
35 
36  virtual void setResetFlag(const bool b) { reset_able = b; }
37  virtual bool getResetFlag() const { return reset_able; }
38  void makeTransient() { persistent = false; }
39 
40  protected:
41  PHNode *parent = nullptr;
42  bool persistent = true;
43  std::string type = "PHNode";
46  bool reset_able = true;
48 
49  private:
50  PHNode() = delete;
51  PHNode(const PHNode &) = delete;
52  PHNode &operator=(const PHNode &) = delete;
53 };
54 
55 std::ostream &operator<<(std::ostream &, const PHNode &);
56 
57 #endif