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

StDbTime.h

Go to the documentation of this file.
00001 /*************************************************************************** 00002 * 00003 * $Id: StDbTime.h,v 1.5 2002/01/30 15:40:48 porter Exp $ 00004 * 00005 * Author: R. Jeff Porter 00006 *************************************************************************** 00007 * 00008 * Description: Time class for "unix & date-time" timestamp access to DB 00009 * 00010 *************************************************************************** 00011 * 00012 * $Log: StDbTime.h,v $ 00013 * Revision 1.5 2002/01/30 15:40:48 porter 00014 * changed limits on flavor tag & made defaults retrieving more readable 00015 * 00016 * Revision 1.4 2000/02/15 20:27:45 porter 00017 * Some updates to writing to the database(s) via an ensemble (should 00018 * not affect read methods & haven't in my tests. 00019 * - closeAllConnections(node) & closeConnection(table) method to mgr. 00020 * - 'NullEntry' version to write, with setStoreMode in table; 00021 * - updated both StDbTable's & StDbTableDescriptor's copy-constructor 00022 * 00023 * Revision 1.3 2000/01/27 05:54:35 porter 00024 * Updated for compiling on CC5 + HPUX-aCC + KCC (when flags are reset) 00025 * Fixed reConnect()+transaction model mismatch 00026 * added some in-code comments 00027 * 00028 * Revision 1.2 2000/01/10 20:37:55 porter 00029 * expanded functionality based on planned additions or feedback from Online work. 00030 * update includes: 00031 * 1. basis for real transaction model with roll-back 00032 * 2. limited SQL access via the manager for run-log & tagDb 00033 * 3. balance obtained between enumerated & string access to databases 00034 * 4. 3-levels of diagnostic output: Quiet, Normal, Verbose 00035 * 5. restructured Node model for better XML support 00036 * 00037 * Revision 1.1 1999/09/30 02:06:11 porter 00038 * add StDbTime to better handle timestamps, modify SQL content (mysqlAccessor) 00039 * allow multiple rows (StDbTable), & Added the comment sections at top of 00040 * each header and src file 00041 * 00042 **************************************************************************/ 00043 #ifndef STDBTIME_H 00044 #define STDBTIME_H 00045 00046 #include <string.h> 00047 00048 00049 class StDbTime { 00050 00051 public: 00052 00053 unsigned int munixTime; 00054 char* mdateTime; 00055 00056 StDbTime(): munixTime(0), mdateTime(0) {}; 00057 StDbTime(unsigned int utime): mdateTime(0) { munixTime = utime;}; 00058 00059 StDbTime(const char* dtime): munixTime(0) { if(dtime){ 00060 mdateTime=new char[strlen(dtime)+1]; 00061 strcpy(mdateTime,dtime); 00062 } else {mdateTime=0;}}; 00063 00064 StDbTime(StDbTime& time) { munixTime=0; mdateTime=0; 00065 if(time.mdateTime){ 00066 mdateTime=new char[strlen(time.mdateTime)+1]; 00067 strcpy(mdateTime,time.mdateTime); 00068 } 00069 munixTime=time.munixTime; 00070 } 00071 ~StDbTime() { if(mdateTime) delete [] mdateTime; } 00072 00073 void setUnixTime(unsigned int utime) { munixTime = utime;} 00074 void setDateTime(const char* dtime) { if(!dtime) return; 00075 if(mdateTime) delete [] mdateTime; 00076 mdateTime=new char[strlen(dtime)+1]; 00077 strcpy(mdateTime,dtime); }; 00078 00079 void setTime(unsigned int utime, const char* dtime){ 00080 setUnixTime(utime); 00081 setDateTime(dtime);} 00082 unsigned int getUnixTime() { return munixTime; } 00083 char* getDateTime(){ return mdateTime; } 00084 00085 }; 00086 00087 00088 #endif 00089 00090 00091 00092 00093 00094 00095

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