00001
00002
00003
00004
00005 #include "tao/SystemException.h"
00006
00007 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00008
00009 ACE_INLINE
00010 TAO_OutputCDR::~TAO_OutputCDR (void)
00011 {
00012 }
00013
00014 ACE_INLINE bool
00015 TAO_OutputCDR::more_fragments (void) const
00016 {
00017 return this->more_fragments_;
00018 }
00019
00020 ACE_INLINE void
00021 TAO_OutputCDR::more_fragments (bool more)
00022 {
00023 this->more_fragments_ = more;
00024 }
00025
00026 ACE_INLINE void
00027 TAO_OutputCDR::message_attributes (CORBA::ULong request_id,
00028 TAO_Stub * stub,
00029 TAO_Message_Semantics message_semantics,
00030 ACE_Time_Value * timeout)
00031 {
00032 this->request_id_ = request_id;
00033 this->stub_ = stub;
00034 this->message_semantics_ = message_semantics;
00035 this->timeout_ = timeout;
00036 }
00037
00038 ACE_INLINE CORBA::ULong
00039 TAO_OutputCDR::request_id (void) const
00040 {
00041 return this->request_id_;
00042 }
00043
00044 ACE_INLINE TAO_Stub *
00045 TAO_OutputCDR::stub (void) const
00046 {
00047 return this->stub_;
00048 }
00049
00050 ACE_INLINE TAO_Message_Semantics
00051 TAO_OutputCDR::message_semantics (void) const
00052 {
00053 return this->message_semantics_;
00054 }
00055
00056 ACE_INLINE ACE_Time_Value *
00057 TAO_OutputCDR::timeout (void) const
00058 {
00059 return this->timeout_;
00060 }
00061
00062 ACE_INLINE void
00063 TAO_OutputCDR::get_version (TAO_GIOP_Message_Version& giop_version)
00064 {
00065 giop_version.major = this->major_version_;
00066 giop_version.minor = this->minor_version_;
00067 }
00068
00069 ACE_INLINE TAO_OutputCDR::Repo_Id_Map_Handle&
00070 TAO_OutputCDR::get_repo_id_map ()
00071 {
00072 return this->repo_id_map_;
00073 }
00074
00075 #ifdef TAO_HAS_VALUETYPE_CODEBASE
00076 ACE_INLINE TAO_OutputCDR::Codebase_URL_Map_Handle&
00077 TAO_OutputCDR::get_codebase_url_map ()
00078 {
00079 return this->codebase_map_;
00080 }
00081 #endif
00082
00083 ACE_INLINE TAO_OutputCDR::Value_Map_Handle&
00084 TAO_OutputCDR::get_value_map ()
00085 {
00086 return this->value_map_;
00087 }
00088
00089 ACE_INLINE void
00090 TAO_OutputCDR::set_repo_id_map (TAO_OutputCDR::Repo_Id_Map_Handle& map)
00091 {
00092 this->repo_id_map_ = map;
00093 }
00094
00095 #ifdef TAO_HAS_VALUETYPE_CODEBASE
00096 ACE_INLINE void
00097 TAO_OutputCDR::set_codebase_url_map (TAO_OutputCDR::Codebase_URL_Map_Handle& map)
00098 {
00099 this->codebase_map_ = map;
00100 }
00101 #endif
00102
00103 ACE_INLINE void
00104 TAO_OutputCDR::set_value_map (TAO_OutputCDR::Value_Map_Handle& map)
00105 {
00106 this->value_map_ = map;
00107 }
00108
00109 ACE_INLINE void
00110 TAO_OutputCDR::reset_vt_indirect_maps ()
00111 {
00112 if (! this->repo_id_map_.is_nil () && this->repo_id_map_->get()->current_size () != 0)
00113 {
00114 this->repo_id_map_->get()->unbind_all ();
00115 }
00116 #ifdef TAO_HAS_VALUETYPE_CODEBASE
00117 if (! this->codebase_map_.is_nil () && this->codebase_map_->get()->current_size () != 0)
00118 {
00119 this->codebase_map_->get()->unbind_all ();
00120 }
00121 #endif
00122 if (! this->value_map_.is_nil () && this->value_map_->get()->current_size () != 0)
00123 {
00124 this->value_map_->get()->unbind_all ();
00125 }
00126 }
00127
00128
00129
00130 ACE_INLINE
00131 TAO_InputCDR::TAO_InputCDR (const char *buf,
00132 size_t bufsiz,
00133 int byte_order,
00134 ACE_CDR::Octet major_version,
00135 ACE_CDR::Octet minor_version,
00136 TAO_ORB_Core* orb_core)
00137 : ACE_InputCDR (buf,
00138 bufsiz,
00139 byte_order,
00140 major_version,
00141 minor_version),
00142 orb_core_ (orb_core)
00143 {
00144 }
00145
00146 ACE_INLINE
00147 TAO_InputCDR::TAO_InputCDR (size_t bufsiz,
00148 int byte_order,
00149 ACE_CDR::Octet major_version,
00150 ACE_CDR::Octet minor_version,
00151 TAO_ORB_Core* orb_core)
00152 : ACE_InputCDR (bufsiz,
00153 byte_order,
00154 major_version,
00155 minor_version),
00156 orb_core_ (orb_core)
00157 {
00158 }
00159
00160 ACE_INLINE
00161 TAO_InputCDR::TAO_InputCDR (const ACE_Message_Block *data,
00162 int byte_order,
00163 ACE_CDR::Octet major_version,
00164 ACE_CDR::Octet minor_version,
00165 TAO_ORB_Core* orb_core)
00166 : ACE_InputCDR (data,
00167 byte_order,
00168 major_version,
00169 minor_version),
00170 orb_core_ (orb_core)
00171 {
00172 }
00173
00174 ACE_INLINE
00175 TAO_InputCDR::TAO_InputCDR (const ACE_Message_Block *data,
00176 ACE_Lock* lock,
00177 int byte_order,
00178 ACE_CDR::Octet major_version,
00179 ACE_CDR::Octet minor_version,
00180 TAO_ORB_Core* orb_core)
00181 : ACE_InputCDR (data,
00182 byte_order,
00183 major_version,
00184 minor_version,
00185 lock),
00186 orb_core_ (orb_core)
00187 {
00188 }
00189
00190 ACE_INLINE
00191 TAO_InputCDR::TAO_InputCDR (ACE_Data_Block *data,
00192 ACE_Message_Block::Message_Flags flag,
00193 int byte_order,
00194 ACE_CDR::Octet major_version,
00195 ACE_CDR::Octet minor_version,
00196 TAO_ORB_Core* orb_core)
00197 : ACE_InputCDR (data,
00198 flag,
00199 byte_order,
00200 major_version,
00201 minor_version),
00202 orb_core_ (orb_core)
00203 {
00204 }
00205
00206
00207 ACE_INLINE
00208 TAO_InputCDR::TAO_InputCDR (ACE_Data_Block *data,
00209 ACE_Message_Block::Message_Flags flag,
00210 size_t rd_pos,
00211 size_t wr_pos,
00212 int byte_order,
00213 ACE_CDR::Octet major_version,
00214 ACE_CDR::Octet minor_version,
00215 TAO_ORB_Core* orb_core)
00216 : ACE_InputCDR (data,
00217 flag,
00218 rd_pos,
00219 wr_pos,
00220 byte_order,
00221 major_version,
00222 minor_version),
00223 orb_core_ (orb_core)
00224 {
00225 }
00226
00227
00228 ACE_INLINE
00229 TAO_InputCDR::TAO_InputCDR (const TAO_InputCDR& rhs,
00230 size_t size,
00231 ACE_CDR::Long offset)
00232 : ACE_InputCDR (rhs,
00233 size,
00234 offset),
00235 orb_core_ (rhs.orb_core_)
00236 {
00237 }
00238
00239 ACE_INLINE
00240 TAO_InputCDR::TAO_InputCDR (const TAO_InputCDR& rhs,
00241 size_t size)
00242 : ACE_InputCDR (rhs,
00243 size),
00244 orb_core_ (rhs.orb_core_)
00245 {
00246 }
00247
00248 ACE_INLINE
00249 TAO_InputCDR::TAO_InputCDR (const TAO_InputCDR& rhs)
00250 : ACE_InputCDR (rhs),
00251 orb_core_ (rhs.orb_core_),
00252 repo_id_map_ (rhs.repo_id_map_),
00253 codebase_map_ (rhs.codebase_map_),
00254 value_map_ (rhs.value_map_)
00255 {
00256 }
00257
00258 ACE_INLINE
00259 TAO_InputCDR::TAO_InputCDR (ACE_InputCDR::Transfer_Contents rhs,
00260 TAO_ORB_Core* orb_core)
00261 : ACE_InputCDR (rhs),
00262 orb_core_ (orb_core)
00263 {
00264 }
00265
00266
00267 ACE_INLINE
00268 TAO_InputCDR::~TAO_InputCDR (void)
00269 {
00270 }
00271
00272 ACE_INLINE TAO_ORB_Core*
00273 TAO_InputCDR::orb_core (void) const
00274 {
00275 return this->orb_core_;
00276 }
00277
00278
00279 ACE_INLINE TAO_InputCDR::Repo_Id_Map_Handle&
00280 TAO_InputCDR::get_repo_id_map ()
00281 {
00282 return this->repo_id_map_;
00283 }
00284
00285 ACE_INLINE TAO_InputCDR::Codebase_URL_Map_Handle&
00286 TAO_InputCDR::get_codebase_url_map ()
00287 {
00288 return this->codebase_map_;
00289 }
00290
00291 ACE_INLINE TAO_InputCDR::Value_Map_Handle&
00292 TAO_InputCDR::get_value_map ()
00293 {
00294 return this->value_map_;
00295 }
00296
00297 ACE_INLINE void
00298 TAO_InputCDR::set_repo_id_map (TAO_InputCDR::Repo_Id_Map_Handle& map)
00299 {
00300 this->repo_id_map_ = map;
00301 }
00302
00303 ACE_INLINE void
00304 TAO_InputCDR::set_codebase_url_map (TAO_InputCDR::Codebase_URL_Map_Handle& map)
00305 {
00306 this->codebase_map_ = map;
00307 }
00308
00309 ACE_INLINE void
00310 TAO_InputCDR::set_value_map (TAO_InputCDR::Value_Map_Handle& map)
00311 {
00312 this->value_map_ = map;
00313 }
00314
00315 ACE_INLINE void
00316 TAO_InputCDR::reset_vt_indirect_maps ()
00317 {
00318 if (! this->repo_id_map_.is_nil () && this->repo_id_map_->get()->current_size () != 0)
00319 {
00320 this->repo_id_map_->get()->unbind_all ();
00321 }
00322 if (! this->codebase_map_.is_nil () && this->codebase_map_->get()->current_size () != 0)
00323 {
00324 this->codebase_map_->get()->unbind_all ();
00325 }
00326 if (! this->value_map_.is_nil () && this->value_map_->get()->current_size () != 0)
00327 {
00328 this->value_map_->get()->unbind_all ();
00329 }
00330 }
00331
00332
00333
00334
00335 ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
00336 CORBA::Short x)
00337 {
00338 return
00339 os.fragment_stream (ACE_CDR::SHORT_ALIGN,
00340 sizeof (CORBA::Short))
00341 && static_cast<ACE_OutputCDR &> (os) << x;
00342 }
00343
00344 ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
00345 CORBA::UShort x)
00346 {
00347 return
00348 os.fragment_stream (ACE_CDR::SHORT_ALIGN,
00349 sizeof (CORBA::UShort))
00350 && static_cast<ACE_OutputCDR &> (os) << x;
00351 }
00352
00353 ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
00354 CORBA::Long x)
00355 {
00356 return
00357 os.fragment_stream (ACE_CDR::LONG_ALIGN,
00358 sizeof (CORBA::Long))
00359 && static_cast<ACE_OutputCDR &> (os) << x;
00360 }
00361
00362 ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
00363 CORBA::ULong x)
00364 {
00365 return
00366 os.fragment_stream (ACE_CDR::LONG_ALIGN,
00367 sizeof (CORBA::ULong))
00368 && static_cast<ACE_OutputCDR &> (os) << x;
00369 }
00370
00371 ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
00372 CORBA::LongLong x)
00373 {
00374 return
00375 os.fragment_stream (ACE_CDR::LONGLONG_ALIGN,
00376 sizeof (CORBA::LongLong))
00377 && static_cast<ACE_OutputCDR &> (os) << x;
00378 }
00379
00380 ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
00381 CORBA::ULongLong x)
00382 {
00383 return
00384 os.fragment_stream (ACE_CDR::LONGLONG_ALIGN,
00385 sizeof (CORBA::ULongLong))
00386 && static_cast<ACE_OutputCDR &> (os) << x;
00387 }
00388
00389 ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR& os,
00390 CORBA::LongDouble x)
00391 {
00392 return
00393 os.fragment_stream (ACE_CDR::LONGDOUBLE_ALIGN,
00394 sizeof (CORBA::LongDouble))
00395 && static_cast<ACE_OutputCDR &> (os) << x;
00396 }
00397
00398 ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
00399 CORBA::Float x)
00400 {
00401 return
00402 os.fragment_stream (ACE_CDR::LONG_ALIGN,
00403 sizeof (CORBA::Float))
00404 && static_cast<ACE_OutputCDR &> (os) << x;
00405 }
00406
00407 ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
00408 CORBA::Double x)
00409 {
00410 return
00411 os.fragment_stream (ACE_CDR::LONGLONG_ALIGN,
00412 sizeof (CORBA::Double))
00413 && static_cast<ACE_OutputCDR &> (os) << x;
00414 }
00415
00416 ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
00417 const char * x)
00418 {
00419 return
00420 os.fragment_stream (ACE_CDR::OCTET_ALIGN,
00421 sizeof (char))
00422 && static_cast<ACE_OutputCDR &> (os) << x;
00423 }
00424
00425 ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
00426 const CORBA::WChar * x)
00427 {
00428 return
00429 os.fragment_stream ((sizeof (CORBA::WChar) == 2
00430 ? ACE_CDR::SHORT_ALIGN
00431 : ACE_CDR::LONG_ALIGN),
00432 sizeof (CORBA::WChar))
00433 && static_cast<ACE_OutputCDR &> (os) << x;
00434 }
00435
00436 ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
00437 ACE_OutputCDR::from_string x)
00438 {
00439 if (x.bound_ != 0 && x.val_ != 0 &&
00440 ACE_OS::strlen (x.val_) > x.bound_)
00441 {
00442 throw ::CORBA::BAD_PARAM ();
00443 }
00444 return os << x.val_;
00445 }
00446
00447 ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
00448 ACE_OutputCDR::from_wstring x)
00449 {
00450 if (x.bound_ != 0 && x.val_ != 0 &&
00451 ACE_OS::strlen (x.val_) > x.bound_)
00452 {
00453 throw ::CORBA::BAD_PARAM ();
00454 }
00455 return os << x.val_;
00456 }
00457
00458 ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
00459 const std::string &x)
00460 {
00461 return os << x.c_str ();
00462 }
00463
00464
00465
00466 ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
00467 CORBA::Short &x)
00468 {
00469 return static_cast<ACE_InputCDR &> (is) >> x;
00470 }
00471
00472 ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
00473 CORBA::UShort &x)
00474 {
00475 return static_cast<ACE_InputCDR &> (is) >> x;
00476 }
00477
00478 ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
00479 CORBA::Long &x)
00480 {
00481 return static_cast<ACE_InputCDR&> (is) >> x;
00482 }
00483
00484 ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
00485 CORBA::ULong &x)
00486 {
00487 return static_cast<ACE_InputCDR &> (is) >> x;
00488 }
00489
00490 ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
00491 CORBA::LongLong &x)
00492 {
00493 return static_cast<ACE_InputCDR &> (is) >> x;
00494 }
00495
00496 ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
00497 CORBA::ULongLong &x)
00498 {
00499 return static_cast<ACE_InputCDR &> (is) >> x;
00500 }
00501
00502 ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
00503 CORBA::LongDouble &x)
00504 {
00505 return static_cast<ACE_InputCDR &> (is) >> x;
00506 }
00507
00508 ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
00509 CORBA::Float &x)
00510 {
00511 return static_cast<ACE_InputCDR &> (is) >> x;
00512 }
00513
00514 ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
00515 CORBA::Double &x)
00516 {
00517 return static_cast<ACE_InputCDR &> (is) >> x;
00518 }
00519
00520 ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
00521 CORBA::Char* &x)
00522 {
00523 return static_cast<ACE_InputCDR &> (is) >> x;
00524 }
00525
00526 ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
00527 CORBA::WChar* &x)
00528 {
00529 return static_cast<ACE_InputCDR &> (is) >> x;
00530 }
00531
00532 ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
00533 ACE_InputCDR::to_string x)
00534 {
00535 CORBA::Boolean const marshal_flag =
00536 is >> const_cast<ACE_CDR::Char *&> (x.val_);
00537 if (marshal_flag && x.bound_ != 0 && x.val_ != 0 &&
00538 ACE_OS::strlen (x.val_) > x.bound_)
00539 {
00540 throw ::CORBA::BAD_PARAM ();
00541 }
00542 return marshal_flag;
00543 }
00544
00545 ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
00546 ACE_InputCDR::to_wstring x)
00547 {
00548 CORBA::Boolean const marshal_flag =
00549 is >> const_cast<ACE_CDR::WChar *&> (x.val_);
00550 if (marshal_flag && x.bound_ != 0 && x.val_ != 0 &&
00551 ACE_OS::strlen (x.val_) > x.bound_)
00552 {
00553 throw ::CORBA::BAD_PARAM ();
00554 }
00555 return marshal_flag;
00556 }
00557
00558 ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
00559 std::string &x)
00560 {
00561 char *buf = 0;
00562 CORBA::Boolean const marshal_flag = is >> buf;
00563 x.assign (buf);
00564 ACE::strdelete (buf);
00565 return marshal_flag;
00566 }
00567
00568 TAO_END_VERSIONED_NAMESPACE_DECL