ACE_OutputCDR Class Reference

A CDR stream for writing, i.e. for marshalling. More...

#include <CDR_Stream.h>

Collaboration diagram for ACE_OutputCDR:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ACE_OutputCDR (size_t size=0, int byte_order=ACE_CDR_BYTE_ORDER, ACE_Allocator *buffer_allocator=0, ACE_Allocator *data_block_allocator=0, ACE_Allocator *message_block_allocator=0, size_t memcpy_tradeoff=ACE_DEFAULT_CDR_MEMCPY_TRADEOFF, ACE_CDR::Octet major_version=ACE_CDR_GIOP_MAJOR_VERSION, ACE_CDR::Octet minor_version=ACE_CDR_GIOP_MINOR_VERSION)
 ACE_OutputCDR (char *data, size_t size, int byte_order=ACE_CDR_BYTE_ORDER, ACE_Allocator *buffer_allocator=0, ACE_Allocator *data_block_allocator=0, ACE_Allocator *message_block_allocator=0, size_t memcpy_tradeoff=ACE_DEFAULT_CDR_MEMCPY_TRADEOFF, ACE_CDR::Octet giop_major_version=ACE_CDR_GIOP_MAJOR_VERSION, ACE_CDR::Octet giop_minor_version=ACE_CDR_GIOP_MINOR_VERSION)
 ACE_OutputCDR (ACE_Message_Block *data, int byte_order=ACE_CDR_BYTE_ORDER, size_t memcpy_tradeoff=ACE_DEFAULT_CDR_MEMCPY_TRADEOFF, ACE_CDR::Octet giop_major_version=ACE_CDR_GIOP_MAJOR_VERSION, ACE_CDR::Octet giop_minor_version=ACE_CDR_GIOP_MINOR_VERSION)
 ~ACE_OutputCDR (void)
 destructor

bool good_bit (void) const
 Returns false if an error has ocurred.

void reset (void)
 Reuse the CDR stream to write on the old buffer.

size_t total_length (void) const
 Add the length of each message block in the chain.

const ACE_Message_Blockbegin (void) const
const ACE_Message_Blockend (void) const
 Return the last message in the chain that is is use.

const ACE_Message_Blockcurrent (void) const
 Return the message block in chain.

const char * buffer (void) const
size_t length (void) const
int align_write_ptr (size_t alignment)
ACE_Char_Codeset_Translatorchar_translator (void) const
 Access the codeset translators. They can be null!

ACE_WChar_Codeset_Translatorwchar_translator (void) const
void char_translator (ACE_Char_Codeset_Translator *)
 Set the char codeset translator.

void wchar_translator (ACE_WChar_Codeset_Translator *)
 Set the wchar codeset translator.

size_t current_alignment (void) const
int adjust (size_t size, char *&buf)
int adjust (size_t size, size_t align, char *&buf)
bool do_byte_swap (void) const
int byte_order (void) const
void reset_byte_order (int byte_order)
int set_version (ACE_CDR::Octet major, ACE_CDR::Octet minor)
 set GIOP version info

int get_version (ACE_CDR::Octet &major, ACE_CDR::Octet &minor)
 Set the underlying GIOP version..

Write operations
ACE_CDR::Boolean write_boolean (ACE_CDR::Boolean x)
ACE_CDR::Boolean write_char (ACE_CDR::Char x)
ACE_CDR::Boolean write_wchar (ACE_CDR::WChar x)
ACE_CDR::Boolean write_octet (ACE_CDR::Octet x)
ACE_CDR::Boolean write_short (ACE_CDR::Short x)
ACE_CDR::Boolean write_ushort (ACE_CDR::UShort x)
ACE_CDR::Boolean write_long (ACE_CDR::Long x)
ACE_CDR::Boolean write_ulong (ACE_CDR::ULong x)
ACE_CDR::Boolean write_longlong (const ACE_CDR::LongLong &x)
ACE_CDR::Boolean write_ulonglong (const ACE_CDR::ULongLong &x)
ACE_CDR::Boolean write_float (ACE_CDR::Float x)
ACE_CDR::Boolean write_double (const ACE_CDR::Double &x)
ACE_CDR::Boolean write_longdouble (const ACE_CDR::LongDouble &x)
ACE_CDR::Boolean replace (ACE_CDR::Long x, char *loc)
ACE_CDR::Boolean write_string (const ACE_CDR::Char *x)
 For string we offer methods that accept a precomputed length.

ACE_CDR::Boolean write_string (ACE_CDR::ULong len, const ACE_CDR::Char *x)
ACE_CDR::Boolean write_string (const ACE_CString &x)
ACE_CDR::Boolean write_wstring (const ACE_CDR::WChar *x)
ACE_CDR::Boolean write_wstring (ACE_CDR::ULong length, const ACE_CDR::WChar *x)
Array write operations
ACE_CDR::Boolean write_boolean_array (const ACE_CDR::Boolean *x, ACE_CDR::ULong length)
ACE_CDR::Boolean write_char_array (const ACE_CDR::Char *x, ACE_CDR::ULong length)
ACE_CDR::Boolean write_wchar_array (const ACE_CDR::WChar *x, ACE_CDR::ULong length)
ACE_CDR::Boolean write_octet_array (const ACE_CDR::Octet *x, ACE_CDR::ULong length)
ACE_CDR::Boolean write_short_array (const ACE_CDR::Short *x, ACE_CDR::ULong length)
ACE_CDR::Boolean write_ushort_array (const ACE_CDR::UShort *x, ACE_CDR::ULong length)
ACE_CDR::Boolean write_long_array (const ACE_CDR::Long *x, ACE_CDR::ULong length)
ACE_CDR::Boolean write_ulong_array (const ACE_CDR::ULong *x, ACE_CDR::ULong length)
ACE_CDR::Boolean write_longlong_array (const ACE_CDR::LongLong *x, ACE_CDR::ULong length)
ACE_CDR::Boolean write_ulonglong_array (const ACE_CDR::ULongLong *x, ACE_CDR::ULong length)
ACE_CDR::Boolean write_float_array (const ACE_CDR::Float *x, ACE_CDR::ULong length)
ACE_CDR::Boolean write_double_array (const ACE_CDR::Double *x, ACE_CDR::ULong length)
ACE_CDR::Boolean write_longdouble_array (const ACE_CDR::LongDouble *x, ACE_CDR::ULong length)
ACE_CDR::Boolean write_octet_array_mb (const ACE_Message_Block *mb)
Append contents of own CDR stream to another
ACE_CDR::Boolean append_boolean (ACE_InputCDR &)
ACE_CDR::Boolean append_char (ACE_InputCDR &)
ACE_CDR::Boolean append_wchar (ACE_InputCDR &)
ACE_CDR::Boolean append_octet (ACE_InputCDR &)
ACE_CDR::Boolean append_short (ACE_InputCDR &)
ACE_CDR::Boolean append_ushort (ACE_InputCDR &)
ACE_CDR::Boolean append_long (ACE_InputCDR &)
ACE_CDR::Boolean append_ulong (ACE_InputCDR &)
ACE_CDR::Boolean append_longlong (ACE_InputCDR &)
ACE_CDR::Boolean append_ulonglong (ACE_InputCDR &)
ACE_CDR::Boolean append_float (ACE_InputCDR &)
ACE_CDR::Boolean append_double (ACE_InputCDR &)
ACE_CDR::Boolean append_longdouble (ACE_InputCDR &)
ACE_CDR::Boolean append_wstring (ACE_InputCDR &)
ACE_CDR::Boolean append_string (ACE_InputCDR &)

Static Public Member Functions

void wchar_maxbytes (int)
int wchar_maxbytes (void)
 access the serialized size of wchars.


Protected Attributes

ACE_CDR::Octet major_version_
 GIOP version information.

ACE_CDR::Octet minor_version_
ACE_Char_Codeset_Translatorchar_translator_
 If not nil, invoke for translation of character and string data.

ACE_WChar_Codeset_Translatorwchar_translator_

Static Protected Attributes

int wchar_maxbytes_ = sizeof (ACE_CDR::WChar)

Private Member Functions

ACE_Message_Blockfind (char *loc)
 ACE_OutputCDR (const ACE_OutputCDR &rhs)
 disallow copying...

ACE_OutputCDRoperator= (const ACE_OutputCDR &rhs)
ACE_CDR::Boolean write_1 (const ACE_CDR::Octet *x)
ACE_CDR::Boolean write_2 (const ACE_CDR::UShort *x)
ACE_CDR::Boolean write_4 (const ACE_CDR::ULong *x)
ACE_CDR::Boolean write_8 (const ACE_CDR::ULongLong *x)
ACE_CDR::Boolean write_16 (const ACE_CDR::LongDouble *x)
ACE_CDR::Boolean write_array (const void *x, size_t size, size_t align, ACE_CDR::ULong length)
ACE_CDR::Boolean write_wchar_array_i (const ACE_CDR::WChar *x, ACE_CDR::ULong length)
int grow_and_adjust (size_t size, size_t align, char *&buf)

Private Attributes

ACE_Message_Block start_
 The start of the chain of message blocks.

