1 #ifndef guard_bounded_object_reference_sequence_hpp
2 #define guard_bounded_object_reference_sequence_hpp
6 * @brief Implement bounded sequences for object references.
8 * @author Carlos O'Ryan
10 #include "Bounded_Reference_Allocation_Traits_T.h"
11 #include "Object_Reference_Traits_T.h"
12 #include "Generic_Sequence_T.h"
13 #include "Object_Reference_Sequence_Element_T.h"
14 #include "Object_Reference_Const_Sequence_Element_T.h"
16 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
20 template<typename object_t
, typename object_t_var
, CORBA::ULong MAX
>
21 class bounded_object_reference_sequence
24 typedef object_t object_type
;
25 typedef object_type
* value_type
;
26 typedef value_type
const const_value_type
;
27 typedef object_t_var object_type_var
;
28 typedef ::CORBA::ULong size_type
;
30 typedef details::object_reference_traits
<object_type
,object_type_var
,true> element_traits
;
31 typedef details::bounded_reference_allocation_traits
<value_type
,element_traits
,MAX
,true> allocation_traits
;
33 typedef details::object_reference_sequence_element
<element_traits
> element_type
;
34 typedef details::object_reference_const_sequence_element
<element_traits
> const_element_type
;
35 typedef element_type subscript_type
;
36 typedef value_type
const & const_subscript_type
;
38 typedef details::generic_sequence
<value_type
, allocation_traits
, element_traits
> implementation_type
;
40 inline bounded_object_reference_sequence()
43 inline bounded_object_reference_sequence(
46 CORBA::Boolean release
)
47 : impl_(MAX
, length
, data
, release
)
50 /* Use default ctor, operator= and dtor */
51 // @copydoc TAO::details::generic_sequence::maximum()
52 inline CORBA::ULong
maximum() const {
53 return impl_
.maximum();
55 // @copydoc TAO::details::generic_sequence::release()
56 inline CORBA::Boolean
release() const {
57 return impl_
.release();
59 // @copydoc TAO::details::generic_sequence::length()
60 inline CORBA::ULong
length() const {
61 return impl_
.length();
64 // @copydoc TAO::details::generic_sequence::length()
65 inline void length(CORBA::ULong length
) {
66 implementation_type::range::check_length(length
, MAX
);
69 // @copydoc TAO::details::generic_sequence::operator[]
70 inline const_element_type
operator[](CORBA::ULong i
) const {
71 return const_element_type (impl_
[i
], release());
73 // @copydoc TAO::details::generic_sequence::operator[]
74 inline element_type
operator[](CORBA::ULong i
) {
75 return element_type(impl_
[i
], release());
77 // @copydoc TAO::details::generic_sequence::get_buffer()
78 inline value_type
const * get_buffer() const {
79 return impl_
.get_buffer();
81 // @copydoc TAO::details::generic_sequence::replace()
85 CORBA::Boolean release
= false) {
86 impl_
.replace(MAX
, length
, data
, release
);
88 // @copydoc TAO::details::generic_sequence::get_buffer(CORBA::Boolean)
89 inline value_type
* get_buffer(CORBA::Boolean orphan
= false) {
90 return impl_
.get_buffer(orphan
);
92 // @copydoc TAO::details::generic_sequence::swap
93 inline void swap(bounded_object_reference_sequence
& rhs
) noexcept
{
94 impl_
.swap(rhs
.impl_
);
97 static value_type
* allocbuf(CORBA::ULong maximum
)
99 return implementation_type::allocbuf(maximum
);
101 static value_type
* allocbuf()
103 return implementation_type::allocbuf(MAX
);
105 static void freebuf(value_type
* buffer
)
107 implementation_type::freebuf(buffer
);
111 implementation_type impl_
;
115 TAO_END_VERSIONED_NAMESPACE_DECL
117 #endif // guard_bounded_object_reference_sequence_hpp