Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

StDbConfigNode Class Reference

#include <StDbConfigNode.hh>

Inheritance diagram for StDbConfigNode:

StDbNode StDbConfigNodeImpl List of all members.

Public Member Functions

 StDbConfigNode (StDbConfigNode *parent, const char *nodeName, const char *configName)
 StDbConfigNode (StDbConfigNode *parent, StDbNode &node)
 StDbConfigNode (StDbType type, StDbDomain domain, const char *nodeName, const char *configName="none")
virtual ~StDbConfigNode ()
void setNextNode (StDbConfigNode *node)
void setParentNode (StDbConfigNode *node)
void setFirstChildNode (StDbConfigNode *node)
virtual void setChildNode (StDbConfigNode *node)
void appendNode (StDbConfigNode *node)
StDbConfigNodegetNextNode ()
StDbConfigNodegetParentNode ()
StDbConfigNodegetFirstChildNode ()
void deleteTree ()
virtual void addChildren (dbEnvList *elist)=0
void deleteChildren ()
bool hasChildren ()
bool hasData ()
int getBranchID ()
void setBranchID (int branchID)
void setIsDbNode (bool isDbNode)
bool isDbNode ()
void printTree (int depth)
virtual void resetConfig (const char *config, int opt=0)=0
virtual int buildTree (int opt=0)=0
virtual StDbElementIndexgetElementIndex ()=0
virtual void setElementIndexInfo (const char *indexName, int indexID)=0
virtual void getElementIndexInfo (char *&indexname, int &indexID)=0
virtual int getNumIndeces () const =0
virtual StDbTableaddDbTable (const char *tableName, const char *version="default")=0
virtual StDbTableaddTable (const char *tableName, const char *version="default")=0
virtual StDbTableaddTable (StDbNode *node)=0
virtual StDbTablefindTable (const char *name, const char *sPath="/")=0
virtual StDbTablefindLocalTable (const char *name)=0
virtual void removeTable (StDbTable *table)=0
virtual StDbTableItergetStDbTableIter ()=0
virtual bool compareTables (StDbTable *tab1, StDbTable *tab2)=0
virtual void printTables (int depth)=0
virtual void printNumberStats ()=0
virtual void getNumberStats (unsigned int &nNodes, unsigned int &ntables, unsigned int &numBytes)=0
virtual void setTablesFlavor (const char *flavor)=0
virtual void setTablesProdTime (unsigned int ptime)=0
void setFlavor (const char *flavor)
void setProdTime (unsigned int ptime)
StDbConfigNodefindConfigNode (StDbType t, StDbDomain d, const char *sPath)
StDbConfigNodefindConfigNode (StDbType t, StDbDomain d)
StDbConfigNodefindConfigNode (const char *sPath)
StDbConfigNodefindChildConfigNode (const char *nodeName)

Protected Member Functions

void zeroNodes ()

Protected Attributes

StDbConfigNodemfirstChildNode
StDbConfigNodemnextNode
StDbConfigNodemparentNode
bool mhasData
int mbranchID
bool misDbNode

Constructor & Destructor Documentation

StDbConfigNode::StDbConfigNode StDbConfigNode parent,
const char *  nodeName,
const char *  configName
 

Definition at line 133 of file StDbConfigNode.cc.

00133 : StDbNode(nodeName,configName) { 00134 00135 zeroNodes(); 00136 setParentNode(parent); 00137 setDbName(parent->printDbName()); 00138 setDbType(parent->getDbType()); 00139 setDbDomain(parent->getDbDomain()); 00140 }

StDbConfigNode::StDbConfigNode StDbConfigNode parent,
StDbNode node
 

Definition at line 143 of file StDbConfigNode.cc.

00143 : StDbNode(node) { 00144 zeroNodes(); 00145 setParentNode(parent); 00146 }

StDbConfigNode::StDbConfigNode StDbType  type,
StDbDomain  domain,
const char *  nodeName,
const char *  configName = "none"
 

Definition at line 149 of file StDbConfigNode.cc.

00149 : StDbNode(nodeName,configName) { 00150 00151 zeroNodes(); 00152 mdbType = type; 00153 mdbDomain = domain; 00154 }

StDbConfigNode::~StDbConfigNode  )  [virtual]
 

