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

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