1 #ifndef guard_unbounded_object_reference_sequence_hpp
2 #define guard_unbounded_object_reference_sequence_hpp
6 * @brief Implement unbounded sequences for object references.
8 * @author Carlos O'Ryan
10 #include "Unbounded_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
>
21 class unbounded_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 ::CORBA::ULong size_type
;
29 typedef details::object_reference_traits
<object_type
,object_t_var
,true> element_traits
;
30 typedef details::unbounded_reference_allocation_traits
<value_type
,element_traits
,true> allocation_traits
;
32 typedef details::object_reference_sequence_element
<element_traits
> element_type
;
33 typedef details::object_reference_const_sequence_element
<element_traits
> const_element_type
;
34 typedef element_type subscript_type
;
35 typedef value_type
const & const_subscript_type
;
37 typedef details::generic_sequence
<value_type
, allocation_traits
, element_traits
> implementation_type
;
39 inline unbounded_object_reference_sequence()
42 inline explicit unbounded_object_reference_sequence(CORBA::ULong maximum
)
45 inline unbounded_object_reference_sequence(
49 CORBA::Boolean release
)
50 : impl_(maximum
, length
, data
, release
)
53 // @copydoc TAO::details::generic_sequence::maximum()
54 inline CORBA::ULong
maximum() const {
55 return impl_
.maximum();
57 // @copydoc TAO::details::generic_sequence::release()
58 inline CORBA::Boolean
release() const {
59 return impl_
.release();
61 // @copydoc TAO::details::generic_sequence::length()
62 inline CORBA::ULong
length() const {
63 return impl_
.length();
66 // @copydoc TAO::details::generic_sequence::length()
67 inline void length(CORBA::ULong length
) {
70 // @copydoc TAO::details::generic_sequence::operator[]
71 inline const_element_type
operator[](CORBA::ULong i
) const {
72 return const_element_type (impl_
[i
], release());
74 // @copydoc TAO::details::generic_sequence::operator[]
75 inline element_type
operator[](CORBA::ULong i
) {
76 return element_type(impl_
[i
], 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::replace()
87 CORBA::Boolean release
= false) {
88 impl_
.replace(maximum
, length
, data
, release
);
90 // @copydoc TAO::details::generic_sequence::get_buffer(CORBA::Boolean)
91 inline value_type
* get_buffer(CORBA::Boolean orphan
= false) {
92 return impl_
.get_buffer(orphan
);
94 // @copydoc TAO::details::generic_sequence::swap()
95 inline void swap(unbounded_object_reference_sequence
& rhs
) noexcept
{
96 impl_
.swap(rhs
.impl_
);
99 static value_type
* allocbuf(CORBA::ULong maximum
)
101 return implementation_type::allocbuf(maximum
);
103 static void freebuf(value_type
* buffer
)
105 implementation_type::freebuf(buffer
);
109 implementation_type impl_
;
113 TAO_END_VERSIONED_NAMESPACE_DECL
115 #endif // guard_unbounded_object_reference_sequence_hpp