StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StDbConfigNodeImpl.hh
1 /***************************************************************************
2  *
3  * $Id: StDbConfigNodeImpl.hh,v 1.2 2011/11/28 17:03:08 dmitry Exp $
4  *
5  * Author: R. Jeff Porter
6  ***************************************************************************
7  *
8  * Description: Node (directory) to hold list of dbtables
9  *
10  ***************************************************************************
11  *
12  * $Log: StDbConfigNodeImpl.hh,v $
13  * Revision 1.2 2011/11/28 17:03:08 dmitry
14  * dbv override support in StDbLib,StDbBroker,St_db_Maker
15  *
16  * Revision 1.1 2001/01/22 18:37:52 porter
17  * Update of code needed in next year running. This update has little
18  * effect on the interface (only 1 method has been changed in the interface).
19  * Code also preserves backwards compatibility so that old versions of
20  * StDbLib can read new table structures.
21  * -Important features:
22  * a. more efficient low-level table structure (see StDbSql.cc)
23  * b. more flexible indexing for new systems (see StDbElememtIndex.cc)
24  * c. environment variable override KEYS for each database
25  * d. StMessage support & clock-time logging diagnostics
26  * -Cosmetic features
27  * e. hid stl behind interfaces (see new *Impl.* files) to again allow rootcint access
28  * f. removed codes that have been obsolete for awhile (e.g. db factories)
29  * & renamed some classes for clarity (e.g. tableQuery became StDataBaseI
30  * and mysqlAccessor became StDbSql)
31  *
32  **************************************************************************/
33 #ifndef STDBCONFIGNODEIMPL_HH
34 #define STDBCONFIGNODEIMPL_HH
35 
36 #include "StDbConfigNode.hh"
37 #include "StDbElementIndex.hh"
38 
39 #include <list>
40 #ifdef ST_NO_TEMPLATE_DEF_ARGS
41  typedef list<StDbTable*, allocator<StDbTable*> > TableList;
42 #else
43  #if !defined(ST_NO_NAMESPACES)
44  using std::list;
45  #endif
46  typedef list<StDbTable*> TableList;
47 #endif
48 
50 
51  friend class StDbTableIterImpl;
52 
53 protected:
54 
55  StDbElementIndex* melementIndex;
56  int mindexRef;
57  TableList mTables;
58 
59  void deleteTables();
60  void updateDbInfo();
61  void updateDbTables(int opt=0);
62  void updateDbTable(StDbTable* table,int opt=0);
63 
64 public:
65 
67  const char* nodeName, const char* configName);
68  StDbConfigNodeImpl( StDbConfigNode* parent, StDbNode& node);
69  StDbConfigNodeImpl( StDbType type, StDbDomain domain,
70  const char* nodeName, const char* configName="none");
71  virtual ~StDbConfigNodeImpl();
72 
73  virtual void addChildren(dbEnvList* elist);
74 
75  // DB & Table Index operations
76  virtual void resetConfig(const char* config, int opt=0);
77  virtual int buildTree(int opt=0);//0=get tableDescriptors from db
78  virtual StDbElementIndex* getElementIndex();
79  virtual void setElementIndexInfo(const char* indexName, int indexID);
80  virtual void getElementIndexInfo(char*& indexname, int& indexID);
81  virtual int getNumIndeces() const;
82 
83  // Table operations
84  virtual StDbTable* addDbTable(const char* tableName,
85  const char* version="default");
86  virtual StDbTable* addTable(const char* tableName,
87  const char* version="default");
88  virtual StDbTable* addTable(StDbNode* node);
89  virtual StDbTable* findTable(const char* name, const char* subPath="/");
90  virtual StDbTable* findLocalTable(const char* name);
91  virtual void removeTable(StDbTable* table);
92 
93  virtual StDbTableIter* getStDbTableIter();
94  virtual bool compareTables(StDbTable* tab1, StDbTable* tab2);
95  virtual void printTables(int depth);
96  virtual void printNumberStats();
97 
98  virtual void getNumberStats(unsigned int& nNodes,
99  unsigned int& ntables,
100  unsigned int& numBytes);
101 
102  // set the table flavors in full sub-tree or local list
103  virtual void setTablesFlavor(const char* flavor);
104  virtual void setTablesProdTime(unsigned int ptime);
105  virtual void setTablesProdTimeOverride(unsigned int ptime, char* dbType = 0, char* dbDomain = 0); // DBV override
106 };
107 
108 #endif
109 
110 
111 
112 
113