ACE_Message_Blockcurrent_
 The current block in the chain were we are writing.

size_t current_alignment_
bool current_is_writable_
bool do_byte_swap_
bool good_bit_
 Set to 0 when an error ocurrs.

size_t memcpy_tradeoff_
 Break-even point for copying.


Friends

class ACE_Char_Codeset_Translator
class ACE_WChar_Codeset_Translator
class ACE_InputCDR

Detailed Description

A CDR stream for writing, i.e. for marshalling.

This class is based on the the CORBA spec for Java (98-02-29), java class omg.org.CORBA.portable.OutputStream. It diverts in a few ways: + Operations taking arrays don't have offsets, because in C++ it is easier to describe an array starting from x+offset. + Operations return an error status, because exceptions are not widely available in C++ (yet).

Definition at line 85 of file CDR_Stream.h.


Constructor & Destructor Documentation

ACE_OutputCDR::ACE_OutputCDR size_t  size = 0,
int  byte_order = ACE_CDR_BYTE_ORDER,
ACE_Allocator buffer_allocator = 0,
ACE_Allocator data_block_allocator = 0,
ACE_Allocator message_block_allocator = 0,
size_t  memcpy_tradeoff = ACE_DEFAULT_CDR_MEMCPY_TRADEOFF,
ACE_CDR::Octet  major_version = ACE_CDR_GIOP_MAJOR_VERSION,
ACE_CDR::Octet  minor_version = ACE_CDR_GIOP_MINOR_VERSION
 

Default constructor, allocates bytes in the internal buffer, if == 0 it allocates the default size.

Definition at line 18 of file CDR_Stream.cpp.

References ACE_CDR_BYTE_ORDER, ACE_CDR::mb_align(), ACE_CDR::Octet, and start_.

00026   :  start_ ((size ? size : (size_t) ACE_CDR::DEFAULT_BUFSIZE) + ACE_CDR::MAX_ALIGNMENT,
00027              ACE_Message_Block::MB_DATA,
00028              0,
00029              0,
00030              buffer_allocator,
00031              0,
00032              0,
00033              ACE_Time_Value::zero,
00034              ACE_Time_Value::max_time,
00035              data_block_allocator,
00036              message_block_allocator),
00037 #if !defined (ACE_LACKS_CDR_ALIGNMENT)
00038      current_alignment_ (0),
00039 #endif /* ACE_LACKS_CDR_ALIGNMENT */
00040      current_is_writable_ (true),
00041      do_byte_swap_ (byte_order != ACE_CDR_BYTE_ORDER),
00042      good_bit_ (true),
00043      memcpy_tradeoff_ (memcpy_tradeoff),
00044      major_version_ (major_version),
00045      minor_version_ (minor_version),
00046      char_translator_ (0),
00047      wchar_translator_ (0)
00048 
00049 {
00050   ACE_CDR::mb_align (&this->start_);
00051   this->current_ = &this->start_;
00052 }

ACE_OutputCDR::ACE_OutputCDR char *  data,
size_t  size,
int  byte_order = ACE_CDR_BYTE_ORDER,
ACE_Allocator buffer_allocator = 0,
ACE_Allocator data_block_allocator = 0,
ACE_Allocator message_block_allocator = 0,
size_t  memcpy_tradeoff = ACE_DEFAULT_CDR_MEMCPY_TRADEOFF,
ACE_CDR::Octet  giop_major_version = ACE_CDR_GIOP_MAJOR_VERSION,
ACE_CDR::Octet  giop_minor_version = ACE_CDR_GIOP_MINOR_VERSION
 

Create an output stream from an arbitrary buffer, care must be exercised with alignment, because this contructor will align if needed. In this case will not point to the start off the output stream. begin()->rd_prt() points to the start off the output stream. See ACE_ptr_align_binary() to properly align a pointer and use ACE_CDR::MAX_ALIGNMENT for the correct alignment.

Definition at line 54 of file CDR_Stream.cpp.

References ACE_CDR_BYTE_ORDER, ACE_CDR::mb_align(), ACE_CDR::Octet, and start_.

00063   :  start_ (size,
00064              ACE_Message_Block::MB_DATA,
00065              0,
00066              data,
00067              buffer_allocator,
00068              0,
00069              0,
00070              ACE_Time_Value::zero,
00071              ACE_Time_Value::max_time,
00072              data_block_allocator,
00073              message_block_allocator),
00074 #if !defined (ACE_LACKS_CDR_ALIGNMENT)
00075      current_alignment_ (0),
00076 #endif /* ACE_LACKS_CDR_ALIGNMENT */
00077      current_is_writable_ (true),
00078      do_byte_swap_ (byte_order != ACE_CDR_BYTE_ORDER),
00079      good_bit_ (true),
00080      memcpy_tradeoff_ (memcpy_tradeoff),
00081      major_version_ (major_version),
00082      minor_version_ (minor_version),
00083      char_translator_ (0),
00084      wchar_translator_ (0)
00085 {
00086   // We cannot trust the buffer to be properly aligned
00087   ACE_CDR::mb_align (&this->start_);
00088   this->current_ = &this->start_;
00089 }

ACE_OutputCDR::ACE_OutputCDR ACE_Message_Block data,
int  byte_order = ACE_CDR_BYTE_ORDER,
size_t  memcpy_tradeoff = ACE_DEFAULT_CDR_MEMCPY_TRADEOFF,
ACE_CDR::Octet  giop_major_version = ACE_CDR_GIOP_MAJOR_VERSION,
ACE_CDR::Octet  giop_minor_version = ACE_CDR_GIOP_MINOR_VERSION
 

Build a CDR stream with an initial Message_Block chain, it will not* remove , since it did not allocate it.

Definition at line 91 of file CDR_Stream.cpp.

References ACE_CDR_BYTE_ORDER, ACE_CDR::mb_align(), ACE_CDR::Octet, and start_.

00096   :  start_ (data->data_block ()->duplicate ()),
00097 #if !defined (ACE_LACKS_CDR_ALIGNMENT)
00098      current_alignment_ (0),
00099 #endif /* ACE_LACKS_CDR_ALIGNMENT */
00100      current_is_writable_ (true),
00101      do_byte_swap_ (byte_order != ACE_CDR_BYTE_ORDER),
00102      good_bit_ (true),
00103      memcpy_tradeoff_ (memcpy_tradeoff),
00104      major_version_ (major_version),
00105      minor_version_ (minor_version),
00106      char_translator_ (0),
00107      wchar_translator_ (0)
00108 {
00109   // We cannot trust the buffer to be properly aligned
00110   ACE_CDR::mb_align (&this->start_);
00111   this->current_ = &this->start_;
00112 }

ACE_INLINE ACE_OutputCDR::~ACE_OutputCDR void   ) 
 

destructor

Definition at line 142 of file CDR_Stream.inl.

References ACE_Message_Block::cont(), ACE_Message_Block::release(), and start_.

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 }

ACE_OutputCDR::ACE_OutputCDR const ACE_OutputCDR rhs  )  [private]
 

disallow copying...


Member Function Documentation

ACE_INLINE int ACE_OutputCDR::adjust size_t  size,
size_t  align,
char *&  buf
 

As above, but now the size and alignment requirements may be different.

Definition at line 429 of file CDR_Stream.inl.

References ACE_align_binary, current_alignment_, current_is_writable_, ACE_Message_Block::end(), grow_and_adjust(), and ACE_Message_Block::wr_ptr().

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 }

ACE_INLINE int ACE_OutputCDR::adjust size_t  size,
char *&  buf
 

Returns (in ) the next position in the buffer aligned to , it advances the Message_Block wr_ptr past the data (i.e., + ). If necessary it grows the Message_Block buffer. Sets the good_bit to 0 and returns a -1 on failure.

Definition at line 462 of file CDR_Stream.inl.

Referenced by ACE_WChar_Codeset_Translator::adjust(), ACE_Char_Codeset_Translator::adjust(), align_write_ptr(), grow_and_adjust(), write_1(), write_16(), write_2(), write_4(), write_8(), write_array(), and write_wchar_array_i().

00463 {
00464   return this->adjust (size, size, buf);
00465 }

ACE_INLINE int ACE_OutputCDR::align_write_ptr size_t  alignment  ) 
 

Utility function to allow the user more flexibility. Pads the stream up to the nearest -byte boundary. Argument MUST be a power of 2. Returns 0 on success and -1 on failure.

Definition at line 554 of file CDR_Stream.inl.

References adjust().

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 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::append_boolean ACE_InputCDR  ) 
 

Return 0 on failure and 1 on success.

Definition at line 1374 of file CDR_Stream.inl.

References ACE_CDR::Boolean, ACE_InputCDR::read_boolean(), and write_boolean().

01375 {
01376   ACE_CDR::Boolean x;
01377   return stream.read_boolean (x) ? this->write_boolean (x) : false;
01378 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::append_char ACE_InputCDR  ) 
 

Return 0 on failure and 1 on success.

Definition at line 1381 of file CDR_Stream.inl.

References ACE_CDR::Char, ACE_InputCDR::read_char(), and write_char().

