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