Definition at line 157 of file StDbConfigNode.cc.

00157 { deleteChildren();};


Member Function Documentation

virtual void StDbConfigNode::addChildren dbEnvList elist  )  [pure virtual]
 

Implemented in StDbConfigNodeImpl.

virtual StDbTable* StDbConfigNode::addDbTable const char *  tableName,
const char *  version = "default"
[pure virtual]
 

Implemented in StDbConfigNodeImpl.

virtual StDbTable* StDbConfigNode::addTable StDbNode node  )  [pure virtual]
 

Implemented in StDbConfigNodeImpl.

virtual StDbTable* StDbConfigNode::addTable const char *  tableName,
const char *  version = "default"
[pure virtual]
 

Implemented in StDbConfigNodeImpl.

void StDbConfigNode::appendNode StDbConfigNode node  ) 
 

Definition at line 314 of file StDbConfigNode.cc.

00314 { 00315 if(mnextNode){ 00316 mnextNode->appendNode(node); 00317 } else { 00318 mnextNode = node; 00319 } 00320 }

virtual int StDbConfigNode::buildTree int  opt = 0  )  [pure virtual]
 

Implemented in StDbConfigNodeImpl.

virtual bool StDbConfigNode::compareTables StDbTable tab1,
StDbTable tab2
[pure virtual]
 

Implemented in StDbConfigNodeImpl.

void StDbConfigNode::deleteChildren  ) 
 

Definition at line 203 of file StDbConfigNode.cc.

00203 { 00204 00205 StDbConfigNode* nextChild = mfirstChildNode; 00206 while(nextChild){ 00207 StDbConfigNode* node=nextChild->getNextNode(); 00208 delete nextChild; 00209 nextChild=node; 00210 } 00211 mfirstChildNode=0; 00212 }

void StDbConfigNode::deleteTree  ) 
 

Definition at line 192 of file StDbConfigNode.cc.

00192 { 00193 00194 if(mfirstChildNode)delete mfirstChildNode; 00195 if(mnextNode){ 00196 mnextNode->deleteTree(); 00197 delete mnextNode; 00198 } 00199 }

StDbConfigNode * StDbConfigNode::findChildConfigNode const char *  nodeName  ) 
 

Definition at line 295 of file StDbConfigNode.cc.

00295 { 00296 00297 StDbConfigNode* retVal=0; 00298 if(!name) return retVal; 00299 retVal=getFirstChildNode(); 00300 while(retVal){ 00301 if(retVal->checkName(name)) break; 00302 retVal=retVal->getNextNode(); 00303 } 00304 return retVal; 00305 }

StDbConfigNode * StDbConfigNode::findConfigNode const char *  sPath  ) 
 

Definition at line 252 of file StDbConfigNode.cc.

00252 { 00253 00254 // tries to find a node below (in the child sense) 00255 // where nodeName/nodeName/nodeName/... = subPath 00256 // 00257 // returns null pointer if not found 00258 00259 StDbConfigNode* node=0; 00260 if(!subPath) return node; 00261 char* path = mstrDup(subPath); 00262 00263 if(path[0]=='/')path++; 00264 char* id=strstr(path,"/"); 00265 if(id){ *id='\0'; id++; } 00266 char* nextNodeName=mstrDup(path); 00267 node=getFirstChildNode(); 00268 00269 if(node){ 00270 bool found = false; 00271 while(!found){ 00272 if(!node->checkName(nextNodeName)){ 00273 node=node->getNextNode(); 00274 if(!node) found=true; 00275 } else { 00276 found=true; 00277 } 00278 } 00279 00280 } 00281 00282 if(node && id) { 00283 node=node->findConfigNode(id); 00284 *id='/'; // make path whole again 00285 } 00286 00287 delete [] path; 00288 delete [] nextNodeName; 00289 00290 return node; 00291 }

StDbConfigNode * StDbConfigNode::findConfigNode StDbType  t,
StDbDomain  d
 

Definition at line 225 of file StDbConfigNode.cc.

00225 { 00226 00227 // Searches for the "highest" node of type & domain 00228 // e.g. if request Calibrations , tpc & node is of that 00229 // type & domain it checks parent 1st and if it is also 00230 // that type & domain returns this call to the parent node 00231 // .. else continue down the tree ... 00232 00233 StDbConfigNode* node = 0; 00234 00235 // search parent & this 00236 if(isNode(type,domain)){ 00237 if(mparentNode && mparentNode->isNode(type,domain)) 00238 return mparentNode->findConfigNode(type,domain); 00239 return this; 00240 } 00241 00242 // search children & sibs 00243 if(hasChildren())node=mfirstChildNode->findConfigNode(type,domain); 00244 if(!node && mnextNode)node = mnextNode->findConfigNode(type,domain); 00245 00246 return node; 00247 }

StDbConfigNode * StDbConfigNode::findConfigNode StDbType  t,
StDbDomain  d,
const char *  sPath
 

Definition at line 217 of file StDbConfigNode.cc.

00217 { 00218 StDbConfigNode* node=findConfigNode(type,domain); 00219 return node->findConfigNode(subPath); 00220 }

virtual StDbTable* StDbConfigNode::findLocalTable const char *  name  )  [pure virtual]
 

Implemented in StDbConfigNodeImpl.

virtual StDbTable* StDbConfigNode::findTable const char *  name,
const char *  sPath = "/"
[pure virtual]
 

Implemented in StDbConfigNodeImpl.

int StDbConfigNode::getBranchID  )  [inline]
 

