00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #include "tao/GIOPC.h"
00033 #include "tao/CDR.h"
00034 #include "tao/ORB_Core.h"
00035 #include "ace/OS_NS_string.h"
00036
00037 #if !defined (__ACE_INLINE__)
00038 #include "tao/GIOPC.inl"
00039 #endif
00040
00041
00042
00043
00044 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00045
00046
00047 namespace TAO
00048 {
00049 }
00050
00051
00052
00053
00054
00055 void
00056 GIOP::Version::_tao_any_destructor (
00057 void *_tao_void_pointer
00058 )
00059 {
00060 Version *_tao_tmp_pointer =
00061 static_cast<Version *> (_tao_void_pointer);
00062 delete _tao_tmp_pointer;
00063 }
00064
00065
00066
00067
00068 void
00069 GIOP::IORAddressingInfo::_tao_any_destructor (
00070 void *_tao_void_pointer
00071 )
00072 {
00073 IORAddressingInfo *_tao_tmp_pointer =
00074 static_cast<IORAddressingInfo *> (_tao_void_pointer);
00075 delete _tao_tmp_pointer;
00076 }
00077
00078
00079
00080
00081 GIOP::TargetAddress::TargetAddress (void)
00082 {
00083 ACE_OS::memset (&this->disc_, 0, sizeof (this->disc_));
00084 ACE_OS::memset (&this->u_, 0, sizeof (this->u_));
00085 this->disc_ = -32768;
00086 }
00087
00088 GIOP::TargetAddress::TargetAddress (const ::GIOP::TargetAddress &u)
00089 {
00090 this->disc_ = u.disc_;
00091 switch (this->disc_)
00092 {
00093 case 0:
00094 {
00095 if (u.u_.object_key_ == 0)
00096 {
00097 this->u_.object_key_ = 0;
00098 }
00099 else
00100 {
00101 ACE_NEW (
00102 this->u_.object_key_,
00103 CORBA::OctetSeq (*u.u_.object_key_)
00104 );
00105 }
00106 }
00107 break;
00108 case 1:
00109 {
00110 if (u.u_.profile_ == 0)
00111 {
00112 this->u_.profile_ = 0;
00113 }
00114 else
00115 {
00116 ACE_NEW (
00117 this->u_.profile_,
00118 IOP::TaggedProfile (*u.u_.profile_)
00119 );
00120 }
00121 }
00122 break;
00123 case 2:
00124 {
00125 if (u.u_.ior_ == 0)
00126 {
00127 this->u_.ior_ = 0;
00128 }
00129 else
00130 {
00131 ACE_NEW (
00132 this->u_.ior_,
00133 GIOP::IORAddressingInfo (*u.u_.ior_)
00134 );
00135 }
00136 }
00137 break;
00138 default:
00139 break;
00140 }
00141 }
00142
00143 GIOP::TargetAddress::~TargetAddress (void)
00144 {
00145
00146 this->_reset ();
00147 }
00148
00149 void GIOP::TargetAddress::_tao_any_destructor (void *_tao_void_pointer)
00150 {
00151 TargetAddress *tmp =
00152 static_cast<TargetAddress *> (_tao_void_pointer);
00153 delete tmp;
00154 }
00155
00156 GIOP::TargetAddress &
00157 GIOP::TargetAddress::operator= (const ::GIOP::TargetAddress &u)
00158 {
00159 if (&u == this)
00160 {
00161 return *this;
00162 }
00163
00164 this->_reset ();
00165 this->disc_ = u.disc_;
00166
00167 switch (this->disc_)
00168 {
00169 case 0:
00170 {
00171 if (u.u_.object_key_ == 0)
00172 {
00173 this->u_.object_key_ = 0;
00174 }
00175 else
00176 {
00177 ACE_NEW_RETURN (
00178 this->u_.object_key_,
00179 CORBA::OctetSeq (*u.u_.object_key_),
00180 *this
00181 );
00182 }
00183 }
00184 break;
00185 case 1:
00186 {
00187 if (u.u_.profile_ == 0)
00188 {
00189 this->u_.profile_ = 0;
00190 }
00191 else
00192 {
00193 ACE_NEW_RETURN (
00194 this->u_.profile_,
00195 IOP::TaggedProfile (*u.u_.profile_),
00196 *this
00197 );
00198 }
00199 }
00200 break;
00201 case 2:
00202 {
00203 if (u.u_.ior_ == 0)
00204 {
00205 this->u_.ior_ = 0;
00206 }
00207 else
00208 {
00209 ACE_NEW_RETURN (
00210 this->u_.ior_,
00211 GIOP::IORAddressingInfo (*u.u_.ior_),
00212 *this
00213 );
00214 }
00215 }
00216 break;
00217 default:
00218 break;
00219 }
00220
00221 return *this;
00222 }
00223
00224
00225 void GIOP::TargetAddress::_reset (void)
00226 {
00227 switch (this->disc_)
00228 {
00229
00230 case 0:
00231 delete this->u_.object_key_;
00232 this->u_.object_key_ = 0;
00233 break;
00234 case 1:
00235 delete this->u_.profile_;
00236 this->u_.profile_ = 0;
00237 break;
00238 case 2:
00239 delete this->u_.ior_;
00240 this->u_.ior_ = 0;
00241 break;
00242 default:
00243 break;
00244 }
00245 }
00246
00247
00248
00249
00250 CORBA::Boolean operator<< (
00251 TAO_OutputCDR &strm,
00252 const GIOP::Version &_tao_aggregate
00253 )
00254 {
00255 return
00256 (strm << ACE_OutputCDR::from_octet (_tao_aggregate.major)) &&
00257 (strm << ACE_OutputCDR::from_octet (_tao_aggregate.minor));
00258 }
00259
00260 CORBA::Boolean operator>> (
00261 TAO_InputCDR &strm,
00262 GIOP::Version &_tao_aggregate
00263 )
00264 {
00265 return
00266 (strm >> ACE_InputCDR::to_octet (_tao_aggregate.major)) &&
00267 (strm >> ACE_InputCDR::to_octet (_tao_aggregate.minor));
00268 }
00269
00270
00271
00272
00273 CORBA::Boolean operator<< (
00274 TAO_OutputCDR &strm,
00275 const GIOP::IORAddressingInfo &_tao_aggregate
00276 )
00277 {
00278 return
00279 (strm << _tao_aggregate.selected_profile_index) &&
00280 (strm << _tao_aggregate.ior);
00281 }
00282
00283 CORBA::Boolean operator>> (
00284 TAO_InputCDR &strm,
00285 GIOP::IORAddressingInfo &_tao_aggregate
00286 )
00287 {
00288 return
00289 (strm >> _tao_aggregate.selected_profile_index) &&
00290 (strm >> _tao_aggregate.ior);
00291 }
00292
00293
00294
00295
00296 CORBA::Boolean operator<< (
00297 TAO_OutputCDR &strm,
00298 const GIOP::TargetAddress &_tao_union
00299 )
00300 {
00301 if ( !(strm << _tao_union._d ()) )
00302 {
00303 return false;
00304 }
00305
00306 CORBA::Boolean result = true;
00307
00308 switch (_tao_union._d ())
00309 {
00310 case 0:
00311 {
00312 result = strm << _tao_union.object_key ();
00313 }
00314 break;
00315 case 1:
00316 {
00317 result = strm << _tao_union.profile ();
00318 }
00319 break;
00320 case 2:
00321 {
00322 result = strm << _tao_union.ior ();
00323 }
00324 break;
00325 default:
00326 break;
00327 }
00328
00329 return result;
00330 }
00331
00332 CORBA::Boolean operator>> (
00333 TAO_InputCDR &strm,
00334 GIOP::TargetAddress &_tao_union
00335 )
00336 {
00337 CORBA::Short _tao_discriminant;
00338 if ( !(strm >> _tao_discriminant) )
00339 {
00340 return false;
00341 }
00342
00343 CORBA::Boolean result = true;
00344
00345 switch (_tao_discriminant)
00346 {
00347 case 0:
00348 {
00349 CORBA::OctetSeq _tao_union_tmp;
00350 result = strm >> _tao_union_tmp;
00351
00352 if (result)
00353 {
00354 _tao_union.object_key (_tao_union_tmp);
00355 _tao_union._d (_tao_discriminant);
00356 }
00357 }
00358 break;
00359 case 1:
00360 {
00361 IOP::TaggedProfile _tao_union_tmp;
00362 result = strm >> _tao_union_tmp;
00363
00364 if (result)
00365 {
00366 _tao_union.profile (_tao_union_tmp);
00367 _tao_union._d (_tao_discriminant);
00368 }
00369 }
00370 break;
00371 case 2:
00372 {
00373 GIOP::IORAddressingInfo _tao_union_tmp;
00374 result = strm >> _tao_union_tmp;
00375
00376 if (result)
00377 {
00378 _tao_union.ior (_tao_union_tmp);
00379 _tao_union._d (_tao_discriminant);
00380 }
00381 }
00382 break;
00383 default:
00384 _tao_union._d (_tao_discriminant);
00385 break;
00386 }
00387
00388 return result;
00389 }
00390
00391 TAO_END_VERSIONED_NAMESPACE_DECL