Unbounded_Object_Reference_Sequence_T.h

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  * @file
00005  *
00006  * @brief Implement unbounded sequences for object references.
00007  *
00008  * $Id: Unbounded_Object_Reference_Sequence_T.h 79363 2007-08-16 11:36:29Z johnnyw $
00009  *
00010  * @author Carlos O'Ryan
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 
00018 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00019 
00020 namespace TAO
00021 {
00022 
00023 template<typename object_t, typename object_t_var>
00024 class unbounded_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 
00031   typedef details::object_reference_traits<object_type,object_t_var,true> element_traits;
00032   typedef details::unbounded_reference_allocation_traits<value_type,element_traits,true> allocation_traits;
00033 
00034   typedef details::object_reference_sequence_element<element_traits> element_type;
00035   typedef details::object_reference_const_sequence_element<element_traits> const_element_type;
00036   typedef element_type subscript_type;
00037   typedef value_type const & const_subscript_type;
00038 
00039   typedef details::generic_sequence<value_type, allocation_traits, element_traits> implementation_type;
00040 
00041   inline unbounded_object_reference_sequence()
00042     : impl_()
00043   {}
00044   inline explicit unbounded_object_reference_sequence(CORBA::ULong maximum)
00045     : impl_(maximum)
00046   {}
00047   inline unbounded_object_reference_sequence(
00048       CORBA::ULong maximum,
00049       CORBA::ULong length,
00050       value_type * data,
00051       CORBA::Boolean release)
00052     : impl_(maximum, length, data, release)
00053   {}
00054 
00055   /// @copydoc details::generic_sequence::maximum
00056   inline CORBA::ULong maximum() const {
00057     return impl_.maximum();
00058   }
00059   /// @copydoc details::generic_sequence::release
00060   inline CORBA::Boolean release() const {
00061     return impl_.release();
00062   }
00063   /// @copydoc details::generic_sequence::length
00064   inline CORBA::ULong length() const {
00065     return impl_.length();
00066   }
00067 
00068   /// @copydoc details::generic_sequence::length
00069   inline void length(CORBA::ULong length) {
00070     impl_.length(length);
00071   }
00072   /// @copydoc details::generic_sequence::operator[]
00073   inline const_element_type operator[](CORBA::ULong i) const {
00074     return const_element_type (impl_[i], release());
00075   }
00076   /// @copydoc details::generic_sequence::operator[]
00077   inline element_type operator[](CORBA::ULong i) {
00078     return element_type(impl_[i], release());
00079   }
00080   /// @copydoc details::generic_sequence::get_buffer
00081   inline value_type const * get_buffer() const {
00082     return impl_.get_buffer();
00083   }
00084   /// @copydoc details::generic_sequence::replace
00085   inline void replace(
00086       CORBA::ULong maximum,
00087       CORBA::ULong length,
00088       value_type * data,
00089       CORBA::Boolean release = false) {
00090     impl_.replace(maximum, length, data, release);
00091   }
00092   /// @copydoc details::generic_sequence::get_buffer(CORBA::Boolean)
00093   inline value_type * get_buffer(CORBA::Boolean orphan = false) {
00094     return impl_.get_buffer(orphan);
00095   }
00096   /// @copydoc details::generic_sequence::swap
00097   inline void swap(unbounded_object_reference_sequence & rhs) throw() {
00098     impl_.swap(rhs.impl_);
00099   }
00100 
00101   static value_type * allocbuf(CORBA::ULong maximum)
00102   {
00103     return implementation_type::allocbuf(maximum);
00104   }
00105   static void freebuf(value_type * buffer)
00106   {
00107     implementation_type::freebuf(buffer);
00108   }
00109 
00110 
00111 private:
00112   implementation_type impl_;
00113 };
00114 
00115 } // namespace TAO
00116 
00117 TAO_END_VERSIONED_NAMESPACE_DECL
00118 
00119 #endif // guard_unbounded_object_reference_sequence_hpp

Generated on Tue Feb 2 17:37:53 2010 for TAO by  doxygen 1.4.7