1 #ifndef guard_unbounded_basic_string_sequence_hpp
2 #define guard_unbounded_basic_string_sequence_hpp
6 * @brief Implement unbounded sequences for strings and wide-strings.
8 * @author Carlos O'Ryan
10 #include "tao/Unbounded_Reference_Allocation_Traits_T.h"
11 #include "tao/String_Traits_T.h"
12 #include "tao/Generic_Sequence_T.h"
13 #include "tao/String_Sequence_Element_T.h"
14 #include "tao/String_Const_Sequence_Element_T.h"
16 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
20 template<typename charT
>
21 class unbounded_basic_string_sequence
24 typedef charT character_type
;
25 typedef character_type
* value_type
;
26 typedef character_type
const * const_value_type
;
27 typedef ::CORBA::ULong size_type
;
29 typedef details::string_traits
<character_type
,true> element_traits
;
30 typedef details::unbounded_reference_allocation_traits
<value_type
,element_traits
,true> allocation_traits
;
32 typedef details::string_sequence_element
<element_traits
> element_type
;
33 typedef details::string_const_sequence_element
<element_traits
> const_element_type
;
35 typedef details::generic_sequence
<value_type
, allocation_traits
, element_traits
> implementation_type
;
37 typedef element_type subscript_type
;
38 typedef const_value_type const_subscript_type
;
41 // @copydoc TAO::details::generic_sequence::generic_sequence()
42 inline unbounded_basic_string_sequence()
47 inline explicit unbounded_basic_string_sequence(CORBA::ULong maximum
)
50 inline unbounded_basic_string_sequence(
54 CORBA::Boolean release
)
55 : impl_(maximum
, length
, data
, release
)
58 /* Use default ctor, operator= and dtor */
60 // @copydoc TAO::details::generic_sequence::maximum()
61 inline CORBA::ULong
maximum() const {
62 return impl_
.maximum();
64 // @copydoc TAO::details::generic_sequence::release()
65 inline CORBA::Boolean
release() const {
66 return impl_
.release();
68 // @copydoc TAO::details::generic_sequence::length()
69 inline CORBA::ULong
length() const {
70 return impl_
.length();
72 // @copydoc TAO::details::generic_sequence::length()
73 inline void length(CORBA::ULong length
) {
76 // @copydoc TAO::details::generic_sequence::operator[]
77 inline const_element_type
operator[](CORBA::ULong i
) const {
78 return const_element_type (impl_
[i
], release());
80 // @copydoc TAO::details::generic_sequence::operator[]
81 inline element_type
operator[](CORBA::ULong i
) {
82 return element_type(impl_
[i
], release());
84 // @copydoc TAO::details::generic_sequence::get_buffer()
85 inline const_value_type
const * get_buffer() const {
86 return impl_
.get_buffer();
88 // @copydoc TAO::details::generic_sequence::replace()
93 CORBA::Boolean release
= false) {
94 impl_
.replace(maximum
, length
, data
, release
);
96 // @copydoc TAO::details::generic_sequence::get_buffer(CORBA::Boolean)
97 inline value_type
* get_buffer(CORBA::Boolean orphan
= false) {
98 return impl_
.get_buffer(orphan
);
100 // @copydoc TAO::details::generic_sequence::swap
101 inline void swap(unbounded_basic_string_sequence
& rhs
) noexcept
{
102 impl_
.swap(rhs
.impl_
);
105 static value_type
* allocbuf(CORBA::ULong maximum
)
107 return implementation_type::allocbuf(maximum
);
109 static void freebuf(value_type
* buffer
)
111 implementation_type::freebuf(buffer
);
115 implementation_type impl_
;
119 TAO_END_VERSIONED_NAMESPACE_DECL
121 #endif // guard_unbounded_basic_string_sequence_hpp