MEM_SAP.inl

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // MEM_SAP.inl,v 4.3 2005/10/28 16:14:53 ossama Exp
00004 
00005 #include "ace/RW_Thread_Mutex.h"
00006 
00007 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00008 
00009 ACE_INLINE
00010 ACE_MEM_SAP_Node::ACE_MEM_SAP_Node (size_t cap)
00011   : capacity_ (cap),
00012     size_ (0),
00013     next_ (0)
00014 {
00015 }
00016 
00017 ACE_INLINE size_t
00018 ACE_MEM_SAP_Node::size (void) const
00019 {
00020   return this->size_;
00021 }
00022 
00023 ACE_INLINE size_t
00024 ACE_MEM_SAP_Node::capacity (void) const
00025 {
00026   return this->capacity_;
00027 }
00028 
00029 ACE_INLINE void *
00030 ACE_MEM_SAP_Node::data (void)
00031 {
00032   return  this + 1;
00033 }
00034 
00035 
00036 ACE_INLINE ACE_MEM_SAP_Node *
00037 ACE_MEM_SAP::acquire_buffer (const ssize_t size)
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 }
00052 
00053 ACE_INLINE int
00054 ACE_MEM_SAP::release_buffer (ACE_MEM_SAP_Node *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 }
00063 
00064 ACE_END_VERSIONED_NAMESPACE_DECL

Generated on Thu Nov 9 09:41:55 2006 for ACE by doxygen 1.3.6