00001 /*************************************************************************** 00002 * 00003 * $Id: StDbMessService.hh,v 1.2 2003/12/16 01:30:32 porter Exp $ 00004 * 00005 * Author: R. Jeff Porter 00006 *************************************************************************** 00007 * 00008 * Description: Simple interface to allow using StMessage without breaking 00009 * StDbLib's stand-alone capability 00010 * 00011 *************************************************************************** 00012 * 00013 * $Log: StDbMessService.hh,v $ 00014 * Revision 1.2 2003/12/16 01:30:32 porter 00015 * additional fixes for change from ostrstream to ostringstream that were not exposed until 00016 * running in online 00017 * 00018 * Revision 1.1 2001/01/22 18:37:56 porter 00019 * Update of code needed in next year running. This update has little 00020 * effect on the interface (only 1 method has been changed in the interface). 00021 * Code also preserves backwards compatibility so that old versions of 00022 * StDbLib can read new table structures. 00023 * -Important features: 00024 * a. more efficient low-level table structure (see StDbSql.cc) 00025 * b. more flexible indexing for new systems (see StDbElememtIndex.cc) 00026 * c. environment variable override KEYS for each database 00027 * d. StMessage support & clock-time logging diagnostics 00028 * -Cosmetic features 00029 * e. hid stl behind interfaces (see new *Impl.* files) to again allow rootcint access 00030 * f. removed codes that have been obsolete for awhile (e.g. db factories) 00031 * & renamed some classes for clarity (e.g. tableQuery became StDataBaseI 00032 * and mysqlAccessor became StDbSql) 00033 * 00034 * 00035 **************************************************************************/ 00036 #ifndef __STDBMESSSERVICE_HH 00037 #define __STDBMESSSERVICE_HH 00038 00039 00040 // simple debug, warn, connection, & error 00041 enum StDbMessLevel { dbMDebug=0, dbMWarn, dbMConnect, dbMErr, dbMFatal }; 00042 00043 class StDbMessService { 00044 00045 protected: 00046 00047 StDbMessLevel mdbLevel; 00048 00049 public: 00050 00051 StDbMessService(): mdbLevel(dbMWarn) {}; 00052 virtual ~StDbMessService(){}; 00053 00054 void setMessLevel(StDbMessLevel dbLevel); 00055 StDbMessLevel getMessLevel(); 00056 00057 virtual void printMessage(const char* message, 00058 StDbMessLevel dbLevel, 00059 int lineNumber, 00060 const char* className, 00061 const char* methodName) = 0; 00062 00063 virtual void printMessage(const char* message, 00064 const char* levelString, 00065 int lineNumber, 00066 const char* className, 00067 const char* methodName) = 0; 00068 }; 00069 00070 inline void StDbMessService::setMessLevel(StDbMessLevel lev){ mdbLevel=lev; } 00071 inline StDbMessLevel StDbMessService::getMessLevel() {return mdbLevel;} 00072 00073 #endif