00001
00002
00003
00004
00005 #include "ace/OS_NS_string.h"
00006 #include "ace/OS_Memory.h"
00007
00008
00009
00010 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00011
00012
00013 ACE_INLINE
00014 ACE_OutputCDR::from_boolean::from_boolean (ACE_CDR::Boolean b)
00015 : val_ (b)
00016 {
00017 }
00018
00019 ACE_INLINE
00020 ACE_InputCDR::to_boolean::to_boolean (ACE_CDR::Boolean &b)
00021 : ref_ (b)
00022 {
00023 }
00024
00025 ACE_INLINE
00026 ACE_OutputCDR::from_octet::from_octet (ACE_CDR::Octet o)
00027 : val_ (o)
00028 {
00029 }
00030
00031 ACE_INLINE
00032 ACE_InputCDR::to_octet::to_octet (ACE_CDR::Octet &o)
00033 : ref_ (o)
00034 {
00035 }
00036
00037 ACE_INLINE
00038 ACE_OutputCDR::from_char::from_char (ACE_CDR::Char c)
00039 : val_ (c)
00040 {
00041 }
00042
00043 ACE_INLINE
00044 ACE_InputCDR::to_char::to_char (ACE_CDR::Char &c)
00045 : ref_ (c)
00046 {
00047 }
00048
00049 ACE_INLINE
00050 ACE_OutputCDR::from_wchar::from_wchar (ACE_CDR::WChar wc)
00051 : val_ (wc)
00052 {
00053 }
00054
00055 ACE_INLINE
00056 ACE_InputCDR::to_wchar::to_wchar (ACE_CDR::WChar &wc)
00057 : ref_ (wc)
00058 {
00059 }
00060
00061 ACE_INLINE
00062 ACE_OutputCDR::from_string::from_string (ACE_CDR::Char *s,
00063 ACE_CDR::ULong b,
00064 ACE_CDR::Boolean nocopy)
00065 : val_ (s),
00066 bound_ (b),
00067 nocopy_ (nocopy)
00068 {
00069 }
00070
00071 ACE_INLINE
00072 ACE_OutputCDR::from_string::from_string (const ACE_CDR::Char *s,
00073 ACE_CDR::ULong b,
00074 ACE_CDR::Boolean nocopy)
00075 : val_ (const_cast<ACE_CDR::Char *> (s)),
00076 bound_ (b),
00077 nocopy_ (nocopy)
00078 {
00079 }
00080
00081 ACE_INLINE
00082 ACE_InputCDR::to_string::to_string (ACE_CDR::Char *&s,
00083 ACE_CDR::ULong b)
00084 : val_ (const_cast<const ACE_CDR::Char *&> (s)),
00085 bound_ (b)
00086 {
00087 }
00088
00089 ACE_INLINE
00090 ACE_InputCDR::to_string::to_string (const ACE_CDR::Char *&s,
00091 ACE_CDR::ULong b)
00092 : val_ (s),
00093 bound_ (b)
00094 {
00095 }
00096
00097 ACE_INLINE
00098 ACE_OutputCDR::from_wstring::from_wstring (ACE_CDR::WChar *ws,
00099 ACE_CDR::ULong b,
00100 ACE_CDR::Boolean nocopy)
00101 : val_ (ws),
00102 bound_ (b),
00103 nocopy_ (nocopy)
00104 {
00105 }
00106
00107 ACE_INLINE
00108 ACE_OutputCDR::from_wstring::from_wstring (const ACE_CDR::WChar *ws,
00109 ACE_CDR::ULong b,
00110 ACE_CDR::Boolean nocopy)
00111 : val_ (const_cast<ACE_CDR::WChar *> (ws)),
00112 bound_ (b),
00113 nocopy_ (nocopy)
00114 {
00115 }
00116
00117 ACE_INLINE
00118 ACE_InputCDR::to_wstring::to_wstring (ACE_CDR::WChar *&ws,
00119 ACE_CDR::ULong b)
00120 : val_ (const_cast<const ACE_CDR::WChar *&> (ws)),
00121 bound_ (b)
00122 {
00123 }
00124
00125 ACE_INLINE
00126 ACE_InputCDR::to_wstring::to_wstring (const ACE_CDR::WChar *&ws,
00127 ACE_CDR::ULong b)
00128 : val_ (ws),
00129 bound_ (b)
00130 {
00131 }
00132
00133 ACE_INLINE
00134 ACE_InputCDR::Transfer_Contents::Transfer_Contents (ACE_InputCDR &rhs)
00135 : rhs_ (rhs)
00136 {
00137 }
00138
00139
00140
00141 ACE_INLINE
00142 ACE_OutputCDR::~ACE_OutputCDR (void)
00143 {
00144 if (this->start_.cont () != 0)
00145 {
00146 ACE_Message_Block::release (this->start_.cont ());
00147 this->start_.cont (0);
00148 }
00149 this->current_ = 0;
00150 }
00151
00152 ACE_INLINE void
00153 ACE_OutputCDR::reset (void)
00154 {
00155 this->current_ = &this->start_;
00156 this->current_is_writable_ = true;
00157 ACE_CDR::mb_align (&this->start_);
00158
00159 #if !defined (ACE_LACKS_CDR_ALIGNMENT)
00160 this->current_alignment_ = 0;
00161 #endif
00162
00163
00164
00165
00166
00167 ACE_Message_Block * const cont = this->start_.cont ();
00168 if (cont)
00169 {
00170 ACE_Message_Block::release (cont);
00171 this->start_.cont (0);
00172 }
00173 }
00174
00175
00176
00177 ACE_INLINE ACE_CDR::Boolean
00178 ACE_OutputCDR::write_octet (ACE_CDR::Octet x)
00179 {
00180 return this->write_1 (&x);
00181 }
00182
00183 ACE_INLINE ACE_CDR::Boolean
00184 ACE_OutputCDR::write_boolean (ACE_CDR::Boolean x)
00185 {
00186 return
00187 static_cast<ACE_CDR::Boolean> (
00188 this->write_octet (
00189 x
00190 ? static_cast<ACE_CDR::Octet> (1)
00191 : static_cast<ACE_CDR::Octet> (0)));
00192 }
00193
00194 ACE_INLINE ACE_CDR::Boolean
00195 ACE_OutputCDR::write_char (ACE_CDR::Char x)
00196 {
00197 if (this->char_translator_ == 0)
00198 {
00199 ACE_CDR::Octet temp = static_cast<ACE_CDR::Octet> (x);
00200 return this->write_1 (&temp);
00201 }
00202 return this->char_translator_->write_char (*this, x);
00203 }
00204
00205 ACE_INLINE ACE_CDR::Boolean
00206 ACE_OutputCDR::write_short (ACE_CDR::Short x)
00207 {
00208 ACE_CDR::UShort temp = static_cast<ACE_CDR::UShort> (x);
00209 return this->write_2 (&temp);
00210 }
00211
00212 ACE_INLINE ACE_CDR::Boolean
00213 ACE_OutputCDR::write_ushort (ACE_CDR::UShort x)
00214 {
00215 return this->write_2 (&x);
00216 }
00217
00218 ACE_INLINE ACE_CDR::Boolean
00219 ACE_OutputCDR::write_long (ACE_CDR::Long x)
00220 {
00221 ACE_CDR::ULong temp = static_cast<ACE_CDR::ULong> (x);
00222 return this->write_4 (&temp);
00223 }
00224
00225 ACE_INLINE ACE_CDR::Boolean
00226 ACE_OutputCDR::write_ulong (ACE_CDR::ULong x)
00227 {
00228 return this->write_4 (&x);
00229 }
00230
00231 ACE_INLINE ACE_CDR::Boolean
00232 ACE_OutputCDR::write_longlong (const ACE_CDR::LongLong &x)
00233 {
00234 void const * const temp = &x;
00235 return this->write_8 (reinterpret_cast<ACE_CDR::ULongLong const *> (temp));
00236 }
00237
00238 ACE_INLINE ACE_CDR::Boolean
00239 ACE_OutputCDR::write_ulonglong (const ACE_CDR::ULongLong &x)
00240 {
00241 return this->write_8 (&x);
00242 }
00243
00244 ACE_INLINE ACE_CDR::Boolean
00245 ACE_OutputCDR::write_float (ACE_CDR::Float x)
00246 {
00247 void const * const temp = &x;
00248 return this->write_4 (reinterpret_cast<ACE_CDR::ULong const *> (temp));
00249 }
00250
00251 ACE_INLINE ACE_CDR::Boolean
00252 ACE_OutputCDR::write_double (const ACE_CDR::Double &x)
00253 {
00254 void const * const temp = &x;
00255 return this->write_8 (reinterpret_cast<ACE_CDR::ULongLong const *> (temp));
00256 }
00257
00258 ACE_INLINE ACE_CDR::Boolean
00259 ACE_OutputCDR::write_longdouble (const ACE_CDR::LongDouble &x)
00260 {
00261 return this->write_16 (&x);
00262 }
00263
00264 ACE_INLINE ACE_CDR::Boolean
00265 ACE_OutputCDR::write_string (const ACE_CDR::Char *x)
00266 {
00267 if (x)
00268 {
00269 const ACE_CDR::ULong len =
00270 static_cast<ACE_CDR::ULong> (ACE_OS::strlen (x));
00271 return this->write_string (len, x);
00272 }
00273
00274 return this->write_string (0, 0);
00275 }
00276
00277 ACE_INLINE ACE_CDR::Boolean
00278 ACE_OutputCDR::write_wstring (const ACE_CDR::WChar *x)
00279 {
00280 if (x)
00281 {
00282 ACE_CDR::ULong len =
00283 static_cast<ACE_CDR::ULong> (ACE_OS::strlen (x));
00284 return this->write_wstring (len, x);
00285 }
00286
00287 return this->write_wstring (0, 0);
00288 }
00289
00290 ACE_INLINE ACE_CDR::Boolean
00291 ACE_OutputCDR::write_char_array (const ACE_CDR::Char *x,
00292 ACE_CDR::ULong length)
00293 {
00294 if (this->char_translator_ == 0)
00295 return this->write_array (x,
00296 ACE_CDR::OCTET_SIZE,
00297 ACE_CDR::OCTET_ALIGN,
00298 length);
00299 return this->char_translator_->write_char_array (*this, x, length);
00300 }
00301
00302 ACE_INLINE ACE_CDR::Boolean
00303 ACE_OutputCDR::write_wchar_array (const ACE_CDR::WChar* x,
00304 ACE_CDR::ULong length)
00305 {
00306 if (this->wchar_translator_)
00307 return this->wchar_translator_->write_wchar_array (*this, x, length);
00308
00309 if (ACE_OutputCDR::wchar_maxbytes_ == 0)
00310 {
00311 errno = EACCES;
00312 return (ACE_CDR::Boolean) (this->good_bit_ = false);
00313 }
00314
00315 if (ACE_OutputCDR::wchar_maxbytes_ == sizeof (ACE_CDR::WChar))
00316 return this->write_array (x,
00317 sizeof (ACE_CDR::WChar),
00318 sizeof (ACE_CDR::WChar) == 2
00319 ? ACE_CDR::SHORT_ALIGN
00320 : ACE_CDR::LONG_ALIGN,
00321 length);
00322 return this->write_wchar_array_i (x,length);
00323 }
00324
00325 ACE_INLINE ACE_CDR::Boolean
00326 ACE_OutputCDR::write_octet_array (const ACE_CDR::Octet* x,
00327 ACE_CDR::ULong length)
00328 {
00329 return this->write_array (x,
00330 ACE_CDR::OCTET_SIZE,
00331 ACE_CDR::OCTET_ALIGN,
00332 length);
00333 }
00334
00335 ACE_INLINE ACE_CDR::Boolean
00336 ACE_OutputCDR::write_short_array (const ACE_CDR::Short *x,
00337 ACE_CDR::ULong length)
00338 {
00339 return this->write_array (x,
00340 ACE_CDR::SHORT_SIZE,
00341 ACE_CDR::SHORT_ALIGN,
00342 length);
00343 }
00344
00345 ACE_INLINE ACE_CDR::Boolean
00346 ACE_OutputCDR::write_ushort_array (const ACE_CDR::UShort *x,
00347 ACE_CDR::ULong length)
00348 {
00349 return this->write_array (x,
00350 ACE_CDR::SHORT_SIZE,
00351 ACE_CDR::SHORT_ALIGN,
00352 length);
00353 }
00354
00355 ACE_INLINE ACE_CDR::Boolean
00356 ACE_OutputCDR::write_long_array (const ACE_CDR::Long *x,
00357 ACE_CDR::ULong length)
00358 {
00359 return this->write_array (x,
00360 ACE_CDR::LONG_SIZE,
00361 ACE_CDR::LONG_ALIGN,
00362 length);
00363 }
00364
00365 ACE_INLINE ACE_CDR::Boolean
00366 ACE_OutputCDR::write_ulong_array (const ACE_CDR::ULong *x,
00367 ACE_CDR::ULong length)
00368 {
00369 return this->write_array (x,
00370 ACE_CDR::LONG_SIZE,
00371 ACE_CDR::LONG_ALIGN,
00372 length);
00373 }
00374
00375 ACE_INLINE ACE_CDR::Boolean
00376 ACE_OutputCDR::write_longlong_array (const ACE_CDR::LongLong *x,
00377 ACE_CDR::ULong length)
00378 {
00379 return this->write_array (x,
00380 ACE_CDR::LONGLONG_SIZE,
00381 ACE_CDR::LONGLONG_ALIGN,
00382 length);
00383 }
00384
00385 ACE_INLINE ACE_CDR::Boolean
00386 ACE_OutputCDR::write_ulonglong_array (const ACE_CDR::ULongLong *x,
00387 ACE_CDR::ULong length)
00388 {
00389 return this->write_array (x,
00390 ACE_CDR::LONGLONG_SIZE,
00391 ACE_CDR::LONGLONG_ALIGN,
00392 length);
00393 }
00394
00395 ACE_INLINE ACE_CDR::Boolean
00396 ACE_OutputCDR::write_float_array (const ACE_CDR::Float *x,
00397 ACE_CDR::ULong length)
00398 {
00399 return this->write_array (x,
00400 ACE_CDR::LONG_SIZE,
00401 ACE_CDR::LONG_ALIGN,
00402 length);
00403 }
00404
00405
00406 ACE_INLINE ACE_CDR::Boolean
00407 ACE_OutputCDR::write_double_array (const ACE_CDR::Double *x,
00408 ACE_CDR::ULong length)
00409 {
00410 return this->write_array (x,
00411 ACE_CDR::LONGLONG_SIZE,
00412 ACE_CDR::LONGLONG_ALIGN,
00413 length);
00414 }
00415
00416 ACE_INLINE ACE_CDR::Boolean
00417 ACE_OutputCDR::write_longdouble_array (const ACE_CDR::LongDouble* x,
00418 ACE_CDR::ULong length)
00419 {
00420 return this->write_array (x,
00421 ACE_CDR::LONGDOUBLE_SIZE,
00422 ACE_CDR::LONGDOUBLE_ALIGN,
00423 length);
00424 }
00425
00426 ACE_INLINE bool
00427 ACE_OutputCDR::good_bit (void) const
00428 {
00429 return this->good_bit_;
00430 }
00431
00432 ACE_INLINE int
00433 ACE_OutputCDR::adjust (size_t size,
00434 size_t align,
00435 char*& buf)
00436 {
00437 if (!this->current_is_writable_)
00438 return this->grow_and_adjust (size, align, buf);
00439
00440 #if !defined (ACE_LACKS_CDR_ALIGNMENT)
00441 size_t const offset =
00442 ACE_align_binary (this->current_alignment_, align)
00443 - this->current_alignment_;
00444
00445 buf = this->current_->wr_ptr () + offset;
00446 #else
00447 buf = this->current_->wr_ptr ();
00448 #endif
00449
00450 char * const end = buf + size;
00451
00452 if (end <= this->current_->end () &&
00453 end >= buf)
00454 {
00455 #if !defined (ACE_LACKS_CDR_ALIGNMENT)
00456 this->current_alignment_ += offset + size;
00457 #endif
00458 this->current_->wr_ptr (end);
00459 return 0;
00460 }
00461
00462 return this->grow_and_adjust (size, align, buf);
00463 }
00464
00465 ACE_INLINE int
00466 ACE_OutputCDR::adjust (size_t size, char*& buf)
00467 {
00468 return this->adjust (size, size, buf);
00469 }
00470
00471 ACE_INLINE void
00472 ACE_OutputCDR::set_version (ACE_CDR::Octet major, ACE_CDR::Octet minor)
00473 {
00474 this->major_version_ = major;
00475 this->minor_version_ = minor;
00476 }
00477
00478 ACE_INLINE void
00479 ACE_OutputCDR::get_version (ACE_CDR::Octet &major, ACE_CDR::Octet &minor)
00480 {
00481 major = this->major_version_;
00482 minor = this->minor_version_;
00483 }
00484
00485
00486 ACE_INLINE const ACE_Message_Block*
00487 ACE_OutputCDR::begin (void) const
00488 {
00489 return &this->start_;
00490 }
00491
00492 ACE_INLINE const ACE_Message_Block*
00493 ACE_OutputCDR::end (void) const
00494 {
00495 return this->current_->cont ();
00496 }
00497
00498 ACE_INLINE const ACE_Message_Block*
00499 ACE_OutputCDR::current (void) const
00500 {
00501 return this->current_;
00502 }
00503
00504 ACE_INLINE size_t
00505 ACE_OutputCDR::total_length (void) const
00506 {
00507 return ACE_CDR::total_length (this->begin (), this->end ());
00508 }
00509
00510 ACE_INLINE const char*
00511 ACE_OutputCDR::buffer (void) const
00512 {
00513 return this->start_.rd_ptr ();
00514 }
00515
00516 ACE_INLINE size_t
00517 ACE_OutputCDR::length (void) const
00518 {
00519 return this->start_.length ();
00520 }
00521
00522 ACE_INLINE bool
00523 ACE_OutputCDR::do_byte_swap (void) const
00524 {
00525 return this->do_byte_swap_;
00526 }
00527
00528 ACE_INLINE int
00529 ACE_OutputCDR::byte_order (void) const
00530 {
00531 if (this->do_byte_swap ())
00532 return !ACE_CDR_BYTE_ORDER;
00533 else
00534 return ACE_CDR_BYTE_ORDER;
00535 }
00536
00537 ACE_INLINE void
00538 ACE_OutputCDR::reset_byte_order (int byte_order)
00539 {
00540 this->do_byte_swap_ = (byte_order != ACE_CDR_BYTE_ORDER);
00541 }
00542
00543 ACE_INLINE size_t
00544 ACE_OutputCDR::current_alignment (void) const
00545 {
00546 #if !defined (ACE_LACKS_CDR_ALIGNMENT)
00547 return this->current_alignment_;
00548 #else
00549
00550 return 0;
00551 #endif
00552 }
00553
00554 ACE_INLINE int
00555 ACE_OutputCDR::align_write_ptr (size_t alignment)
00556 {
00557 #if !defined (ACE_LACKS_CDR_ALIGNMENT)
00558 char *dummy;
00559 return this->adjust (0, alignment, dummy);
00560 #else
00561 ACE_UNUSED_ARG (alignment);
00562
00563
00564 return 0;
00565 #endif
00566 }
00567
00568 ACE_INLINE ACE_Char_Codeset_Translator *
00569 ACE_OutputCDR::char_translator (void) const
00570 {
00571 return this->char_translator_;
00572 }
00573
00574 ACE_INLINE ACE_WChar_Codeset_Translator *
00575 ACE_OutputCDR::wchar_translator (void) const
00576 {
00577 return this->wchar_translator_;
00578 }
00579
00580 ACE_INLINE void
00581 ACE_OutputCDR::char_translator (ACE_Char_Codeset_Translator * ctran)
00582 {
00583 this->char_translator_ = ctran;
00584 }
00585
00586 ACE_INLINE void
00587 ACE_OutputCDR::wchar_translator (ACE_WChar_Codeset_Translator * wctran)
00588 {
00589 this->wchar_translator_ = wctran;
00590 }
00591
00592
00593
00594 ACE_INLINE
00595 ACE_InputCDR::~ACE_InputCDR (void)
00596 {
00597 }
00598
00599 ACE_INLINE ACE_CDR::Boolean
00600 ACE_InputCDR::read_octet (ACE_CDR::Octet& x)
00601 {
00602 return this->read_1 (&x);
00603 }
00604
00605 ACE_INLINE ACE_CDR::Boolean
00606 ACE_InputCDR::read_boolean (ACE_CDR::Boolean& x)
00607 {
00608 ACE_CDR::Octet tmp = 0;
00609 (void) this->read_octet (tmp);
00610 x = tmp ? true : false;
00611 return (ACE_CDR::Boolean) this->good_bit_;
00612 }
00613
00614 ACE_INLINE ACE_CDR::Boolean
00615 ACE_InputCDR::read_char (ACE_CDR::Char &x)
00616 {
00617 if (this->char_translator_ == 0)
00618 {
00619 void *temp = &x;
00620 return this->read_1 (reinterpret_cast<ACE_CDR::Octet*> (temp));
00621 }
00622 return this->char_translator_->read_char (*this, x);
00623 }
00624
00625
00626 ACE_INLINE ACE_CDR::Boolean
00627 ACE_InputCDR::read_short (ACE_CDR::Short &x)
00628 {
00629 void *temp = &x;
00630 return this->read_2 (reinterpret_cast<ACE_CDR::UShort*> (temp));
00631 }
00632
00633 ACE_INLINE ACE_CDR::Boolean
00634 ACE_InputCDR::read_ushort (ACE_CDR::UShort &x)
00635 {
00636 return this->read_2 (&x);
00637 }
00638
00639
00640 ACE_INLINE ACE_CDR::Boolean
00641 ACE_InputCDR::read_long (ACE_CDR::Long &x)
00642 {
00643 void *temp = &x;
00644 return this->read_4 (reinterpret_cast<ACE_CDR::ULong*> (temp));
00645 }
00646
00647
00648 ACE_INLINE ACE_CDR::Boolean
00649 ACE_InputCDR::read_ulong (ACE_CDR::ULong &x)
00650 {
00651 return this->read_4 (&x);
00652 }
00653
00654
00655 ACE_INLINE ACE_CDR::Boolean
00656 ACE_InputCDR::read_longlong (ACE_CDR::LongLong &x)
00657 {
00658 void *temp = &x;
00659 return this->read_8 (reinterpret_cast<ACE_CDR::ULongLong*> (temp));
00660 }
00661
00662 ACE_INLINE ACE_CDR::Boolean
00663 ACE_InputCDR::read_ulonglong (ACE_CDR::ULongLong &x)
00664 {
00665 return this->read_8 (&x);
00666 }
00667
00668 ACE_INLINE ACE_CDR::Boolean
00669 ACE_InputCDR::read_float (ACE_CDR::Float &x)
00670 {
00671 void *temp = &x;
00672 return this->read_4 (reinterpret_cast<ACE_CDR::ULong*> (temp));
00673 }
00674
00675 ACE_INLINE ACE_CDR::Boolean
00676 ACE_InputCDR::read_double (ACE_CDR::Double &x)
00677 {
00678 void *temp = &x;
00679 return this->read_8 (reinterpret_cast<ACE_CDR::ULongLong*> (temp));
00680 }
00681
00682 ACE_INLINE ACE_CDR::Boolean
00683 ACE_InputCDR::read_longdouble (ACE_CDR::LongDouble &x)
00684 {
00685 return this->read_16 (&x);
00686 }
00687
00688 ACE_INLINE size_t
00689 ACE_InputCDR::length (void) const
00690 {
00691 return this->start_.length ();
00692 }
00693
00694 ACE_INLINE ACE_CDR::Boolean
00695 ACE_InputCDR::read_char_array (ACE_CDR::Char* x,
00696 ACE_CDR::ULong length)
00697 {
00698
00699
00700 if (length > this->length ())
00701 {
00702 this->good_bit_ = false;
00703 return false;
00704 }
00705
00706 if (this->char_translator_ == 0)
00707 return this->read_array (x,
00708 ACE_CDR::OCTET_SIZE,
00709 ACE_CDR::OCTET_ALIGN,
00710 length);
00711 return this->char_translator_->read_char_array (*this, x, length);
00712 }
00713
00714 ACE_INLINE ACE_CDR::Boolean
00715 ACE_InputCDR::read_wchar_array (ACE_CDR::WChar* x,
00716 ACE_CDR::ULong length)
00717 {
00718
00719
00720 if (length * ACE_OutputCDR::wchar_maxbytes_ > this->length ())
00721 {
00722 this->good_bit_ = false;
00723 return false;
00724 }
00725
00726 if (this->wchar_translator_ != 0)
00727 return this->wchar_translator_->read_wchar_array (*this, x, length);
00728 if (ACE_OutputCDR::wchar_maxbytes_ != sizeof (ACE_CDR::WChar))
00729 return this->read_wchar_array_i (x, length);
00730 return this->read_array (x,
00731 sizeof (ACE_CDR::WChar),
00732 sizeof (ACE_CDR::WChar) == 2
00733 ? ACE_CDR::SHORT_ALIGN
00734 : ACE_CDR::LONG_ALIGN,
00735 length);
00736 }
00737
00738 ACE_INLINE ACE_CDR::Boolean
00739 ACE_InputCDR::read_octet_array (ACE_CDR::Octet* x,
00740 ACE_CDR::ULong length)
00741 {
00742
00743
00744 if (length * ACE_CDR::OCTET_SIZE > this->length ())
00745 {
00746 this->good_bit_ = false;
00747 return false;
00748 }
00749
00750 return this->read_array (x,
00751 ACE_CDR::OCTET_SIZE,
00752 ACE_CDR::OCTET_ALIGN,
00753 length);
00754 }
00755
00756 ACE_INLINE ACE_CDR::Boolean
00757 ACE_InputCDR::read_short_array (ACE_CDR::Short *x,
00758 ACE_CDR::ULong length)
00759 {
00760
00761
00762 if (length * ACE_CDR::SHORT_SIZE > this->length ())
00763 {
00764 this->good_bit_ = false;
00765 return false;
00766 }
00767
00768 return this->read_array (x,
00769 ACE_CDR::SHORT_SIZE,
00770 ACE_CDR::SHORT_ALIGN,
00771 length);
00772 }
00773
00774 ACE_INLINE ACE_CDR::Boolean
00775 ACE_InputCDR::read_ushort_array (ACE_CDR::UShort *x,
00776 ACE_CDR::ULong length)
00777 {
00778
00779
00780 if (length * ACE_CDR::SHORT_SIZE > this->length ())
00781 {
00782 this->good_bit_ = false;
00783 return false;
00784 }
00785
00786 return this->read_array (x,
00787 ACE_CDR::SHORT_SIZE,
00788 ACE_CDR::SHORT_ALIGN,
00789 length);
00790 }
00791
00792 ACE_INLINE ACE_CDR::Boolean
00793 ACE_InputCDR::read_long_array (ACE_CDR::Long *x,
00794 ACE_CDR::ULong length)
00795 {
00796
00797
00798 if (length * ACE_CDR::LONG_SIZE > this->length ())
00799 {
00800 this->good_bit_ = false;
00801 return false;
00802 }
00803
00804 return this->read_array (x,
00805 ACE_CDR::LONG_SIZE,
00806 ACE_CDR::LONG_ALIGN,
00807 length);
00808 }
00809
00810 ACE_INLINE ACE_CDR::Boolean
00811 ACE_InputCDR::read_ulong_array (ACE_CDR::ULong *x,
00812 ACE_CDR::ULong length)
00813 {
00814
00815
00816 if (length * ACE_CDR::LONG_SIZE > this->length ())
00817 {
00818 this->good_bit_ = false;
00819 return false;
00820 }
00821
00822 return this->read_array (x,
00823 ACE_CDR::LONG_SIZE,
00824 ACE_CDR::LONG_ALIGN,
00825 length);
00826 }
00827
00828 ACE_INLINE ACE_CDR::Boolean
00829 ACE_InputCDR::read_longlong_array (ACE_CDR::LongLong *x,
00830 ACE_CDR::ULong length)
00831 {
00832
00833
00834 if (length * ACE_CDR::LONGLONG_SIZE > this->length ())
00835 {
00836 this->good_bit_ = false;
00837 return false;
00838 }
00839
00840 return this->read_array (x,
00841 ACE_CDR::LONGLONG_SIZE,
00842 ACE_CDR::LONGLONG_ALIGN,
00843 length);
00844 }
00845
00846 ACE_INLINE ACE_CDR::Boolean
00847 ACE_InputCDR::read_ulonglong_array (ACE_CDR::ULongLong *x,
00848 ACE_CDR::ULong length)
00849 {
00850
00851
00852 if (length * ACE_CDR::LONGLONG_SIZE > this->length ())
00853 {
00854 this->good_bit_ = false;
00855 return false;
00856 }
00857
00858 return this->read_array (x,
00859 ACE_CDR::LONGLONG_SIZE,
00860 ACE_CDR::LONGLONG_ALIGN,
00861 length);
00862 }
00863
00864 ACE_INLINE ACE_CDR::Boolean
00865 ACE_InputCDR::read_float_array (ACE_CDR::Float *x,
00866 ACE_CDR::ULong length)
00867 {
00868
00869
00870 if (length * ACE_CDR::LONG_SIZE > this->length ())
00871 {
00872 this->good_bit_ = false;
00873 return false;
00874 }
00875
00876 return this->read_array (x,
00877 ACE_CDR::LONG_SIZE,
00878 ACE_CDR::LONG_ALIGN,
00879 length);
00880 }
00881
00882
00883 ACE_INLINE ACE_CDR::Boolean
00884 ACE_InputCDR::read_double_array (ACE_CDR::Double *x,
00885 ACE_CDR::ULong length)
00886 {
00887
00888
00889 if (length * ACE_CDR::LONGLONG_SIZE > this->length ())
00890 {
00891 this->good_bit_ = false;
00892 return false;
00893 }
00894
00895 return this->read_array (x,
00896 ACE_CDR::LONGLONG_SIZE,
00897 ACE_CDR::LONGLONG_ALIGN,
00898 length);
00899 }
00900
00901 ACE_INLINE ACE_CDR::Boolean
00902 ACE_InputCDR::read_longdouble_array (ACE_CDR::LongDouble* x,
00903 ACE_CDR::ULong length)
00904 {
00905
00906
00907 if (length * ACE_CDR::LONGDOUBLE_SIZE > this->length ())
00908 {
00909 this->good_bit_ = false;
00910 return false;
00911 }
00912 return this->read_array (x,
00913 ACE_CDR::LONGDOUBLE_SIZE,
00914 ACE_CDR::LONGDOUBLE_ALIGN,
00915 length);
00916 }
00917
00918 ACE_INLINE ACE_CDR::Boolean
00919 ACE_InputCDR::skip_octet (void)
00920 {
00921 ACE_CDR::Octet x;
00922 return this->read_1 (&x);
00923 }
00924
00925 ACE_INLINE ACE_CDR::Boolean
00926 ACE_InputCDR::skip_char (void)
00927 {
00928 return this->skip_octet ();
00929 }
00930
00931 ACE_INLINE ACE_CDR::Boolean
00932 ACE_InputCDR::skip_boolean (void)
00933 {
00934 return this->skip_octet () && this->good_bit_;
00935 }
00936
00937 ACE_INLINE ACE_CDR::Boolean
00938 ACE_InputCDR::skip_ushort (void)
00939 {
00940 ACE_CDR::UShort x;
00941 return this->read_2 (&x);
00942 }
00943
00944 ACE_INLINE ACE_CDR::Boolean
00945 ACE_InputCDR::skip_short (void)
00946 {
00947 return this->skip_ushort ();
00948 }
00949
00950 ACE_INLINE ACE_CDR::Boolean
00951 ACE_InputCDR::skip_ulong (void)
00952 {
00953 ACE_CDR::ULong x;
00954 return this->read_4 (&x);
00955 }
00956
00957 ACE_INLINE ACE_CDR::Boolean
00958 ACE_InputCDR::skip_long (void)
00959 {
00960 return this->skip_ulong ();
00961 }
00962
00963 ACE_INLINE ACE_CDR::Boolean
00964 ACE_InputCDR::skip_ulonglong (void)
00965 {
00966 ACE_CDR::ULongLong x;
00967 return this->read_8 (&x);
00968 }
00969
00970 ACE_INLINE ACE_CDR::Boolean
00971 ACE_InputCDR::skip_longlong (void)
00972 {
00973 return this->skip_ulonglong ();
00974 }
00975
00976 ACE_INLINE ACE_CDR::Boolean
00977 ACE_InputCDR::skip_float (void)
00978 {
00979 return this->skip_ulong ();
00980 }
00981
00982 ACE_INLINE ACE_CDR::Boolean
00983 ACE_InputCDR::skip_double (void)
00984 {
00985 return this->skip_ulonglong ();
00986 }
00987
00988 ACE_INLINE ACE_CDR::Boolean
00989 ACE_InputCDR::skip_longdouble (void)
00990 {
00991 ACE_CDR::LongDouble x;
00992 return this->read_16 (&x);
00993 }
00994
00995 ACE_INLINE char*
00996 ACE_InputCDR::end (void)
00997 {
00998 return this->start_.end ();
00999 }
01000
01001 ACE_INLINE void
01002 ACE_InputCDR::rd_ptr (size_t offset)
01003 {
01004 this->start_.rd_ptr (offset);
01005 }
01006
01007 ACE_INLINE char*
01008 ACE_InputCDR::rd_ptr (void)
01009 {
01010 return this->start_.rd_ptr ();
01011 }
01012
01013 ACE_INLINE char*
01014 ACE_InputCDR::wr_ptr (void)
01015 {
01016 return this->start_.wr_ptr ();
01017 }
01018
01019 ACE_INLINE int
01020 ACE_InputCDR::adjust (size_t size,
01021 size_t align,
01022 char*& buf)
01023 {
01024 #if !defined (ACE_LACKS_CDR_ALIGNMENT)
01025 buf = ACE_ptr_align_binary (this->rd_ptr (), align);
01026 #else
01027 buf = this->rd_ptr ();
01028 #endif
01029
01030 char * const end = buf + size;
01031 if (end <= this->wr_ptr ())
01032 {
01033 this->start_.rd_ptr (end);
01034 return 0;
01035 }
01036
01037 this->good_bit_ = false;
01038 return -1;
01039 #if defined (ACE_LACKS_CDR_ALIGNMENT)
01040 ACE_UNUSED_ARG (align);
01041 #endif
01042 }
01043
01044 ACE_INLINE int
01045 ACE_InputCDR::adjust (size_t size,
01046 char*& buf)
01047 {
01048 return this->adjust (size, size, buf);
01049 }
01050
01051 ACE_INLINE const ACE_Message_Block*
01052 ACE_InputCDR::start (void) const
01053 {
01054 return &this->start_;
01055 }
01056
01057 ACE_INLINE bool
01058 ACE_InputCDR::good_bit (void) const
01059 {
01060 return this->good_bit_;
01061 }
01062
01063
01064
01065 ACE_INLINE ACE_CDR::Boolean
01066 operator<< (ACE_OutputCDR &os, ACE_CDR::Char x)
01067 {
01068 os.write_char (x);
01069 return (ACE_CDR::Boolean) os.good_bit ();
01070 }
01071
01072 ACE_INLINE ACE_CDR::Boolean
01073 operator<< (ACE_OutputCDR &os, ACE_CDR::Short x)
01074 {
01075 os.write_short (x);
01076 return (ACE_CDR::Boolean) os.good_bit ();
01077 }
01078
01079 ACE_INLINE ACE_CDR::Boolean
01080 operator<< (ACE_OutputCDR &os, ACE_CDR::UShort x)
01081 {
01082 os.write_ushort (x);
01083 return (ACE_CDR::Boolean) os.good_bit ();
01084 }
01085
01086 ACE_INLINE ACE_CDR::Boolean
01087 operator<< (ACE_OutputCDR &os, ACE_CDR::Long x)
01088 {
01089 os.write_long (x);
01090 return (ACE_CDR::Boolean) os.good_bit ();
01091 }
01092
01093 ACE_INLINE ACE_CDR::Boolean
01094 operator<< (ACE_OutputCDR &os, ACE_CDR::ULong x)
01095 {
01096 os.write_ulong (x);
01097 return (ACE_CDR::Boolean) os.good_bit ();
01098 }
01099
01100 ACE_INLINE ACE_CDR::Boolean
01101 operator<< (ACE_OutputCDR &os, ACE_CDR::LongLong x)
01102 {
01103 os.write_longlong (x);
01104 return (ACE_CDR::Boolean) os.good_bit ();
01105 }
01106
01107 ACE_INLINE ACE_CDR::Boolean
01108 operator<< (ACE_OutputCDR &os, ACE_CDR::ULongLong x)
01109 {
01110 os.write_ulonglong (x);
01111 return (ACE_CDR::Boolean) os.good_bit ();
01112 }
01113
01114 ACE_INLINE ACE_CDR::Boolean
01115 operator<< (ACE_OutputCDR &os, ACE_CDR::LongDouble x)
01116 {
01117 os.write_longdouble (x);
01118 return (ACE_CDR::Boolean) os.good_bit ();
01119 }
01120
01121 ACE_INLINE ACE_CDR::Boolean
01122 operator<< (ACE_OutputCDR &os, ACE_CDR::Float x)
01123 {
01124 os.write_float (x);
01125 return (ACE_CDR::Boolean) os.good_bit ();
01126 }
01127
01128 ACE_INLINE ACE_CDR::Boolean
01129 operator<< (ACE_OutputCDR &os, ACE_CDR::Double x)
01130 {
01131 os.write_double (x);
01132 return (ACE_CDR::Boolean) os.good_bit ();
01133 }
01134
01135 ACE_INLINE ACE_CDR::Boolean
01136 operator<< (ACE_OutputCDR &os, const ACE_CDR::Char *x)
01137 {
01138 os.write_string (x);
01139 return (ACE_CDR::Boolean) os.good_bit ();
01140 }
01141
01142 ACE_INLINE ACE_CDR::Boolean
01143 operator<< (ACE_OutputCDR &os, const ACE_CDR::WChar *x)
01144 {
01145 os.write_wstring (x);
01146 return (ACE_CDR::Boolean) os.good_bit ();
01147 }
01148
01149
01150 ACE_INLINE ACE_CDR::Boolean
01151 operator<< (ACE_OutputCDR &os, ACE_OutputCDR::from_boolean x)
01152 {
01153 (void) os.write_boolean (x.val_);
01154 return (ACE_CDR::Boolean) os.good_bit ();
01155 }
01156
01157 ACE_INLINE ACE_CDR::Boolean
01158 operator<< (ACE_OutputCDR &os, ACE_OutputCDR::from_char x)
01159 {
01160 os.write_char (x.val_);
01161 return (ACE_CDR::Boolean) os.good_bit ();
01162 }
01163
01164 ACE_INLINE ACE_CDR::Boolean
01165 operator<< (ACE_OutputCDR &os, ACE_OutputCDR::from_wchar x)
01166 {
01167 os.write_wchar (x.val_);
01168 return (ACE_CDR::Boolean) os.good_bit ();
01169 }
01170
01171 ACE_INLINE ACE_CDR::Boolean
01172 operator<< (ACE_OutputCDR &os, ACE_OutputCDR::from_octet x)
01173 {
01174 os.write_octet (x.val_);
01175 return (ACE_CDR::Boolean) os.good_bit ();
01176 }
01177
01178 ACE_INLINE ACE_CDR::Boolean
01179 operator<< (ACE_OutputCDR &os, ACE_OutputCDR::from_string x)
01180 {
01181 ACE_CDR::ULong len = 0;
01182
01183 if (x.val_ != 0)
01184 {
01185 len = static_cast<ACE_CDR::ULong> (ACE_OS::strlen (x.val_));
01186 }
01187
01188 os.write_string (len, x.val_);
01189 return
01190 (ACE_CDR::Boolean) (os.good_bit () && (!x.bound_ || len <= x.bound_));
01191 }
01192
01193 ACE_INLINE ACE_CDR::Boolean
01194 operator<< (ACE_OutputCDR &os, ACE_OutputCDR::from_wstring x)
01195 {
01196 ACE_CDR::ULong len = 0;
01197
01198 if (x.val_ != 0)
01199 {
01200 len = static_cast<ACE_CDR::ULong> (ACE_OS::strlen (x.val_));
01201 }
01202
01203 os.write_wstring (len, x.val_);
01204 return
01205 (ACE_CDR::Boolean) (os.good_bit () && (!x.bound_ || len <= x.bound_));
01206 }
01207
01208
01209
01210 ACE_INLINE ACE_CDR::Boolean
01211 operator>> (ACE_InputCDR &is, ACE_CDR::Char &x)
01212 {
01213 return is.read_char (x) && is.good_bit ();
01214 }
01215
01216 ACE_INLINE ACE_CDR::Boolean
01217 operator>> (ACE_InputCDR &is, ACE_CDR::Short &x)
01218 {
01219 return is.read_short (x) && is.good_bit ();
01220 }
01221
01222 ACE_INLINE ACE_CDR::Boolean
01223 operator>> (ACE_InputCDR &is, ACE_CDR::UShort &x)
01224 {
01225 return is.read_ushort (x) && is.good_bit ();
01226 }
01227
01228 ACE_INLINE ACE_CDR::Boolean
01229 operator>>(ACE_InputCDR &is, ACE_CDR::Long &x)
01230 {
01231 return is.read_long (x) && is.good_bit ();
01232 }
01233
01234 ACE_INLINE ACE_CDR::Boolean
01235 operator>> (ACE_InputCDR &is, ACE_CDR::ULong &x)
01236 {
01237 return is.read_ulong (x) && is.good_bit ();
01238 }
01239
01240 ACE_INLINE ACE_CDR::Boolean
01241 operator>> (ACE_InputCDR& is, ACE_CDR::LongLong &x)
01242 {
01243 return is.read_longlong (x) && is.good_bit ();
01244 }
01245
01246 ACE_INLINE ACE_CDR::Boolean
01247 operator>> (ACE_InputCDR& is, ACE_CDR::ULongLong &x)
01248 {
01249 return is.read_ulonglong (x) && is.good_bit ();
01250 }
01251
01252 ACE_INLINE ACE_CDR::Boolean
01253 operator>> (ACE_InputCDR& is, ACE_CDR::LongDouble &x)
01254 {
01255 return is.read_longdouble (x) && is.good_bit ();
01256 }
01257
01258 ACE_INLINE ACE_CDR::Boolean
01259 operator>> (ACE_InputCDR &is, ACE_CDR::Float &x)
01260 {
01261 return is.read_float (x) && is.good_bit ();
01262 }
01263
01264 ACE_INLINE ACE_CDR::Boolean
01265 operator>> (ACE_InputCDR &is, ACE_CDR::Double &x)
01266 {
01267 return is.read_double (x) && is.good_bit ();
01268 }
01269
01270 ACE_INLINE ACE_CDR::Boolean
01271 operator>> (ACE_InputCDR &is, ACE_CDR::Char *&x)
01272 {
01273 return is.read_string (x) && is.good_bit ();
01274 }
01275
01276 ACE_INLINE ACE_CDR::Boolean
01277 operator>> (ACE_InputCDR &is, ACE_CDR::WChar *&x)
01278 {
01279 return is.read_wstring (x) && is.good_bit ();
01280 }
01281
01282
01283 ACE_INLINE ACE_CDR::Boolean
01284 operator>> (ACE_InputCDR &is, ACE_InputCDR::to_boolean x)
01285 {
01286 return is.read_boolean (x.ref_);
01287 }
01288
01289 ACE_INLINE ACE_CDR::Boolean
01290 operator>> (ACE_InputCDR &is, ACE_InputCDR::to_char x)
01291 {
01292 return is.read_char (x.ref_) && is.good_bit ();
01293 }
01294
01295 ACE_INLINE ACE_CDR::Boolean
01296 operator>> (ACE_InputCDR &is, ACE_InputCDR::to_wchar x)
01297 {
01298 return is.read_wchar (x.ref_) && is.good_bit ();
01299 }
01300
01301 ACE_INLINE ACE_CDR::Boolean
01302 operator>> (ACE_InputCDR &is, ACE_InputCDR::to_octet x)
01303 {
01304 return is.read_octet (x.ref_) && is.good_bit ();
01305 }
01306
01307 ACE_INLINE ACE_CDR::Boolean
01308 operator>> (ACE_InputCDR &is, ACE_InputCDR::to_string x)
01309 {
01310
01311 return
01312 (is.read_string (const_cast<char *&> (x.val_))
01313 && is.good_bit ()
01314 && (!x.bound_
01315 || ACE_OS::strlen (x.val_) <= x.bound_));
01316 }
01317
01318 ACE_INLINE ACE_CDR::Boolean
01319 operator>> (ACE_InputCDR &is, ACE_InputCDR::to_wstring x)
01320 {
01321
01322 return
01323 (is.read_wstring (const_cast<ACE_CDR::WChar *&> (x.val_))
01324 && is.good_bit ()
01325 && (!x.bound_
01326 || ACE_OS::strlen (x.val_) <= x.bound_));
01327 }
01328
01329
01330
01331
01332
01333
01334 ACE_INLINE ACE_CDR::Boolean
01335 ACE_OutputCDR::append_boolean (ACE_InputCDR &stream)
01336 {
01337 ACE_CDR::Boolean x;
01338 return stream.read_boolean (x) ? this->write_boolean (x) : false;
01339 }
01340
01341 ACE_INLINE ACE_CDR::Boolean
01342 ACE_OutputCDR::append_char (ACE_InputCDR &stream)
01343 {
01344 ACE_CDR::Char x;
01345 return stream.read_char (x) ? this->write_char (x) : false;
01346 }
01347
01348 ACE_INLINE ACE_CDR::Boolean
01349 ACE_OutputCDR::append_wchar (ACE_InputCDR &stream)
01350 {
01351 ACE_CDR::WChar x;
01352 return stream.read_wchar (x) ? this->write_wchar (x) : false;
01353 }
01354
01355 ACE_INLINE ACE_CDR::Boolean
01356 ACE_OutputCDR::append_octet (ACE_InputCDR &stream)
01357 {
01358 ACE_CDR::Octet x;
01359 return stream.read_octet (x) ? this->write_octet (x) : false;
01360 }
01361
01362 ACE_INLINE ACE_CDR::Boolean
01363 ACE_OutputCDR::append_short (ACE_InputCDR &stream)
01364 {
01365 ACE_CDR::Short x;
01366 return stream.read_short (x) ? this->write_short (x) : false;
01367 }
01368
01369 ACE_INLINE ACE_CDR::Boolean
01370 ACE_OutputCDR::append_ushort (ACE_InputCDR &stream)
01371 {
01372 ACE_CDR::UShort x;
01373 return stream.read_ushort (x) ? this->write_ushort (x) : false;
01374 }
01375
01376 ACE_INLINE ACE_CDR::Boolean
01377 ACE_OutputCDR::append_long (ACE_InputCDR &stream)
01378 {
01379 ACE_CDR::Long x;
01380 return stream.read_long (x) ? this->write_long (x) : false;
01381 }
01382
01383 ACE_INLINE ACE_CDR::Boolean
01384 ACE_OutputCDR::append_ulong (ACE_InputCDR &stream)
01385 {
01386 ACE_CDR::ULong x;
01387 return stream.read_ulong (x) ? this->write_ulong (x) : false;
01388 }
01389
01390 ACE_INLINE ACE_CDR::Boolean
01391 ACE_OutputCDR::append_longlong (ACE_InputCDR &stream)
01392 {
01393 ACE_CDR::LongLong x;
01394 return stream.read_longlong (x) ? this->write_longlong (x) : false;
01395 }
01396
01397 ACE_INLINE ACE_CDR::Boolean
01398 ACE_OutputCDR::append_ulonglong (ACE_InputCDR &stream)
01399 {
01400 ACE_CDR::ULongLong x;
01401 return stream.read_ulonglong (x) ? this->write_ulonglong (x) : false;
01402 }
01403
01404 ACE_INLINE ACE_CDR::Boolean
01405 ACE_OutputCDR::append_float (ACE_InputCDR &stream)
01406 {
01407 ACE_CDR::Float x;
01408 return stream.read_float (x) ? this->write_float (x) : false;
01409 }
01410
01411 ACE_INLINE ACE_CDR::Boolean
01412 ACE_OutputCDR::append_double (ACE_InputCDR &stream)
01413 {
01414 ACE_CDR::Double x;
01415 return stream.read_double (x) ? this->write_double (x) : false;
01416 }
01417
01418 ACE_INLINE ACE_CDR::Boolean
01419 ACE_OutputCDR::append_longdouble (ACE_InputCDR &stream)
01420 {
01421 ACE_CDR::LongDouble x;
01422 return stream.read_longdouble (x) ? this->write_longdouble (x) : false;
01423 }
01424
01425 ACE_INLINE ACE_CDR::Boolean
01426 ACE_OutputCDR::append_string (ACE_InputCDR &stream)
01427 {
01428 ACE_CDR::Char *x;
01429 const ACE_CDR::Boolean flag =
01430 (stream.read_string (x) ? this->write_string (x) : false);
01431 delete [] x;
01432 return flag;
01433 }
01434
01435 ACE_INLINE ACE_CDR::Boolean
01436 ACE_OutputCDR::append_wstring (ACE_InputCDR &stream)
01437 {
01438 ACE_CDR::WChar *x;
01439 const ACE_CDR::Boolean flag =
01440 (stream.read_wstring (x) ? this->write_wstring (x) : false);
01441 delete [] x;
01442 return flag;
01443 }
01444
01445 ACE_INLINE void
01446 ACE_InputCDR::reset_byte_order (int byte_order)
01447 {
01448 this->do_byte_swap_ = (byte_order != ACE_CDR_BYTE_ORDER);
01449 }
01450
01451 ACE_INLINE bool
01452 ACE_InputCDR::do_byte_swap (void) const
01453 {
01454 return this->do_byte_swap_;
01455 }
01456
01457 ACE_INLINE int
01458 ACE_InputCDR::byte_order (void) const
01459 {
01460 return this->do_byte_swap () ? !ACE_CDR_BYTE_ORDER : ACE_CDR_BYTE_ORDER;
01461 }
01462
01463 ACE_INLINE int
01464 ACE_InputCDR::align_read_ptr (size_t alignment)
01465 {
01466 #if !defined (ACE_LACKS_CDR_ALIGNMENT)
01467 char *buf = ACE_ptr_align_binary (this->rd_ptr (),
01468 alignment);
01469 #else
01470 char *buf = this->rd_ptr ();
01471 #endif
01472
01473 if (buf <= this->wr_ptr ())
01474 {
01475 this->start_.rd_ptr (buf);
01476 return 0;
01477 }
01478
01479 this->good_bit_ = false;
01480 return -1;
01481 }
01482
01483 ACE_INLINE void
01484 ACE_InputCDR::set_version (ACE_CDR::Octet major, ACE_CDR::Octet minor)
01485 {
01486 this->major_version_ = major;
01487 this->minor_version_ = minor;
01488 }
01489
01490 ACE_INLINE void
01491 ACE_InputCDR::get_version (ACE_CDR::Octet &major, ACE_CDR::Octet &minor)
01492 {
01493 major = this->major_version_;
01494 minor = this->minor_version_;
01495 }
01496
01497 ACE_INLINE ACE_Char_Codeset_Translator *
01498 ACE_InputCDR::char_translator (void) const
01499 {
01500 return this->char_translator_;
01501 }
01502
01503 ACE_INLINE ACE_WChar_Codeset_Translator *
01504 ACE_InputCDR::wchar_translator (void) const
01505 {
01506 return this->wchar_translator_;
01507 }
01508
01509
01510 ACE_INLINE void
01511 ACE_InputCDR::char_translator (ACE_Char_Codeset_Translator * ctran)
01512 {
01513 this->char_translator_ = ctran;
01514 }
01515
01516 ACE_INLINE void
01517 ACE_InputCDR::wchar_translator (ACE_WChar_Codeset_Translator * wctran)
01518 {
01519 this->wchar_translator_ = wctran;
01520 }
01521
01522
01523
01524 ACE_INLINE ACE_CDR::Boolean
01525 ACE_Char_Codeset_Translator::read_1 (ACE_InputCDR& input,
01526 ACE_CDR::Octet *x)
01527 {
01528 return input.read_1 (x);
01529 }
01530
01531 ACE_INLINE ACE_CDR::Boolean
01532 ACE_Char_Codeset_Translator::write_1 (ACE_OutputCDR& output,
01533 const ACE_CDR::Octet *x)
01534 {
01535 return output.write_1 (x);
01536 }
01537
01538 ACE_INLINE ACE_CDR::Boolean
01539 ACE_Char_Codeset_Translator::read_array (ACE_InputCDR& in,
01540 void* x,
01541 size_t size,
01542 size_t align,
01543 ACE_CDR::ULong length)
01544 {
01545 return in.read_array (x, size, align, length);
01546 }
01547
01548 ACE_INLINE ACE_CDR::Boolean
01549 ACE_Char_Codeset_Translator::write_array (ACE_OutputCDR& out,
01550 const void *x,
01551 size_t size,
01552 size_t align,
01553 ACE_CDR::ULong length)
01554 {
01555 return out.write_array(x, size, align, length);
01556 }
01557
01558 ACE_INLINE int
01559 ACE_Char_Codeset_Translator::adjust (ACE_OutputCDR& out,
01560 size_t size,
01561 size_t align,
01562 char *&buf)
01563 {
01564 return out.adjust(size, align, buf);
01565 }
01566
01567 ACE_INLINE void
01568 ACE_Char_Codeset_Translator::good_bit (ACE_OutputCDR& out, bool bit)
01569 {
01570 out.good_bit_ = bit;
01571 }
01572
01573 ACE_INLINE ACE_CDR::Octet
01574 ACE_Char_Codeset_Translator::major_version (ACE_InputCDR& input)
01575 {
01576 return input.major_version_;
01577 }
01578
01579 ACE_INLINE ACE_CDR::Octet
01580 ACE_Char_Codeset_Translator::minor_version (ACE_InputCDR& input)
01581 {
01582 return input.minor_version_;
01583 }
01584
01585 ACE_INLINE ACE_CDR::Octet
01586 ACE_Char_Codeset_Translator::major_version (ACE_OutputCDR& output)
01587 {
01588 return output.major_version_;
01589 }
01590
01591 ACE_INLINE ACE_CDR::Octet
01592 ACE_Char_Codeset_Translator::minor_version (ACE_OutputCDR& output)
01593 {
01594 return output.minor_version_;
01595 }
01596
01597
01598
01599 ACE_INLINE ACE_CDR::Boolean
01600 ACE_WChar_Codeset_Translator::read_1 (ACE_InputCDR& input,
01601 ACE_CDR::Octet *x)
01602 {
01603 return input.read_1 (x);
01604 }
01605
01606 ACE_INLINE ACE_CDR::Boolean
01607 ACE_WChar_Codeset_Translator::read_2 (ACE_InputCDR& input,
01608 ACE_CDR::UShort *x)
01609 {
01610 return input.read_2 (x);
01611 }
01612
01613 ACE_INLINE ACE_CDR::Boolean
01614 ACE_WChar_Codeset_Translator::read_4 (ACE_InputCDR& input,
01615 ACE_CDR::ULong *x)
01616 {
01617 return input.read_4 (x);
01618 }
01619
01620 ACE_INLINE ACE_CDR::Boolean
01621 ACE_WChar_Codeset_Translator::write_1 (ACE_OutputCDR& output,
01622 const ACE_CDR::Octet *x)
01623 {
01624 return output.write_1 (x);
01625 }
01626
01627 ACE_INLINE ACE_CDR::Boolean
01628 ACE_WChar_Codeset_Translator::write_2 (ACE_OutputCDR& output,
01629 const ACE_CDR::UShort *x)
01630 {
01631 return output.write_2 (x);
01632 }
01633
01634 ACE_INLINE ACE_CDR::Boolean
01635 ACE_WChar_Codeset_Translator::write_4 (ACE_OutputCDR& output,
01636 const ACE_CDR::ULong *x)
01637 {
01638 return output.write_4 (x);
01639 }
01640
01641 ACE_INLINE ACE_CDR::Boolean
01642 ACE_WChar_Codeset_Translator::read_array (ACE_InputCDR& in,
01643 void* x,
01644 size_t size,
01645 size_t align,
01646 ACE_CDR::ULong length)
01647 {
01648 return in.read_array (x, size, align, length);
01649 }
01650
01651 ACE_INLINE ACE_CDR::Boolean
01652 ACE_WChar_Codeset_Translator::write_array (ACE_OutputCDR& out,
01653 const void *x,
01654 size_t size,
01655 size_t align,
01656 ACE_CDR::ULong length)
01657 {
01658 return out.write_array(x, size, align, length);
01659 }
01660
01661 ACE_INLINE int
01662 ACE_WChar_Codeset_Translator::adjust (ACE_OutputCDR& out,
01663 size_t size,
01664 size_t align,
01665 char *&buf)
01666 {
01667 return out.adjust(size, align, buf);
01668 }
01669
01670 ACE_INLINE void
01671 ACE_WChar_Codeset_Translator::good_bit (ACE_OutputCDR& out, bool bit)
01672 {
01673 out.good_bit_ = bit;
01674 }
01675
01676 ACE_INLINE ACE_CDR::Octet
01677 ACE_WChar_Codeset_Translator::major_version (ACE_InputCDR& input)
01678 {
01679 return input.major_version_;
01680 }
01681
01682 ACE_INLINE ACE_CDR::Octet
01683 ACE_WChar_Codeset_Translator::minor_version (ACE_InputCDR& input)
01684 {
01685 return input.minor_version_;
01686 }
01687
01688 ACE_INLINE ACE_CDR::Octet
01689 ACE_WChar_Codeset_Translator::major_version (ACE_OutputCDR& output)
01690 {
01691 return output.major_version_;
01692 }
01693
01694 ACE_INLINE ACE_CDR::Octet
01695 ACE_WChar_Codeset_Translator::minor_version (ACE_OutputCDR& output)
01696 {
01697 return output.minor_version_;
01698 }
01699
01700 ACE_END_VERSIONED_NAMESPACE_DECL