/* -*- C++ -*- */ // $Id$ // Malloc_T.i template ACE_INLINE T * ACE_Cached_Mem_Pool_Node::addr (void) { // This should be done using a single reinterpret_cast, but Sun/CC // (4.2) gets awfully confused when T is a char[20] (and maybe other // types). return ACE_static_cast (T *, ACE_static_cast (void *, this)); } template ACE_INLINE ACE_Cached_Mem_Pool_Node * ACE_Cached_Mem_Pool_Node::get_next (void) { return this->next_; } template ACE_INLINE void ACE_Cached_Mem_Pool_Node::set_next (ACE_Cached_Mem_Pool_Node *ptr) { this->next_ = ptr; } template ACE_INLINE void * ACE_Cached_Allocator::malloc (size_t nbytes) { // Check if size requested fits within pre-determined size. if (nbytes > sizeof (T)) return NULL; // addr() call is really not absolutely necessary because of the way // ACE_Cached_Mem_Pool_Node's internal structure arranged. return this->free_list_.remove ()->addr (); } template ACE_INLINE void ACE_Cached_Allocator::free (void * ptr) { this->free_list_.add ((ACE_Cached_Mem_Pool_Node *) ptr) ; } template ACE_INLINE void * ACE_Allocator_Adapter::malloc (size_t nbytes) { ACE_TRACE ("ACE_Allocator_Adapter::malloc"); return this->allocator_.malloc (nbytes); } template ACE_INLINE void * ACE_Allocator_Adapter::calloc (size_t nbytes, char initial_value) { ACE_TRACE ("ACE_Allocator_Adapter::malloc"); return this->allocator_.calloc (nbytes, initial_value); } template ACE_INLINE MALLOC & ACE_Allocator_Adapter::alloc (void) { ACE_TRACE ("ACE_Allocator_Adapter::allocator"); return this->allocator_; } template ACE_INLINE void ACE_Allocator_Adapter::free (void *ptr) { ACE_TRACE ("ACE_Allocator_Adapter::free"); this->allocator_.free (ptr); } template ACE_INLINE int ACE_Allocator_Adapter::remove (void) { ACE_TRACE ("ACE_Allocator_Adapter::remove"); return this->allocator_.remove (); } template ACE_INLINE int ACE_Allocator_Adapter::trybind (const char *name, void *&pointer) { ACE_TRACE ("ACE_Allocator_Adapter::trybind"); return this->allocator_.trybind (name, pointer); } template ACE_INLINE int ACE_Allocator_Adapter::bind (const char *name, void *pointer, int duplicates) { ACE_TRACE ("ACE_Allocator_Adapter::bind"); return this->allocator_.bind (name, pointer, duplicates); } template ACE_INLINE int ACE_Allocator_Adapter::find (const char *name, void *&pointer) { ACE_TRACE ("ACE_Allocator_Adapter::find"); return this->allocator_.find (name, pointer); } template ACE_INLINE int ACE_Allocator_Adapter::find (const char *name) { ACE_TRACE ("ACE_Allocator_Adapter::find"); return this->allocator_.find (name); } template ACE_INLINE int ACE_Allocator_Adapter::unbind (const char *name, void *&pointer) { ACE_TRACE ("ACE_Allocator_Adapter::unbind"); return this->allocator_.unbind (name, pointer); } template ACE_INLINE int ACE_Allocator_Adapter::unbind (const char *name) { ACE_TRACE ("ACE_Allocator_Adapter::unbind"); return this->allocator_.unbind (name); } template ACE_INLINE int ACE_Allocator_Adapter::sync (ssize_t len, int flags) { ACE_TRACE ("ACE_Allocator_Adapter::sync"); return this->allocator_.sync (len, flags); } template ACE_INLINE int ACE_Allocator_Adapter::sync (void *addr, size_t len, int flags) { ACE_TRACE ("ACE_Allocator_Adapter::sync"); return this->allocator_.sync (addr, len, flags); } template ACE_INLINE int ACE_Allocator_Adapter::protect (ssize_t len, int flags) { ACE_TRACE ("ACE_Allocator_Adapter::protect"); return this->allocator_.protect (len, flags); } template ACE_INLINE int ACE_Allocator_Adapter::protect (void *addr, size_t len, int flags) { ACE_TRACE ("ACE_Allocator_Adapter::protect"); return this->allocator_.protect (addr, len, flags); } template ACE_INLINE ACE_MEM_POOL & ACE_Malloc::memory_pool (void) { ACE_TRACE ("ACE_Malloc::memory_pool"); return this->memory_pool_; } template ACE_INLINE int ACE_Malloc::sync (ssize_t len, int flags) { ACE_TRACE ("ACE_Malloc::sync"); return this->memory_pool_.sync (len, flags); } template ACE_INLINE int ACE_Malloc::sync (void *addr, size_t len, int flags) { ACE_TRACE ("ACE_Malloc::sync"); return this->memory_pool_.sync (addr, len, flags); } template ACE_INLINE int ACE_Malloc::protect (ssize_t len, int flags) { ACE_TRACE ("ACE_Malloc::protect"); return this->memory_pool_.protect (len, flags); } template ACE_INLINE int ACE_Malloc::protect (void *addr, size_t len, int flags) { ACE_TRACE ("ACE_Malloc::protect"); return this->memory_pool_.protect (addr, len, flags); } template ACE_INLINE ACE_LOCK & ACE_Malloc::mutex (void) { return this->lock_; }