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

StDbConfigNode.hh

Go to the documentation of this file.
00001 /*************************************************************************** 00002 * 00003 * $Id: StDbConfigNode.hh,v 1.16 2001/01/22 18:37:52 porter Exp $ 00004 * 00005 * Author: R. Jeff Porter 00006 *************************************************************************** 00007 * 00008 * Description: Node (directory) & db handle to hold list of dbtables 00009 * Now (Dec2000) pure-virtual for hiding db & table (stl) part 00010 * 00011 *************************************************************************** 00012 * 00013 * $Log: StDbConfigNode.hh,v $ 00014 * Revision 1.16 2001/01/22 18:37:52 porter 00015 * Update of code needed in next year running. This update has little 00016 * effect on the interface (only 1 method has been changed in the interface). 00017 * Code also preserves backwards compatibility so that old versions of 00018 * StDbLib can read new table structures. 00019 * -Important features: 00020 * a. more efficient low-level table structure (see StDbSql.cc) 00021 * b. more flexible indexing for new systems (see StDbElememtIndex.cc) 00022 * c. environment variable override KEYS for each database 00023 * d. StMessage support & clock-time logging diagnostics 00024 * -Cosmetic features 00025 * e. hid stl behind interfaces (see new *Impl.* files) to again allow rootcint access 00026 * f. removed codes that have been obsolete for awhile (e.g. db factories) 00027 * & renamed some classes for clarity (e.g. tableQuery became StDataBaseI 00028 * and mysqlAccessor became StDbSql) 00029 * 00030 * Revision 1.15 2000/04/25 18:26:02 porter 00031 * added flavor & production time as settable query fields in 00032 * table &/or node. Associated SQL updated in mysqlAccessor. 00033 * Flavor key supports "+" as an OR symbol. 00034 * 00035 * Revision 1.14 2000/03/28 17:03:18 porter 00036 * Several upgrades: 00037 * 1. configuration by timestamp for Conditions 00038 * 2. query by whereClause made more systematic 00039 * 3. conflict between db-stored comments & number lists resolved 00040 * 4. ensure endtime is correct for certain query falures 00041 * 5. dbstl.h->handles ObjectSpace & RogueWave difference (Online vs Offline) 00042 * 00043 * Revision 1.13 2000/01/27 05:54:33 porter 00044 * Updated for compiling on CC5 + HPUX-aCC + KCC (when flags are reset) 00045 * Fixed reConnect()+transaction model mismatch 00046 * added some in-code comments 00047 * 00048 * Revision 1.12 2000/01/19 20:20:05 porter 00049 * - finished transaction model needed by online 00050 * - fixed CC5 compile problem in StDbNodeInfo.cc 00051 * - replace TableIter class by StDbTableIter to prevent name problems 00052 * 00053 * Revision 1.11 2000/01/14 14:50:52 porter 00054 * expanded use of verbose mode & fixed inconsistency in 00055 * StDbNodeInfo::getElementID 00056 * 00057 * Revision 1.10 2000/01/10 20:37:53 porter 00058 * expanded functionality based on planned additions or feedback from Online work. 00059 * update includes: 00060 * 1. basis for real transaction model with roll-back 00061 * 2. limited SQL access via the manager for run-log & tagDb 00062 * 3. balance obtained between enumerated & string access to databases 00063 * 4. 3-levels of diagnostic output: Quiet, Normal, Verbose 00064 * 5. restructured Node model for better XML support 00065 * 00066 * Revision 1.9 1999/12/28 21:31:41 porter 00067 * added 'using std::vector' and 'using std::list' for Solaris CC5 compilation. 00068 * Also fixed some warnings arising from the CC5 compiles 00069 * 00070 * Revision 1.8 1999/12/03 22:24:01 porter 00071 * expanded functionality used by online, fixed bug in 00072 * mysqlAccessor::getElementID(char*), & update StDbDataSet to 00073 * conform to changes in Xml reader & writer 00074 * 00075 * Revision 1.7 1999/10/19 14:30:38 porter 00076 * modifications relevant to use with StDbBroker and future merging with 00077 * "params" database structure + some docs + suppressing diagnostics messages 00078 * 00079 * Revision 1.6 1999/09/30 02:06:03 porter 00080 * add StDbTime to better handle timestamps, modify SQL content (mysqlAccessor) 00081 * allow multiple rows (StDbTable), & Added the comment sections at top of 00082 * each header and src file 00083 * 00084 **************************************************************************/ 00085 #ifndef STDBCONFIGNODE_HH 00086 #define STDBCONFIGNODE_HH 00087 00088 #include "StDbNode.hh" 00089 #include "StDbTableIter.hh" 00090 00091 class dbEnvList; 00092 class StDbElementIndex; 00093 class StDbTable; 00094 00095 #ifdef __ROOT_ 00096 #include "TROOT.h" 00097 #endif 00098 00099 class StDbConfigNode : public StDbNode { 00100 00101 protected: 00102 00103 StDbConfigNode* mfirstChildNode; 00104 StDbConfigNode* mnextNode; 00105 StDbConfigNode* mparentNode; 00106 00107 bool mhasData; 00108 int mbranchID; 00109 bool misDbNode; 00110 void zeroNodes(); 00111 00112 public: 00113 00114 StDbConfigNode( StDbConfigNode* parent, 00115 const char* nodeName, const char* configName); 00116 StDbConfigNode( StDbConfigNode* parent, StDbNode& node); 00117 StDbConfigNode( StDbType type, StDbDomain domain, 00118 const char* nodeName, const char* configName="none"); 00119 virtual ~StDbConfigNode(); 00120 00121 // node & tree operations 00122 void setNextNode(StDbConfigNode* node); 00123 void setParentNode(StDbConfigNode* node); 00124 void setFirstChildNode(StDbConfigNode* node); 00125 virtual void setChildNode(StDbConfigNode* node); 00126 void appendNode(StDbConfigNode* node); 00127 StDbConfigNode* getNextNode(); 00128 StDbConfigNode* getParentNode(); 00129 StDbConfigNode* getFirstChildNode(); 00130 void deleteTree(); 00131 virtual void addChildren(dbEnvList* elist) = 0; 00132 void deleteChildren(); 00133 00134 // check container status 00135 bool hasChildren(); 00136 bool hasData(); 00137 int getBranchID(); 00138 void setBranchID(int branchID); 00139 void setIsDbNode(bool isDbNode); 00140 bool isDbNode(); 00141 void printTree(int depth); 00142 00143 // DB & Table Index operations 00144 virtual void resetConfig(const char* config, int opt=0) =0; 00145 virtual int buildTree(int opt=0) =0; 00146 virtual StDbElementIndex* getElementIndex() =0; 00147 virtual void setElementIndexInfo(const char* indexName, int indexID) =0; 00148 virtual void getElementIndexInfo(char*& indexname, int& indexID) =0; 00149 virtual int getNumIndeces() const =0; 00150 00151 // Table operations --> pure virtual for db & stl dependencies 00152 virtual StDbTable* addDbTable(const char* tableName, 00153 const char* version="default") =0; 00154 virtual StDbTable* addTable (const char* tableName, 00155 const char* version="default") =0; 00156 virtual StDbTable* addTable(StDbNode* node) =0; 00157 virtual StDbTable* findTable(const char* name, const char* sPath="/")=0; 00158 virtual StDbTable* findLocalTable(const char* name) =0; 00159 virtual void removeTable(StDbTable* table) =0; 00160 virtual StDbTableIter* getStDbTableIter() =0; 00161 virtual bool compareTables(StDbTable* tab1, StDbTable* tab2) =0; 00162 virtual void printTables(int depth) =0; 00163 virtual void printNumberStats() =0; 00164 virtual void getNumberStats(unsigned int& nNodes, 00165 unsigned int& ntables, 00166 unsigned int& numBytes) =0; 00167 00168 // set the table flavors in full sub-tree or local list 00169 virtual void setTablesFlavor(const char* flavor) =0; 00170 virtual void setTablesProdTime(unsigned int ptime) =0; 00171 void setFlavor(const char* flavor); 00172 void setProdTime(unsigned int ptime); 00173 00174 // More node operations 00175 StDbConfigNode* findConfigNode(StDbType t, StDbDomain d, const char* sPath); 00176 StDbConfigNode* findConfigNode(StDbType t, StDbDomain d); 00177 StDbConfigNode* findConfigNode(const char* sPath); 00178 StDbConfigNode* findChildConfigNode(const char* nodeName); 00179 #ifdef __ROOT__ 00180 ClassDef(StDbConfigNode,0) 00181 #endif 00182 00183 }; 00184 00185 inline void StDbConfigNode::setNextNode(StDbConfigNode* node){ mnextNode=node;} 00186 inline StDbConfigNode* StDbConfigNode::getNextNode() { return mnextNode; }; 00187 inline StDbConfigNode* StDbConfigNode::getParentNode() { return mparentNode; }; 00188 inline StDbConfigNode* StDbConfigNode::getFirstChildNode(){ return mfirstChildNode; }; 00189 inline bool StDbConfigNode::hasData(){ return mhasData;}; 00190 inline int StDbConfigNode::getBranchID() { return mbranchID; }; 00191 inline void StDbConfigNode::setBranchID(int branchID) { mbranchID=branchID; }; 00192 inline void StDbConfigNode::setIsDbNode(bool isDbNode){misDbNode=isDbNode; }; 00193 inline bool StDbConfigNode::isDbNode() { return misDbNode; }; 00194 inline bool StDbConfigNode::hasChildren(){return (mfirstChildNode) ? true : false; }; 00195 00196 #endif 00197 00198 00199 00200 00201

Generated on Thu Aug 24 14:45:25 2006 for Doxygen by doxygen 1.3.7