1 #ifndef guard_unbounded_value_sequence_hpp
2 #define guard_unbounded_value_sequence_hpp
6 * @brief Implement unbounded sequences for types with value-like
9 * @author Carlos O'Ryan
12 #include "tao/Unbounded_Value_Allocation_Traits_T.h"
13 #include "tao/Value_Traits_T.h"
14 #include "tao/Generic_Sequence_T.h"
16 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
20 template<class T
, class Tag
=int>
21 class unbounded_value_sequence
25 typedef T element_type
;
26 typedef T
const const_value_type
;
27 typedef value_type
& subscript_type
;
28 typedef value_type
const & const_subscript_type
;
29 typedef ::CORBA::ULong size_type
;
31 typedef details::unbounded_value_allocation_traits
<value_type
,true> allocation_traits
;
32 typedef details::value_traits
<value_type
,true> element_traits
;
33 typedef details::generic_sequence
<value_type
, allocation_traits
, element_traits
> implementation_type
;
35 inline unbounded_value_sequence()
38 inline explicit unbounded_value_sequence(CORBA::ULong maximum
)
41 inline unbounded_value_sequence(
45 CORBA::Boolean release
= false)
46 : impl_(maximum
, length
, data
, release
)
48 /* Use default ctor, operator= and dtor */
49 inline CORBA::ULong
maximum() const {
50 return impl_
.maximum();
52 inline CORBA::Boolean
release() const {
53 return impl_
.release();
55 inline CORBA::ULong
length() const {
56 return impl_
.length();
58 inline void length(CORBA::ULong length
) {
61 inline value_type
const & operator[](CORBA::ULong i
) const {
64 inline value_type
& operator[](CORBA::ULong i
) {
71 CORBA::Boolean release
= false) {
72 impl_
.replace(maximum
, length
, data
, release
);
74 inline value_type
const * get_buffer() const {
75 return impl_
.get_buffer();
77 inline value_type
* get_buffer(CORBA::Boolean orphan
= false) {
78 return impl_
.get_buffer(orphan
);
80 inline void swap(unbounded_value_sequence
& rhs
) noexcept
{
81 impl_
.swap(rhs
.impl_
);
83 static value_type
* allocbuf(CORBA::ULong maximum
) {
84 return implementation_type::allocbuf(maximum
);
86 static void freebuf(value_type
* buffer
) {
87 implementation_type::freebuf(buffer
);
91 implementation_type impl_
;
95 TAO_END_VERSIONED_NAMESPACE_DECL
97 #endif // guard_unbounded_string_sequence_hpp