01382 {
01383   ACE_CDR::Char x;
01384   return stream.read_char (x) ? this->write_char (x) : false;
01385 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::append_double ACE_InputCDR  ) 
 

Return 0 on failure and 1 on success.

Definition at line 1451 of file CDR_Stream.inl.

References ACE_InputCDR::read_double(), and write_double().

01452 {
01453   ACE_CDR::Double x;
01454   return stream.read_double (x) ? this->write_double (x) : false;
01455 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::append_float ACE_InputCDR  ) 
 

Return 0 on failure and 1 on success.

Definition at line 1444 of file CDR_Stream.inl.

References ACE_InputCDR::read_float(), and write_float().

01445 {
01446   ACE_CDR::Float x;
01447   return stream.read_float (x) ? this->write_float (x) : false;
01448 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::append_long ACE_InputCDR  ) 
 

Return 0 on failure and 1 on success.

Definition at line 1416 of file CDR_Stream.inl.

References ACE_CDR::Long, ACE_InputCDR::read_long(), and write_long().

01417 {
01418   ACE_CDR::Long x;
01419   return stream.read_long (x) ? this->write_long (x) : false;
01420 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::append_longdouble ACE_InputCDR  ) 
 

Return 0 on failure and 1 on success.

Definition at line 1458 of file CDR_Stream.inl.

References ACE_InputCDR::read_longdouble(), and write_longdouble().

01459 {
01460   ACE_CDR::LongDouble x;
01461   return stream.read_longdouble (x) ? this->write_longdouble (x) : false;
01462 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::append_longlong ACE_InputCDR  ) 
 

Return 0 on failure and 1 on success.

Definition at line 1430 of file CDR_Stream.inl.

References ACE_CDR::LongLong, ACE_InputCDR::read_longlong(), and write_longlong().

01431 {
01432   ACE_CDR::LongLong x;
01433   return stream.read_longlong (x) ? this->write_longlong (x) : false;
01434 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::append_octet ACE_InputCDR  ) 
 

Return 0 on failure and 1 on success.

Definition at line 1395 of file CDR_Stream.inl.

References ACE_CDR::Octet, ACE_InputCDR::read_octet(), and write_octet().

01396 {
01397   ACE_CDR::Octet x;
01398   return stream.read_octet (x) ? this->write_octet (x) : false;
01399 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::append_short ACE_InputCDR  ) 
 

Return 0 on failure and 1 on success.

Definition at line 1402 of file CDR_Stream.inl.

References ACE_InputCDR::read_short(), ACE_CDR::Short, and write_short().

01403 {
01404   ACE_CDR::Short x;
01405   return stream.read_short (x) ? this->write_short (x) : false;
01406 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::append_string ACE_InputCDR  ) 
 

Return 0 on failure and 1 on success.

Definition at line 1465 of file CDR_Stream.inl.

References ACE_CDR::Boolean, ACE_CDR::Char, ACE_InputCDR::read_string(), and write_string().

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 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::append_ulong ACE_InputCDR  ) 
 

Return 0 on failure and 1 on success.

Definition at line 1423 of file CDR_Stream.inl.

References ACE_InputCDR::read_ulong(), ACE_CDR::ULong, and write_ulong().

01424 {
01425   ACE_CDR::ULong x;
01426   return stream.read_ulong (x) ? this->write_ulong (x) : false;
01427 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::append_ulonglong ACE_InputCDR  ) 
 

Return 0 on failure and 1 on success.

Definition at line 1437 of file CDR_Stream.inl.

References ACE_InputCDR::read_ulonglong(), ACE_CDR::ULongLong, and write_ulonglong().

01438 {
01439   ACE_CDR::ULongLong x;
01440   return stream.read_ulonglong (x) ? this->write_ulonglong (x) : false;
01441 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::append_ushort ACE_InputCDR  ) 
 

Return 0 on failure and 1 on success.

Definition at line 1409 of file CDR_Stream.inl.

References ACE_InputCDR::read_ushort(), ACE_CDR::UShort, and write_ushort().

01410 {
01411   ACE_CDR::UShort x;
01412   return stream.read_ushort (x) ? this->write_ushort (x) : false;
01413 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::append_wchar ACE_InputCDR  ) 
 

Return 0 on failure and 1 on success.

Definition at line 1388 of file CDR_Stream.inl.

References ACE_InputCDR::read_wchar(), ACE_CDR::WChar, and write_wchar().

01389 {
01390   ACE_CDR::WChar x;
01391   return stream.read_wchar (x) ? this->write_wchar (x) : false;
01392 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::append_wstring ACE_InputCDR  ) 
 

Return 0 on failure and 1 on success.

Definition at line 1475 of file CDR_Stream.inl.

References ACE_CDR::Boolean, ACE_InputCDR::read_wstring(), ACE_CDR::WChar, and write_wstring().

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 }

ACE_INLINE const ACE_Message_Block * ACE_OutputCDR::begin void   )  const
 

Return the start of the message block chain for this CDR stream.

Note:
The complete CDR stream is represented by a chain of message blocks.

Definition at line 486 of file CDR_Stream.inl.

References start_.

Referenced by ACE_InputCDR::ACE_InputCDR(), and ACE_Log_Msg_IPC::log().

00487 {
00488   return &this->start_;
00489 }

ACE_INLINE const char * ACE_OutputCDR::buffer void   )  const
 

Access the underlying buffer (read only).

Note:
This method only returns a pointer to the first block in the chain.

Definition at line 510 of file CDR_Stream.inl.

References ACE_Message_Block::rd_ptr(), and start_.

00511 {
00512   return this->start_.rd_ptr ();
00513 }

ACE_INLINE int ACE_OutputCDR::byte_order void   )  const
 

If returns 0, this returns ACE_CDR_BYTE_ORDER else it returns !ACE_CDR_BYTE_ORDER.

Definition at line 528 of file CDR_Stream.inl.

References ACE_CDR_BYTE_ORDER, and do_byte_swap().

00529 {
00530   if (this->do_byte_swap ())
00531     return !ACE_CDR_BYTE_ORDER;
00532   else
00533     return ACE_CDR_BYTE_ORDER;
00534 }

ACE_INLINE void ACE_OutputCDR::char_translator ACE_Char_Codeset_Translator  ) 
 

Set the char codeset translator.

Definition at line 580 of file CDR_Stream.inl.

References char_translator_.

00581 {
00582   this->char_translator_ = ctran;
00583 }

ACE_INLINE ACE_Char_Codeset_Translator * ACE_OutputCDR::char_translator void   )  const
 

Access the codeset translators. They can be null!

Definition at line 568 of file CDR_Stream.inl.

References char_translator_.

00569 {
00570   return this->char_translator_;
00571 }

ACE_INLINE const ACE_Message_Block * ACE_OutputCDR::current void   )  const
 

Return the message block in chain.

Definition at line 498 of file CDR_Stream.inl.

00499 {
00500   return this->current_;
00501 }

ACE_INLINE size_t ACE_OutputCDR::current_alignment void   )  const
 

Return alignment of the wr_ptr(), with respect to the start of the CDR stream. This is not the same as the alignment of current->wr_ptr()!

Definition at line 543 of file CDR_Stream.inl.

References current_alignment_.

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 }

ACE_INLINE bool ACE_OutputCDR::do_byte_swap void   )  const
 

If non-zero then this stream is writing in non-native byte order, this is only meaningful if ACE_ENABLE_SWAP_ON_WRITE is defined.

Definition at line 522 of file CDR_Stream.inl.

References do_byte_swap_.

Referenced by byte_order().

00523 {
00524   return this->do_byte_swap_;
00525 }

ACE_INLINE const ACE_Message_Block * ACE_OutputCDR::end void   )  const
 

Return the last message in the chain that is is use.

Definition at line 492 of file CDR_Stream.inl.

References ACE_Message_Block::cont().

Referenced by ACE_InputCDR::ACE_InputCDR(), and total_length().

00493 {
00494   return this->current_->cont ();
00495 }

ACE_Message_Block * ACE_OutputCDR::find char *  loc  )  [private]
 

Definition at line 662 of file CDR_Stream.cpp.

References ACE_Message_Block::cont(), ACE_Message_Block::rd_ptr(), start_, and ACE_Message_Block::wr_ptr().

Referenced by replace().

00663 {
00664   ACE_Message_Block* mb = 0;
00665   for (mb = &this->start_; mb != 0; mb = mb->cont ())
00666   {
00667     if (loc <= mb->wr_ptr () && loc >= mb->rd_ptr ())
00668     {
00669       break;
00670     }
00671   }
00672 
00673   return mb;
00674 }

ACE_INLINE int ACE_OutputCDR::get_version ACE_CDR::Octet major,
ACE_CDR::Octet minor
 

Set the underlying GIOP version..

Definition at line 476 of file CDR_Stream.inl.

References ACE_CDR::Octet.

00478 {
00479   major = this->major_version_;
00480   minor = this->minor_version_;
00481   return 0;
00482 }

ACE_INLINE bool ACE_OutputCDR::good_bit void   )  const
 

Returns false if an error has ocurred.

