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  * Unbounded_Object_Reference_Sequence_T.h,v 1.2 2006/04/19 08:22:00 jwillemsen Exp
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 
00017 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00018 
00019 namespace TAO
00020 {
00021 
00022 template<typename object_t, typename object_t_var>
00023 class unbounded_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 
00030   typedef details::object_reference_traits<object_type,object_t_var,true> element_traits;
00031   typedef details::unbounded_reference_allocation_traits<value_type,element_traits,true> allocation_traits;
00032 
00033   typedef details::object_reference_sequence_element<element_traits> element_type;
00034   typedef element_type subscript_type;
00035   typedef value_type const & const_subscript_type;
00036 
00037   typedef details::generic_sequence<value_type, allocation_traits, element_traits> implementation_type;
00038 
00039   inline unbounded_object_reference_sequence()
00040     : impl_()
00041   {}
00042   inline explicit unbounded_object_reference_sequence(CORBA::ULong maximum)
00043     : impl_(maximum)
00044   {}
00045   inline unbounded_object_reference_sequence(
00046       CORBA::ULong maximum,
00047       CORBA::ULong length,
00048       value_type * data,
00049       CORBA::Boolean release)
00050     : impl_(maximum, length, data, release)
00051   {}
00052 
00053   /* Use default ctor, operator= and dtor */
00054   inline CORBA::ULong maximum() const {
00055     return impl_.maximum();
00056   }
00057   inline CORBA::Boolean release() const {
00058     return impl_.release();
00059   }
00060   inline CORBA::ULong length() const {
00061     return impl_.length();
00062   }
00063 
00064   inline void length(CORBA::ULong length) {
00065     impl_.length(length);
00066   }
00067   inline value_type const & operator[](CORBA::ULong i) const {
00068     return impl_[i];
00069   }
00070   inline element_type operator[](CORBA::ULong i) {
00071     return element_type(impl_[i], release());
00072   }
00073   inline value_type const * get_buffer() const {
00074     return impl_.get_buffer();
00075   }
00076   inline void replace(
00077       CORBA::ULong maximum,
00078       CORBA::ULong length,
00079       value_type * data,
00080       CORBA::Boolean release = false) {
00081     impl_.replace(maximum, length, data, release);
00082   }
00083   inline value_type * get_buffer(CORBA::Boolean orphan = false) {
00084     return impl_.get_buffer(orphan);
00085   }
00086   inline void swap(unbounded_object_reference_sequence & rhs) throw() {
00087     impl_.swap(rhs.impl_);
00088   }
00089 
00090   static value_type * allocbuf(CORBA::ULong maximum)
00091   {
00092     return implementation_type::allocbuf(maximum);
00093   }
00094   static void freebuf(value_type * buffer)
00095   {
00096     implementation_type::freebuf(buffer);
00097   }
00098 
00099 
00100 private:
00101   implementation_type impl_;
00102 };
00103 
00104 } // namespace TAO
00105 
00106 TAO_END_VERSIONED_NAMESPACE_DECL
00107 
00108 #endif // guard_unbounded_object_reference_sequence_hpp

Generated on Thu Nov 9 11:54:27 2006 for TAO by doxygen 1.3.6