1 #ifndef guard_bounded_value_sequence_hpp
2 #define guard_bounded_value_sequence_hpp
6 * @brief Implement bounded sequences for types with value-like
9 * @author Carlos O'Ryan
12 #include "tao/Bounded_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
, CORBA::ULong MAX
, class Tag
=int>
21 class bounded_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::bounded_value_allocation_traits
<value_type
,MAX
,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 bounded_value_sequence()
38 inline bounded_value_sequence(
41 CORBA::Boolean release
= false)
42 : impl_(MAX
, length
, data
, release
)
44 /* Use default ctor, operator= and dtor */
46 // @copydoc TAO::details::generic_sequence::maximum()
47 inline CORBA::ULong
maximum() const {
48 return impl_
.maximum();
50 // @copydoc TAO::details::generic_sequence::release()
51 inline CORBA::Boolean
release() const {
52 return impl_
.release();
54 // @copydoc TAO::details::generic_sequence::length()
55 inline CORBA::ULong
length() const {
56 return impl_
.length();
58 // @copydoc TAO::details::generic_sequence::length()
59 inline void length(CORBA::ULong length
) {
60 implementation_type::range::check_length(length
, MAX
);
63 // @copydoc TAO::details::generic_sequence::operator[]
64 inline value_type
const & operator[](CORBA::ULong i
) const {
67 // @copydoc TAO::details::generic_sequence::operator[]
68 inline value_type
& operator[](CORBA::ULong i
) {
71 // @copydoc TAO::details::generic_sequence::replace()
75 CORBA::Boolean release
= false) {
76 impl_
.replace(MAX
, length
, data
, release
);
78 // @copydoc TAO::details::generic_sequence::get_buffer()
79 inline value_type
const * get_buffer() const {
80 return impl_
.get_buffer();
82 // @copydoc TAO::details::generic_sequence::get_buffer(CORBA::Boolean)
83 inline value_type
* get_buffer(CORBA::Boolean orphan
= false) {
84 return impl_
.get_buffer(orphan
);
86 // @copydoc TAO::details::generic_sequence::swap()
87 inline void swap(bounded_value_sequence
& rhs
) noexcept
{
88 impl_
.swap(rhs
.impl_
);
90 static value_type
* allocbuf(CORBA::ULong maximum
) {
91 return implementation_type::allocbuf(maximum
);
93 static value_type
* allocbuf() {
94 return implementation_type::allocbuf(MAX
);
96 static void freebuf(value_type
* buffer
)
98 implementation_type::freebuf(buffer
);
102 implementation_type impl_
;
106 TAO_END_VERSIONED_NAMESPACE_DECL
108 #endif // guard_bounded_string_sequence_hpp