00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __JackGlobals__
00021 #define __JackGlobals__
00022
00023 #include "JackError.h"
00024
00025 namespace Jack
00026 {
00027
00028 class JackSynchro;
00029 class JackServerNotifyChannelInterface;
00030 class JackClientChannelInterface;
00031 class JackNotifyChannelInterface;
00032 class JackServerChannelInterface;
00033 class JackSyncInterface;
00034 class JackThread;
00035 class JackDriverClientInterface;
00036 class JackRunnableInterface;
00037 class JackEngine;
00038
00045 class JackFactoryImpl
00046 {
00047 public:
00048
00049 JackFactoryImpl()
00050 {}
00051 virtual ~JackFactoryImpl()
00052 {}
00053
00054 virtual JackSynchro* MakeSynchro() = 0;
00055 virtual JackServerNotifyChannelInterface* MakeServerNotifyChannel() = 0;
00056 virtual JackClientChannelInterface* MakeClientChannel() = 0;
00057 virtual JackNotifyChannelInterface* MakeNotifyChannel() = 0;
00058 virtual JackServerChannelInterface* MakeServerChannel() = 0;
00059 virtual JackSyncInterface* MakeInterProcessSync() = 0;
00060 virtual JackThread* MakeThread(JackRunnableInterface* runnable) = 0;
00061 };
00062
00063 #ifdef __linux__
00064
00065 class JackFactoryLinuxServer : public JackFactoryImpl
00066 {
00067 public:
00068
00069 JackFactoryLinuxServer()
00070 {}
00071 virtual ~JackFactoryLinuxServer()
00072 {}
00073
00074 JackSynchro* MakeSynchro();
00075 JackServerNotifyChannelInterface* MakeServerNotifyChannel();
00076 JackClientChannelInterface* MakeClientChannel();
00077 JackNotifyChannelInterface* MakeNotifyChannel();
00078 JackServerChannelInterface* MakeServerChannel();
00079 JackSyncInterface* MakeInterProcessSync();
00080 JackThread* MakeThread(JackRunnableInterface* runnable);
00081 };
00082
00083 class JackFactoryLinuxClient : public JackFactoryImpl
00084 {
00085 public:
00086
00087 JackFactoryLinuxClient()
00088 {}
00089 virtual ~JackFactoryLinuxClient()
00090 {}
00091
00092 JackSynchro* MakeSynchro();
00093 JackServerNotifyChannelInterface* MakeServerNotifyChannel();
00094 JackClientChannelInterface* MakeClientChannel();
00095 JackNotifyChannelInterface* MakeNotifyChannel();
00096 JackServerChannelInterface* MakeServerChannel();
00097 JackSyncInterface* MakeInterProcessSync();
00098 JackThread* MakeThread(JackRunnableInterface* runnable);
00099 };
00100
00101 #endif
00102
00103 #ifdef WIN32
00104
00105 class JackFactoryWindowsServer : public JackFactoryImpl
00106 {
00107 public:
00108
00109 JackFactoryWindowsServer()
00110 {}
00111 virtual ~JackFactoryWindowsServer()
00112 {}
00113
00114 JackSynchro* MakeSynchro();
00115 JackServerNotifyChannelInterface* MakeServerNotifyChannel();
00116 JackClientChannelInterface* MakeClientChannel();
00117 JackNotifyChannelInterface* MakeNotifyChannel();
00118 JackServerChannelInterface* MakeServerChannel();
00119 JackSyncInterface* MakeInterProcessSync();
00120 JackThread* MakeThread(JackRunnableInterface* runnable);
00121 };
00122
00123 class JackFactoryWindowsClient : public JackFactoryImpl
00124 {
00125 public:
00126
00127 JackFactoryWindowsClient()
00128 {}
00129 virtual ~JackFactoryWindowsClient()
00130 {}
00131
00132 JackSynchro* MakeSynchro();
00133 JackServerNotifyChannelInterface* MakeServerNotifyChannel();
00134 JackClientChannelInterface* MakeClientChannel();
00135 JackNotifyChannelInterface* MakeNotifyChannel();
00136 JackServerChannelInterface* MakeServerChannel();
00137 JackSyncInterface* MakeInterProcessSync();
00138 JackThread* MakeThread(JackRunnableInterface* runnable);
00139 };
00140
00141 #endif
00142
00143 #if defined(__APPLE__)
00144
00145 class JackFactoryOSXServer : public JackFactoryImpl
00146 {
00147 public:
00148
00149 JackFactoryOSXServer()
00150 {}
00151 virtual ~JackFactoryOSXServer()
00152 {}
00153
00154 JackSynchro* MakeSynchro();
00155 JackServerNotifyChannelInterface* MakeServerNotifyChannel();
00156 JackClientChannelInterface* MakeClientChannel();
00157 JackNotifyChannelInterface* MakeNotifyChannel();
00158 JackServerChannelInterface* MakeServerChannel();
00159 JackSyncInterface* MakeInterProcessSync();
00160 JackThread* MakeThread(JackRunnableInterface* runnable);
00161 };
00162
00163 class JackFactoryOSXClient : public JackFactoryImpl
00164 {
00165 public:
00166
00167 JackFactoryOSXClient()
00168 {}
00169 virtual ~JackFactoryOSXClient()
00170 {}
00171
00172 JackSynchro* MakeSynchro();
00173 JackServerNotifyChannelInterface* MakeServerNotifyChannel();
00174 JackClientChannelInterface* MakeClientChannel();
00175 JackNotifyChannelInterface* MakeNotifyChannel();
00176 JackServerChannelInterface* MakeServerChannel();
00177 JackSyncInterface* MakeInterProcessSync();
00178 JackThread* MakeThread(JackRunnableInterface* runnable);
00179 };
00180
00181 #endif
00182
00187 class JackGlobals
00188 {
00189 private:
00190
00191 static JackFactoryImpl* fInstance;
00192
00193 public:
00194
00195 JackGlobals()
00196 {}
00197 virtual ~JackGlobals()
00198 {}
00199
00200 static JackSynchro* MakeSynchro()
00201 {
00202 return fInstance->MakeSynchro();
00203 }
00204 static JackServerNotifyChannelInterface* MakeServerNotifyChannel()
00205 {
00206 return fInstance->MakeServerNotifyChannel();
00207 }
00208 static JackClientChannelInterface* MakeClientChannel()
00209 {
00210 return fInstance->MakeClientChannel();
00211 }
00212 static JackNotifyChannelInterface* MakeNotifyChannel()
00213 {
00214 return fInstance->MakeNotifyChannel();
00215 }
00216 static JackServerChannelInterface* MakeServerChannel()
00217 {
00218 return fInstance->MakeServerChannel();
00219 }
00220 static JackSyncInterface* MakeInterProcessSync()
00221 {
00222 return fInstance->MakeInterProcessSync();
00223 }
00224 static JackThread* MakeThread(JackRunnableInterface* runnable)
00225 {
00226 return fInstance->MakeThread(runnable);
00227 }
00228
00229 static void InitServer()
00230 {
00231 JackLog("JackGlobals InitServer\n");
00232 if (!fInstance) {
00233
00234 #ifdef __APPLE__
00235 fInstance = new JackFactoryOSXServer();
00236 #endif
00237
00238 #ifdef WIN32
00239 fInstance = new JackFactoryWindowsServer();
00240 #endif
00241
00242 #ifdef __linux__
00243 fInstance = new JackFactoryLinuxServer();
00244 #endif
00245
00246 }
00247 }
00248
00249 static void InitClient()
00250 {
00251 JackLog("JackGlobals InitClient\n");
00252 if (!fInstance) {
00253
00254 #ifdef __APPLE__
00255 fInstance = new JackFactoryOSXClient();
00256 #endif
00257
00258 #ifdef WIN32
00259 fInstance = new JackFactoryWindowsClient();
00260 #endif
00261
00262 #ifdef __linux__
00263 fInstance = new JackFactoryLinuxClient();
00264 #endif
00265
00266 }
00267 }
00268
00269 static void Destroy()
00270 {
00271 JackLog("JackGlobals Destroy\n");
00272 if (fInstance) {
00273 delete fInstance;
00274 fInstance = NULL;
00275 }
00276 }
00277
00278 };
00279
00280 }
00281
00282 #endif