71 fDepth( p->GetDepth() + 1),
72 fParentTree(p->GetParentTree())
117 if (this->GetLeft() != NULL)
118 n+= this->GetLeft()->CountMeAndAllDaughters();
119 if (this->GetRight() != NULL)
120 n+= this->GetRight()->CountMeAndAllDaughters();
140 if (node!=NULL) node->
Print(os);
149 std::stringstream
s(
"");
154 this->AddAttributesToNode(node);
155 if (this->GetLeft()) this->GetLeft()->AddXMLTo(node);
156 if (this->GetRight()) this->GetRight()->AddXMLTo(node);
165 ReadAttributes(node, tmva_Version_Code);
168 std::stringstream
s(content);
176 Node*
n = CreateNode();
177 n->ReadXML(ch, tmva_Version_Code);
178 if (
n->GetPos()==
'l') { this->SetLeft(
n); }
179 else if(
n->GetPos()==
'r') { this->SetRight(
n); }
181 std::cout <<
"neither left nor right" << std::endl;
Node for the BinarySearch or Decision Trees.
virtual void Print(std::ostream &os) const =0
virtual void SetRight(Node *r)
virtual void SetLeft(Node *l)
void * AddXMLTo(void *parent) const
add attributes to XML
int GetCount()
returns the global number of instantiated nodes
Int_t CountMeAndAllDaughters() const
recursively go through the part of the tree below this node and count all daughters
virtual ~Node()
node destructor
void ReadXML(void *node, UInt_t tmva_Version_Code=TMVA_VERSION_CODE)
read attributes from XML
static constexpr double s
std::ostream & operator<<(std::ostream &os, const BinaryTree &tree)