gcontrol.h

Go to the documentation of this file.
00001 #ifndef gCONTROL_X_H
00002 #define gCONTROL_X_H
00003 
00004 #include "glist.h"
00005 ////////////////////////////////////////////////////////////
00006 class gControl : public gStorage {
00007 public:
00008     gControl (eStorage aKind=e_Control) ;
00009     virtual ~gControl () {
00010     }
00011 
00012     // Public data-members
00013     int lastOpError;
00014     int dbgLevel;
00015     static int nErrors[ LOG_LOGMAX ];
00016     static gList lLog[ LOG_LOGMAX ];
00017 
00018     // Get methods
00019     virtual bool IsOk () {
00020         return lastOpError==0;
00021     }
00022 
00023     virtual char* GetErrorStr () {
00024         return sStrError;
00025     }
00026 
00027     virtual t_uint16 GetRandom (t_uint16 maxRange) ;
00028 
00029     virtual int MinimumStorageSize () {
00030         return 0;
00031     }
00032     virtual int MaximumStorageSize () {
00033         return 0;
00034     }
00035 
00036     // Set methods
00037     virtual void Reset () ;
00038 
00039     virtual void ResetLog () ;
00040 
00041     virtual int SetDefaultDbgLevel (int aDbgLevel) {
00042         return dbgLevelDefault = aDbgLevel;
00043     }
00044 
00045     virtual int SetError (int opError) ;
00046 
00047     // Special methods
00048     int Log (FILE* dbgFile, int level, const char* formatStr, ...) ;
00049     virtual int ClearLogMem (int level) ;
00050     virtual int ClearLogMemAll () ;
00051     virtual int ClearAllLogs () ;
00052 
00053     // Save/etc methods
00054     virtual gStorage* NewObject () ;
00055     virtual t_uchar* ToString (t_uchar* uBuf) {
00056         return nil;
00057     }
00058     virtual bool SaveGuts (FILE* f) {
00059         return CanSave( f );
00060     }
00061     virtual bool RestoreGuts (FILE* f) {
00062         return CanRestore( f );
00063     }
00064 
00065 protected:
00066     char sStrError[200];
00067     static int dbgLevelDefault;
00068     static char logBuf[4096];
00069 
00070 private:
00071     static short intCtrl;
00072 
00073     // Operators,empty
00074     gControl (gControl& ) ; //empty
00075     gControl& operator= (gControl& ) ; //empty
00076 };
00077 ////////////////////////////////////////////////////////////
00078 class gStorageControl : public gControl {
00079 public:
00080     virtual ~gStorageControl () ;
00081 
00082     static gStorageControl& Self () {
00083         return myself;
00084     }
00085 
00086     // Public data-members
00087     static short assertedNr;
00088 
00089     // Get methods
00090     virtual int NumObjs () ;
00091 
00092     virtual char* StorageKindName (short refKind) ;
00093 
00094     // Set methods
00095     void StaticAlloc (char* msgStr, int incrNrStaticStgObjs) ;
00096 
00097     // Multi-Service methods
00098     bool IsServiceUsed (short servIdx) ;
00099     char* GetServiceName (short servIdx) ;
00100     sStorageDesc& GetServiceDescriptor (short servIdx) ;
00101     sServiceRegister& GetService (char* descStr) ;
00102     sServiceRegister* GetServicePtr (char* descStr) ;
00103     short RegisterService (char* descStr, short refKind, short servIdx=-1) ;
00104     void ServiceAlloc (char* descStr, unsigned nNodes=0) ;
00105     bool ServiceAdd (char* descStr, sServiceNode& aNode) ;
00106     bool ServiceDelete (char* descStr, gStorage* pStorage) ;
00107 
00108     // Method only called by FileControl
00109     void Release () ;
00110 
00111 protected:
00112     gStorageControl () ;
00113 
00114     // Multi-service data-members
00115     short nServices;
00116     static sServiceRegister* pServReg;
00117 
00118     short thisFindService (char* descStr, short& refKind) ;
00119 
00120 private:
00121     static int rStaticStgObjs;
00122     static short maxServices;
00123     static gStorageControl myself;
00124 
00125     // Operators,empty
00126     gStorageControl (gStorageControl& ) ; //empty
00127     gStorageControl& operator= (gStorageControl& ) ; //empty
00128 };
00129 ////////////////////////////////////////////////////////////
00130 #endif //gCONTROL_X_H
00131 

Generated on Sat Aug 18 02:40:51 2007 for xpfweb_v2x lib by  doxygen 1.4.2