00001 /* -*- C++ -*- */ 00002 // $Id: MEM_SAP.i,v 1.1.1.3 2001/12/04 14:33:02 chad Exp $ 00003 00004 // MEM_SAP.i 00005 00006 00007 ASYS_INLINE 00008 ACE_MEM_SAP_Node::ACE_MEM_SAP_Node (size_t cap) 00009 : capacity_ (cap), 00010 size_ (0), 00011 next_ (0) 00012 { 00013 } 00014 00015 ASYS_INLINE size_t 00016 ACE_MEM_SAP_Node::size (void) const 00017 { 00018 return this->size_; 00019 } 00020 00021 ASYS_INLINE size_t 00022 ACE_MEM_SAP_Node::capacity (void) const 00023 { 00024 return this->capacity_; 00025 } 00026 00027 ASYS_INLINE void * 00028 ACE_MEM_SAP_Node::data (void) 00029 { 00030 return this + 1; 00031 } 00032 00033 ASYS_INLINE 00034 ACE_MEM_SAP::~ACE_MEM_SAP (void) 00035 { 00036 // ACE_TRACE ("ACE_MEM_SAP::~ACE_MEM_SAP"); 00037 delete this->shm_malloc_; 00038 } 00039 00040 00041 ASYS_INLINE ACE_MEM_SAP_Node * 00042 ACE_MEM_SAP::acquire_buffer (const ssize_t size) 00043 { 00044 ACE_TRACE ("ACE_MEM_SAP::acquire_buffer"); 00045 if (this->shm_malloc_ == 0) 00046 return 0; // not initialized. 00047 00048 ACE_MEM_SAP_Node *buf = 0; 00049 00050 ACE_NEW_MALLOC_RETURN (buf, 00051 ACE_static_cast (ACE_MEM_SAP_Node *, 00052 this->shm_malloc_->malloc (sizeof (ACE_MEM_SAP_Node) + size)), 00053 ACE_MEM_SAP_Node (size), 00054 0); 00055 return buf; 00056 } 00057 00058 ASYS_INLINE int 00059 ACE_MEM_SAP::release_buffer (ACE_MEM_SAP_Node *buf) 00060 { 00061 ACE_TRACE ("ACE_MEM_SAP::release_buffer"); 00062 if (this->shm_malloc_ == 0) 00063 return -1; // not initialized. 00064 00065 this->shm_malloc_->free (buf); 00066 return 0; 00067 }
1.2.14 written by Dimitri van Heesch,
© 1997-2002