UB_String_Argument_T.cpp

Go to the documentation of this file.
00001 // $Id: UB_String_Argument_T.cpp 77390 2007-02-26 13:59:03Z johnnyw $
00002 
00003 #ifndef TAO_UB_STRING_ARGUMENT_T_CPP
00004 #define TAO_UB_STRING_ARGUMENT_T_CPP
00005 
00006 #include "tao/UB_String_Argument_T.h"
00007 #include "tao/CDR.h"
00008 #include "ace/OS_NS_string.h"
00009 
00010 #if !defined (__ACE_INLINE__)
00011 #include "tao/UB_String_Argument_T.inl"
00012 #endif /* __ACE_INLINE__ */
00013 
00014 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00015 
00016 template<typename S_var,
00017          class Insert_Policy>
00018 CORBA::Boolean
00019 TAO::In_UB_String_Argument_T<S_var,Insert_Policy>::marshal (TAO_OutputCDR &cdr)
00020 {
00021   return cdr << this->x_;
00022 }
00023 
00024 #if TAO_HAS_INTERCEPTORS == 1
00025 
00026 template<typename S_var,
00027          class Insert_Policy>
00028 void
00029 TAO::In_UB_String_Argument_T<S_var,Insert_Policy>::interceptor_value (
00030     CORBA::Any *any) const
00031 {
00032   Insert_Policy::any_insert (any, this->x_);
00033 }
00034 
00035 #endif /* TAO_HAS_INTERCEPTORS */
00036 
00037 template<typename S_var,
00038          class Insert_Policy>
00039 TAO::In_UB_String_Clonable_Argument_T<S_var,Insert_Policy>::~In_UB_String_Clonable_Argument_T (void)
00040 {
00041   if (this->is_clone_)
00042     {
00043       typename S_var::s_traits::char_type * tmp =
00044            const_cast<typename S_var::s_traits::char_type *> (this->x_);
00045       delete [] tmp;
00046     }
00047 }
00048 
00049 template<typename S_var,
00050          class Insert_Policy>
00051 TAO::Argument*
00052 TAO::In_UB_String_Clonable_Argument_T<S_var,Insert_Policy>::clone ()
00053 {
00054   size_t len = ACE_OS::strlen (this->x_);
00055   typename S_var::s_traits::char_type * clone_x =
00056            new typename S_var::s_traits::char_type [len + 1];
00057   ACE_OS::strncpy (clone_x, this->x_, len);
00058   clone_x[len] = '\0';
00059   In_UB_String_Clonable_Argument_T<S_var,Insert_Policy>* clone_arg =
00060        new In_UB_String_Clonable_Argument_T<S_var,Insert_Policy> (clone_x);
00061   clone_arg->is_clone_ = true;
00062   return clone_arg;
00063 }
00064 
00065 // ===========================================================
00066 
00067 template<typename S_var,
00068          class Insert_Policy>
00069 CORBA::Boolean
00070 TAO::Inout_UB_String_Argument_T<S_var,Insert_Policy>::marshal (
00071     TAO_OutputCDR &cdr)
00072 {
00073   return cdr << this->x_;
00074 }
00075 
00076 template<typename S_var,
00077          class Insert_Policy>
00078 CORBA::Boolean
00079 TAO::Inout_UB_String_Argument_T<S_var,Insert_Policy>::demarshal (
00080     TAO_InputCDR & cdr)
00081 {
00082   delete [] this->x_;
00083   return cdr >> this->x_;
00084 }
00085 
00086 #if TAO_HAS_INTERCEPTORS == 1
00087 
00088 template<typename S_var,
00089          class Insert_Policy>
00090 void
00091 TAO::Inout_UB_String_Argument_T<S_var,Insert_Policy>::interceptor_value (
00092     CORBA::Any *any) const
00093 {
00094   Insert_Policy::any_insert (any, this->x_);
00095 }
00096 
00097 #endif /* TAO_HAS_INTERCEPTORS */
00098 
00099 // ==============================================================
00100 
00101 template<typename S_var,
00102          class Insert_Policy>
00103 CORBA::Boolean
00104 TAO::Out_UB_String_Argument_T<S_var,Insert_Policy>::demarshal (TAO_InputCDR & cdr)
00105 {
00106   return cdr >> this->x_;
00107 }
00108 
00109 #if TAO_HAS_INTERCEPTORS == 1
00110 
00111 template<typename S_var,
00112          class Insert_Policy>
00113 void
00114 TAO::Out_UB_String_Argument_T<S_var,Insert_Policy>::interceptor_value (
00115     CORBA::Any *any) const
00116 {
00117   Insert_Policy::any_insert (any, this->x_);
00118 }
00119 
00120 #endif /* TAO_HAS_INTERCEPTORS */
00121 
00122 // ============================================================
00123 
00124 template<typename S_var,
00125          class Insert_Policy>
00126 CORBA::Boolean
00127 TAO::Ret_UB_String_Argument_T<S_var,Insert_Policy>::demarshal (TAO_InputCDR & cdr)
00128 {
00129   return cdr >> this->x_.out ();
00130 }
00131 
00132 #if TAO_HAS_INTERCEPTORS == 1
00133 
00134 template<typename S_var,
00135          class Insert_Policy>
00136 void
00137 TAO::Ret_UB_String_Argument_T<S_var,Insert_Policy>::interceptor_value (
00138   CORBA::Any *any) const
00139 {
00140   Insert_Policy::any_insert (any, this->x_.in ());
00141 }
00142 
00143 #endif /* TAO_HAS_INTERCEPTORS */
00144 
00145 TAO_END_VERSIONED_NAMESPACE_DECL
00146 
00147 #endif /* TAO_UB_STRING_ARGUMENT_T_CPP */

Generated on Tue Feb 2 17:37:53 2010 for TAO by  doxygen 1.4.7