Note:
The only expected error is to run out of memory.

Definition at line 423 of file CDR_Stream.inl.

Referenced by operator<<(), and write_boolean_array().

00424 {
00425   return this->good_bit_;
00426 }

int ACE_OutputCDR::grow_and_adjust size_t  size,
size_t  align,
char *&  buf
[private]
 

Grow the CDR stream. When it returns contains a pointer to memory in the CDR stream, with at least bytes ahead of it and aligned to an boundary. It moved the to <buf + size>.

Definition at line 127 of file CDR_Stream.cpp.

References ACE_NEW_RETURN, adjust(), ACE_Message_Block::cont(), current_is_writable_, ACE_Message_Block::data_block(), ACE_Data_Block::data_block_allocator(), ACE_CDR::next_size(), ACE_Message_Block::rd_ptr(), ACE_Message_Block::size(), and ACE_Message_Block::wr_ptr().

Referenced by adjust().

00130 {
00131   if (!this->current_is_writable_
00132       || this->current_->cont () == 0
00133       || this->current_->cont ()->size () < size + ACE_CDR::MAX_ALIGNMENT)
00134     {
00135       // Calculate the new buffer's length; if growing for encode, we
00136       // don't grow in "small" chunks because of the cost.
00137       size_t cursize = this->current_->size ();
00138       if (this->current_->cont () != 0)
00139         cursize = this->current_->cont ()->size ();
00140       size_t minsize = size;
00141 
00142 #if !defined (ACE_LACKS_CDR_ALIGNMENT)
00143       minsize += ACE_CDR::MAX_ALIGNMENT;
00144 #endif /* ACE_LACKS_CDR_ALIGNMENT */
00145 
00146       // Make sure that there is enough room for <minsize> bytes, but
00147       // also make it bigger than whatever our current size is.
00148       if (minsize < cursize)
00149         minsize = cursize;
00150 
00151       const size_t newsize = ACE_CDR::next_size (minsize);
00152 
00153       this->good_bit_ = false;
00154       ACE_Message_Block* tmp = 0;
00155       ACE_NEW_RETURN (tmp,
00156                       ACE_Message_Block (newsize,
00157                                          ACE_Message_Block::MB_DATA,
00158                                          0,
00159                                          0,
00160                                          this->current_->data_block ()->allocator_strategy (),
00161                                          0,
00162                                          0,
00163                                          ACE_Time_Value::zero,
00164                                          ACE_Time_Value::max_time,
00165                                          this->current_->data_block ()->data_block_allocator ()),
00166                       -1);
00167       this->good_bit_ = true;
00168 
00169 #if !defined (ACE_LACKS_CDR_ALIGNMENT)
00170       // The new block must start with the same alignment as the
00171       // previous block finished.
00172       ptrdiff_t tmpalign =
00173         ptrdiff_t(tmp->rd_ptr ()) % ACE_CDR::MAX_ALIGNMENT;
00174       ptrdiff_t curalign =
00175         ptrdiff_t(this->current_alignment_) % ACE_CDR::MAX_ALIGNMENT;
00176       ptrdiff_t offset = curalign - tmpalign;
00177       if (offset < 0)
00178         offset += ACE_CDR::MAX_ALIGNMENT;
00179       tmp->rd_ptr (static_cast<size_t> (offset));
00180       tmp->wr_ptr (tmp->rd_ptr ());
00181 #endif /* ACE_LACKS_CDR_ALIGNMENT */
00182 
00183       // grow the chain and set the current block.
00184       tmp->cont (this->current_->cont ());
00185       this->current_->cont (tmp);
00186     }
00187   this->current_ = this->current_->cont ();
00188   this->current_is_writable_ = true;
00189 
00190   return this->adjust (size, align, buf);
00191 }

ACE_INLINE size_t ACE_OutputCDR::length void   )  const
 

Return the start and size of the internal buffer.

Note:
This method only returns information about the first block in the chain.

Definition at line 516 of file CDR_Stream.inl.

References ACE_Message_Block::length(), and start_.

Referenced by write_octet_array_mb().

00517 {
00518   return this->start_.length ();
00519 }

ACE_OutputCDR& ACE_OutputCDR::operator= const ACE_OutputCDR rhs  )  [private]
 

ACE_CDR::Boolean ACE_OutputCDR::replace ACE_CDR::Long  x,
char *  loc
 

Definition at line 619 of file CDR_Stream.cpp.

References find(), ACE_CDR::Long, and ACE_CDR::swap_4().

00620 {
00621   if (this->find (loc) == 0)
00622     return false;
00623 
00624 #if !defined (ACE_ENABLE_SWAP_ON_WRITE)
00625   *reinterpret_cast<ACE_CDR::Long*> (loc) = x;
00626 #else
00627   if (!strm->do_byte_swap ())
00628   {
00629     *reinterpret_cast<ACE_CDR::Long *> (loc) = x;
00630   }
00631   else
00632   {
00633     ACE_CDR::swap_4 (reinterpret_cast<const char*> (&x), loc);
00634   }
00635 #endif /* ACE_ENABLE_SWAP_ON_WRITE */
00636 
00637   return true;
00638 }

ACE_INLINE void ACE_OutputCDR::reset void   ) 
 

Reuse the CDR stream to write on the old buffer.

Definition at line 153 of file CDR_Stream.inl.

References current_alignment_, current_is_writable_, ACE_CDR::mb_align(), ACE_Message_Block::release(), and start_.

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 }

ACE_INLINE void ACE_OutputCDR::reset_byte_order int  byte_order  ) 
 

For use by a gateway, which creates the output stream for the reply to the client in its native byte order, but which must send the reply in the byte order of the target's reply to the gateway.

Definition at line 537 of file CDR_Stream.inl.

References ACE_CDR_BYTE_ORDER, and do_byte_swap_.

00538 {
00539   this->do_byte_swap_ = (byte_order != ACE_CDR_BYTE_ORDER);
00540 }

ACE_INLINE int ACE_OutputCDR::set_version ACE_CDR::Octet  major,
ACE_CDR::Octet  minor
 

set GIOP version info

Definition at line 468 of file CDR_Stream.inl.

References ACE_CDR::Octet.

00469 {
00470   this->major_version_ = major;
00471   this->minor_version_ = minor;
00472   return 0;
00473 }

ACE_INLINE size_t ACE_OutputCDR::total_length void   )  const
 

Add the length of each message block in the chain.

Definition at line 504 of file CDR_Stream.inl.

References end(), and ACE_CDR::total_length().

Referenced by ACE_Log_Msg_IPC::log().

00505 {
00506   return ACE_CDR::total_length (this->begin (), this->end ());
00507 }

int ACE_OutputCDR::wchar_maxbytes void   )  [static]
 

access the serialized size of wchars.

Definition at line 121 of file CDR_Stream.cpp.

References wchar_maxbytes_.

Referenced by ACE_SizeCDR::write_wchar(), ACE_SizeCDR::write_wchar_array(), ACE_SizeCDR::write_wchar_array_i(), and ACE_SizeCDR::write_wstring().

00122 {
00123   return ACE_OutputCDR::wchar_maxbytes_;
00124 }

void ACE_OutputCDR::wchar_maxbytes int   )  [static]
 

set the global size of serialized wchars. This may be different than the size of a wchar_t.

Definition at line 115 of file CDR_Stream.cpp.

References wchar_maxbytes_.

00116 {
00117   ACE_OutputCDR::wchar_maxbytes_ = maxbytes;
00118 }

ACE_INLINE void ACE_OutputCDR::wchar_translator ACE_WChar_Codeset_Translator  ) 
 

Set the wchar codeset translator.

Definition at line 586 of file CDR_Stream.inl.

References wchar_translator_.

00587 {
00588   this->wchar_translator_ = wctran;
00589 }

ACE_INLINE ACE_WChar_Codeset_Translator * ACE_OutputCDR::wchar_translator void   )  const
 

Definition at line 574 of file CDR_Stream.inl.

References wchar_translator_.

00575 {
00576   return this->wchar_translator_;
00577 }

ACE_CDR::Boolean ACE_OutputCDR::write_1 const ACE_CDR::Octet x  )  [private]
 

Definition at line 396 of file CDR_Stream.cpp.

References adjust(), and ACE_CDR::Octet.

Referenced by ACE_WChar_Codeset_Translator::write_1(), ACE_Char_Codeset_Translator::write_1(), write_char(), write_octet(), and write_wchar().

00397 {
00398   char *buf = 0;
00399   if (this->adjust (1, buf) == 0)
00400     {
00401       *reinterpret_cast<ACE_CDR::Octet*> (buf) = *x;
00402       return true;
00403     }
00404 
00405   return false;
00406 }

ACE_CDR::Boolean ACE_OutputCDR::write_16 const ACE_CDR::LongDouble x  )  [private]
 

Definition at line 501 of file CDR_Stream.cpp.

References adjust(), do_byte_swap_, and ACE_CDR::swap_16().

Referenced by write_longdouble().

