sharelib/SharedSegment.h

Go to the documentation of this file.
00001 #ifndef SHARED_SEGMENT_H
00002 #define SHARED_SEGMENT_H
00003 
00012 #if !defined _LINUX && !defined _WIN32
00013 #  error "Platform was not specified. Add macro _LINUX or _WIN32 to compiler options."
00014 #endif
00015 
00016 #include "sharelib.h"
00017 
00018 #ifdef _WIN32
00019 #include <windows.h>
00020 #endif  // _WIN32
00021 
00022 namespace Share {
00023 #ifdef _WIN32
00024   typedef HANDLE SegmentId;   
00025 #endif  // _WIN32
00026 
00027 #ifdef _LINUX
00028   typedef int SegmentId;      
00029 #endif // _LINUX
00030 
00036   class SharedSegment {
00037     public:
00046       SHARE_EXPORT SharedSegment (const char *name, size_t size) throw (ShareException);
00047 
00054       SHARE_EXPORT SharedSegment (const char *name) throw (ShareException);
00055 
00059       SHARE_EXPORT ~SharedSegment () throw ();
00060 
00064       SHARE_EXPORT const char* name() const { return szName_; }
00065 
00069       SHARE_EXPORT void* atAddress () const { return atAddr_; }
00070 
00075       SHARE_EXPORT void destroy ();
00076 
00077     private:
00078       SharedSegment (const SharedSegment&);                 
00079       void operator= (const SharedSegment&);                
00080 
00081     private:
00082       SegmentId id_;
00083       char *szName_;
00084       void *atAddr_;
00085 
00086     private:
00087       void setName (const char *name);
00088       void attach ();
00089   };  // (class SharedSegment)
00090 
00091 } // (namespace Share)
00092 
00093 #endif // SHARED_SEGMENT_H

Generated on Sun Aug 26 17:42:59 2007 for ShareLibrary by  doxygen 1.5.2