00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef SHAREDMEMC_H
00027 #define SHAREDMEMC_H
00028
00029 #include "oaw/misc/stringc.h"
00030
00031 #ifdef _WIN32
00032 #ifdef _AFXDLL
00033 #include <afx.h>
00034 #else
00035 #include <windows.h>
00036 #endif
00037 #else
00038 #include <sys/types.h>
00039 #define HANDLE int
00040 #endif
00041
00042 #include "../oawconfig.h"
00043
00044 OAW_BEGIN_NAMESPACE
00045
00046 class OAW_DLLMAPPING SharedMemC{
00047 public:
00048 SharedMemC();
00049
00050 SharedMemC(StringC, long);
00051 SharedMemC(const SharedMemC& shMem);
00052 virtual ~SharedMemC();
00053 char* Create(StringC, long);
00054 char* Open(StringC);
00055 char* ReOpen();
00056 inline short SizeChanged();
00057 long GetSize();
00058
00059 inline char& operator [](long i){
00060 return m_buf[sizeof(long)+i];
00061 }
00062 inline char* GetBuffer(){return &m_buf[sizeof(long)];}
00063
00064 const SharedMemC& operator = (const SharedMemC&);
00065 private:
00066
00067 char* m_buf;
00068 long m_size;
00069 HANDLE m_hMap;
00070 StringC m_name;
00071 #ifndef _Win32
00072 short m_owner;
00073 #endif
00074
00075 };
00076
00077 OAW_END_NAMESPACE
00078
00079
00080 #endif
00081
00082
00083
00084
00085