00001 #ifndef guard_bounded_value_sequence_hpp
00002 #define guard_bounded_value_sequence_hpp
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include "tao/Bounded_Value_Allocation_Traits_T.h"
00015 #include "tao/Value_Traits_T.h"
00016 #include "tao/Generic_Sequence_T.h"
00017
00018 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00019
00020 namespace TAO
00021 {
00022
00023 template<class T, CORBA::ULong MAX>
00024 class bounded_value_sequence
00025 {
00026 public:
00027 typedef T value_type;
00028 typedef T element_type;
00029 typedef T const const_value_type;
00030 typedef value_type & subscript_type;
00031 typedef value_type const & const_subscript_type;
00032
00033 typedef details::bounded_value_allocation_traits<value_type,MAX,true> allocation_traits;
00034 typedef details::value_traits<value_type,true> element_traits;
00035 typedef details::generic_sequence<value_type, allocation_traits, element_traits> implementation_type;
00036
00037 inline bounded_value_sequence()
00038 : impl_()
00039 {}
00040 inline bounded_value_sequence(
00041 CORBA::ULong length,
00042 value_type * data,
00043 CORBA::Boolean release = false)
00044 : impl_(MAX, length, data, release)
00045 {}
00046
00047
00048
00049 inline CORBA::ULong maximum() const {
00050 return impl_.maximum();
00051 }
00052
00053 inline CORBA::Boolean release() const {
00054 return impl_.release();
00055 }
00056
00057 inline CORBA::ULong length() const {
00058 return impl_.length();
00059 }
00060
00061 inline void length(CORBA::ULong length) {
00062 implementation_type::range::check_length(length, MAX);
00063 impl_.length(length);
00064 }
00065
00066 inline value_type const & operator[](CORBA::ULong i) const {
00067 return impl_[i];
00068 }
00069
00070 inline value_type & operator[](CORBA::ULong i) {
00071 return impl_[i];
00072 }
00073
00074 inline void replace(
00075 CORBA::ULong length,
00076 value_type * data,
00077 CORBA::Boolean release = false) {
00078 impl_.replace(MAX, length, data, release);
00079 }
00080
00081 inline value_type const * get_buffer() const {
00082 return impl_.get_buffer();
00083 }
00084
00085 inline value_type * get_buffer(CORBA::Boolean orphan = false) {
00086 return impl_.get_buffer(orphan);
00087 }
00088
00089 inline void swap(bounded_value_sequence & rhs) throw() {
00090 impl_.swap(rhs.impl_);
00091 }
00092 static value_type * allocbuf(CORBA::ULong maximum) {
00093 return implementation_type::allocbuf(maximum);
00094 }
00095 static value_type * allocbuf() {
00096 return implementation_type::allocbuf(MAX);
00097 }
00098 static void freebuf(value_type * buffer)
00099 {
00100 implementation_type::freebuf(buffer);
00101 }
00102
00103 private:
00104 implementation_type impl_;
00105 };
00106
00107 }
00108
00109 TAO_END_VERSIONED_NAMESPACE_DECL
00110
00111 #endif // guard_bounded_string_sequence_hpp