59 #ifndef StiCompositeTreeNode_H
60 #define StiCompositeTreeNode_H
85 : key(0.), index(0) {};
87 : key(k), index(i) {};
109 void setName(
const string&);
120 const string& getName()
const;
123 unsigned int getChildCount()
const;
150 return (mparent) ? (mparent->begin()+mkey.index) : mVec.end();
154 typename vec_type::iterator
begin() {
return mVec.begin();}
157 typename vec_type::iterator
end() {
return mVec.end();}
160 typename vec_type::const_iterator
begin()
const {
return mVec.begin();}
163 typename vec_type::const_iterator
end()
const {
return mVec.end();}
166 typename vec_type::reverse_iterator
rbegin() {
return mVec.rbegin();}
169 typename vec_type::reverse_iterator
rend() {
return mVec.rend();}
172 typename vec_type::const_reverse_iterator
rbegin()
const {
return mVec.rbegin();}
175 typename vec_type::const_reverse_iterator
rend()
const {
return mVec.rend();}
206 : mparent(0), mdata(0)
283 if (!newChild)
return;
284 typename StiCompositeTreeNodeVector::iterator where = find(mVec.begin(), mVec.end(),
288 cout <<
"StiCompositeTreeNode::add(). ERROR:\t";
289 cout <<
"Child Already exists. Abort"<<endl;
293 newChild->setParent(
this);
294 mVec.push_back(newChild);
304 cout <<
"StiCompositeTreeNode::setParent()\tError:\t";
305 cout <<
"parent already exists"<<endl;
387 #include "StiDetector.h"
395 typedef vector<StiDetectorNode*> StiDetectorNodeVector;
398 inline ostream& operator<<(ostream& os,
const StiOrderKey& theKey)
400 return os<<
"key: "<<theKey.key<<
" index: "<<theKey.index;
const string & getName() const
Return the name of the node.
virtual ~StiCompositeTreeNode()
Default Destructor.
vec_type::reverse_iterator rbegin()
Provide reverse iterator to the beginning of the vector of children.
T * getData() const
Return a (non-const!) pointer to the data hung on this node.
vector< StiCompositeTreeNode * > vec_type
For internal convenience.
vec_type::reverse_iterator rend()
Provide reverse iterator to the end of the vector of children.
vec_type::iterator whereInParent()
Provide the iterator into the parent that can be dereferenced to get this node.
unsigned int getChildCount() const
Return the number of children that belong to this node.
vec_type::const_reverse_iterator rbegin() const
Provide const_reverse_iterator tot he beginning of the vector of children.
vec_type::const_iterator end() const
Provied const_iterator to the end of the vector of children.
const StiOrderKey & getOrderKey() const
Return a reference to the the orderkey of this node.
vec_type::const_reverse_iterator rend() const
Provide const_reverse_iterator to the end of the vector of children.
vector< StiCompositeTreeNode * > StiCompositeTreeNodeVector
For internal convenience.
StiCompositeTreeNode()
We provide only a default constructor.
virtual void add(StiCompositeTreeNode *)
Add a child to this node.
vec_type::const_iterator begin() const
Provide const_iterator to the beginning of the vector of children.
void setName(const string &)
Set the name of the node.
vec_type::iterator begin()
Provide random access iterator to the beginning of the vector of children.
vec_type::iterator end()
Provide random access iterator to the end of the vector of children.
StiCompositeTreeNode * getParent() const
Return a (non-const!) pointer to the parent of this node.
void setData(T *)
Set the data to be hung on the node.
void setOrderKey(const StiOrderKey &)
Set the order-key for the node.