CDR_Stream.inl

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

Generated on Thu Nov 9 09:41:48 2006 for ACE by doxygen 1.3.6