00001 #ifndef __GLOBALOBJECTS_H 00002 #define __GLOBALOBJECTS_H 00003 00004 #include "config.h" 00005 #include "catcher.h" 00006 #include "ServiceTable.h" 00007 #include "TransportLayer.h" 00008 #include "NetworkLayer.h" 00009 #include "Timer.h" 00010 #include "Interfaces.h" 00011 #include "CommandProcessor.h" 00012 #include "WebServer.h" 00013 #include "ProxyCommandProcessor.h" 00014 #include "HttpTestCommandProcessor.h" 00015 00016 #ifdef TEST 00017 #include "FileHandleCommandProcessor.h" 00018 #endif 00019 00020 class GlobalObjects { 00021 public: 00022 static GlobalObjects* instance(); 00023 static void destroy(); 00024 00025 Config* getConfig(); 00026 Catcher* getCatcher(); 00027 NetworkLayer* getNetworkLayer(); 00028 Interfaces* getInterfaces(); 00029 ProxyCommandProcessor* getProxyCommandProcessor(); 00030 TransportLayer* getTransportLayer(); 00031 ServiceTable* getServiceTable(); 00032 HttpTestCommandProcessor* getHttpTestCommandProcessor(); 00033 #ifdef TEST 00034 FileHandleCommandProcessor* getCli(); 00035 #endif 00036 00037 void setConfig(Config* config); 00038 void setCatcher(Catcher* catcher); 00039 void setNetworkLayer(NetworkLayer* networkLayer); 00040 void setInterfaces(Interfaces* interfaces); 00041 void setTransportLayer(TransportLayer* transportLayer); 00042 00043 private: 00044 GlobalObjects(); 00045 ~GlobalObjects(); 00046 void init(); 00047 void destroyImpl(); 00048 static GlobalObjects* m_globalObjects; 00049 static void initializeCommands(CommandProcessor* cp, HttpTestCommandProcessor* hcp); 00050 00051 Config* m_config; 00052 Catcher* m_catcher; 00053 NetworkLayer* m_networkLayer; 00054 Interfaces* m_interfaces; 00055 TransportLayer* m_transportLayer; 00056 WebServer* m_webServer; 00057 ProxyCommandProcessor* m_proxy; 00058 HttpTestCommandProcessor* m_httpTestProcessor; 00059 00060 #ifdef TEST 00061 FileHandleCommandProcessor* m_cli; 00062 #endif 00063 }; 00064 00065 #endif 00066