Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tao / Unbounded_Object_Reference_Sequence_T.h
blob8d43f831c7a04e5aa16480515c1a2d07ccedd643
1 #ifndef guard_unbounded_object_reference_sequence_hpp
2 #define guard_unbounded_object_reference_sequence_hpp
3 /**
4 * @file
6 * @brief Implement unbounded sequences for object references.
8 * @author Carlos O'Ryan
9 */
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
18 namespace TAO
20 template<typename object_t, typename object_t_var>
21 class unbounded_object_reference_sequence
23 public:
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()
40 : impl_()
42 inline explicit unbounded_object_reference_sequence(CORBA::ULong maximum)
43 : impl_(maximum)
45 inline unbounded_object_reference_sequence(
46 CORBA::ULong maximum,
47 CORBA::ULong length,
48 value_type * data,
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) {
68 impl_.length(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()
83 inline void replace(
84 CORBA::ULong maximum,
85 CORBA::ULong length,
86 value_type * data,
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);
108 private:
109 implementation_type impl_;
111 } // namespace TAO
113 TAO_END_VERSIONED_NAMESPACE_DECL
115 #endif // guard_unbounded_object_reference_sequence_hpp