00502 {
00503   char* buf = 0;
00504   if (this->adjust (ACE_CDR::LONGDOUBLE_SIZE,
00505                     ACE_CDR::LONGDOUBLE_ALIGN,
00506                     buf) == 0)
00507     {
00508 #if !defined (ACE_ENABLE_SWAP_ON_WRITE)
00509       *reinterpret_cast<ACE_CDR::LongDouble*> (buf) = *x;
00510       return 1;
00511 #else
00512       if (!this->do_byte_swap_)
00513         {
00514           *reinterpret_cast<ACE_CDR::LongDouble *> (buf) = *x;
00515           return true;
00516         }
00517       else
00518         {
00519           ACE_CDR::swap_16 (reinterpret_cast<const char*> (x), buf);
00520           return true;
00521         }
00522 #endif /* ACE_ENABLE_SWAP_ON_WRITE */
00523     }
00524 
00525   return false;
00526 }

ACE_CDR::Boolean ACE_OutputCDR::write_2 const ACE_CDR::UShort x  )  [private]
 

Definition at line 409 of file CDR_Stream.cpp.

References adjust(), do_byte_swap_, ACE_CDR::swap_2(), and ACE_CDR::UShort.

Referenced by ACE_WChar_Codeset_Translator::write_2(), write_short(), write_ushort(), and write_wchar().

00410 {
00411   char *buf = 0;
00412   if (this->adjust (ACE_CDR::SHORT_SIZE, buf) == 0)
00413     {
00414 #if !defined (ACE_ENABLE_SWAP_ON_WRITE)
00415       *reinterpret_cast<ACE_CDR::UShort*> (buf) = *x;
00416       return true;
00417 #else
00418       if (!this->do_byte_swap_)
00419         {
00420           *reinterpret_cast<ACE_CDR::UShort *> (buf) = *x;
00421           return true;
00422         }
00423       else
00424         {
00425           ACE_CDR::swap_2 (reinterpret_cast<const char*> (x), buf);
00426           return true;
00427         }
00428 #endif /* ACE_ENABLE_SWAP_ON_WRITE */
00429     }
00430 
00431   return false;
00432 }

ACE_CDR::Boolean ACE_OutputCDR::write_4 const ACE_CDR::ULong x  )  [private]
 

Definition at line 435 of file CDR_Stream.cpp.

References adjust(), do_byte_swap_, ACE_CDR::swap_4(), and ACE_CDR::ULong.

Referenced by ACE_WChar_Codeset_Translator::write_4(), write_float(), write_long(), write_ulong(), and write_wchar().

00436 {
00437   char *buf = 0;
00438   if (this->adjust (ACE_CDR::LONG_SIZE, buf) == 0)
00439     {
00440 #if !defined (ACE_ENABLE_SWAP_ON_WRITE)
00441       *reinterpret_cast<ACE_CDR::ULong*> (buf) = *x;
00442       return true;
00443 #else
00444       if (!this->do_byte_swap_)
00445         {
00446           *reinterpret_cast<ACE_CDR::ULong *> (buf) = *x;
00447           return true;
00448         }
00449       else
00450         {
00451           ACE_CDR::swap_4 (reinterpret_cast<const char*> (x), buf);
00452           return true;
00453         }
00454 #endif /* ACE_ENABLE_SWAP_ON_WRITE */
00455     }
00456 
00457   return false;
00458 }

ACE_CDR::Boolean ACE_OutputCDR::write_8 const ACE_CDR::ULongLong x  )  [private]
 

Definition at line 461 of file CDR_Stream.cpp.

References adjust(), do_byte_swap_, ACE_CDR::swap_8(), and ACE_CDR::ULongLong.

Referenced by write_double(), write_longlong(), and write_ulonglong().

00462 {
00463   char *buf = 0;
00464 
00465   if (this->adjust (ACE_CDR::LONGLONG_SIZE, buf) == 0)
00466     {
00467 #if defined (__arm__)
00468       // Convert to Intel format (12345678 => 56781234)
00469       const char *orig = reinterpret_cast<const char *> (x);
00470       char *target = buf;
00471       register ACE_UINT32 x =
00472         *reinterpret_cast<const ACE_UINT32 *> (orig);
00473       register ACE_UINT32 y =
00474         *reinterpret_cast<const ACE_UINT32 *> (orig + 4);
00475       *reinterpret_cast<ACE_UINT32 *> (target) = y;
00476       *reinterpret_cast<ACE_UINT32 *> (target + 4) = x;
00477       return true;
00478 #else
00479 #  if !defined (ACE_ENABLE_SWAP_ON_WRITE)
00480       *reinterpret_cast<ACE_CDR::ULongLong *> (buf) = *x;
00481       return true;
00482 #  else
00483       if (!this->do_byte_swap_)
00484         {
00485           *reinterpret_cast<ACE_CDR::ULongLong *> (buf) = *x;
00486           return true;
00487         }
00488       else
00489         {
00490           ACE_CDR::swap_8 (reinterpret_cast<const char*> (x), buf);
00491           return true;
00492         }
00493 #  endif /* ACE_ENABLE_SWAP_ON_WRITE */
00494 #endif /* !__arm__ */
00495      }
00496 
00497   return false;
00498 }

ACE_CDR::Boolean ACE_OutputCDR::write_array const void *  x,
size_t  size,
size_t  align,
ACE_CDR::ULong  length
[private]
 

write an array of elements, each of bytes and the start aligned at a multiple of . The elements are assumed to be packed with the right alignment restrictions. It is mostly designed for buffers of the basic types.

This operation uses ; as explained above it is expected that using assignment is faster that for one element, but for several elements should be more efficient, it could be interesting to find the break even point and optimize for that case, but that would be too platform dependent.

Definition at line 569 of file CDR_Stream.cpp.

References adjust(), do_byte_swap_, ACE_OS::memcpy(), ACE_CDR::swap_16_array(), ACE_CDR::swap_2_array(), ACE_CDR::swap_4_array(), ACE_CDR::swap_8_array(), and ACE_CDR::ULong.

Referenced by ACE_WChar_Codeset_Translator::write_array(), ACE_Char_Codeset_Translator::write_array(), write_char_array(), write_double_array(), write_float_array(), write_long_array(), write_longdouble_array(), write_longlong_array(), write_octet_array(), write_octet_array_mb(), write_short_array(), write_ulong_array(), write_ulonglong_array(), write_ushort_array(), and write_wchar_array().

00573 {
00574   if (length == 0)
00575     return true;
00576   char *buf = 0;
00577   if (this->adjust (size * length, align, buf) == 0)
00578     {
00579 #if !defined (ACE_ENABLE_SWAP_ON_WRITE)
00580       ACE_OS::memcpy (buf, x, size*length);
00581       return true;
00582 #else
00583       if (!this->do_byte_swap_ || size == 1)
00584         {
00585           ACE_OS::memcpy (buf, x, size*length);
00586           return true;
00587         }
00588       else
00589         {
00590           const char *source = reinterpret_cast<const char *> (x);
00591           switch (size)
00592             {
00593             case 2:
00594               ACE_CDR::swap_2_array (source, buf, length);
00595               return true;
00596             case 4:
00597               ACE_CDR::swap_4_array (source, buf, length);
00598               return true;
00599             case 8:
00600               ACE_CDR::swap_8_array (source, buf, length);
00601               return true;
00602             case 16:
00603               ACE_CDR::swap_16_array (source, buf, length);
00604               return true;
00605             default:
00606               // TODO: print something?
00607               this->good_bit_ = false;
00608               return false;
00609             }
00610         }
00611 #endif /* ACE_ENABLE_SWAP_ON_WRITE */
00612     }
00613   this->good_bit_ = false;
00614   return false;
00615 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::write_boolean ACE_CDR::Boolean  x  ) 
 

Definition at line 185 of file CDR_Stream.inl.

References ACE_CDR::Boolean, ACE_CDR::Octet, and write_octet().

Referenced by append_boolean(), operator<<(), and write_boolean_array().

00186 {
00187   return (ACE_CDR::Boolean) this->write_octet (x ? (ACE_CDR::Octet) 1 : (ACE_CDR::Octet) 0);
00188 }

ACE_CDR::Boolean ACE_OutputCDR::write_boolean_array const ACE_CDR::Boolean x,
ACE_CDR::ULong  length
 

Note:
the portion written starts at and ends at <x + length>. The length is *NOT* stored into the CDR stream.

Definition at line 642 of file CDR_Stream.cpp.

References ACE_CDR::Boolean, good_bit(), ACE_CDR::ULong, and write_boolean().

00644 {
00645   // It is hard to optimize this, the spec requires that on the wire
00646   // booleans be represented as a byte with value 0 or 1, but in
00647   // memoery it is possible (though very unlikely) that a boolean has
00648   // a non-zero value (different from 1).
00649   // We resort to a simple loop.
00650   const ACE_CDR::Boolean* end = x + length;
00651 
00652   for (const ACE_CDR::Boolean* i = x;
00653        i != end && this->good_bit ();
00654        ++i)
00655     this->write_boolean (*i);
00656 
00657   return this->good_bit ();
00658 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::write_char ACE_CDR::Char  x  ) 
 

Definition at line 191 of file CDR_Stream.inl.

