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


Public Methods | |
| ACE_Shared_Memory_MM (void) | |
| Default constructor. More... | |
| 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. More... | |
| 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. More... | |
| 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. More... | |
| 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. More... | |
| const ACE_TCHAR * | filename (void) const |
| Return the name of file that is mapped (if any). More... | |
| virtual int | close (void) |
| Close down the shared memory segment. More... | |
| virtual int | remove (void) |
| Remove the shared memory segment and the underlying file. More... | |
| virtual void * | malloc (size_t size=0) |
| Create a new chuck of memory containing <size> bytes. More... | |
| virtual int | free (void *p) |
| Free a chuck of memory allocated by <ACE_Shared_Memory_MM::malloc>. More... | |
| virtual int | get_segment_size (void) const |
| Return the size of the shared memory segment. More... | |
| virtual ACE_HANDLE | get_id (void) const |
| Return the ID of the shared memory segment (i.e., an ACE_HANDLE). More... | |
| void | dump (void) const |
| Dump the state of an object. More... | |
Public Attributes | |
| ACE_ALLOC_HOOK_DECLARE | |
| Declare the dynamic allocation hooks. More... | |
Private Attributes | |
| ACE_Mem_Map | shared_memory_ |
| This version is implemented with memory-mapped files. More... | |
This class provides a very simple-minded shared memory manager. For more a powerful memory allocator please see <ACE_Malloc>.
Definition at line 35 of file Shared_Memory_MM.h.
|
|
Default constructor.
Definition at line 50 of file Shared_Memory_MM.cpp. References ACE_TRACE.
00051 {
00052 ACE_TRACE ("ACE_Shared_Memory_MM::ACE_Shared_Memory_MM");
00053 }
|
|
||||||||||||||||||||||||||||
|
Constructor.
Definition at line 23 of file Shared_Memory_MM.cpp. References ACE_TRACE.
00029 : shared_memory_ (handle, length, prot, share, addr, pos) 00030 { 00031 ACE_TRACE ("ACE_Shared_Memory_MM::ACE_Shared_Memory_MM"); 00032 } |
|
||||||||||||||||||||||||||||||||||||
|
Constructor.
Definition at line 34 of file Shared_Memory_MM.cpp. References ACE_TCHAR, and ACE_TRACE.
00042 : shared_memory_ (file_name, len, flags, mode, 00043 prot, share, addr, pos) 00044 { 00045 ACE_TRACE ("ACE_Shared_Memory_MM::ACE_Shared_Memory_MM"); 00046 } |
|
|
Close down the shared memory segment.
Implements ACE_Shared_Memory. Definition at line 63 of file Shared_Memory_MM.i. References ACE_TRACE, shared_memory_, and ACE_Mem_Map::unmap.
00064 {
00065 ACE_TRACE ("ACE_Shared_Memory_MM::close");
00066 return shared_memory_.unmap ();
00067 }
|
|
|
Dump the state of an object.
Definition at line 16 of file Shared_Memory_MM.cpp. References ACE_TRACE.
00017 {
00018 ACE_TRACE ("ACE_Shared_Memory_MM::dump");
00019 }
|
|
|
Return the name of file that is mapped (if any).
Definition at line 9 of file Shared_Memory_MM.i. References ACE_Mem_Map::filename, and shared_memory_.
00010 {
00011 return this->shared_memory_.filename ();
00012 }
|
|
|
Free a chuck of memory allocated by <ACE_Shared_Memory_MM::malloc>.
Implements ACE_Shared_Memory. Definition at line 86 of file Shared_Memory_MM.i. References ACE_TRACE.
00087 {
00088 ACE_TRACE ("ACE_Shared_Memory_MM::free");
00089 return p != 0;
00090 }
|
|
|
Return the ID of the shared memory segment (i.e., an ACE_HANDLE).
Implements ACE_Shared_Memory. Definition at line 79 of file Shared_Memory_MM.i. References ACE_TRACE, ACE_Mem_Map::handle, and shared_memory_.
00080 {
00081 ACE_TRACE ("ACE_Shared_Memory_MM::get_id");
00082 return this->shared_memory_.handle ();
00083 }
|
|
|
Return the size of the shared memory segment.
Implements ACE_Shared_Memory. Definition at line 44 of file Shared_Memory_MM.i. References ACE_TRACE.
00045 {
00046 ACE_TRACE ("ACE_Shared_Memory_MM::get_segment_size");
00047 // This cast is legit since the original length in open() is an int.
00048 return ACE_static_cast (int, this->shared_memory_.size ());
00049 }
|
|
|
Create a new chuck of memory containing <size> bytes.
Implements ACE_Shared_Memory. Definition at line 70 of file Shared_Memory_MM.i. References ACE_TRACE, and shared_memory_.
00071 {
00072 ACE_TRACE ("ACE_Shared_Memory_MM::malloc");
00073 void *addr;
00074
00075 return this->shared_memory_ (addr) == -1 ? 0 : addr;
00076 }
|
|
||||||||||||||||||||||||||||||||||||
|
Open method.
Definition at line 27 of file Shared_Memory_MM.i. References ACE_TCHAR, ACE_TRACE, ACE_Mem_Map::map, and shared_memory_.
00035 {
00036 ACE_TRACE ("ACE_Shared_Memory_MM::open");
00037 return shared_memory_.map (file_name, len, flags, mode,
00038 prot, share, addr, pos);
00039 }
|
|
||||||||||||||||||||||||||||
|
Open method.
Definition at line 15 of file Shared_Memory_MM.i. References ACE_TRACE, ACE_Mem_Map::map, and shared_memory_.
00021 {
00022 ACE_TRACE ("ACE_Shared_Memory_MM::open");
00023 return shared_memory_.map (handle, length, prot, share, addr, pos);
00024 }
|
|
|
Remove the shared memory segment and the underlying file.
Implements ACE_Shared_Memory. Definition at line 54 of file Shared_Memory_MM.i. References ACE_TRACE, ACE_Mem_Map::remove, and shared_memory_.
00055 {
00056 ACE_TRACE ("ACE_Shared_Memory_MM::remove");
00057 return shared_memory_.remove ();
00058 }
|
|
|
Declare the dynamic allocation hooks.
Definition at line 104 of file Shared_Memory_MM.h. |
|
|
This version is implemented with memory-mapped files.
Definition at line 108 of file Shared_Memory_MM.h. Referenced by close, filename, get_id, malloc, open, and remove. |
1.2.14 written by Dimitri van Heesch,
© 1997-2002