Definition at line 190 of file StDbConfigNode.hh.

00190 { return mbranchID; };

virtual StDbElementIndex* StDbConfigNode::getElementIndex  )  [pure virtual]
 

Implemented in StDbConfigNodeImpl.

virtual void StDbConfigNode::getElementIndexInfo char *&  indexname,
int &  indexID
[pure virtual]
 

Implemented in StDbConfigNodeImpl.

StDbConfigNode * StDbConfigNode::getFirstChildNode  )  [inline]
 

Definition at line 188 of file StDbConfigNode.hh.

00188 { return mfirstChildNode; };

StDbConfigNode * StDbConfigNode::getNextNode  )  [inline]
 

Definition at line 186 of file StDbConfigNode.hh.

00186 { return mnextNode; };

virtual void StDbConfigNode::getNumberStats unsigned int &  nNodes,
unsigned int &  ntables,
unsigned int &  numBytes
[pure virtual]
 

Implemented in StDbConfigNodeImpl.

virtual int StDbConfigNode::getNumIndeces  )  const [pure virtual]
 

Implemented in StDbConfigNodeImpl.

StDbConfigNode * StDbConfigNode::getParentNode  )  [inline]
 

Definition at line 187 of file StDbConfigNode.hh.

00187 { return mparentNode; };

virtual StDbTableIter* StDbConfigNode::getStDbTableIter  )  [pure virtual]
 

Implemented in StDbConfigNodeImpl.

bool StDbConfigNode::hasChildren  )  [inline]
 

Definition at line 194 of file StDbConfigNode.hh.

00194 {return (mfirstChildNode) ? true : false; };

bool StDbConfigNode::hasData  )  [inline]
 

Definition at line 189 of file StDbConfigNode.hh.

00189 { return mhasData;};

bool StDbConfigNode::isDbNode  )  [inline]
 

Definition at line 193 of file StDbConfigNode.hh.

00193 { return misDbNode; };

virtual void StDbConfigNode::printNumberStats  )  [pure virtual]
 

Implemented in StDbConfigNodeImpl.

virtual void StDbConfigNode::printTables int  depth  )  [pure virtual]
 

Implemented in StDbConfigNodeImpl.

void StDbConfigNode::printTree int  depth  ) 
 

Definition at line 344 of file StDbConfigNode.cc.

00344 { 00345 00346 if(!depth)cout<<endl<<"************* Node Structure ****************" <<endl<<endl; 00347 00348 if(StDbManager::Instance()->IsVerbose()){ 00349 for(int k=0;k<depth;k++)cout<<" "; 00350 cout<<"Node=" << mname <<" VersionKey = " << mversion <<endl; 00351 if(mhasData) { 00352 int depth2 = depth+4; 00353 printTables(depth2); 00354 } 00355 } 00356 int depth3=depth+4; 00357 if(mfirstChildNode)mfirstChildNode->printTree(depth3); 00358 if(mnextNode)mnextNode->printTree(depth); 00359 00360 if(!depth)cout<<endl<<"*********************************************" << endl; 00361 00362 }

