StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StDbDefaults.hh
1 /***************************************************************************
2  *
3  * $Id: StDbDefaults.hh,v 1.1 2001/01/22 18:37:53 porter Exp $
4  *
5  * Author: R. Jeff Porter
6  ***************************************************************************
7  *
8  * Description: Defualt values -> version, flavor, endTime, dbserver file
9  * -> Used to be imbedded in code & in StDbDefs header.
10  * now (Dec2000) separate file.
11  *
12  ***************************************************************************
13  *
14  * $Log: StDbDefaults.hh,v $
15  * Revision 1.1 2001/01/22 18:37:53 porter
16  * Update of code needed in next year running. This update has little
17  * effect on the interface (only 1 method has been changed in the interface).
18  * Code also preserves backwards compatibility so that old versions of
19  * StDbLib can read new table structures.
20  * -Important features:
21  * a. more efficient low-level table structure (see StDbSql.cc)
22  * b. more flexible indexing for new systems (see StDbElememtIndex.cc)
23  * c. environment variable override KEYS for each database
24  * d. StMessage support & clock-time logging diagnostics
25  * -Cosmetic features
26  * e. hid stl behind interfaces (see new *Impl.* files) to again allow rootcint access
27  * f. removed codes that have been obsolete for awhile (e.g. db factories)
28  * & renamed some classes for clarity (e.g. tableQuery became StDataBaseI
29  * and mysqlAccessor became StDbSql)
30  *
31  *
32  *
33  ***************************************************************************/
34 #ifndef STDBDEFAULTS_HH
35 #define STDBDEFAULTS_HH
36 
37 #include "StDbDefs.hh"
38 #include <string.h>
39 
40 class StDbDefaults {
41 
42 private:
43 
44  char mversion[64];
45  char mflavor[16];
46  unsigned int mprodTime;
47  unsigned int mendTime;
48  char mdbServerVar[16];
49  char mdbServerFile[16];
50 
51  StDbDefaults();
52 
53  static StDbDefaults* mInstance;
54 
55 public:
56 
57  static StDbDefaults* Instance(){
58  if(!mInstance)mInstance = new StDbDefaults;
59  return mInstance;
60  }
61 
62  ~StDbDefaults() {};
63 
64  bool IsDefaultVersion(const char* version);
65  bool IsDefaultFlavor(const char* flavor);
66  char* printVersion();
67  char* printFlavor();
68  unsigned int getProdTime() const;
69  unsigned int getEndTime() const;
70  char* printDbServerVar();
71  char* printDbServerFile();
72 
73  char* getServerFileName(const dbFindServerMode mode);
74  char* getFileName(const char* fileName);
75 
76 };
77 
78 inline
79 bool StDbDefaults::IsDefaultVersion(const char* version){
80 if(strcmp(version,mversion)==0)return true;
81 return false;
82 }
83 
84 inline
85 bool StDbDefaults::IsDefaultFlavor(const char* flavor){
86 if(strcmp(flavor,mflavor)==0)return true;
87 return false;
88 }
89 
90 inline
91 char* StDbDefaults::printVersion(){ return mversion; }
92 
93 inline
94 char* StDbDefaults::printFlavor() { return mflavor; }
95 
96 inline
97 unsigned int StDbDefaults::getProdTime() const { return mprodTime; }
98 
99 inline
100 unsigned int StDbDefaults::getEndTime() const { return mendTime; }
101 
102 inline
103 char* StDbDefaults::printDbServerVar() { return mdbServerVar; };
104 
105 inline
106 char* StDbDefaults::printDbServerFile() { return mdbServerFile; };
107 #endif
108 
109 
110 
111 
112