2 Copyright (C) 2004-2006 Grame
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef __JackGlobals__
21 #define __JackGlobals__
23 #include "JackError.h"
29 class JackServerNotifyChannelInterface
;
30 class JackClientChannelInterface
;
31 class JackNotifyChannelInterface
;
32 class JackServerChannelInterface
;
33 class JackSyncInterface
;
35 class JackDriverClientInterface
;
36 class JackRunnableInterface
;
40 \brief Factory description
42 \totdo possibly use in a dynamic way to test different communication/synchro implementations.
51 virtual ~JackFactoryImpl()
54 virtual JackSynchro
* MakeSynchro() = 0;
55 virtual JackServerNotifyChannelInterface
* MakeServerNotifyChannel() = 0;
56 virtual JackClientChannelInterface
* MakeClientChannel() = 0;
57 virtual JackNotifyChannelInterface
* MakeNotifyChannel() = 0;
58 virtual JackServerChannelInterface
* MakeServerChannel() = 0;
59 virtual JackSyncInterface
* MakeInterProcessSync() = 0;
60 virtual JackThread
* MakeThread(JackRunnableInterface
* runnable
) = 0;
65 class JackFactoryLinuxServer
: public JackFactoryImpl
69 JackFactoryLinuxServer()
71 virtual ~JackFactoryLinuxServer()
74 JackSynchro
* MakeSynchro();
75 JackServerNotifyChannelInterface
* MakeServerNotifyChannel();
76 JackClientChannelInterface
* MakeClientChannel();
77 JackNotifyChannelInterface
* MakeNotifyChannel();
78 JackServerChannelInterface
* MakeServerChannel();
79 JackSyncInterface
* MakeInterProcessSync();
80 JackThread
* MakeThread(JackRunnableInterface
* runnable
);
83 class JackFactoryLinuxClient
: public JackFactoryImpl
87 JackFactoryLinuxClient()
89 virtual ~JackFactoryLinuxClient()
92 JackSynchro
* MakeSynchro();
93 JackServerNotifyChannelInterface
* MakeServerNotifyChannel();
94 JackClientChannelInterface
* MakeClientChannel();
95 JackNotifyChannelInterface
* MakeNotifyChannel();
96 JackServerChannelInterface
* MakeServerChannel();
97 JackSyncInterface
* MakeInterProcessSync();
98 JackThread
* MakeThread(JackRunnableInterface
* runnable
);
105 class JackFactoryWindowsServer
: public JackFactoryImpl
109 JackFactoryWindowsServer()
111 virtual ~JackFactoryWindowsServer()
114 JackSynchro
* MakeSynchro();
115 JackServerNotifyChannelInterface
* MakeServerNotifyChannel();
116 JackClientChannelInterface
* MakeClientChannel();
117 JackNotifyChannelInterface
* MakeNotifyChannel();
118 JackServerChannelInterface
* MakeServerChannel();
119 JackSyncInterface
* MakeInterProcessSync();
120 JackThread
* MakeThread(JackRunnableInterface
* runnable
);
123 class JackFactoryWindowsClient
: public JackFactoryImpl
127 JackFactoryWindowsClient()
129 virtual ~JackFactoryWindowsClient()
132 JackSynchro
* MakeSynchro();
133 JackServerNotifyChannelInterface
* MakeServerNotifyChannel();
134 JackClientChannelInterface
* MakeClientChannel();
135 JackNotifyChannelInterface
* MakeNotifyChannel();
136 JackServerChannelInterface
* MakeServerChannel();
137 JackSyncInterface
* MakeInterProcessSync();
138 JackThread
* MakeThread(JackRunnableInterface
* runnable
);
143 #if defined(__APPLE__)
145 class JackFactoryOSXServer
: public JackFactoryImpl
149 JackFactoryOSXServer()
151 virtual ~JackFactoryOSXServer()
154 JackSynchro
* MakeSynchro();
155 JackServerNotifyChannelInterface
* MakeServerNotifyChannel();
156 JackClientChannelInterface
* MakeClientChannel();
157 JackNotifyChannelInterface
* MakeNotifyChannel();
158 JackServerChannelInterface
* MakeServerChannel();
159 JackSyncInterface
* MakeInterProcessSync();
160 JackThread
* MakeThread(JackRunnableInterface
* runnable
);
163 class JackFactoryOSXClient
: public JackFactoryImpl
167 JackFactoryOSXClient()
169 virtual ~JackFactoryOSXClient()
172 JackSynchro
* MakeSynchro();
173 JackServerNotifyChannelInterface
* MakeServerNotifyChannel();
174 JackClientChannelInterface
* MakeClientChannel();
175 JackNotifyChannelInterface
* MakeNotifyChannel();
176 JackServerChannelInterface
* MakeServerChannel();
177 JackSyncInterface
* MakeInterProcessSync();
178 JackThread
* MakeThread(JackRunnableInterface
* runnable
);
184 \brief Factory for OS specific ressources.
191 static JackFactoryImpl
* fInstance
;
197 virtual ~JackGlobals()
200 static JackSynchro
* MakeSynchro()
202 return fInstance
->MakeSynchro();
204 static JackServerNotifyChannelInterface
* MakeServerNotifyChannel()
206 return fInstance
->MakeServerNotifyChannel();
208 static JackClientChannelInterface
* MakeClientChannel()
210 return fInstance
->MakeClientChannel();
212 static JackNotifyChannelInterface
* MakeNotifyChannel()
214 return fInstance
->MakeNotifyChannel();
216 static JackServerChannelInterface
* MakeServerChannel()
218 return fInstance
->MakeServerChannel();
220 static JackSyncInterface
* MakeInterProcessSync()
222 return fInstance
->MakeInterProcessSync();
224 static JackThread
* MakeThread(JackRunnableInterface
* runnable
)
226 return fInstance
->MakeThread(runnable
);
229 static void InitServer()
231 JackLog("JackGlobals InitServer\n");
235 fInstance
= new JackFactoryOSXServer();
239 fInstance
= new JackFactoryWindowsServer();
243 fInstance
= new JackFactoryLinuxServer();
249 static void InitClient()
251 JackLog("JackGlobals InitClient\n");
255 fInstance
= new JackFactoryOSXClient();
259 fInstance
= new JackFactoryWindowsClient();
263 fInstance
= new JackFactoryLinuxClient();
269 static void Destroy()
271 JackLog("JackGlobals Destroy\n");
280 } // end of namespace