00001
00002
00003 #ifndef TAO_BD_STRING_ARGUMENT_T_CPP
00004 #define TAO_BD_STRING_ARGUMENT_T_CPP
00005
00006 #include "tao/BD_String_Argument_T.h"
00007 #include "tao/SystemException.h"
00008
00009 #if !defined (__ACE_INLINE__)
00010 #include "tao/BD_String_Argument_T.inl"
00011 #endif
00012
00013 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00014
00015 template<typename S_var,
00016 size_t BOUND,
00017 template <typename> class Insert_Policy>
00018 CORBA::Boolean
00019 TAO::In_BD_String_Argument_T<S_var,BOUND,Insert_Policy>::marshal (
00020 TAO_OutputCDR & cdr)
00021 {
00022 if (this->x_ != 0 && ACE_OS::strlen (this->x_) > BOUND)
00023 {
00024 throw ::CORBA::BAD_PARAM ();
00025 }
00026 return cdr << this->x_;
00027 }
00028
00029 #if TAO_HAS_INTERCEPTORS == 1
00030
00031 template<typename S_var,
00032 size_t BOUND,
00033 template <typename> class Insert_Policy>
00034 void
00035 TAO::In_BD_String_Argument_T<S_var,BOUND,Insert_Policy>::interceptor_value (
00036 CORBA::Any *any) const
00037 {
00038 typedef typename S_var::s_traits::from_type from_type;
00039 Insert_Policy<from_type>::any_insert (
00040 any,
00041 from_type (this->x_, BOUND));
00042 }
00043
00044 #endif
00045
00046 template<typename S_var,
00047 size_t BOUND,
00048 template <typename> class Insert_Policy>
00049 TAO::In_BD_String_Clonable_Argument_T<S_var,BOUND,Insert_Policy>::~In_BD_String_Clonable_Argument_T (void)
00050 {
00051 if (this->is_clone_)
00052 {
00053 typename S_var::s_traits::char_type * tmp =
00054 const_cast<typename S_var::s_traits::char_type *> (this->x_);
00055 delete [] tmp;
00056 }
00057 }
00058
00059 template<typename S_var,
00060 size_t BOUND,
00061 template <typename> class Insert_Policy>
00062 TAO::Argument*
00063 TAO::In_BD_String_Clonable_Argument_T<S_var,BOUND,Insert_Policy>::clone (void)
00064 {
00065 typename S_var::s_traits::char_type * clone_x =
00066 new typename S_var::s_traits::char_type [BOUND];
00067 ACE_OS::strncpy (clone_x, this->x_, BOUND);
00068 In_BD_String_Clonable_Argument_T<S_var,BOUND,Insert_Policy>* clone_arg =
00069 new In_BD_String_Clonable_Argument_T<S_var,BOUND,Insert_Policy> (clone_x);
00070 clone_arg->is_clone_ = true;
00071 return clone_arg;
00072 }
00073
00074
00075
00076 template<typename S_var,
00077 size_t BOUND,
00078 template <typename> class Insert_Policy>
00079 CORBA::Boolean
00080 TAO::Inout_BD_String_Argument_T<S_var,BOUND,Insert_Policy>::marshal (
00081 TAO_OutputCDR & cdr)
00082 {
00083 if (this->x_ != 0 && ACE_OS::strlen (this->x_) > BOUND)
00084 {
00085 throw ::CORBA::BAD_PARAM ();
00086 }
00087 return cdr << this->x_;
00088 }
00089
00090 template<typename S_var,
00091 size_t BOUND,
00092 template <typename> class Insert_Policy>
00093 CORBA::Boolean
00094 TAO::Inout_BD_String_Argument_T<S_var,BOUND,Insert_Policy>::demarshal (
00095 TAO_InputCDR & cdr)
00096 {
00097 S_var tmp = this->x_;
00098 CORBA::Boolean const demarshalled = cdr >> this->x_;
00099 if (this->x_ != 0 && ACE_OS::strlen (this->x_) > BOUND)
00100 {
00101 S_var for_deletion = this->x_;
00102 this->x_ = tmp._retn ();
00103 throw ::CORBA::BAD_PARAM ();
00104 }
00105 return demarshalled;
00106 }
00107
00108 #if TAO_HAS_INTERCEPTORS == 1
00109
00110 template<typename S_var,
00111 size_t BOUND,
00112 template <typename> class Insert_Policy>
00113 void
00114 TAO::Inout_BD_String_Argument_T<S_var,BOUND,Insert_Policy>::interceptor_value (
00115 CORBA::Any *any) const
00116 {
00117 typedef typename S_var::s_traits::from_type from_type;
00118 Insert_Policy<from_type>::any_insert (
00119 any,
00120 from_type (this->x_, BOUND));
00121 }
00122
00123 #endif
00124
00125
00126
00127 template<typename S_var,
00128 size_t BOUND,
00129 template <typename> class Insert_Policy>
00130 CORBA::Boolean
00131 TAO::Out_BD_String_Argument_T<S_var,BOUND,Insert_Policy>::demarshal (
00132 TAO_InputCDR & cdr)
00133 {
00134 CORBA::Boolean const demarshalled = cdr >> this->x_;
00135 if (this->x_ != 0 && ACE_OS::strlen (this->x_) > BOUND)
00136 {
00137 throw ::CORBA::BAD_PARAM ();
00138 }
00139 return demarshalled;
00140 }
00141
00142 #if TAO_HAS_INTERCEPTORS == 1
00143
00144 template<typename S_var,
00145 size_t BOUND,
00146 template <typename> class Insert_Policy>
00147 void
00148 TAO::Out_BD_String_Argument_T<S_var,BOUND,Insert_Policy>::interceptor_value (
00149 CORBA::Any *any) const
00150 {
00151 typedef typename S_var::s_traits::from_type from_type;
00152 Insert_Policy<from_type>::any_insert (
00153 any,
00154 from_type (this->x_, BOUND)
00155 );
00156 }
00157
00158 #endif
00159
00160
00161
00162 template<typename S_var,
00163 size_t BOUND,
00164 template <typename> class Insert_Policy>
00165 CORBA::Boolean
00166 TAO::Ret_BD_String_Argument_T<S_var,BOUND,Insert_Policy>::demarshal (
00167 TAO_InputCDR & cdr)
00168 {
00169 CORBA::Boolean const demarshalled = cdr >> this->x_.out ();
00170 if (this->x_.in () != 0 && ACE_OS::strlen (this->x_.in ()) > BOUND)
00171 {
00172 throw ::CORBA::BAD_PARAM ();
00173 }
00174 return demarshalled;
00175 }
00176
00177 #if TAO_HAS_INTERCEPTORS == 1
00178
00179 template<typename S_var,
00180 size_t BOUND,
00181 template <typename> class Insert_Policy>
00182 void
00183 TAO::Ret_BD_String_Argument_T<S_var,BOUND,Insert_Policy>::interceptor_value (
00184 CORBA::Any *any) const
00185 {
00186 typedef typename S_var::s_traits::from_type from_type;
00187 Insert_Policy<from_type>::any_insert (
00188 any,
00189 from_type (this->x_.in (), BOUND));
00190 }
00191
00192 #endif
00193
00194 TAO_END_VERSIONED_NAMESPACE_DECL
00195
00196 #endif