00001 /*******************************************************************\ 00002 00003 SESAME project software license 00004 00005 Copyright (C) 2002, 2003 University of Amsterdam 00006 00007 This program is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU General Public License 00009 as published by the Free Software Foundation; either version 2 00010 of the License, or (at your option) any later version. 00011 00012 This program is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with this program; if not, write to the Free Software 00019 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 00020 02111-1307, USA. 00021 00022 For information regarding the SESAME software project see 00023 http://sesamesim.sourceforge.net or email 00024 jcofflan@users.sourceforge.net 00025 00026 \*******************************************************************/ 00027 00028 #ifndef BASICIPCMSGQUEUE_H 00029 #define BASICIPCMSGQUEUE_H 00030 00031 #include <sys/types.h> 00032 00033 #include "basiccleanuphandler.h" 00034 00035 class BasicIPCMsgQueue { 00036 key_t key; 00037 int id; 00038 bool amOwner; 00039 00040 BasicCleanupFunctor<BasicIPCMsgQueue> cleanupFunctor; 00041 00042 public: 00043 BasicIPCMsgQueue(); 00044 virtual ~BasicIPCMsgQueue(); 00045 00046 virtual bool open(key_t key, unsigned int mode = 0666); 00047 virtual key_t create(key_t key, unsigned int mode = 0666); 00048 virtual void close(); 00049 00050 virtual bool isOpen(); 00051 virtual bool isOwner() {return amOwner;} 00052 00053 virtual bool send(void *msgp, size_t size, bool blocking = true); 00054 virtual size_t receive(void *msgp, size_t size, bool blocking = true); 00055 }; 00056 #endif