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