#include <MEM_SAP.h>
Inheritance diagram for ACE_MEM_SAP:


Public Types | |
| typedef ACE_Malloc_T< ACE_MMAP_MEMORY_POOL, ACE_Process_Mutex, ACE_PI_Control_Block > | MALLOC_TYPE |
| typedef ACE_MMAP_Memory_Pool_Options | MALLOC_OPTIONS |
Public Member Functions | |
| virtual | ~ACE_MEM_SAP (void) |
| Destructor. | |
| virtual int | init (ACE_HANDLE handle, const ACE_TCHAR *name, MALLOC_OPTIONS *options)=0 |
| virtual int | fini () |
| virtual ssize_t | recv_buf (ACE_MEM_SAP_Node *&buf, int flags, const ACE_Time_Value *timeout)=0 |
| virtual ssize_t | send_buf (ACE_MEM_SAP_Node *buf, int flags, const ACE_Time_Value *timeout)=0 |
| ACE_MEM_SAP_Node * | acquire_buffer (const ssize_t size) |
| int | release_buffer (ACE_MEM_SAP_Node *buf) |
| void | dump (void) const |
| Dump the state of an object. | |
Public Attributes | |
| ACE_ALLOC_HOOK_DECLARE | |
| Declare the dynamic allocation hooks. | |
Protected Member Functions | |
| int | create_shm_malloc (const ACE_TCHAR *name, MALLOC_OPTIONS *options) |
| int | close_shm_malloc (void) |
| ACE_MEM_SAP (void) | |
| Constructor. Prevent this class from being instantiated. | |
Protected Attributes | |
| ACE_HANDLE | handle_ |
| MALLOC_TYPE * | shm_malloc_ |
| Data exchange channel. | |
Definition at line 79 of file MEM_SAP.h.
|
|
Definition at line 85 of file MEM_SAP.h. Referenced by create_shm_malloc(), and ACE_MEM_IO::init(). |
|
|
Definition at line 84 of file MEM_SAP.h. Referenced by create_shm_malloc(), and ACE_MT_MEM_IO::Simple_Queue::init(). |
|
|
Destructor.
Definition at line 39 of file MEM_SAP.cpp. References shm_malloc_.
00040 {
00041 // ACE_TRACE ("ACE_MEM_SAP::~ACE_MEM_SAP");
00042 delete this->shm_malloc_;
00043 }
|
|
|
Constructor. Prevent this class from being instantiated.
Definition at line 32 of file MEM_SAP.cpp.
00033 : handle_ (ACE_INVALID_HANDLE), 00034 shm_malloc_ (0) 00035 { 00036 // ACE_TRACE ("ACE_MEM_SAP::ACE_MEM_SAP"); 00037 } |
|
|
request a buffer of size . Return 0 if the is not initialized. Definition at line 37 of file MEM_SAP.inl. References ACE_NEW_MALLOC_RETURN, ACE_TRACE, shm_malloc_, and ssize_t. Referenced by ACE_MEM_IO::send().
00038 {
00039 ACE_TRACE ("ACE_MEM_SAP::acquire_buffer");
00040 if (this->shm_malloc_ == 0)
00041 return 0; // not initialized.
00042
00043 ACE_MEM_SAP_Node *buf = 0;
00044
00045 ACE_NEW_MALLOC_RETURN (buf,
00046 static_cast<ACE_MEM_SAP_Node *>
00047 (this->shm_malloc_->malloc (sizeof (ACE_MEM_SAP_Node) + size)),
00048 ACE_MEM_SAP_Node (size),
00049 0);
00050 return buf;
00051 }
|
|
|
Close down the share memory pool. Clean up the mmap file if we are the last one using it. Definition at line 80 of file MEM_SAP.cpp. References ACE_TRACE, ACE_Malloc_T<, ACE_LOCK, ACE_CB >::release(), and shm_malloc_. Referenced by fini().
00081 {
00082 ACE_TRACE ("ACE_MEM_SAP::close_shm_malloc");
00083
00084 int retv = -1;
00085
00086 if (this->shm_malloc_ != 0)
00087 this->shm_malloc_->release (1);
00088
00089 delete this->shm_malloc_;
00090 this->shm_malloc_ = 0;
00091
00092 return retv;
00093 }
|
|
||||||||||||
|
Create a new shm_malloc object. Return 0 if succeed and -1 otherwise. This method should only be called from an acceptor class that wants to create a new memory pool for inter process communication. Definition at line 54 of file MEM_SAP.cpp. References ACE_NEW_RETURN, ACE_TCHAR, ACE_TRACE, ACE_Malloc_T<, ACE_LOCK, ACE_CB >::bad(), MALLOC_OPTIONS, MALLOC_TYPE, ACE_Malloc_T<, ACE_LOCK, ACE_CB >::remove(), and shm_malloc_. Referenced by ACE_MT_MEM_IO::init(), and ACE_Reactive_MEM_IO::init().
00056 {
00057 ACE_TRACE ("ACE_MEM_SAP::create_shm_malloc");
00058
00059 if (this->shm_malloc_ != 0)
00060 return -1; // already initialized.
00061
00062 ACE_NEW_RETURN (this->shm_malloc_,
00063 MALLOC_TYPE (name,
00064 0,
00065 options),
00066 -1);
00067
00068 if (this->shm_malloc_->bad () != 0)
00069 {
00070 this->shm_malloc_->remove (); // Cleanup OS resources
00071 delete this->shm_malloc_;
00072 this->shm_malloc_ = 0;
00073 return -1;
00074 }
00075
00076 return 0;
00077 }
|
|
|
Dump the state of an object.
Definition at line 18 of file MEM_SAP.cpp. References ACE_BEGIN_DUMP, ACE_DEBUG, ACE_END_DUMP, ACE_LIB_TEXT, ACE_TRACE, ACE_Malloc_T<, ACE_LOCK, ACE_CB >::dump(), LM_DEBUG, and shm_malloc_.
00019 {
00020 #if defined (ACE_HAS_DUMP)
00021 ACE_TRACE ("ACE_MEM_SAP::dump");
00022
00023 ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00024 if (this->shm_malloc_ != 0)
00025 this->shm_malloc_->dump ();
00026 else
00027 ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("ACE_MEM_SAP uninitialized.\n")));
00028 ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00029 #endif /* ACE_HAS_DUMP */
00030 }
|
|
|
Finalizing the MEM_SAP object. This method doesn't invoke the method. Definition at line 46 of file MEM_SAP.cpp. References ACE_TRACE, and close_shm_malloc(). Referenced by ACE_MEM_IO::fini().
00047 {
00048 ACE_TRACE ("ACE_MEM_SAP::fini");
00049
00050 return this->close_shm_malloc ();
00051 }
|
|
||||||||||||||||
|
Initialize the MEM_SAP object. Implemented in ACE_Reactive_MEM_IO, and ACE_MT_MEM_IO. Referenced by ACE_MEM_IO::init(). |
|
||||||||||||||||
|
Fetch location of next available data into . As this operation read the address of the data off the socket using ACE::recv, timeout only applies to ACE::recv. Implemented in ACE_Reactive_MEM_IO, and ACE_MT_MEM_IO. Referenced by ACE_MEM_IO::fetch_recv_buf(). |
|
|
release a buffer pointed by . Return -1 if the is not initialized. Definition at line 54 of file MEM_SAP.inl. References ACE_TRACE, ACE_Malloc_T<, ACE_LOCK, ACE_CB >::free(), and shm_malloc_. Referenced by ACE_MEM_IO::fetch_recv_buf(), ACE_MT_MEM_IO::send_buf(), and ACE_Reactive_MEM_IO::send_buf().
00055 {
00056 ACE_TRACE ("ACE_MEM_SAP::release_buffer");
00057 if (this->shm_malloc_ == 0)
00058 return -1; // not initialized.
00059
00060 this->shm_malloc_->free (buf);
00061 return 0;
00062 }
|
|
||||||||||||||||
|
Wait to to amount of time to send . If times out a -1 is returned with <errno == ETIME>. If it succeeds the number of bytes sent is returned. Implemented in ACE_Reactive_MEM_IO, and ACE_MT_MEM_IO. Referenced by ACE_MEM_IO::send(). |
|
|
Declare the dynamic allocation hooks.
|
|
|
|
|
|
Data exchange channel.
Definition at line 153 of file MEM_SAP.h. Referenced by acquire_buffer(), close_shm_malloc(), create_shm_malloc(), dump(), release_buffer(), and ~ACE_MEM_SAP(). |
1.3.6