00001 #ifndef guard_bounded_value_allocation_traits_hpp 00002 #define guard_bounded_value_allocation_traits_hpp 00003 /** 00004 * @file 00005 * 00006 * @brief Details can be found in the documentation for 00007 * TAO::details::generic_sequence 00008 * 00009 * $Id: Bounded_Value_Allocation_Traits_T.h 79349 2007-08-15 11:21:50Z johnnyw $ 00010 * 00011 * @author Carlos O'Ryan 00012 */ 00013 00014 #include "tao/Basic_Types.h" 00015 00016 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00017 00018 namespace TAO 00019 { 00020 namespace details 00021 { 00022 00023 template<typename T, CORBA::ULong MAX, bool dummy> 00024 struct bounded_value_allocation_traits 00025 { 00026 typedef T value_type; 00027 00028 inline static CORBA::ULong default_maximum() 00029 { 00030 return MAX; 00031 } 00032 00033 inline static value_type * default_buffer_allocation() 00034 { 00035 return 0; 00036 } 00037 00038 inline static value_type * allocbuf(CORBA::ULong /* maximum */) 00039 { 00040 return new value_type[MAX]; 00041 } 00042 00043 inline static void freebuf(value_type * buffer) 00044 { 00045 delete[] buffer; 00046 } 00047 00048 inline static CORBA::ULong maximum() 00049 { 00050 return MAX; 00051 } 00052 /* static CORBA::ULong const MAXIMUM = MAX; */ 00053 }; 00054 00055 } // namespace details 00056 } // namespace TAO 00057 00058 TAO_END_VERSIONED_NAMESPACE_DECL 00059 00060 #endif // guard_bounded_value_allocation_traits_hpp