Go to the documentation of this file.00001
00002
00003 #ifndef TAO_BUFFER_ALLOCATOR_T_CPP
00004 #define TAO_BUFFER_ALLOCATOR_T_CPP
00005
00006 #include "tao/Buffer_Allocator_T.h"
00007 #include "ace/Global_Macros.h"
00008
00009
00010 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00011
00012 namespace TAO
00013 {
00014 template <typename handler_type, typename alloc_type>
00015 TAO_Buffer_Allocator<handler_type, alloc_type>::TAO_Buffer_Allocator (alloc_type *allocator) :
00016 allocator_(allocator)
00017 {
00018 }
00019
00020 template <typename handler_type, typename alloc_type>
00021 handler_type*
00022 TAO_Buffer_Allocator<handler_type, alloc_type>::allocate (void)
00023 {
00024 handler_type* myvalue = 0;
00025 ACE_NEW_MALLOC_RETURN (myvalue,
00026 static_cast <handler_type*>(
00027 allocator_->malloc (sizeof (handler_type))),
00028 handler_type (), 0);
00029
00030 return myvalue;
00031 }
00032
00033 template <typename handler_type, typename alloc_type>
00034 void
00035 TAO_Buffer_Allocator<handler_type, alloc_type>::release (handler_type *ptr)
00036 {
00037 ACE_DES_FREE (ptr,
00038 allocator_->free,
00039 handler_type);
00040 }
00041 }
00042
00043 TAO_END_VERSIONED_NAMESPACE_DECL
00044
00045 #endif