Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tao / UB_String_Argument_T.cpp
blob0576a2d4e88aed0583483dac58f0007b9eb7095b
1 #ifndef TAO_UB_STRING_ARGUMENT_T_CPP
2 #define TAO_UB_STRING_ARGUMENT_T_CPP
4 #include "tao/UB_String_Argument_T.h"
5 #include "tao/CDR.h"
6 #include "ace/OS_NS_string.h"
8 #if !defined (__ACE_INLINE__)
9 #include "tao/UB_String_Argument_T.inl"
10 #endif /* __ACE_INLINE__ */
12 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
14 template<typename S_var,
15 template <typename> class Insert_Policy>
16 CORBA::Boolean
17 TAO::In_UB_String_Argument_T<S_var,Insert_Policy>::marshal (TAO_OutputCDR &cdr)
19 return cdr << this->x_;
22 #if TAO_HAS_INTERCEPTORS == 1
24 template<typename S_var,
25 template <typename> class Insert_Policy>
26 void
27 TAO::In_UB_String_Argument_T<S_var,Insert_Policy>::interceptor_value (
28 CORBA::Any *any) const
30 Insert_Policy<S_var>::any_insert (any, this->x_);
33 #endif /* TAO_HAS_INTERCEPTORS */
35 template<typename S_var,
36 template <typename> class Insert_Policy>
37 TAO::In_UB_String_Clonable_Argument_T<S_var,Insert_Policy>::~In_UB_String_Clonable_Argument_T ()
39 if (this->is_clone_)
41 typename S_var::s_traits::char_type * tmp =
42 const_cast<typename S_var::s_traits::char_type *> (this->x_);
43 S_var::s_traits::release (tmp);
47 template<typename S_var,
48 template <typename> class Insert_Policy>
49 TAO::Argument*
50 TAO::In_UB_String_Clonable_Argument_T<S_var,Insert_Policy>::clone ()
52 size_t const len = ACE_OS::strlen (this->x_);
53 typename S_var::s_traits::char_type * clone_x =
54 new typename S_var::s_traits::char_type [len + 1];
55 ACE_OS::strncpy (clone_x, this->x_, len);
56 clone_x[len] = '\0';
57 In_UB_String_Clonable_Argument_T<S_var,Insert_Policy>* clone_arg =
58 new In_UB_String_Clonable_Argument_T<S_var,Insert_Policy> (clone_x);
59 clone_arg->is_clone_ = true;
60 return clone_arg;
63 // ===========================================================
65 template<typename S_var,
66 template <typename> class Insert_Policy>
67 CORBA::Boolean
68 TAO::Inout_UB_String_Argument_T<S_var,Insert_Policy>::marshal (
69 TAO_OutputCDR &cdr)
71 return cdr << this->x_;
74 template<typename S_var,
75 template <typename> class Insert_Policy>
76 CORBA::Boolean
77 TAO::Inout_UB_String_Argument_T<S_var,Insert_Policy>::demarshal (
78 TAO_InputCDR & cdr)
80 S_var::s_traits::release (this->x_);
81 return cdr >> this->x_;
84 #if TAO_HAS_INTERCEPTORS == 1
86 template<typename S_var,
87 template <typename> class Insert_Policy>
88 void
89 TAO::Inout_UB_String_Argument_T<S_var,Insert_Policy>::interceptor_value (
90 CORBA::Any *any) const
92 Insert_Policy<typename S_var::s_traits::char_type const *>::any_insert (any, this->x_);
95 #endif /* TAO_HAS_INTERCEPTORS */
97 // ==============================================================
99 template<typename S_var,
100 template <typename> class Insert_Policy>
101 CORBA::Boolean
102 TAO::Out_UB_String_Argument_T<S_var,Insert_Policy>::demarshal (TAO_InputCDR & cdr)
104 return cdr >> this->x_;
107 #if TAO_HAS_INTERCEPTORS == 1
109 template<typename S_var,
110 template <typename> class Insert_Policy>
111 void
112 TAO::Out_UB_String_Argument_T<S_var,Insert_Policy>::interceptor_value (
113 CORBA::Any *any) const
115 Insert_Policy<typename S_var::s_traits::char_type const *>::any_insert (any, this->x_);
118 #endif /* TAO_HAS_INTERCEPTORS */
120 // ============================================================
122 template<typename S_var,
123 template <typename> class Insert_Policy>
124 CORBA::Boolean
125 TAO::Ret_UB_String_Argument_T<S_var,Insert_Policy>::demarshal (TAO_InputCDR & cdr)
127 return cdr >> this->x_.out ();
130 #if TAO_HAS_INTERCEPTORS == 1
132 template<typename S_var,
133 template <typename> class Insert_Policy>
134 void
135 TAO::Ret_UB_String_Argument_T<S_var,Insert_Policy>::interceptor_value (
136 CORBA::Any *any) const
138 Insert_Policy<typename S_var::s_traits::char_type const *>::any_insert (any, this->x_.in ());
141 #endif /* TAO_HAS_INTERCEPTORS */
143 TAO_END_VERSIONED_NAMESPACE_DECL
145 #endif /* TAO_UB_STRING_ARGUMENT_T_CPP */