Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tao / Var_Array_Argument_T.cpp
blob4754cc4e1ed197c12881c0be2c1fe49cea051d25
1 #ifndef TAO_VAR_ARRAY_ARGUMENT_T_CPP
2 #define TAO_VAR_ARRAY_ARGUMENT_T_CPP
4 #include "tao/Var_Array_Argument_T.h"
5 #include "tao/Array_Traits_T.h"
7 #if !defined (__ACE_INLINE__)
8 #include "tao/Var_Array_Argument_T.inl"
9 #endif /* __ACE_INLINE__ */
11 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
13 template<typename S_forany,
14 template <typename> class Insert_Policy>
15 CORBA::Boolean
16 TAO::In_Var_Array_Argument_T<S_forany,Insert_Policy>::marshal (
17 TAO_OutputCDR & cdr
20 return cdr << this->x_;
23 #if TAO_HAS_INTERCEPTORS == 1
25 template<typename S_forany,
26 template <typename> class Insert_Policy>
27 void
28 TAO::In_Var_Array_Argument_T<S_forany,Insert_Policy>::interceptor_value (
29 CORBA::Any *any) const
31 Insert_Policy<S_forany>::any_insert (any, this->x_);
34 #endif /* TAO_HAS_INTERCEPTORS */
36 template<typename S_forany,
37 template <typename> class Insert_Policy>
38 TAO::In_Var_Array_Clonable_Argument_T<S_forany,Insert_Policy>::~In_Var_Array_Clonable_Argument_T ()
40 if (this->is_clone_)
42 typedef TAO::details::array_traits<S_forany> ARRAY_TRAITS;
43 typename ARRAY_TRAITS::slice_type * tmp =
44 const_cast<typename ARRAY_TRAITS::slice_type*> (this->x_.in ());
45 ARRAY_TRAITS::free (tmp);
49 template<typename S_forany,
50 template <typename> class Insert_Policy>
51 TAO::Argument*
52 TAO::In_Var_Array_Clonable_Argument_T<S_forany,Insert_Policy>::clone ()
54 typedef TAO::details::array_traits<S_forany> ARRAY_TRAITS;
55 typename ARRAY_TRAITS::slice_type * tmp_ptr = 0;
56 ACE_ALLOCATOR_RETURN (tmp_ptr,
57 ARRAY_TRAITS::alloc (),
58 0);
59 ARRAY_TRAITS::copy(tmp_ptr, this->x_.in ());
61 In_Var_Array_Clonable_Argument_T<S_forany,Insert_Policy>* clone_arg
62 = new In_Var_Array_Clonable_Argument_T<S_forany,Insert_Policy> (tmp_ptr);
63 clone_arg->is_clone_ = true;
64 return clone_arg;
67 // ===========================================================
69 template<typename S_forany,
70 template <typename> class Insert_Policy>
71 CORBA::Boolean
72 TAO::Inout_Var_Array_Argument_T<S_forany,Insert_Policy>::marshal (
73 TAO_OutputCDR & cdr
76 return cdr << this->x_;
79 template<typename S_forany,
80 template <typename> class Insert_Policy>
81 CORBA::Boolean
82 TAO::Inout_Var_Array_Argument_T<S_forany,Insert_Policy>::demarshal (
83 TAO_InputCDR & cdr
86 return cdr >> this->x_;
89 #if TAO_HAS_INTERCEPTORS == 1
91 template<typename S_forany,
92 template <typename> class Insert_Policy>
93 void
94 TAO::Inout_Var_Array_Argument_T<S_forany,Insert_Policy>::interceptor_value (
95 CORBA::Any *any) const
97 Insert_Policy<S_forany>::any_insert (any, this->x_);
100 #endif /* TAO_HAS_INTERCEPTORS */
102 // ==============================================================
104 template<typename S_out,
105 typename S_forany,
106 template <typename> class Insert_Policy>
107 CORBA::Boolean
108 TAO::Out_Var_Array_Argument_T<S_out,S_forany,Insert_Policy>::demarshal (
109 TAO_InputCDR & cdr
112 typedef TAO::Array_Traits<S_forany> ARRAY_TRAITS;
113 ACE_ALLOCATOR_RETURN (this->x_,
114 ARRAY_TRAITS::alloc (),
116 S_forany tmp (this->x_);
117 return cdr >> tmp;
120 #if TAO_HAS_INTERCEPTORS == 1
122 template<typename S_out,
123 typename S_forany,
124 template <typename> class Insert_Policy>
125 void
126 TAO::Out_Var_Array_Argument_T<S_out,S_forany,Insert_Policy>::
127 interceptor_value (CORBA::Any *any) const
129 S_forany tmp (this->x_);
130 Insert_Policy<S_forany>::any_insert (any, tmp);
133 #endif /* TAO_HAS_INTERCEPTORS */
135 // ============================================================
137 template<typename S_var,
138 typename S_forany,
139 template <typename> class Insert_Policy>
140 CORBA::Boolean
141 TAO::Ret_Var_Array_Argument_T<S_var,S_forany,Insert_Policy>::demarshal (
142 TAO_InputCDR & cdr
145 typedef TAO::Array_Traits<S_forany> ARRAY_TRAITS;
146 typename S_forany::_slice_type * tmp_ptr = 0;
147 ACE_ALLOCATOR_RETURN (tmp_ptr,
148 ARRAY_TRAITS::alloc (),
150 this->x_ = tmp_ptr;
151 S_forany tmp (this->x_.ptr ());
152 return cdr >> tmp;
155 #if TAO_HAS_INTERCEPTORS == 1
157 template<typename S_var,
158 typename S_forany,
159 template <typename> class Insert_Policy>
160 void
161 TAO::Ret_Var_Array_Argument_T<S_var,S_forany,Insert_Policy>::
162 interceptor_value (CORBA::Any *any) const
164 Insert_Policy<S_forany>::any_insert (any, S_forany (this->x_.ptr ()));
167 #endif /* TAO_HAS_INTERCEPTORS */
169 TAO_END_VERSIONED_NAMESPACE_DECL
171 #endif /* TAO_VAR_ARRAY_ARGUMENT_T_CPP */