Go to the documentation of this file.00001 #ifndef guard_bounded_basic_string_sequence_hpp
00002 #define guard_bounded_basic_string_sequence_hpp
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "tao/Bounded_Reference_Allocation_Traits_T.h"
00013 #include "tao/String_Traits_T.h"
00014 #include "tao/Generic_Sequence_T.h"
00015 #include "tao/String_Sequence_Element_T.h"
00016 #include "tao/String_Const_Sequence_Element_T.h"
00017 #include "tao/MM_Sequence_Iterator_T.h"
00018
00019 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00020
00021 namespace TAO
00022 {
00023 template<typename charT, CORBA::ULong MAX>
00024 class bounded_basic_string_sequence
00025 {
00026 public:
00027 typedef charT character_type;
00028 typedef charT * value_type;
00029 typedef charT const * const_value_type;
00030 typedef ::CORBA::ULong size_type;
00031
00032 typedef details::string_traits<charT,true> element_traits;
00033 typedef details::bounded_reference_allocation_traits<value_type,element_traits,MAX,true> allocation_traits;
00034
00035 typedef details::string_sequence_element<element_traits> element_type;
00036 typedef details::string_const_sequence_element<element_traits> const_element_type;
00037 typedef element_type subscript_type;
00038 typedef const_value_type const_subscript_type;
00039
00040 typedef details::generic_sequence<value_type, allocation_traits, element_traits> implementation_type;
00041
00042
00043 inline bounded_basic_string_sequence()
00044 : impl_()
00045 {}
00046
00047 inline bounded_basic_string_sequence(
00048 CORBA::ULong length,
00049 value_type * data,
00050 CORBA::Boolean release)
00051 : impl_(MAX, length, data, release)
00052 {}
00053
00054 inline CORBA::ULong maximum() const {
00055 return impl_.maximum();
00056 }
00057
00058 inline CORBA::Boolean release() const {
00059 return impl_.release();
00060 }
00061
00062 inline CORBA::ULong length() const {
00063 return impl_.length();
00064 }
00065
00066
00067 inline void length(CORBA::ULong length) {
00068 implementation_type::range::check_length(length, MAX);
00069 impl_.length(length);
00070 }
00071
00072 inline const_element_type operator[](CORBA::ULong i) const {
00073 return const_element_type (impl_[i], release());
00074 }
00075
00076 inline element_type operator[](CORBA::ULong i) {
00077 return element_type(impl_[i], release());
00078 }
00079
00080 inline const_value_type const * get_buffer() const {
00081 return impl_.get_buffer();
00082 }
00083
00084 inline void replace(
00085 CORBA::ULong length,
00086 value_type * data,
00087 CORBA::Boolean release = false) {
00088 impl_.replace(MAX, length, data, release);
00089 }
00090
00091 inline value_type * get_buffer(CORBA::Boolean orphan = false) {
00092 return impl_.get_buffer(orphan);
00093 }
00094 inline void swap(bounded_basic_string_sequence & rhs) throw() {
00095 impl_.swap(rhs.impl_);
00096 }
00097
00098 static value_type * allocbuf(CORBA::ULong maximum)
00099 {
00100 return implementation_type::allocbuf(maximum);
00101 }
00102 static value_type * allocbuf() {
00103 return implementation_type::allocbuf(MAX);
00104 }
00105 static void freebuf(value_type * buffer)
00106 {
00107 implementation_type::freebuf(buffer);
00108 }
00109
00110 #if defined TAO_HAS_SEQUENCE_ITERATORS && TAO_HAS_SEQUENCE_ITERATORS == 1
00111
00112
00113
00114
00115
00116
00117
00118 typedef MM_Sequence_Iterator<bounded_basic_string_sequence<charT, MAX> > iterator;
00119 typedef Const_MM_Sequence_Iterator<bounded_basic_string_sequence<charT, MAX> > const_iterator;
00120 typedef MM_Sequence_Reverse_Iterator<bounded_basic_string_sequence<charT, MAX> > reverse_iterator;
00121 typedef Const_MM_Sequence_Reverse_Iterator<bounded_basic_string_sequence<charT, MAX> > const_reverse_iterator;
00122
00123
00124 inline iterator begin (void)
00125 {
00126 return iterator (&this->impl_);
00127 }
00128
00129
00130 inline const_iterator begin (void) const
00131 {
00132 return const_iterator (&this->impl_);
00133 }
00134
00135
00136 inline iterator end (void)
00137 {
00138 return iterator (&this->impl_,
00139 this->impl_.length ());
00140 }
00141
00142
00143 inline const_iterator end (void) const
00144 {
00145 return const_iterator (&this->impl_,
00146 this->impl_.length ());
00147 }
00148
00149
00150 inline reverse_iterator rbegin (void)
00151 {
00152 return reverse_iterator (&this->impl_,
00153 this->impl_.length () - 1);
00154 }
00155
00156
00157 inline const_reverse_iterator rbegin (void) const
00158 {
00159 return const_reverse_iterator (&this->impl_,
00160 this->impl_.length () - 1);
00161 }
00162
00163
00164
00165 inline reverse_iterator rend (void)
00166 {
00167 return reverse_iterator (&this->impl_,
00168 -1);
00169 }
00170
00171
00172
00173 inline const_reverse_iterator rend (void) const
00174 {
00175 return const_reverse_iterator (&this->impl_,
00176 -1);
00177 }
00178
00179 #endif
00180
00181 private:
00182 implementation_type impl_;
00183 };
00184 }
00185
00186 TAO_END_VERSIONED_NAMESPACE_DECL
00187
00188 #endif // guard_bounded_basic_string_sequence_hpp