Jack2 1.9.6

JackMachPort.h

00001 /*
00002 Copyright (C) 2004-2008 Grame
00003 
00004 This program is free software; you can redistribute it and/or modify
00005 it under the terms of the GNU Lesser General Public License as published by
00006 the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
00013 
00014 You should have received a copy of the GNU Lesser General Public License
00015 along with this program; if not, write to the Free Software 
00016 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00017 
00018 */
00019 
00020 #ifndef __JackMachPort__
00021 #define __JackMachPort__
00022 
00023 #include <mach/mach.h>
00024 #include <mach/mach_types.h>
00025 #include <mach/message.h>
00026 #include <mach/mach_error.h>
00027 #include <servers/bootstrap.h>
00028 
00029 namespace Jack
00030 {
00031 
00036 class JackMachPort
00037 {
00038 
00039     protected:
00040 
00041         mach_port_t fBootPort;
00042         mach_port_t fServerPort;
00043 
00044     public:
00045 
00046         JackMachPort():fBootPort(0), fServerPort(0)
00047         {}
00048         virtual ~JackMachPort()
00049         {}
00050 
00051         virtual bool AllocatePort(const char* name);
00052         virtual bool AllocatePort(const char* name, int queue);
00053         virtual bool ConnectPort(const char* name);
00054         virtual bool DisconnectPort();
00055         virtual bool DestroyPort();
00056         virtual mach_port_t GetPort();
00057 };
00058 
00063 class JackMachPortSet : public JackMachPort
00064 {
00065 
00066     private:
00067 
00068         mach_port_t fPortSet;
00069 
00070     public:
00071 
00072         JackMachPortSet():fPortSet(0)
00073         {}
00074         virtual ~JackMachPortSet()
00075         {}
00076 
00077         bool AllocatePort(const char* name);
00078         bool AllocatePort(const char* name, int queue);
00079         bool DisconnectPort();
00080         bool DestroyPort();
00081         mach_port_t GetPortSet();
00082         mach_port_t AddPort();
00083 };
00084 
00085 } // end of namespace
00086 
00087 #endif
00088