/* -*- C++ -*- */

//=============================================================================
/**
 *  @file    Buffer_Allocator_T.h
 *
 *  @author Johnny Willemsen (jwillemsen@remedy.nl)
 */
//=============================================================================

#ifndef TAO_BUFFER_ALLOCATOR_T_H
#define TAO_BUFFER_ALLOCATOR_T_H

#include /**/ "ace/pre.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#include "tao/Allocator.h"

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

namespace TAO
{
  /**
   * @class TAO_Buffer_Allocator
   *
   * @brief Generic buffer allocator for TAO
   *
   * handler_type is the type of object to allocator, alloc_type is the type
   * of allocator to be used to allocate the object.
   */
  template <typename handler_type, typename alloc_type>
  class TAO_Buffer_Allocator : public TAO_Allocator<handler_type>
  {
    public:
      typedef handler_type HANDLER_TYPE;
      typedef alloc_type ALLOC_TYPE;
      TAO_Buffer_Allocator (alloc_type *allocator);

      virtual handler_type *allocate ();
      virtual void release (handler_type *ptr);
    private:
      alloc_type* allocator_;
  };
}

TAO_END_VERSIONED_NAMESPACE_DECL

#include "tao/Buffer_Allocator_T.cpp"

#include /**/ "ace/post.h"
#endif /* TAO_BUFFER_ALLOCATOR_T_H */
