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
00018 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00019
00020 namespace TAO
00021 {
00022 template<typename charT, CORBA::ULong MAX>
00023 class bounded_basic_string_sequence
00024 {
00025 public:
00026 typedef charT character_type;
00027 typedef charT * value_type;
00028 typedef charT const * const_value_type;
00029
00030 typedef details::string_traits<charT,true> element_traits;
00031 typedef details::bounded_reference_allocation_traits<value_type,element_traits,MAX,true> allocation_traits;
00032
00033 typedef details::string_sequence_element<element_traits> element_type;
00034 typedef details::string_const_sequence_element<element_traits> const_element_type;
00035 typedef element_type subscript_type;
00036 typedef const_value_type const_subscript_type;
00037
00038 typedef details::generic_sequence<value_type, allocation_traits, element_traits> implementation_type;
00039
00040
00041 inline bounded_basic_string_sequence()
00042 : impl_()
00043 {}
00044
00045 inline bounded_basic_string_sequence(
00046 CORBA::ULong length,
00047 value_type * data,
00048 CORBA::Boolean release)
00049 : impl_(MAX, length, data, release)
00050 {}
00051
00052 inline CORBA::ULong maximum() const {
00053 return impl_.maximum();
00054 }
00055
00056 inline CORBA::Boolean release() const {
00057 return impl_.release();
00058 }
00059
00060 inline CORBA::ULong length() const {
00061 return impl_.length();
00062 }
00063
00064
00065 inline void length(CORBA::ULong length) {
00066 implementation_type::range::check_length(length, MAX);
00067 impl_.length(length);
00068 }
00069
00070 inline const_element_type operator[](CORBA::ULong i) const {
00071 return const_element_type (impl_[i], release());
00072 }
00073
00074 inline element_type operator[](CORBA::ULong i) {
00075 return element_type(impl_[i], release());
00076 }
00077
00078 inline const_value_type const * get_buffer() const {
00079 return impl_.get_buffer();
00080 }
00081
00082 inline void replace(
00083 CORBA::ULong length,
00084 value_type * data,
00085 CORBA::Boolean release = false) {
00086 impl_.replace(MAX, length, data, release);
00087 }
00088
00089 inline value_type * get_buffer(CORBA::Boolean orphan = false) {
00090 return impl_.get_buffer(orphan);
00091 }
00092 inline void swap(bounded_basic_string_sequence & rhs) throw() {
00093 impl_.swap(rhs.impl_);
00094 }
00095
00096 static value_type * allocbuf(CORBA::ULong maximum)
00097 {
00098 return implementation_type::allocbuf(maximum);
00099 }
00100 static value_type * allocbuf() {
00101 return implementation_type::allocbuf(MAX);
00102 }
00103 static void freebuf(value_type * buffer)
00104 {
00105 implementation_type::freebuf(buffer);
00106 }
00107
00108 private:
00109 implementation_type impl_;
00110 };
00111 }
00112
00113 TAO_END_VERSIONED_NAMESPACE_DECL
00114
00115 #endif // guard_bounded_basic_string_sequence_hpp