ATLAS Offline Software
Loading...
Searching...
No Matches
addnode.h File Reference
#include "node.h"
#include "TDirectory.h"
Include dependency graph for addnode.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

nodesubnode (node *np, const std::string &name)
 check if a subnode already exists
nodeaddnode (node *np, const std::string &name, TObject *td=0, node::TYPE t=node::DIRECTORY)
 add a new node (or return the already existing node with this name)

Function Documentation

◆ addnode()

node * addnode ( node * np,
const std::string & name,
TObject * td,
node::TYPE t )

add a new node (or return the already existing node with this name)

add a new node (or return the already existing node with this name)

Definition at line 28 of file addnode.cxx.

28 {
29
30 node* np_ = subnode( np, name );
31
32 if ( np_ ) return np_;
33
34 np_ = new node( np, np->depth()+spacer, td );
35 np_->name( name );
36 np_->type( t );
37
38 np->push_back( np_ );
39
40 return np_;
41}
node * subnode(node *np, const std::string &name)
check whether a subnode with this name already exists
Definition addnode.cxx:20
Definition node.h:24
void type(TYPE t)
Definition node.h:51
void name(const std::string &n)
Definition node.h:40
const std::string spacer
Definition spacer.h:27

◆ subnode()

node * subnode ( node * np,
const std::string & name )

check if a subnode already exists

check if a subnode already exists

Definition at line 20 of file addnode.cxx.

20 {
21 if ( np==0 ) return 0;
22 for ( unsigned i=np->size() ; i-- ; ) if ( np->at(i)->name()==name ) return np->at(i);
23 return 0;
24}