StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StDbMessService.hh
1 /***************************************************************************
2  *
3  * $Id: StDbMessService.hh,v 1.2 2003/12/16 01:30:32 porter Exp $
4  *
5  * Author: R. Jeff Porter
6  ***************************************************************************
7  *
8  * Description: Simple interface to allow using StMessage without breaking
9  * StDbLib's stand-alone capability
10  *
11  ***************************************************************************
12  *
13  * $Log: StDbMessService.hh,v $
14  * Revision 1.2 2003/12/16 01:30:32 porter
15  * additional fixes for change from ostrstream to ostringstream that were not exposed until
16  * running in online
17  *
18  * Revision 1.1 2001/01/22 18:37:56 porter
19  * Update of code needed in next year running. This update has little
20  * effect on the interface (only 1 method has been changed in the interface).
21  * Code also preserves backwards compatibility so that old versions of
22  * StDbLib can read new table structures.
23  * -Important features:
24  * a. more efficient low-level table structure (see StDbSql.cc)
25  * b. more flexible indexing for new systems (see StDbElememtIndex.cc)
26  * c. environment variable override KEYS for each database
27  * d. StMessage support & clock-time logging diagnostics
28  * -Cosmetic features
29  * e. hid stl behind interfaces (see new *Impl.* files) to again allow rootcint access
30  * f. removed codes that have been obsolete for awhile (e.g. db factories)
31  * & renamed some classes for clarity (e.g. tableQuery became StDataBaseI
32  * and mysqlAccessor became StDbSql)
33  *
34  *
35  **************************************************************************/
36 #ifndef __STDBMESSSERVICE_HH
37 #define __STDBMESSSERVICE_HH
38 
39 
40 // simple debug, warn, connection, & error
41 enum StDbMessLevel { dbMDebug=0, dbMWarn, dbMConnect, dbMErr, dbMFatal };
42 
44 
45 protected:
46 
47  StDbMessLevel mdbLevel;
48 
49 public:
50 
51  StDbMessService(): mdbLevel(dbMWarn) {};
52  virtual ~StDbMessService(){};
53 
54  void setMessLevel(StDbMessLevel dbLevel);
55  StDbMessLevel getMessLevel();
56 
57  virtual void printMessage(const char* message,
58  StDbMessLevel dbLevel,
59  int lineNumber,
60  const char* className,
61  const char* methodName) = 0;
62 
63  virtual void printMessage(const char* message,
64  const char* levelString,
65  int lineNumber,
66  const char* className,
67  const char* methodName) = 0;
68 };
69 
70 inline void StDbMessService::setMessLevel(StDbMessLevel lev){ mdbLevel=lev; }
71 inline StDbMessLevel StDbMessService::getMessLevel() {return mdbLevel;}
72 
73 #endif