virtual void StDbConfigNode::removeTable StDbTable table  )  [pure virtual]
 

Implemented in StDbConfigNodeImpl.

virtual void StDbConfigNode::resetConfig const char *  config,
int  opt = 0
[pure virtual]
 

Implemented in StDbConfigNodeImpl.

void StDbConfigNode::setBranchID int  branchID  )  [inline]
 

Definition at line 191 of file StDbConfigNode.hh.

00191 { mbranchID=branchID; };

void StDbConfigNode::setChildNode StDbConfigNode node  )  [virtual]
 

Definition at line 324 of file StDbConfigNode.cc.

00324 { 00325 if(mfirstChildNode) { 00326 mfirstChildNode->appendNode(node); 00327 } else { 00328 mfirstChildNode = node; 00329 } 00330 }

virtual void StDbConfigNode::setElementIndexInfo const char *  indexName,
int  indexID
[pure virtual]
 

Implemented in StDbConfigNodeImpl.

void StDbConfigNode::setFirstChildNode StDbConfigNode node  ) 
 

Definition at line 334 of file StDbConfigNode.cc.

00334 { 00335 if(mfirstChildNode)node->appendNode(mfirstChildNode); 00336 mfirstChildNode = 0; 00337 setChildNode(node); 00338 }

void StDbConfigNode::setFlavor const char *  flavor  ) 
 

Definition at line 172 of file StDbConfigNode.cc.

00172 { 00173 00174 setTablesFlavor(flavor); 00175 if(mfirstChildNode)mfirstChildNode->setFlavor(flavor); 00176 if(mnextNode)mnextNode->setFlavor(flavor); 00177 00178 }

void StDbConfigNode::setIsDbNode bool  isDbNode  )  [inline]
 

Definition at line 192 of file StDbConfigNode.hh.

00192 {misDbNode=isDbNode; };

void StDbConfigNode::setNextNode StDbConfigNode node  )  [inline]
 

Definition at line 185 of file StDbConfigNode.hh.

00185 { mnextNode=node;}

void StDbConfigNode::setParentNode StDbConfigNode node  ) 
 

Definition at line 308 of file StDbConfigNode.cc.

00308 { 00309 mparentNode = parent; 00310 parent->setChildNode(this); 00311 }

void StDbConfigNode::setProdTime unsigned int  ptime  ) 
 

Definition at line 182 of file StDbConfigNode.cc.

00182 { 00183 setTablesProdTime(ptime); 00184 if(mfirstChildNode)mfirstChildNode->setProdTime(ptime); 00185 if(mnextNode)mnextNode->setProdTime(ptime); 00186 }

virtual void StDbConfigNode::setTablesFlavor const char *  flavor  )  [pure virtual]
 

Implemented in StDbConfigNodeImpl.

virtual void StDbConfigNode::setTablesProdTime unsigned int  ptime  )  [pure virtual]
 

Implemented in StDbConfigNodeImpl.

void StDbConfigNode::zeroNodes  )  [protected]
 

Definition at line 160 of file StDbConfigNode.cc.

00160 { 00161 mfirstChildNode=0; 00162 mnextNode=0; 00163 mparentNode=0; 00164 mhasData=false; 00165 mbranchID=0; 00166 misDbNode=false; 00167 };


Member Data Documentation

int StDbConfigNode::mbranchID [protected]
 

Definition at line 108 of file StDbConfigNode.hh.

StDbConfigNode* StDbConfigNode::mfirstChildNode [protected]
 

Definition at line 103 of file StDbConfigNode.hh.

bool StDbConfigNode::mhasData [protected]
 

Definition at line 107 of file StDbConfigNode.hh.

bool StDbConfigNode::misDbNode [protected]
 

Definition at line 109 of file StDbConfigNode.hh.

StDbConfigNode* StDbConfigNode::mnextNode [protected]
 

Definition at line 104 of file StDbConfigNode.hh.

StDbConfigNode* StDbConfigNode::mparentNode [protected]
 

Definition at line 105 of file StDbConfigNode.hh.


The documentation for this class was generated from the following files:
Generated on Thu Aug 24 14:45:51 2006 for Doxygen by doxygen 1.3.7