JackGlobalsClient.cpp

00001 /*
00002 Copyright (C) 2004-2006 Grame  
00003 
00004 This program is free software; you can redistribute it and/or modify
00005 it under the terms of the GNU General Public License as published by
00006 the Free Software Foundation; either version 2 of the License, or
00007 (at your option) any later version.
00008 
00009 This program is distributed in the hope that it will be useful,
00010 but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 GNU General Public License for more details.
00013 
00014 You should have received a copy of the GNU General Public License
00015 along with this program; if not, write to the Free Software
00016 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00017 
00018 */
00019 
00020 #include "JackGlobals.h"
00021 
00022 // OSX
00023 #if defined(__APPLE__)
00024 #include "JackCoreAudioDriver.h"
00025 #include "JackMachServerNotifyChannel.h"
00026 #include "JackMachNotifyChannel.h"
00027 #include "JackMachServerChannel.h"
00028 #include "JackMachClientChannel.h"
00029 #include "JackMachThread.h"
00030 #include "JackMachSemaphore.h"
00031 #include "JackProcessSync.h"
00032 #include "JackSocketServerNotifyChannel.h"
00033 #include "JackSocketNotifyChannel.h"
00034 #include "JackSocketServerChannel.h"
00035 #include "JackSocketClientChannel.h"
00036 #include "JackPosixThread.h"
00037 #include "JackPosixSemaphore.h"
00038 #include "JackFifo.h"
00039 #endif
00040 
00041 // WINDOWS
00042 #ifdef WIN32
00043 #include "JackWinProcessSync.h"
00044 #include "JackWinNamedPipeClientChannel.h"
00045 #include "JackWinEvent.h"
00046 #include "JackWinThread.h"
00047 #endif
00048 
00049 // LINUX
00050 #ifdef __linux__
00051 #include "JackAlsaDriver.h"
00052 #include "JackProcessSync.h"
00053 #include "JackSocketServerNotifyChannel.h"
00054 #include "JackSocketNotifyChannel.h"
00055 #include "JackSocketServerChannel.h"
00056 #include "JackSocketClientChannel.h"
00057 #include "JackPosixThread.h"
00058 #include "JackPosixSemaphore.h"
00059 #include "JackFifo.h"
00060 #endif
00061 
00062 
00063 using namespace std;
00064 
00065 namespace Jack
00066 {
00067 
00068 #ifdef WIN32
00069 
00070 JackSynchro* JackFactoryWindowsClient::MakeSynchro()
00071 {
00072     return new JackWinEvent();
00073 }
00074 
00075 JackServerNotifyChannelInterface* JackFactoryWindowsClient::MakeServerNotifyChannel()
00076 {
00077     return NULL;
00078 }
00079 // Not used
00080 JackClientChannelInterface* JackFactoryWindowsClient::MakeClientChannel()
00081 {
00082     return new JackWinNamedPipeClientChannel();
00083 }
00084 
00085 JackNotifyChannelInterface* JackFactoryWindowsClient::MakeNotifyChannel()
00086 {
00087     return NULL;
00088 }
00089 // Not used
00090 JackServerChannelInterface* JackFactoryWindowsClient::MakeServerChannel()
00091 {
00092     return NULL;
00093 }
00094 // Not used
00095 JackSyncInterface* JackFactoryWindowsClient::MakeInterProcessSync()
00096 {
00097     return new JackWinProcessSync();
00098 }
00099 
00100 JackThread* JackFactoryWindowsClient::MakeThread(JackRunnableInterface* runnable)
00101 {
00102     return new JackWinThread(runnable);
00103 }
00104 #endif
00105 
00106 #ifdef __linux__
00107 
00108 #if defined(SOCKET_RPC_POSIX_SEMA)
00109 JackSynchro* JackFactoryLinuxClient::MakeSynchro()
00110 {
00111     return new JackPosixSemaphore();
00112 }
00113 
00114 JackServerNotifyChannelInterface* JackFactoryLinuxClient::MakeServerNotifyChannel()
00115 {
00116     return NULL;
00117 }
00118 // Not used
00119 JackClientChannelInterface* JackFactoryLinuxClient::MakeClientChannel()
00120 {
00121     return new JackSocketClientChannel();
00122 }
00123 
00124 JackNotifyChannelInterface* JackFactoryLinuxClient::MakeNotifyChannel()
00125 {
00126     return NULL;
00127 }
00128 // Not used
00129 JackServerChannelInterface* JackFactoryLinuxClient::MakeServerChannel()
00130 {
00131     return NULL;
00132 }
00133 // Not used
00134 JackSyncInterface* JackFactoryLinuxClient::MakeInterProcessSync()
00135 {
00136     return new JackProcessSync();
00137 }
00138 
00139 JackThread* JackFactoryLinuxClient::MakeThread(JackRunnableInterface* runnable)
00140 {
00141     return new JackPosixThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS);
00142 }
00143 #endif
00144 
00145 #if defined(SOCKET_RPC_FIFO_SEMA)
00146 JackSynchro* JackFactoryLinuxClient::MakeSynchro()
00147 {
00148     return new JackFifo();
00149 }
00150 
00151 JackServerNotifyChannelInterface* JackFactoryLinuxClient::MakeServerNotifyChannel()
00152 {
00153     return NULL;
00154 }
00155 // Not used
00156 JackClientChannelInterface* JackFactoryLinuxClient::MakeClientChannel()
00157 {
00158     return new JackSocketClientChannel();
00159 }
00160 
00161 JackNotifyChannelInterface* JackFactoryLinuxClient::MakeNotifyChannel()
00162 {
00163     return NULL;
00164 }
00165 // Not used
00166 JackServerChannelInterface* JackFactoryLinuxClient::MakeServerChannel()
00167 {
00168     return NULL;
00169 }
00170 // Not used
00171 JackSyncInterface* JackFactoryLinuxClient::MakeInterProcessSync()
00172 {
00173     return new JackProcessSync();
00174 }
00175 
00176 JackThread* JackFactoryLinuxClient::MakeThread(JackRunnableInterface* runnable)
00177 {
00178     return new JackPosixThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS);
00179 }
00180 #endif
00181 
00182 #if defined(SOCKET_RPC_FIFO_SEMA_DUMMY)
00183 JackSynchro* JackFactoryLinuxClient::MakeSynchro()
00184 {
00185     return new JackFifo();
00186 }
00187 
00188 JackServerNotifyChannelInterface* JackFactoryLinuxClient::MakeServerNotifyChannel()
00189 {
00190     return NULL;
00191 }
00192 // Not used
00193 JackClientChannelInterface* JackFactoryLinuxClient::MakeClientChannel()
00194 {
00195     return new JackSocketClientChannel();
00196 }
00197 
00198 JackNotifyChannelInterface* JackFactoryLinuxClient::MakeNotifyChannel()
00199 {
00200     return NULL;
00201 }
00202 // Not used
00203 JackServerChannelInterface* JackFactoryLinuxClient::MakeServerChannel()
00204 {
00205     return NULL;
00206 }
00207 // Not used
00208 JackSyncInterface* JackFactoryLinuxClient::MakeInterProcessSync()
00209 {
00210     return new JackProcessSync();
00211 }
00212 
00213 JackThread* JackFactoryLinuxClient::MakeThread(JackRunnableInterface* runnable)
00214 {
00215     return new JackPosixThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS);
00216 }
00217 #endif
00218 
00219 #endif
00220 
00221 #if defined(__APPLE__)
00222 
00223 #if defined(MACH_RPC_MACH_SEMA) 
00224 // Mach RPC + Mach Semaphore
00225 JackSynchro* JackFactoryOSXClient::MakeSynchro()
00226 {
00227     return new JackMachSemaphore();
00228 }
00229 
00230 JackServerNotifyChannelInterface* JackFactoryOSXClient::MakeServerNotifyChannel()
00231 {
00232     return NULL;
00233 }
00234 // Not used
00235 JackClientChannelInterface* JackFactoryOSXClient::MakeClientChannel()
00236 {
00237     return new JackMachClientChannel();
00238 }
00239 
00240 JackNotifyChannelInterface* JackFactoryOSXClient::MakeNotifyChannel()
00241 {
00242     return NULL;
00243 }
00244 // Not used
00245 JackServerChannelInterface* JackFactoryOSXClient::MakeServerChannel()
00246 {
00247     return NULL;
00248 } // Not used
00249 
00250 JackSyncInterface* JackFactoryOSXClient::MakeInterProcessSync()
00251 {
00252     return new JackProcessSync();
00253 }
00254 
00255 JackThread* JackFactoryOSXClient::MakeThread(JackRunnableInterface* runnable)
00256 {
00257     return new JackMachThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS);
00258 }
00259 #endif
00260 
00261 #if defined(SOCKET_RPC_POSIX_SEMA) 
00262 // Socket RPC + Posix Semaphore
00263 JackSynchro* JackFactoryOSXClient::MakeSynchro()
00264 {
00265     return new JackPosixSemaphore();
00266 }
00267 
00268 JackServerNotifyChannelInterface* JackFactoryOSXClient::MakeServerNotifyChannel()
00269 {
00270     return NULL;
00271 }
00272 // Not used
00273 JackClientChannelInterface* JackFactoryOSXClient::MakeClientChannel()
00274 {
00275     return new JackSocketClientChannel();
00276 }
00277 
00278 JackNotifyChannelInterface* JackFactoryOSXClient::MakeNotifyChannel()
00279 {
00280     return NULL;
00281 }
00282 // Not used
00283 JackServerChannelInterface* JackFactoryOSXClient::MakeServerChannel()
00284 {
00285     return NULL;
00286 }
00287 // Not used
00288 JackSyncInterface* JackFactoryOSXClient::MakeInterProcessSync()
00289 {
00290     return new JackProcessSync();
00291 }
00292 
00293 JackThread* JackFactoryOSXClient::MakeThread(JackRunnableInterface* runnable)
00294 {
00295     return new JackMachThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS);
00296 }
00297 #endif
00298 
00299 #if defined(SOCKET_RPC_FIFO_SEMA) 
00300 // Socket RPC + Fifo Semaphore
00301 JackSynchro* JackFactoryOSXClient::MakeSynchro()
00302 {
00303     return new JackFifo();
00304 }
00305 
00306 JackServerNotifyChannelInterface* JackFactoryOSXClient::MakeServerNotifyChannel()
00307 {
00308     return NULL;
00309 }
00310 // Not used
00311 JackClientChannelInterface* JackFactoryOSXClient::MakeClientChannel()
00312 {
00313     return new JackSocketClientChannel();
00314 }
00315 
00316 JackNotifyChannelInterface* JackFactoryOSXClient::MakeNotifyChannel()
00317 {
00318     return NULL;
00319 }
00320 // Not used
00321 JackServerChannelInterface* JackFactoryOSXClient::MakeServerChannel()
00322 {
00323     return NULL;
00324 }
00325 // Not used
00326 JackSyncInterface* JackFactoryOSXClient::MakeInterProcessSync()
00327 {
00328     return new JackProcessSync();
00329 }
00330 
00331 JackThread* JackFactoryOSXClient::MakeThread(JackRunnableInterface* runnable)
00332 {
00333     return new JackMachThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS);
00334 }
00335 
00336 JackThread* JackFactoryOSXClient::MakeThread(JackRunnableInterface* runnable, int priority)
00337 {
00338     return new JackMachThread(runnable, false, priority, PTHREAD_CANCEL_ASYNCHRONOUS);
00339 }
00340 #endif
00341 
00342 #if defined(MACH_RPC_FIFO_SEMA) 
00343 // Mach RPC + Fifo Semaphore
00344 JackSynchro* JackFactoryOSXClient::MakeSynchro()
00345 {
00346     return new JackFifo();
00347 }
00348 
00349 JackServerNotifyChannelInterface* JackFactoryOSXClient::MakeServerNotifyChannel()
00350 {
00351     return NULL;
00352 }
00353 // Not used
00354 JackClientChannelInterface* JackFactoryOSXClient::MakeClientChannel()
00355 {
00356     return new JackMachClientChannel();
00357 }
00358 
00359 JackNotifyChannelInterface* JackFactoryOSXClient::MakeNotifyChannel()
00360 {
00361     return NULL;
00362 }
00363 // Not used
00364 JackServerChannelInterface* JackFactoryOSXClient::MakeServerChannel()
00365 {
00366     return NULL;
00367 }
00368 // Not used
00369 JackSyncInterface* JackFactoryOSXClient::MakeInterProcessSync()
00370 {
00371     return new JackProcessSync();
00372 }
00373 
00374 JackThread* JackFactoryOSXClient::MakeThread(JackRunnableInterface* runnable)
00375 {
00376     return new JackMachThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS);
00377 }
00378 #endif
00379 
00380 #if defined(MACH_RPC_POSIX_SEMA) 
00381 // Mach RPC + Posix Semaphore
00382 JackSynchro* JackFactoryOSXClient::MakeSynchro()
00383 {
00384     return new JackPosixSemaphore();
00385 }
00386 
00387 JackServerNotifyChannelInterface* JackFactoryOSXClient::MakeServerNotifyChannel()
00388 {
00389     return NULL;
00390 }
00391 // Not used
00392 JackClientChannelInterface* JackFactoryOSXClient::MakeClientChannel()
00393 {
00394     return new JackMachClientChannel();
00395 }
00396 
00397 JackNotifyChannelInterface* JackFactoryOSXClient::MakeNotifyChannel()
00398 {
00399     return NULL;
00400 }
00401 // Not used
00402 JackServerChannelInterface* JackFactoryOSXClient::MakeServerChannel()
00403 {
00404     return NULL;
00405 }
00406 // Not used
00407 JackSyncInterface* JackFactoryOSXClient::MakeInterProcessSync()
00408 {
00409     return new JackProcessSync();
00410 }
00411 
00412 JackThread* JackFactoryOSXClient::MakeThread(JackRunnableInterface* runnable)
00413 {
00414     return new JackMachThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS);
00415 }
00416 #endif
00417 
00418 #if defined SOCKET_RPC_MACH_SEMA 
00419 // Socket RPC + Mach Semaphore
00420 JackSynchro* JackFactoryOSXClient::MakeSynchro()
00421 {
00422     return new JackMachSemaphore();
00423 }
00424 
00425 JackServerNotifyChannelInterface* JackFactoryOSXClient::MakeServerNotifyChannel()
00426 {
00427     return NULL;
00428 }
00429 // Not used
00430 JackClientChannelInterface* JackFactoryOSXClient::MakeClientChannel()
00431 {
00432     return new JackSocketClientChannel();
00433 }
00434 
00435 JackNotifyChannelInterface* JackFactoryOSXClient::MakeNotifyChannel()
00436 {
00437     return NULL;
00438 }
00439 // Not used
00440 JackServerChannelInterface* JackFactoryOSXClient::MakeServerChannel()
00441 {
00442     return NULL;
00443 }
00444 // Not used
00445 JackSyncInterface* JackFactoryOSXClient::MakeInterProcessSync()
00446 {
00447     return new JackProcessSync();
00448 }
00449 
00450 JackThread* JackFactoryOSXClient::MakeThread(JackRunnableInterface* runnable)
00451 {
00452     return new JackMachThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS);
00453 }
00454 #endif
00455 
00456 #endif
00457 
00458 } // end of namespace
00459 
00460 

Generated on Wed Jan 10 11:42:45 2007 for Jackdmp by  doxygen 1.4.5