summaryrefslogtreecommitdiff
path: root/TAO/tao/Buffer_Allocator_T.h
blob: 59684723965597c3f6b803733cc8eca7e3d7f329 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/* -*- C++ -*- */

//=============================================================================
/**
 *  @file    Buffer_Allocator_T.h
 *
 *  $Id$
 *
 *  @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"

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 (void);
      virtual void release (handler_type *ptr);
    private:
      alloc_type* allocator_;
  };
}

#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "tao/Buffer_Allocator_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */

#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Buffer_Allocator_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */

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