Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tao / Var_Size_Argument_T.cpp
blobe7e23c5201f65a988e6998cd84c5f86fa1446d29
1 #ifndef TAO_VAR_SIZE_ARGUMENT_T_CPP
2 #define TAO_VAR_SIZE_ARGUMENT_T_CPP
4 #include "tao/Var_Size_Argument_T.h"
5 #include "ace/OS_Memory.h"
7 #if !defined (__ACE_INLINE__)
8 #include "tao/Var_Size_Argument_T.inl"
9 #endif /* __ACE_INLINE__ */
11 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
13 template<typename S,
14 template <typename> class Insert_Policy>
15 CORBA::Boolean
16 TAO::In_Var_Size_Argument_T<S,Insert_Policy>::marshal (TAO_OutputCDR &cdr)
18 return cdr << *this->x_;
21 #if TAO_HAS_INTERCEPTORS == 1
23 template<typename S,
24 template <typename> class Insert_Policy>
25 void
26 TAO::In_Var_Size_Argument_T<S,Insert_Policy>::interceptor_value (
27 CORBA::Any *any) const
29 Insert_Policy<S>::any_insert (any, *this->x_);
32 #endif /* TAO_HAS_INTERCEPTORS */
34 template<typename S,
35 template <typename> class Insert_Policy>
36 TAO::In_Var_Size_Clonable_Argument_T<S,Insert_Policy>::~In_Var_Size_Clonable_Argument_T ()
38 if (this->is_clone_)
40 S* tmp = const_cast<S*> (this->x_);
41 delete tmp;
45 template<typename S,
46 template <typename> class Insert_Policy>
47 TAO::Argument*
48 TAO::In_Var_Size_Clonable_Argument_T<S,Insert_Policy>::clone ()
50 S* clone_x = new S (*(this->x_));
51 In_Var_Size_Clonable_Argument_T<S,Insert_Policy>* clone_arg
52 = new In_Var_Size_Clonable_Argument_T<S,Insert_Policy> (*clone_x);
53 clone_arg->is_clone_ = true;
54 return clone_arg;
57 // ===========================================================
59 template<typename S,
60 template <typename> class Insert_Policy>
61 CORBA::Boolean
62 TAO::Inout_Var_Size_Argument_T<S,Insert_Policy>::marshal (
63 TAO_OutputCDR &cdr
66 return cdr << *this->x_;
69 template<typename S,
70 template <typename> class Insert_Policy>
71 CORBA::Boolean
72 TAO::Inout_Var_Size_Argument_T<S,Insert_Policy>::demarshal (
73 TAO_InputCDR & cdr
76 return cdr >> *this->x_;
79 #if TAO_HAS_INTERCEPTORS == 1
81 template<typename S,
82 template <typename> class Insert_Policy>
83 void
84 TAO::Inout_Var_Size_Argument_T<S,Insert_Policy>::interceptor_value (
85 CORBA::Any *any) const
87 Insert_Policy<S>::any_insert (any, *this->x_);
90 #endif /* TAO_HAS_INTERCEPTORS */
92 // ==============================================================
94 template<typename S,
95 template <typename> class Insert_Policy>
96 CORBA::Boolean
97 TAO::Out_Var_Size_Argument_T<S,Insert_Policy>::demarshal (
98 TAO_InputCDR & cdr
101 this->x_ = new (std::nothrow) S;
102 return cdr >> *this->x_;
105 #if TAO_HAS_INTERCEPTORS == 1
107 template<typename S,
108 template <typename> class Insert_Policy>
109 void
110 TAO::Out_Var_Size_Argument_T<S,Insert_Policy>::interceptor_value (
111 CORBA::Any *any) const
113 Insert_Policy<S>::any_insert (any, *this->x_);
116 #endif /* TAO_HAS_INTERCEPTORS */
118 // ============================================================
120 template<typename S,
121 template <typename> class Insert_Policy>
122 CORBA::Boolean
123 TAO::Ret_Var_Size_Argument_T<S,Insert_Policy>::demarshal (
124 TAO_InputCDR & cdr
127 S * tmp = 0;
128 ACE_NEW_RETURN (tmp,
129 S (),
131 this->x_ = tmp;
132 return cdr >> this->x_.inout ();
135 #if TAO_HAS_INTERCEPTORS == 1
137 template<typename S,
138 template <typename> class Insert_Policy>
139 void
140 TAO::Ret_Var_Size_Argument_T<S,Insert_Policy>::interceptor_value (
141 CORBA::Any *any) const
143 Insert_Policy<S>::any_insert (any, this->x_.in ());
146 #endif /* TAO_HAS_INTERCEPTORS */
148 TAO_END_VERSIONED_NAMESPACE_DECL
150 #endif /* TAO_VAR_SIZE_ARGUMENT_T_CPP */