diff options
Diffstat (limited to 'TAO/tao/Bounded_Value_Allocation_Traits_T.h')
-rw-r--r-- | TAO/tao/Bounded_Value_Allocation_Traits_T.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/TAO/tao/Bounded_Value_Allocation_Traits_T.h b/TAO/tao/Bounded_Value_Allocation_Traits_T.h new file mode 100644 index 00000000000..aa94641e539 --- /dev/null +++ b/TAO/tao/Bounded_Value_Allocation_Traits_T.h @@ -0,0 +1,60 @@ +#ifndef guard_bounded_value_allocation_traits_hpp +#define guard_bounded_value_allocation_traits_hpp +/** + * @file + * + * @brief Details can be found in the documentation for + * TAO::details::generic_sequence + * + * $Id$ + * + * @author Carlos O'Ryan + */ + +#include "tao/Basic_Types.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ +namespace details +{ + +template<typename T, CORBA::ULong MAX, bool dummy> +struct bounded_value_allocation_traits +{ + typedef T value_type; + + inline static CORBA::ULong default_maximum() + { + return MAX; + } + + inline static value_type * default_buffer_allocation() + { + return allocbuf(MAX); + } + + inline static value_type * allocbuf(CORBA::ULong /* maximum */) + { + return new value_type[MAX]; + } + + inline static void freebuf(value_type * buffer) + { + delete[] buffer; + } + + inline static CORBA::ULong maximum() + { + return MAX; + } + /* static CORBA::ULong const MAXIMUM = MAX; */ +}; + +} // namespace details +} // namespace TAO + +TAO_END_VERSIONED_NAMESPACE_DECL + +#endif // guard_bounded_value_allocation_traits_hpp |