s/Uint/UInt/g
[ACE_TAO.git] / TAO / tao / Bounded_Reference_Allocation_Traits_T.h
blob444258197ac109b14457d7a4f4634b6e0f24640f
1 #ifndef guard_bounded_reference_allocation_traits_hpp
2 #define guard_bounded_reference_allocation_traits_hpp
3 /**
4 * @file
6 * @brief Details can be found in the documentation for
7 * TAO::details::generic_sequence
9 * @author Carlos O'Ryan
12 #include "tao/Basic_Types.h"
14 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
16 namespace TAO
18 namespace details
21 template<typename T, class ref_traits, CORBA::ULong MAX, bool dummy>
22 struct bounded_reference_allocation_traits
24 typedef T value_type;
25 typedef ref_traits reference_traits;
27 inline static CORBA::ULong default_maximum()
29 return MAX;
32 inline static value_type * default_buffer_allocation()
34 return 0;
37 inline static value_type * allocbuf(CORBA::ULong /* maximum */)
39 value_type * buffer = new value_type[MAX];
40 // no throw
41 reference_traits::initialize_range(buffer, buffer + MAX);
43 return buffer;
46 inline static value_type * allocbuf_noinit(CORBA::ULong /* maximum */)
48 value_type * buffer = new value_type[MAX];
49 // no throw
50 reference_traits::zero_range(buffer, buffer + MAX);
52 return buffer;
55 inline static void freebuf(value_type * buffer)
57 reference_traits::release_range(buffer, buffer + MAX);
58 delete[] buffer;
61 inline static CORBA::ULong maximum()
63 return MAX;
67 } // namespace details
68 } // namespace TAO
70 TAO_END_VERSIONED_NAMESPACE_DECL
72 #endif // guard_bounded_reference_allocation_traits_hpp