#include <Shared_Memory_MM.h>
Inheritance diagram for ACE_Shared_Memory_MM:


Public Member Functions | |
| ACE_Shared_Memory_MM (void) | |
| Default constructor. | |
| ACE_Shared_Memory_MM (ACE_HANDLE handle, int length=-1, int prot=PROT_RDWR, int share=ACE_MAP_PRIVATE, char *addr=0, off_t pos=0) | |
| Constructor. | |
| ACE_Shared_Memory_MM (const ACE_TCHAR *file_name, int len=-1, int flags=O_RDWR|O_CREAT, int mode=ACE_DEFAULT_FILE_PERMS, int prot=PROT_RDWR, int share=ACE_MAP_SHARED, char *addr=0, off_t pos=0) | |
| Constructor. | |
| int | open (ACE_HANDLE handle, int length=-1, int prot=PROT_RDWR, int share=ACE_MAP_PRIVATE, char *addr=0, off_t pos=0) |
| Open method. | |
| int | open (const ACE_TCHAR *file_name, int len=-1, int flags=O_RDWR|O_CREAT, int mode=ACE_DEFAULT_FILE_PERMS, int prot=PROT_RDWR, int share=ACE_MAP_SHARED, char *addr=0, off_t pos=0) |
| Open method. | |
| const ACE_TCHAR * | filename (void) const |
| Return the name of file that is mapped (if any). | |
| virtual int | close (void) |
| Close down the shared memory segment. | |
| virtual int | remove (void) |
| Remove the shared memory segment and the underlying file. | |
| virtual void * | malloc (size_t size=0) |
| Create a new chuck of memory containing bytes. | |
| virtual int | free (void *p) |
| virtual int | get_segment_size (void) const |
| Return the size of the shared memory segment. | |
| virtual ACE_HANDLE | get_id (void) const |
| Return the ID of the shared memory segment (i.e., an ACE_HANDLE). | |
| void | dump (void) const |
| Dump the state of an object. | |
Public Attributes | |
| ACE_ALLOC_HOOK_DECLARE | |
| Declare the dynamic allocation hooks. | |
Private Attributes | |
| ACE_Mem_Map | shared_memory_ |
| This version is implemented with memory-mapped files. | |
This class provides a very simple-minded shared memory manager. We strongly recommend that you do NOT use this class. Instead, please use ACE_Malloc, which has much more powerful capabilities.
Definition at line 37 of file Shared_Memory_MM.h.
|
|
Default constructor.
Definition at line 55 of file Shared_Memory_MM.cpp. References ACE_TRACE.
00056 {
00057 ACE_TRACE ("ACE_Shared_Memory_MM::ACE_Shared_Memory_MM");
00058 }
|
|
||||||||||||||||||||||||||||
|
Constructor.
Definition at line 28 of file Shared_Memory_MM.cpp. References ACE_TRACE.
00034 : shared_memory_ (handle, length, prot, share, addr, pos) 00035 { 00036 ACE_TRACE ("ACE_Shared_Memory_MM::ACE_Shared_Memory_MM"); 00037 } |
|
||||||||||||||||||||||||||||||||||||
|
Constructor.
Definition at line 39 of file Shared_Memory_MM.cpp. References ACE_TCHAR, and ACE_TRACE.
00047 : shared_memory_ (file_name, len, flags, mode, 00048 prot, share, addr, pos) 00049 { 00050 ACE_TRACE ("ACE_Shared_Memory_MM::ACE_Shared_Memory_MM"); 00051 } |
|
|
Close down the shared memory segment.
Implements ACE_Shared_Memory. Definition at line 82 of file Shared_Memory_MM.cpp. References ACE_TRACE, shared_memory_, and ACE_Mem_Map::unmap().
00083 {
00084 ACE_TRACE ("ACE_Shared_Memory_MM::close");
00085 return shared_memory_.unmap ();
00086 }
|
|
|
Dump the state of an object.
Definition at line 19 of file Shared_Memory_MM.cpp. References ACE_TRACE.
00020 {
00021 #if defined (ACE_HAS_DUMP)
00022 ACE_TRACE ("ACE_Shared_Memory_MM::dump");
00023 #endif /* ACE_HAS_DUMP */
00024 }
|
|
|
Return the name of file that is mapped (if any).
Definition at line 10 of file Shared_Memory_MM.inl. References ACE_Mem_Map::filename(), and shared_memory_.
00011 {
00012 return this->shared_memory_.filename ();
00013 }
|
|
|
Free a chuck of memory allocated by <ACE_Shared_Memory_MM::malloc>. Implements ACE_Shared_Memory. Definition at line 105 of file Shared_Memory_MM.cpp. References ACE_TRACE.
00106 {
00107 ACE_TRACE ("ACE_Shared_Memory_MM::free");
00108 return p != 0;
00109 }
|
|
|
Return the ID of the shared memory segment (i.e., an ACE_HANDLE).
Implements ACE_Shared_Memory. Definition at line 98 of file Shared_Memory_MM.cpp. References ACE_TRACE, ACE_Mem_Map::handle(), and shared_memory_.
00099 {
00100 ACE_TRACE ("ACE_Shared_Memory_MM::get_id");
00101 return this->shared_memory_.handle ();
00102 }
|
|
|
Return the size of the shared memory segment.
Implements ACE_Shared_Memory. Definition at line 63 of file Shared_Memory_MM.cpp. References ACE_TRACE, shared_memory_, and ACE_Mem_Map::size().
00064 {
00065 ACE_TRACE ("ACE_Shared_Memory_MM::get_segment_size");
00066 // This cast is legit since the original length in open() is an int.
00067 return static_cast<int> (this->shared_memory_.size ());
00068 }
|
|
|
Create a new chuck of memory containing bytes.
Implements ACE_Shared_Memory. Definition at line 89 of file Shared_Memory_MM.cpp. References ACE_TRACE, and shared_memory_.
00090 {
00091 ACE_TRACE ("ACE_Shared_Memory_MM::malloc");
00092 void *addr = 0;
00093
00094 return this->shared_memory_ (addr) == -1 ? 0 : addr;
00095 }
|
|
||||||||||||||||||||||||||||||||||||
|
Open method.
Definition at line 28 of file Shared_Memory_MM.inl. References ACE_TCHAR, ACE_TRACE, ACE_Mem_Map::map(), and shared_memory_.
00036 {
00037 ACE_TRACE ("ACE_Shared_Memory_MM::open");
00038 return shared_memory_.map (file_name, len, flags, mode,
00039 prot, share, addr, pos);
00040 }
|
|
||||||||||||||||||||||||||||
|
Open method.
Definition at line 16 of file Shared_Memory_MM.inl. References ACE_TRACE, ACE_Mem_Map::map(), and shared_memory_.
00022 {
00023 ACE_TRACE ("ACE_Shared_Memory_MM::open");
00024 return shared_memory_.map (handle, length, prot, share, addr, pos);
00025 }
|
|
|
Remove the shared memory segment and the underlying file.
Implements ACE_Shared_Memory. Definition at line 73 of file Shared_Memory_MM.cpp. References ACE_TRACE, ACE_Mem_Map::remove(), and shared_memory_.
00074 {
00075 ACE_TRACE ("ACE_Shared_Memory_MM::remove");
00076 return shared_memory_.remove ();
00077 }
|
|
|
Declare the dynamic allocation hooks.
Definition at line 106 of file Shared_Memory_MM.h. |
|
|
This version is implemented with memory-mapped files.
Definition at line 110 of file Shared_Memory_MM.h. Referenced by close(), filename(), get_id(), get_segment_size(), malloc(), open(), and remove(). |
1.3.6