00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef __COREDATA_H__
00032 #define __COREDATA_H__
00033
00034 #include "global.h"
00035
00036 namespace tacpp {
00037
00038 const string DEBUG_TYPE = "DEbug";
00039 class CoreDebug;
00040 const string ACCESS_TYPE = "ACCess";
00041 class CoreAccess;
00042 const string POOL_TYPE = "POOl";
00043 class CorePool;
00044 const string LISTENER_TYPE = "LISTener";
00045 class CoreListener;
00046 const string MANAGER_TYPE = "MANager";
00047 class CoreManager;
00048 const string DEVICE_TYPE = "DEVice";
00049 class CoreDevice;
00050 const string DB_TYPE = "DATabase";
00051 class CoreDb;
00052 const string BILLING_TYPE = "BILling";
00053 class CoreBilling;
00054 const string BUNDLE_TYPE = "BUNdle";
00055 class CoreBundle;
00056 const string PEER_TYPE = "PEer";
00057 class CorePeer;
00058
00059 #define CORE_NAME_LEN 30
00060 #define CORE_DESCR_LEN 50
00061
00067 class Core_data {
00070 pthread_mutex_t Mutex_;
00073 void lock();
00076 void unlock();
00077 public:
00080 void zero_all();
00083 CoreAccess *coreAccess;
00086 CoreDevice *coreDevice;
00089 CoreDebug *coreDebug;
00092 CoreManager *coreManager;
00095 CorePool *corePool;
00098 CoreDb *coreDb;
00101 CoreListener *coreListener;
00104 CoreBundle *coreBundle;
00107 CoreBilling *coreBilling;
00110 CorePeer *corePeer;
00113 Core_data(const string,const string,CoreAccess*);
00116 Core_data(const string,const string,CoreDevice*);
00119 Core_data(const string,const string,CoreDebug*);
00122 Core_data(const string,const string,CoreManager*);
00125 Core_data(const string,const string,CorePool*);
00128 Core_data(const string,const string,CoreDb*);
00131 Core_data(const string,const string,CoreListener*);
00134 Core_data(const string,const string,CoreBundle*);
00137 Core_data(const string,const string,CoreBilling*);
00140 Core_data(const string,const string,CorePeer*);
00143 virtual ~Core_data();
00146 string name;
00149 string descr;
00152 string buildcf();
00155 virtual string buildcfstr(int)=0;
00158 virtual string applycf(char * const*mask,const string cmdname,const list<string>paramList,Command * cmd=NULL)throw (CmdErr)=0;
00161 string buildcf(int,string);
00162 };
00163
00168 class CoreData {
00171 list<Core_data*> core_;
00174 pthread_mutex_t Mutex_;
00177 void lock();
00180 void unlock();
00181 public:
00184 CoreData();
00187 ~CoreData();
00190 int size();
00193 Core_data *get(int);
00196 Core_data *get(const char*);
00197 Core_data *get(const string);
00200 string getn(int);
00203 string showcf(char*);
00206 char *writecf(char*,char*);
00209 string help();
00212 CoreAccess *getAccess();
00215 CoreDevice *getDevice();
00218 CoreDebug *getDebug();
00221 CoreManager *getManager();
00224 CorePool *getPool();
00227 CoreDb *getDb();
00230 CoreListener *getListener();
00233 CoreBundle *getBundle();
00236 CoreBilling *getBilling();
00239 CorePeer *getPeer();
00240 };
00241
00242 };
00243
00244 #endif //__COREDATA_H__