References ACE_CDR::Char, char_translator_, write_1(), and ACE_Char_Codeset_Translator::write_char().

Referenced by append_char(), operator<<(), and write_string().

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 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::write_char_array const ACE_CDR::Char x,
ACE_CDR::ULong  length
 

Note:
the portion written starts at and ends at <x + length>. The length is *NOT* stored into the CDR stream.

Definition at line 289 of file CDR_Stream.inl.

References ACE_CDR::Char, char_translator_, ACE_CDR::ULong, write_array(), and ACE_Char_Codeset_Translator::write_char_array().

Referenced by operator<<(), and write_string().

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 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::write_double const ACE_CDR::Double x  ) 
 

Definition at line 251 of file CDR_Stream.inl.

References write_8().

Referenced by append_double(), and operator<<().

00252 {
00253   const void *temp = &x;
00254   return this->write_8 (reinterpret_cast<const ACE_CDR::ULongLong*> (temp));
00255 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::write_double_array const ACE_CDR::Double x,
ACE_CDR::ULong  length
 

Note:
the portion written starts at and ends at <x + length>. The length is *NOT* stored into the CDR stream.

Definition at line 403 of file CDR_Stream.inl.

References ACE_CDR::ULong, and write_array().

00405 {
00406   return this->write_array (x,
00407                             ACE_CDR::LONGLONG_SIZE,
00408                             ACE_CDR::LONGLONG_ALIGN,
00409                             length);
00410 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::write_float ACE_CDR::Float  x  ) 
 

Definition at line 244 of file CDR_Stream.inl.

References write_4().

Referenced by append_float(), and operator<<().

00245 {
00246   const void *temp = &x;
00247   return this->write_4 (reinterpret_cast<const ACE_CDR::ULong*> (temp));
00248 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::write_float_array const ACE_CDR::Float x,
ACE_CDR::ULong  length
 

Note:
the portion written starts at and ends at <x + length>. The length is *NOT* stored into the CDR stream.

Definition at line 392 of file CDR_Stream.inl.

References ACE_CDR::ULong, and write_array().

00394 {
00395   return this->write_array (x,
00396                             ACE_CDR::LONG_SIZE,
00397                             ACE_CDR::LONG_ALIGN,
00398                             length);
00399 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::write_long ACE_CDR::Long  x  ) 
 

Definition at line 216 of file CDR_Stream.inl.

References ACE_CDR::Long, and write_4().

Referenced by append_long(), and operator<<().

00217 {
00218   const void *temp = &x;
00219   return this->write_4 (reinterpret_cast<const ACE_CDR::ULong*> (temp));
00220 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::write_long_array const ACE_CDR::Long x,
ACE_CDR::ULong  length
 

Note:
the portion written starts at and ends at <x + length>. The length is *NOT* stored into the CDR stream.

Definition at line 352 of file CDR_Stream.inl.

References ACE_CDR::Long, ACE_CDR::ULong, and write_array().

00354 {
00355   return this->write_array (x,
00356                             ACE_CDR::LONG_SIZE,
00357                             ACE_CDR::LONG_ALIGN,
00358                             length);
00359 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::write_longdouble const ACE_CDR::LongDouble x  ) 
 

Definition at line 258 of file CDR_Stream.inl.

References write_16().

Referenced by append_longdouble(), and operator<<().

00259 {
00260   const void *temp = &x;
00261   return this->write_16 (reinterpret_cast<const ACE_CDR::LongDouble*> (temp));
00262 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::write_longdouble_array const ACE_CDR::LongDouble x,
ACE_CDR::ULong  length
 

Note:
the portion written starts at and ends at <x + length>. The length is *NOT* stored into the CDR stream.

Definition at line 413 of file CDR_Stream.inl.

References ACE_CDR::ULong, and write_array().

00415 {
00416   return this->write_array (x,
00417                             ACE_CDR::LONGDOUBLE_SIZE,
00418                             ACE_CDR::LONGDOUBLE_ALIGN,
00419                             length);
00420 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::write_longlong const ACE_CDR::LongLong x  ) 
 

Definition at line 230 of file CDR_Stream.inl.

References ACE_CDR::LongLong, and write_8().

Referenced by append_longlong(), and operator<<().

00231 {
00232   const void *temp = &x;
00233   return this->write_8 (reinterpret_cast<const ACE_CDR::ULongLong*> (temp));
00234 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::write_longlong_array const ACE_CDR::LongLong x,
ACE_CDR::ULong  length
 

Note:
the portion written starts at and ends at <x + length>. The length is *NOT* stored into the CDR stream.

Definition at line 372 of file CDR_Stream.inl.

References ACE_CDR::LongLong, ACE_CDR::ULong, and write_array().

00374 {
00375   return this->write_array (x,
00376                             ACE_CDR::LONGLONG_SIZE,
00377                             ACE_CDR::LONGLONG_ALIGN,
00378                             length);
00379 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::write_octet ACE_CDR::Octet  x  ) 
 

Definition at line 178 of file CDR_Stream.inl.

References ACE_CDR::Octet, and write_1().

Referenced by append_octet(), operator<<(), and write_boolean().

00179 {
00180   const void *temp = &x;
00181   return this->write_1 (reinterpret_cast<const ACE_CDR::Octet *> (temp));
00182 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::write_octet_array const ACE_CDR::Octet x,
ACE_CDR::ULong  length
 

Note:
the portion written starts at and ends at <x + length>. The length is *NOT* stored into the CDR stream.

Definition at line 322 of file CDR_Stream.inl.

References ACE_CDR::Octet, ACE_CDR::ULong, and write_array().

Referenced by write_wchar().

00324 {
00325   return this->write_array (x,
00326                             ACE_CDR::OCTET_SIZE,
00327                             ACE_CDR::OCTET_ALIGN,
00328                             length);
00329 }

ACE_CDR::Boolean ACE_OutputCDR::write_octet_array_mb const ACE_Message_Block mb  ) 
 

Write an octet array contained inside a MB, this can be optimized to minimize copies.

Definition at line 331 of file CDR_Stream.cpp.

References ACE_BIT_ENABLED, ACE_NEW_RETURN, ACE_Message_Block::cont(), current_alignment_, current_is_writable_, ACE_Message_Block::data_block(), ACE_Data_Block::duplicate(), ACE_Message_Block::end(), ACE_Message_Block::flags(), ACE_Message_Block::length(), length(), memcpy_tradeoff_, ACE_Message_Block::rd_ptr(), ACE_Message_Block::release(), ACE_Message_Block::wr_ptr(), and write_array().

00332 {
00333   // If the buffer is small and it fits in the current message
00334   // block it is be cheaper just to copy the buffer.
00335   for (const ACE_Message_Block* i = mb;
00336        i != 0;
00337        i = i->cont ())
00338     {
00339       const size_t length = i->length ();
00340 
00341       // If the mb does not own its data we are forced to make a copy.
00342       if (ACE_BIT_ENABLED (i->flags (),
00343                            ACE_Message_Block::DONT_DELETE))
00344         {
00345           if (! this->write_array (i->rd_ptr (),
00346                                    ACE_CDR::OCTET_SIZE,
00347                                    ACE_CDR::OCTET_ALIGN,
00348                                    static_cast<ACE_CDR::ULong> (length)))
00349             return (this->good_bit_ = false);
00350           continue;
00351         }
00352 
00353       if (length < this->memcpy_tradeoff_
00354           && this->current_->wr_ptr () + length < this->current_->end ())
00355         {
00356           if (! this->write_array (i->rd_ptr (),
00357                                    ACE_CDR::OCTET_SIZE,
00358                                    ACE_CDR::OCTET_ALIGN,
00359                                    static_cast<ACE_CDR::ULong> (length)))
00360             return (this->good_bit_ = false);
00361           continue;
00362         }
00363 
00364       ACE_Message_Block* cont = 0;
00365       this->good_bit_ = false;
00366       ACE_NEW_RETURN (cont,
00367                       ACE_Message_Block (i->data_block ()->duplicate ()),
00368                       0);
00369       this->good_bit_ = true;
00370 
00371       if (cont != 0)
00372         {
00373           if (this->current_->cont () != 0)
00374             ACE_Message_Block::release (this->current_->cont ());
00375           cont->rd_ptr (i->rd_ptr ());
00376           cont->wr_ptr (i->wr_ptr ());
00377 
00378           this->current_->cont (cont);
00379           this->current_ = cont;
00380           this->current_is_writable_ = false;
00381 #if !defined (ACE_LACKS_CDR_ALIGNMENT)
00382           this->current_alignment_ =
00383             (this->current_alignment_ + cont->length ()) % ACE_CDR::MAX_ALIGNMENT;
00384 #endif /* ACE_LACKS_CDR_ALIGNMENT */
00385         }
00386       else
00387         {
00388           this->good_bit_ = false;
00389           return false;
00390         }
00391     }
00392   return true;
00393 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::write_short ACE_CDR::Short  x  ) 
 

Definition at line 202 of file CDR_Stream.inl.

References ACE_CDR::Short, and write_2().

Referenced by append_short(), and operator<<().

00203 {
00204   const void *temp = &x;
00205   return this->write_2 (reinterpret_cast<const ACE_CDR::UShort*> (temp));
00206 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::write_short_array const ACE_CDR::Short x,
ACE_CDR::ULong  length
 

Note:
the portion written starts at and ends at <x + length>. The length is *NOT* stored into the CDR stream.

Definition at line 332 of file CDR_Stream.inl.

References ACE_CDR::Short, ACE_CDR::ULong, and write_array().

00334 {
00335   return this->write_array (x,
00336                             ACE_CDR::SHORT_SIZE,
00337                             ACE_CDR::SHORT_ALIGN,
00338                             length);
00339 }

ACE_CDR::Boolean ACE_OutputCDR::write_string const ACE_CString x  ) 
 

Definition at line 279 of file CDR_Stream.cpp.

References ACE_CString, ACE_String_Base< CHAR >::c_str(), ACE_String_Base< CHAR >::length(), and write_string().

00280 {
00281   // @@ Leave this method in here, not the `.i' file so that we don't
00282   //    have to unnecessarily pull in the `ace/SString.h' header.
00283   return this->write_string (static_cast<ACE_CDR::ULong> (x.length ()),
00284                              x.c_str());
00285 }

ACE_CDR::Boolean ACE_OutputCDR::write_string ACE_CDR::ULong  len,
const ACE_CDR::Char x
 

Definition at line 251 of file CDR_Stream.cpp.

References ACE_CDR::Char, char_translator_, ACE_CDR::ULong, write_char(), write_char_array(), ACE_Char_Codeset_Translator::write_string(), and write_ulong().

00253 {
00254   // @@ This is a slight violation of "Optimize for the common case",
00255   // i.e. normally the translator will be 0, but OTOH the code is
00256   // smaller and should be better for the cache ;-) ;-)
00257   if (this->char_translator_ != 0)
00258     return this->char_translator_->write_string (*this, len, x);
00259 
00260   if (len != 0)
00261     {
00262       if (this->write_ulong (len + 1))
00263         return this->write_char_array (x, len + 1);
00264     }
00265   else
00266     {
00267       // Be nice to programmers: treat nulls as empty strings not
00268       // errors. (OMG-IDL supports languages that don't use the C/C++
00269       // notion of null v. empty strings; nulls aren't part of the OMG-IDL
00270       // string model.)
00271       if (this->write_ulong (1))
00272         return this->write_char (0);
00273     }
00274 
00275   return (this->good_bit_ = false);
00276 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::write_string const ACE_CDR::Char x  ) 
 

For string we offer methods that accept a precomputed length.

Definition at line 265 of file CDR_Stream.inl.

References ACE_CDR::Char, ACE_OS::strlen(), and ACE_CDR::ULong.

Referenced by append_string(), operator<<(), and write_string().

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 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::write_ulong ACE_CDR::ULong  x  ) 
 

Definition at line 223 of file CDR_Stream.inl.

References ACE_CDR::ULong, and write_4().

Referenced by append_ulong(), operator<<(), write_string(), and write_wstring().

00224 {
00225   const void *temp = &x;
00226   return this->write_4 (reinterpret_cast<const ACE_CDR::ULong*> (temp));
00227 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::write_ulong_array const ACE_CDR::ULong x,
ACE_CDR::ULong  length
 

Note:
the portion written starts at and ends at <x + length>. The length is *NOT* stored into the CDR stream.

Definition at line 362 of file CDR_Stream.inl.

References ACE_CDR::ULong, and write_array().

00364 {
00365   return this->write_array (x,
00366                             ACE_CDR::LONG_SIZE,
00367                             ACE_CDR::LONG_ALIGN,
00368                             length);
00369 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::write_ulonglong const ACE_CDR::ULongLong x  ) 
 

Definition at line 237 of file CDR_Stream.inl.

References ACE_CDR::ULongLong, and write_8().

Referenced by append_ulonglong(), and operator<<().

00238 {
00239   const void *temp = &x;
00240   return this->write_8 (reinterpret_cast<const ACE_CDR::ULongLong*> (temp));
00241 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::write_ulonglong_array const ACE_CDR::ULongLong x,
ACE_CDR::ULong  length
 

Note:
the portion written starts at and ends at <x + length>. The length is *NOT* stored into the CDR stream.

Definition at line 382 of file CDR_Stream.inl.

References ACE_CDR::ULong, ACE_CDR::ULongLong, and write_array().

00384 {
00385   return this->write_array (x,
00386                             ACE_CDR::LONGLONG_SIZE,
00387                             ACE_CDR::LONGLONG_ALIGN,
00388                             length);
00389 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::write_ushort ACE_CDR::UShort  x  ) 
 

Definition at line 209 of file CDR_Stream.inl.

References ACE_CDR::UShort, and write_2().

Referenced by append_ushort(), and operator<<().

00210 {
00211   const void *temp = &x;
00212   return this->write_2 (reinterpret_cast<const ACE_CDR::UShort*> (temp));
00213 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::write_ushort_array const ACE_CDR::UShort x,
ACE_CDR::ULong  length
 

Note:
the portion written starts at and ends at <x + length>. The length is *NOT* stored into the CDR stream.

Definition at line 342 of file CDR_Stream.inl.

References ACE_CDR::ULong, ACE_CDR::UShort, and write_array().

00344 {
00345   return this->write_array (x,
00346                             ACE_CDR::SHORT_SIZE,
00347                             ACE_CDR::SHORT_ALIGN,
00348                             length);
00349 }

ACE_CDR::Boolean ACE_OutputCDR::write_wchar ACE_CDR::WChar  x  ) 
 

Definition at line 194 of file CDR_Stream.cpp.

References ACE_CDR::Octet, ACE_CDR::Short, ACE_CDR::WChar, wchar_maxbytes_, wchar_translator_, write_1(), write_2(), write_4(), write_octet_array(), and ACE_WChar_Codeset_Translator::write_wchar().

Referenced by append_wchar(), operator<<(), and write_wstring().

00195 {
00196   if (this->wchar_translator_ != 0)
00197     return (this->good_bit_ = this->wchar_translator_->write_wchar (*this, x));
00198   if (ACE_OutputCDR::wchar_maxbytes_ == 0)
00199     {
00200       errno = EACCES;
00201       return (this->good_bit_ = false);
00202     }
00203   if (static_cast<ACE_CDR::Short> (major_version_) == 1
00204       && static_cast<ACE_CDR::Short> (minor_version_) == 2)
00205     {
00206       ACE_CDR::Octet len =
00207         static_cast<ACE_CDR::Octet> (ACE_OutputCDR::wchar_maxbytes_);
00208       if (this->write_1 (&len))
00209         {
00210           if (ACE_OutputCDR::wchar_maxbytes_ == sizeof(ACE_CDR::WChar))
00211             return
00212               this->write_octet_array (
00213                                        reinterpret_cast<const ACE_CDR::Octet*> (&x),
00214                                        static_cast<ACE_CDR::ULong> (len));
00215           else
00216             if (ACE_OutputCDR::wchar_maxbytes_ == 2)
00217               {
00218                 ACE_CDR::Short sx = static_cast<ACE_CDR::Short> (x);
00219                 return
00220                   this->write_octet_array (
00221                                            reinterpret_cast<const ACE_CDR::Octet*> (&sx),
00222                                            static_cast<ACE_CDR::ULong> (len));
00223               }
00224             else
00225               {
00226                 ACE_CDR::Octet ox = static_cast<ACE_CDR::Octet> (x);
00227                 return
00228                   this->write_octet_array (
00229                                            reinterpret_cast<const ACE_CDR::Octet*> (&ox),
00230                                            static_cast<ACE_CDR::ULong> (len));
00231               }
00232         }
00233     }
00234   else if (static_cast<ACE_CDR::Short> (minor_version_) == 0)
00235     { // wchar is not allowed with GIOP 1.0.
00236       errno = EINVAL;
00237       return (this->good_bit_ = false);
00238     }
00239   if (ACE_OutputCDR::wchar_maxbytes_ == sizeof (ACE_CDR::WChar))
00240     return this->write_4 (reinterpret_cast<const ACE_CDR::ULong *> (&x));
00241   else if (ACE_OutputCDR::wchar_maxbytes_ == 2)
00242     {
00243       ACE_CDR::Short sx = static_cast<ACE_CDR::Short> (x);
00244       return this->write_2 (reinterpret_cast<const ACE_CDR::UShort *> (&sx));
00245     }
00246   ACE_CDR::Octet ox = static_cast<ACE_CDR::Octet> (x);
00247   return this->write_1 (reinterpret_cast<const ACE_CDR::Octet *> (&ox));
00248 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::write_wchar_array const ACE_CDR::WChar x,
ACE_CDR::ULong  length
 

Note:
the portion written starts at and ends at <x + length>. The length is *NOT* stored into the CDR stream.

Definition at line 301 of file CDR_Stream.inl.

References ACE_CDR::Boolean, ACE_CDR::ULong, ACE_CDR::WChar, wchar_maxbytes_, wchar_translator_, write_array(), ACE_WChar_Codeset_Translator::write_wchar_array(), and write_wchar_array_i().

Referenced by operator<<(), and write_wstring().

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 }

ACE_CDR::Boolean ACE_OutputCDR::write_wchar_array_i const ACE_CDR::WChar x,
ACE_CDR::ULong  length
[private]
 

Definition at line 529 of file CDR_Stream.cpp.

References adjust(), do_byte_swap_, ACE_CDR::swap_2(), ACE_CDR::ULong, ACE_CDR::UShort, ACE_CDR::WChar, and wchar_maxbytes_.

Referenced by write_wchar_array().

00531 {
00532   if (length == 0)
00533     return true;
00534   char* buf = 0;
00535   const size_t align = (ACE_OutputCDR::wchar_maxbytes_ == 2) ?
00536     ACE_CDR::SHORT_ALIGN :
00537     ACE_CDR::OCTET_ALIGN;
00538 
00539   if (this->adjust (ACE_OutputCDR::wchar_maxbytes_ * length, align, buf) == 0)
00540     {
00541       if (ACE_OutputCDR::wchar_maxbytes_ == 2)
00542         {
00543           ACE_CDR::UShort *sb = reinterpret_cast<ACE_CDR::UShort *> (buf);
00544           for (size_t i = 0; i < length; ++i)
00545 #if !defined (ACE_ENABLE_SWAP_ON_WRITE)
00546             sb[i] = static_cast<ACE_CDR::UShort> (x[i]);
00547 #else
00548               if (!this->do_byte_swap_)
00549               sb[i] = static_cast<ACE_CDR::UShort> (x[i]);
00550             else
00551               {
00552                 ACE_CDR::UShort sx = static_cast<ACE_CDR::UShort> (x[i]);
00553                 ACE_CDR::swap_2 (reinterpret_cast<char *> (&sx), &buf[i * 2]);
00554               }
00555 #endif /* ACE_DISABLE_SWAP_ON_READ */
00556         }
00557       else
00558         {
00559           for (size_t i = 0; i < length; ++i)
00560             buf[i] = static_cast<ACE_CDR::Octet> (x[i]);
00561         }
00562       return this->good_bit_;
00563     }
00564   return false;
00565 }

ACE_CDR::Boolean ACE_OutputCDR::write_wstring ACE_CDR::ULong  length,
const ACE_CDR::WChar x
 

Definition at line 288 of file CDR_Stream.cpp.

References ACE_CDR::ULong, ACE_CDR::WChar, wchar_maxbytes_, wchar_translator_, write_ulong(), write_wchar(), write_wchar_array(), and ACE_WChar_Codeset_Translator::write_wstring().

00290 {
00291   // @@ This is a slight violation of "Optimize for the common case",
00292   // i.e. normally the translator will be 0, but OTOH the code is
00293   // smaller and should be better for the cache ;-) ;-)
00294   // What do we do for GIOP 1.2???
00295   if (this->wchar_translator_ != 0)
00296     return this->wchar_translator_->write_wstring (*this, len, x);
00297   if (ACE_OutputCDR::wchar_maxbytes_ == 0)
00298     {
00299       errno = EACCES;
00300       return (this->good_bit_ = false);
00301     }
00302 
00303   if (static_cast<ACE_CDR::Short> (this->major_version_) == 1
00304       && static_cast<ACE_CDR::Short> (this->minor_version_) == 2)
00305     {
00306       if (x != 0)
00307         {
00308           //In GIOP 1.2 the length field contains the number of bytes
00309           //the wstring occupies rather than number of wchars
00310           //Taking sizeof might not be a good way! This is a temporary fix.
00311           if (this->write_ulong (ACE_OutputCDR::wchar_maxbytes_ * len))
00312             return this->write_wchar_array (x, len);
00313         }
00314       else
00315         //In GIOP 1.2 zero length wstrings are legal
00316         return this->write_ulong (0);
00317     }
00318 
00319   else
00320     if (x != 0)
00321       {
00322         if (this->write_ulong (len + 1))
00323           return this->write_wchar_array (x, len + 1);
00324       }
00325     else if (this->write_ulong (1))
00326       return this->write_wchar (0);
00327   return (this->good_bit_ = false);
00328 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::write_wstring const ACE_CDR::WChar x  ) 
 

Definition at line 277 of file CDR_Stream.inl.

References ACE_OS::strlen(), ACE_CDR::ULong, and ACE_CDR::WChar.

Referenced by append_wstring(), and operator<<().

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 }


Friends And Related Function Documentation

friend class ACE_Char_Codeset_Translator [friend]
 

The Codeset translators need access to some private members to efficiently marshal arrays For reading from an output CDR stream.

Definition at line 93 of file CDR_Stream.h.

friend class ACE_InputCDR [friend]
 

Definition at line 95 of file CDR_Stream.h.

friend class ACE_WChar_Codeset_Translator [friend]
 

Definition at line 94 of file CDR_Stream.h.


Member Data Documentation

ACE_Char_Codeset_Translator* ACE_OutputCDR::char_translator_ [protected]
 

If not nil, invoke for translation of character and string data.

Definition at line 500 of file CDR_Stream.h.

Referenced by char_translator(), write_char(), write_char_array(), and write_string().

ACE_Message_Block* ACE_OutputCDR::current_ [private]
 

The current block in the chain were we are writing.

Definition at line 455 of file CDR_Stream.h.

size_t ACE_OutputCDR::current_alignment_ [private]
 

The current alignment as measured from the start of the buffer. Usually this coincides with the alignment of the buffer in memory, but, when we chain another buffer this "quasi invariant" is broken. The current_alignment is used to readjust the buffer following the stolen message block.

Definition at line 466 of file CDR_Stream.h.

Referenced by adjust(), current_alignment(), reset(), and write_octet_array_mb().

bool ACE_OutputCDR::current_is_writable_ [private]
 

Is the current block writable. When we steal a buffer from the user and just chain it into the message block we are not supposed to write on it, even if it is past the start and end of the buffer.

Definition at line 475 of file CDR_Stream.h.

Referenced by adjust(), grow_and_adjust(), reset(), and write_octet_array_mb().

bool ACE_OutputCDR::do_byte_swap_ [private]
 

If not zero swap bytes at writing so the created CDR stream byte order does *not* match the machine byte order. The motivation for such a beast is that in some setting a few (fast) machines can be serving hundreds of slow machines with the opposite byte order, so it makes sense (as a load balancing device) to put the responsibility in the writers. THIS IS NOT A STANDARD IN CORBA, USE AT YOUR OWN RISK

Definition at line 486 of file CDR_Stream.h.

Referenced by do_byte_swap(), reset_byte_order(), write_16(), write_2(), write_4(), write_8(), write_array(), and write_wchar_array_i().

bool ACE_OutputCDR::good_bit_ [private]
 

Set to 0 when an error ocurrs.

Definition at line 489 of file CDR_Stream.h.

Referenced by ACE_WChar_Codeset_Translator::good_bit(), and ACE_Char_Codeset_Translator::good_bit().

ACE_CDR::Octet ACE_OutputCDR::major_version_ [protected]
 

GIOP version information.

Definition at line 496 of file CDR_Stream.h.

Referenced by ACE_WChar_Codeset_Translator::major_version(), and ACE_Char_Codeset_Translator::major_version().

size_t ACE_OutputCDR::memcpy_tradeoff_ [private]
 

Break-even point for copying.

Definition at line 492 of file CDR_Stream.h.

Referenced by write_octet_array_mb().

ACE_CDR::Octet ACE_OutputCDR::minor_version_ [protected]
 

Definition at line 497 of file CDR_Stream.h.

Referenced by ACE_WChar_Codeset_Translator::minor_version(), and ACE_Char_Codeset_Translator::minor_version().

ACE_Message_Block ACE_OutputCDR::start_ [private]
 

The start of the chain of message blocks.

Definition at line 452 of file CDR_Stream.h.

Referenced by ACE_OutputCDR(), begin(), buffer(), find(), length(), reset(), and ~ACE_OutputCDR().

ACE_BEGIN_VERSIONED_NAMESPACE_DECL int ACE_OutputCDR::wchar_maxbytes_ = sizeof (ACE_CDR::WChar) [static, protected]
 

Some wide char codesets may be defined with a maximum number of bytes that is smaller than the size of a wchar_t. This means that the CDR cannot simply memcpy a block of wchars to and from the stream, but must instead realign the bytes appropriately. In cases when wchar i/o is not allowed, such as with GIOP 1.0, or not having a native wchar codeset defined, the maxbytes is set to zero, indicating no wchar data is allowed.

Definition at line 16 of file CDR_Stream.cpp.

Referenced by wchar_maxbytes(), write_wchar(), write_wchar_array(), write_wchar_array_i(), and write_wstring().

ACE_WChar_Codeset_Translator* ACE_OutputCDR::wchar_translator_ [protected]
 

Definition at line 501 of file CDR_Stream.h.

Referenced by wchar_translator(), write_wchar(), write_wchar_array(), and write_wstring().


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 11:26:17 2006 for ACE by doxygen 1.3.6