Bounded_Object_Reference_Sequence_T.h

Go to the documentation of this file.
00001 #ifndef guard_bounded_object_reference_sequence_hpp
00002 #define guard_bounded_object_reference_sequence_hpp
00003 /**
00004  * @file
00005  *
00006  * @brief Implement bounded sequences for object references.
00007  *
00008  * $Id: Bounded_Object_Reference_Sequence_T.h 79363 2007-08-16 11:36:29Z johnnyw $
00009  *
00010  * @author Carlos O'Ryan
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   /* Use default ctor, operator= and dtor */
00053   /// @copydoc details::generic_sequence::maximum
00054   inline CORBA::ULong maximum() const {
00055     return impl_.maximum();
00056   }
00057   /// @copydoc details::generic_sequence::release
00058   inline CORBA::Boolean release() const {
00059     return impl_.release();
00060   }
00061   /// @copydoc details::generic_sequence::length
00062   inline CORBA::ULong length() const {
00063     return impl_.length();
00064   }
00065 
00066   /// @copydoc details::generic_sequence::length
00067   inline void length(CORBA::ULong length) {
00068     implementation_type::range::check_length(length, MAX);
00069     impl_.length(length);
00070   }
00071   /// @copydoc details::generic_sequence::operator[]
00072   inline const_element_type operator[](CORBA::ULong i) const {
00073     return const_element_type (impl_[i], release());
00074   }
00075   /// @copydoc details::generic_sequence::operator[]
00076   inline element_type operator[](CORBA::ULong i) {
00077     return element_type(impl_[i], release());
00078   }
00079   /// @copydoc details::generic_sequence::get_buffer
00080   inline value_type const * get_buffer() const {
00081     return impl_.get_buffer();
00082   }
00083   /// @copydoc details::generic_sequence::replace
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   /// @copydoc details::generic_sequence::get_buffer(CORBA::Boolean)
00091   inline value_type * get_buffer(CORBA::Boolean orphan = false) {
00092     return impl_.get_buffer(orphan);
00093   }
00094   /// @copydoc details::generic_sequence::swap
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 } // namespace TAO
00114 
00115 TAO_END_VERSIONED_NAMESPACE_DECL
00116 
00117 #endif // guard_bounded_object_reference_sequence_hpp

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