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
21 template<class T
, CORBA::ULong MAX
>
22 class bounded_value_sequence
26 typedef T element_type
;
27 typedef T
const const_value_type
;
28 typedef value_type
& subscript_type
;
29 typedef value_type
const & const_subscript_type
;
30 typedef ::CORBA::ULong size_type
;
32 typedef details::bounded_value_allocation_traits
<value_type
,MAX
,true> allocation_traits
;
33 typedef details::value_traits
<value_type
,true> element_traits
;
34 typedef details::generic_sequence
<value_type
, allocation_traits
, element_traits
> implementation_type
;
36 inline bounded_value_sequence()
39 inline bounded_value_sequence(
42 CORBA::Boolean release
= false)
43 : impl_(MAX
, length
, data
, release
)
45 /* Use default ctor, operator= and dtor */
47 // @copydoc TAO::details::generic_sequence::maximum()
48 inline CORBA::ULong
maximum() const {
49 return impl_
.maximum();
51 // @copydoc TAO::details::generic_sequence::release()
52 inline CORBA::Boolean
release() const {
53 return impl_
.release();
55 // @copydoc TAO::details::generic_sequence::length()
56 inline CORBA::ULong
length() const {
57 return impl_
.length();
59 // @copydoc TAO::details::generic_sequence::length()
60 inline void length(CORBA::ULong length
) {
61 implementation_type::range::check_length(length
, MAX
);
64 // @copydoc TAO::details::generic_sequence::operator[]
65 inline value_type
const & operator[](CORBA::ULong i
) const {
68 // @copydoc TAO::details::generic_sequence::operator[]
69 inline value_type
& operator[](CORBA::ULong i
) {
72 // @copydoc TAO::details::generic_sequence::replace()
76 CORBA::Boolean release
= false) {
77 impl_
.replace(MAX
, length
, data
, release
);
79 // @copydoc TAO::details::generic_sequence::get_buffer()
80 inline value_type
const * get_buffer() const {
81 return impl_
.get_buffer();
83 // @copydoc TAO::details::generic_sequence::get_buffer(CORBA::Boolean)
84 inline value_type
* get_buffer(CORBA::Boolean orphan
= false) {
85 return impl_
.get_buffer(orphan
);
87 // @copydoc TAO::details::generic_sequence::swap()
88 inline void swap(bounded_value_sequence
& rhs
) throw() {
89 impl_
.swap(rhs
.impl_
);
91 static value_type
* allocbuf(CORBA::ULong maximum
) {
92 return implementation_type::allocbuf(maximum
);
94 static value_type
* allocbuf() {
95 return implementation_type::allocbuf(MAX
);
97 static void freebuf(value_type
* buffer
)
99 implementation_type::freebuf(buffer
);
103 implementation_type impl_
;
108 TAO_END_VERSIONED_NAMESPACE_DECL
110 #endif // guard_bounded_string_sequence_hpp