00001 #ifndef guard_bounded_object_reference_sequence_hpp
00002 #define guard_bounded_object_reference_sequence_hpp
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "Bounded_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
00018 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00019
00020 namespace TAO
00021 {
00022
00023 template<typename object_t, typename object_t_var, CORBA::ULong MAX>
00024 class bounded_object_reference_sequence
00025 {
00026 public:
00027 typedef object_t object_type;
00028 typedef object_type * value_type;
00029 typedef value_type const const_value_type;
00030 typedef object_t_var object_type_var;
00031
00032 typedef details::object_reference_traits<object_type,object_type_var,true> element_traits;
00033 typedef details::bounded_reference_allocation_traits<value_type,element_traits,MAX,true> allocation_traits;
00034
00035 typedef details::object_reference_sequence_element<element_traits> element_type;
00036 typedef details::object_reference_const_sequence_element<element_traits> const_element_type;
00037 typedef element_type subscript_type;
00038 typedef value_type const & const_subscript_type;
00039
00040 typedef details::generic_sequence<value_type, allocation_traits, element_traits> implementation_type;
00041
00042 inline bounded_object_reference_sequence()
00043 : impl_()
00044 {}
00045 inline bounded_object_reference_sequence(
00046 CORBA::ULong length,
00047 value_type * data,
00048 CORBA::Boolean release)
00049 : impl_(MAX, length, data, release)
00050 {}
00051
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 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
00095 inline void swap(bounded_object_reference_sequence & rhs) throw() {
00096 impl_.swap(rhs.impl_);
00097 }
00098
00099 static value_type * allocbuf(CORBA::ULong maximum)
00100 {
00101 return implementation_type::allocbuf(maximum);
00102 }
00103 static void freebuf(value_type * buffer)
00104 {
00105 implementation_type::freebuf(buffer);
00106 }
00107
00108
00109 private:
00110 implementation_type impl_;
00111 };
00112
00113 }
00114
00115 TAO_END_VERSIONED_NAMESPACE_DECL
00116
00117 #endif // guard_bounded_object_reference_sequence_hpp