ATLAS Offline Software
Loading...
Searching...
No Matches
addnode.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4//
5// @file addnode.cxx
6//
7//
8// @author M.Sutton
9//
10//
11//
12// $Id: addnode.cxx, v0.0 Thu 21 Apr 2016 20:31:53 CEST sutt $
13
14
15#include "addnode.h"
16#include "spacer.h"
17
20node* subnode( node* np, const std::string& name ) {
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}
25
28node* addnode( node* np, const std::string& name, TObject* td, node::TYPE t ) {
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 * addnode(node *np, const std::string &name, TObject *td, node::TYPE t)
add a submode with a specific name, or return the existing node if one already exists
Definition addnode.cxx:28
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
TYPE
Definition node.h:28
void name(const std::string &n)
Definition node.h:40
const std::string spacer
Definition spacer.h:27