Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tao / Buffer_Allocator_T.cpp
blobafe698ff1ffe592dfd521bc64b5731f7171d3f5c
1 #ifndef TAO_BUFFER_ALLOCATOR_T_CPP
2 #define TAO_BUFFER_ALLOCATOR_T_CPP
4 #include "tao/Buffer_Allocator_T.h"
5 #include "ace/Global_Macros.h"
8 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
10 namespace TAO
12 template <typename handler_type, typename alloc_type>
13 TAO_Buffer_Allocator<handler_type, alloc_type>::TAO_Buffer_Allocator (alloc_type *allocator) :
14 allocator_(allocator)
18 template <typename handler_type, typename alloc_type>
19 handler_type*
20 TAO_Buffer_Allocator<handler_type, alloc_type>::allocate ()
22 handler_type* myvalue = 0;
23 ACE_NEW_MALLOC_RETURN (myvalue,
24 static_cast <handler_type*>(
25 allocator_->malloc (sizeof (handler_type))),
26 handler_type (), 0);
28 return myvalue;
31 template <typename handler_type, typename alloc_type>
32 void
33 TAO_Buffer_Allocator<handler_type, alloc_type>::release (handler_type *ptr)
35 ACE_DES_FREE (ptr,
36 allocator_->free,
37 handler_type);
41 TAO_END_VERSIONED_NAMESPACE_DECL
43 #endif /* TAO_BUFFER_ALLOCATOR_T_CPP */