CDR_Stream.inl

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

Generated on Tue Feb 2 17:18:38 2010 for ACE by  doxygen 1.4.7