Go to the documentation of this file.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 typedef ::CORBA::ULong size_type;
00033
00034 typedef details::bounded_value_allocation_traits<value_type,MAX,true> allocation_traits;
00035 typedef details::value_traits<value_type,true> element_traits;
00036 typedef details::generic_sequence<value_type, allocation_traits, element_traits> implementation_type;
00037
00038 inline bounded_value_sequence()
00039 : impl_()
00040 {}
00041 inline bounded_value_sequence(
00042 CORBA::ULong length,
00043 value_type * data,
00044 CORBA::Boolean release = false)
00045 : impl_(MAX, length, data, release)
00046 {}
00047
00048
00049
00050 inline CORBA::ULong maximum() const {
00051 return impl_.maximum();
00052 }
00053
00054 inline CORBA::Boolean release() const {
00055 return impl_.release();
00056 }
00057
00058 inline CORBA::ULong length() const {
00059 return impl_.length();
00060 }
00061
00062 inline void length(CORBA::ULong length) {
00063 implementation_type::range::check_length(length, MAX);
00064 impl_.length(length);
00065 }
00066
00067 inline value_type const & operator[](CORBA::ULong i) const {
00068 return impl_[i];
00069 }
00070
00071 inline value_type & operator[](CORBA::ULong i) {
00072 return impl_[i];
00073 }
00074
00075 inline void replace(
00076 CORBA::ULong length,
00077 value_type * data,
00078 CORBA::Boolean release = false) {
00079 impl_.replace(MAX, length, data, release);
00080 }
00081
00082 inline value_type const * get_buffer() const {
00083 return impl_.get_buffer();
00084 }
00085
00086 inline value_type * get_buffer(CORBA::Boolean orphan = false) {
00087 return impl_.get_buffer(orphan);
00088 }
00089
00090 inline void swap(bounded_value_sequence & rhs) throw() {
00091 impl_.swap(rhs.impl_);
00092 }
00093 static value_type * allocbuf(CORBA::ULong maximum) {
00094 return implementation_type::allocbuf(maximum);
00095 }
00096 static value_type * allocbuf() {
00097 return implementation_type::allocbuf(MAX);
00098 }
00099 static void freebuf(value_type * buffer)
00100 {
00101 implementation_type::freebuf(buffer);
00102 }
00103
00104 private:
00105 implementation_type impl_;
00106 };
00107
00108 }
00109
00110 TAO_END_VERSIONED_NAMESPACE_DECL
00111
00112 #endif // guard_bounded_string_sequence_hpp