Unbounded_Value_Sequence_T.h

Go to the documentation of this file.
00001 #ifndef guard_unbounded_value_sequence_hpp
00002 #define guard_unbounded_value_sequence_hpp
00003 /**
00004  * @file
00005  *
00006  * @brief Implement unbounded sequences for types with value-like
00007  * semantics.
00008  *
00009  * Unbounded_Value_Sequence_T.h,v 1.2 2006/04/19 08:22:00 jwillemsen Exp
00010  *
00011  * @author Carlos O'Ryan
00012  */
00013 
00014 #include "tao/Unbounded_Value_Allocation_Traits_T.h"
00015 #include "tao/Value_Traits_T.h"
00016 #include "tao/Generic_Sequence_T.h"
00017 
00018 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00019 
00020 namespace TAO
00021 {
00022 
00023 template<class T>
00024 class unbounded_value_sequence
00025 {
00026 public:
00027   typedef T value_type;
00028   typedef T element_type;
00029   typedef T const const_value_type;
00030   typedef value_type & subscript_type;
00031   typedef value_type const & const_subscript_type;
00032 
00033   typedef details::unbounded_value_allocation_traits<value_type,true> allocation_traits;
00034   typedef details::value_traits<value_type,true> element_traits;
00035   typedef details::generic_sequence<value_type, allocation_traits, element_traits> implementation_type;
00036 
00037   inline unbounded_value_sequence()
00038     : impl_()
00039   {}
00040   inline explicit unbounded_value_sequence(CORBA::ULong maximum)
00041     : impl_(maximum)
00042   {}
00043   inline unbounded_value_sequence(
00044       CORBA::ULong maximum,
00045       CORBA::ULong length,
00046       value_type * data,
00047       CORBA::Boolean release = false)
00048     : impl_(maximum, length, data, release)
00049   {}
00050   /* Use default ctor, operator= and dtor */
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   inline void length(CORBA::ULong length) {
00061     impl_.length(length);
00062   }
00063   inline value_type const & operator[](CORBA::ULong i) const {
00064     return impl_[i];
00065   }
00066   inline value_type & operator[](CORBA::ULong i) {
00067     return impl_[i];
00068   }
00069   inline void replace(
00070       CORBA::ULong maximum,
00071       CORBA::ULong length,
00072       value_type * data,
00073       CORBA::Boolean release = false) {
00074     impl_.replace(maximum, length, data, release);
00075   }
00076   inline value_type const * get_buffer() const {
00077     return impl_.get_buffer();
00078   }
00079   inline value_type * get_buffer(CORBA::Boolean orphan = false) {
00080     return impl_.get_buffer(orphan);
00081   }
00082   inline void swap(unbounded_value_sequence & rhs) throw() {
00083     impl_.swap(rhs.impl_);
00084   }
00085   static value_type * allocbuf(CORBA::ULong maximum) {
00086     return implementation_type::allocbuf(maximum);
00087   }
00088   static void freebuf(value_type * buffer) {
00089     implementation_type::freebuf(buffer);
00090   }
00091 
00092 private:
00093   implementation_type impl_;
00094 };
00095 
00096 } // namespace TAO
00097 
00098 TAO_END_VERSIONED_NAMESPACE_DECL
00099 
00100 #endif // guard_unbounded_string_sequence_hpp
00101 

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