Unbounded_Basic_String_Sequence_T.h

Go to the documentation of this file.
00001 #ifndef guard_unbounded_basic_string_sequence_hpp
00002 #define guard_unbounded_basic_string_sequence_hpp
00003 /**
00004  * @file
00005  *
00006  * @brief Implement unbounded sequences for strings and wide-strings.
00007  *
00008  * $Id: Unbounded_Basic_String_Sequence_T.h 76899 2007-02-04 19:59:58Z johnnyw $
00009  *
00010  * @author Carlos O'Ryan
00011  */
00012 #include "tao/Unbounded_Reference_Allocation_Traits_T.h"
00013 #include "tao/String_Traits_T.h"
00014 #include "tao/Generic_Sequence_T.h"
00015 #include "tao/String_Sequence_Element_T.h"
00016 #include "tao/String_Const_Sequence_Element_T.h"
00017 
00018 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00019 
00020 namespace TAO
00021 {
00022 template<typename charT>
00023 class unbounded_basic_string_sequence
00024 {
00025 public:
00026   typedef charT character_type;
00027   typedef character_type * value_type;
00028   typedef character_type const * const_value_type;
00029 
00030   typedef details::string_traits<character_type,true> element_traits;
00031   typedef details::unbounded_reference_allocation_traits<value_type,element_traits,true> allocation_traits;
00032 
00033   typedef details::string_sequence_element<element_traits> element_type;
00034   typedef details::string_const_sequence_element<element_traits> const_element_type;
00035 
00036   typedef details::generic_sequence<value_type, allocation_traits, element_traits> implementation_type;
00037 
00038   typedef element_type subscript_type;
00039   typedef const_value_type const_subscript_type;
00040 
00041 
00042   /// @copydoc details::generic_sequence::generic_sequence
00043   inline unbounded_basic_string_sequence()
00044     : impl_()
00045   {}
00046 
00047 
00048   inline explicit unbounded_basic_string_sequence(CORBA::ULong maximum)
00049     : impl_(maximum)
00050   {}
00051   inline unbounded_basic_string_sequence(
00052       CORBA::ULong maximum,
00053       CORBA::ULong length,
00054       value_type * data,
00055       CORBA::Boolean release)
00056     : impl_(maximum, length, data, release)
00057   {}
00058 
00059   /* Use default ctor, operator= and dtor */
00060 
00061   /// @copydoc details::generic_sequence::maximum
00062   inline CORBA::ULong maximum() const {
00063     return impl_.maximum();
00064   }
00065   /// @copydoc details::generic_sequence::release
00066   inline CORBA::Boolean release() const {
00067     return impl_.release();
00068   }
00069   /// @copydoc details::generic_sequence::length
00070   inline CORBA::ULong length() const {
00071     return impl_.length();
00072   }
00073   /// @copydoc details::generic_sequence::length
00074   inline void length(CORBA::ULong length) {
00075     impl_.length(length);
00076   }
00077   /// @copydoc details::generic_sequence::operator[]
00078   inline const_element_type operator[](CORBA::ULong i) const {
00079     return const_element_type (impl_[i], release());
00080   }
00081   /// @copydoc details::generic_sequence::operator[]
00082   inline element_type operator[](CORBA::ULong i) {
00083     return element_type(impl_[i], release());
00084   }
00085   /// @copydoc details::generic_sequence::get_buffer
00086   inline const_value_type const * get_buffer() const {
00087     return impl_.get_buffer();
00088   }
00089   /// @copydoc details::generic_sequence::replace
00090   inline void replace(
00091       CORBA::ULong maximum,
00092       CORBA::ULong length,
00093       value_type * data,
00094       CORBA::Boolean release = false) {
00095     impl_.replace(maximum, length, data, release);
00096   }
00097   /// @copydoc details::generic_sequence::get_buffer(CORBA::Boolean)
00098   inline value_type * get_buffer(CORBA::Boolean orphan = false) {
00099     return impl_.get_buffer(orphan);
00100   }
00101   /// @copydoc details::generic_sequence::swap
00102   inline void swap(unbounded_basic_string_sequence & rhs) throw() {
00103     impl_.swap(rhs.impl_);
00104   }
00105 
00106   static value_type * allocbuf(CORBA::ULong maximum)
00107   {
00108     return implementation_type::allocbuf(maximum);
00109   }
00110   static void freebuf(value_type * buffer)
00111   {
00112     implementation_type::freebuf(buffer);
00113   }
00114 
00115 
00116 private:
00117   implementation_type impl_;
00118 };
00119 } // namespace TAO
00120 
00121 TAO_END_VERSIONED_NAMESPACE_DECL
00122 
00123 #endif // guard_unbounded_basic_string_sequence_hpp

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