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 inline CORBA::ULong maximum() const {
00048 return impl_.maximum();
00049 }
00050 inline CORBA::Boolean release() const {
00051 return impl_.release();
00052 }
00053 inline CORBA::ULong length() const {
00054 return impl_.length();
00055 }
00056 inline void length(CORBA::ULong length) {
00057 implementation_type::range::check_length(length, MAX);
00058 impl_.length(length);
00059 }
00060 inline value_type const & operator[](CORBA::ULong i) const {
00061 return impl_[i];
00062 }
00063 inline value_type & operator[](CORBA::ULong i) {
00064 return impl_[i];
00065 }
00066 inline void replace(
00067 CORBA::ULong length,
00068 value_type * data,
00069 CORBA::Boolean release = false) {
00070 impl_.replace(MAX, length, data, release);
00071 }
00072 inline value_type const * get_buffer() const {
00073 return impl_.get_buffer();
00074 }
00075 inline value_type * get_buffer(CORBA::Boolean orphan = false) {
00076 return impl_.get_buffer(orphan);
00077 }
00078 inline void swap(bounded_value_sequence & rhs) throw() {
00079 impl_.swap(rhs.impl_);
00080 }
00081 static value_type * allocbuf(CORBA::ULong maximum) {
00082 return implementation_type::allocbuf(maximum);
00083 }
00084 static value_type * allocbuf() {
00085 return implementation_type::allocbuf(MAX);
00086 }
00087 static void freebuf(value_type * buffer)
00088 {
00089 implementation_type::freebuf(buffer);
00090 }
00091
00092 private:
00093 implementation_type impl_;
00094 };
00095
00096 }
00097
00098 TAO_END_VERSIONED_NAMESPACE_DECL
00099
00100 #endif // guard_bounded_string_sequence_hpp