49 Int_t TMVA::Node::fgCount = 0;
66 TMVA::Node::Node( Node* p,
char pos )
71 fDepth( p->GetDepth() + 1),
72 fParentTree(p->GetParentTree())
75 if (fPos ==
'l' ) p->SetLeft(
this);
76 else if (fPos ==
'r' ) p->SetRight(
this);
84 TMVA::Node::Node (
const Node &n )
106 int TMVA::Node::GetCount()
114 Int_t TMVA::Node::CountMeAndAllDaughters()
const
117 if (this->GetLeft() != NULL)
118 n+= this->GetLeft()->CountMeAndAllDaughters();
119 if (this->GetRight() != NULL)
120 n+= this->GetRight()->CountMeAndAllDaughters();
129 std::ostream& TMVA::operator<<( std::ostream& os,
const TMVA::Node& node )
138 std::ostream& TMVA::operator<<( std::ostream& os,
const TMVA::Node* node )
140 if (node!=NULL) node->Print(os);
147 void* TMVA::Node::AddXMLTo(
void* parent )
const
149 std::stringstream s(
"");
151 void* node = gTools().AddChild(parent,
"Node", s.str().c_str());
152 gTools().AddAttr( node,
"pos", fPos );
153 gTools().AddAttr( node,
"depth", fDepth );
154 this->AddAttributesToNode(node);
155 if (this->GetLeft()) this->GetLeft()->AddXMLTo(node);
156 if (this->GetRight()) this->GetRight()->AddXMLTo(node);
163 void TMVA::Node::ReadXML(
void* node, UInt_t tmva_Version_Code )
165 ReadAttributes(node, tmva_Version_Code);
166 const char* content = gTools().GetContent(node);
168 std::stringstream s(content);
171 gTools().ReadAttr( node,
"pos", fPos );
172 gTools().ReadAttr( node,
"depth", fDepth );
174 void* ch = gTools().GetChild(node);
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;
183 ch = gTools().GetNextChild(ch);