LinuxShMem.h

Go to the documentation of this file.
00001 // ----------------------------------------------------------------------------
00002 //
00003 // $Id$
00004 //
00005 // Copyright 2008, 2009, 2010, 2011, 2012  Antonio Franchi and Paolo Stegagno    
00006 //
00007 // This file is part of MIP.
00008 //
00009 // MIP is free software: you can redistribute it and/or modify
00010 // it under the terms of the GNU General Public License as published by
00011 // the Free Software Foundation, either version 3 of the License, or
00012 // (at your option) any later version.
00013 //
00014 // MIP is distributed in the hope that it will be useful,
00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 // GNU General Public License for more details.
00018 //
00019 // You should have received a copy of the GNU General Public License
00020 // along with MIP. If not, see <http://www.gnu.org/licenses/>.
00021 //
00022 // Contact info: franchi@diag.uniroma1.it stegagno@diag.uniroma1.it
00023 //
00024 // ----------------------------------------------------------------------------
00025 
00026 
00027 
00028 
00035 
00039 
00041 /* @{ */
00042 
00043 #ifndef __LINUX_SH_MEM_UDP_
00044 #define __LINUX_SH_MEM_UDP_
00045 
00046 #include <stdlib.h>
00047 #include <stdio.h>
00048 #include <sys/types.h>
00049 #include <sys/ipc.h>
00050 #include <sys/shm.h>
00051 #include <semaphore.h>
00052 #include <ctype.h>
00053 #include <string.h>
00054 
00055 #include <baselib.h>
00056 
00057 struct ShMemSegment{
00058  char testString[10];
00059  int wrappLoopbacks[255];
00060 };
00061 
00062 class LinuxShMem : public MIPObject{
00063  private:
00064   int _shmid;
00065   ShMemSegment *_segptr;
00066  
00067 //   sem_t* _sem;
00068   
00069   stringstream _ssfatal;
00070   
00071   void _init();
00072   
00073   void _usage();
00074   void _write(char *text);
00075   void _changemode(char *mode); 
00076   void _read();
00077   
00078  public:
00080   LinuxShMem(int argc, char *argv[]);
00081   
00083   LinuxShMem();
00084   
00086   ~LinuxShMem();
00087   
00089   void remove();
00090 
00091 //   void setWrappNumAgents(int nA);
00092 //   int getWrappNumAgents();
00093 //   void incWrappNumAgents();
00094 //   void decWrappNumAgents();
00095 
00096   void regWrappLoopback(int loopback);
00097   int getWrappLoopback(int index);
00098   void resetWrappLoopback();
00099   
00100   string getObjectName() const {
00101    return string("LShMem");
00102   }
00103 };
00104 
00105 
00106 
00107 #endif
00108 
00109 
00110 /* @} */
00111 

Generated on Mon Feb 20 07:01:06 2017 for MIP by  doxygen 1.5.6