1 #ifndef guard_object_reference_sequence_element_hpp
2 #define guard_object_reference_sequence_element_hpp
6 * @brief Implement the type returned by operator[] in object_reference
9 * @author Carlos O'Ryan
11 #include "tao/Basic_Types.h"
15 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
21 template<typename obj_ref_traits
>
22 class object_reference_sequence_element
25 typedef typename
obj_ref_traits::object_type object_reference_type
;
26 typedef object_reference_type
* value_type
;
27 typedef object_reference_type
const * const_value_type
;
28 typedef typename
obj_ref_traits::object_type_var object_reference_var
;
31 inline object_reference_sequence_element
<obj_ref_traits
> & pseudo_copy_swap(
32 object_reference_var
& rhs
)
36 obj_ref_traits::release(*element_
);
38 *element_
= rhs
._retn();
43 object_reference_sequence_element(
44 value_type
& e
, CORBA::Boolean release
)
50 object_reference_sequence_element(
51 object_reference_sequence_element
const & rhs
)
52 : element_(rhs
.element_
)
53 , release_(rhs
.release_
)
57 ~object_reference_sequence_element()
61 object_reference_sequence_element
& operator=(
62 object_reference_var
const & rhs
)
64 object_reference_var
tmp(rhs
);
65 return pseudo_copy_swap(tmp
);
68 object_reference_sequence_element
& operator=(
69 object_reference_sequence_element
const & rhs
)
71 object_reference_var
tmp(obj_ref_traits::duplicate(*rhs
.element_
));
72 return pseudo_copy_swap(tmp
);
75 object_reference_sequence_element
& operator=(value_type rhs
)
77 object_reference_var
tmp(rhs
);
78 return pseudo_copy_swap(tmp
);
81 inline operator value_type()
83 return *this->element_
;
86 inline operator const_value_type() const
88 return *this->element_
;
91 inline object_reference_type
*in () const {
92 return *this->element_
;
95 inline object_reference_type
*&inout () const {
96 return *this->element_
;
99 inline value_type
operator->()
101 return *this->element_
;
104 inline value_type
operator->() const
106 return *this->element_
;
109 void swap(object_reference_sequence_element
& rhs
)
111 std::swap(this->element_
, rhs
.element_
);
112 std::swap(this->release_
, rhs
.release_
);
115 inline CORBA::Boolean
release() const
117 return this->release_
;
121 // This function is not implemented
122 object_reference_sequence_element();
125 value_type
* element_
;
126 CORBA::Boolean release_
;
128 } // namespace details
131 TAO_END_VERSIONED_NAMESPACE_DECL
133 #endif // guard_object_reference_sequence_element_hpp