Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

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 Methods

 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 <size> bytes in the internal buffer, if <size> == 0 it allocates the default size. More...

 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)
 Build a CDR stream with an initial buffer, it will *not* remove <data>, since it did not allocated it. It's important to be careful with the alignment of <data>. More...

 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 <data>, since it did not allocate it. More...

 ~ACE_OutputCDR (void)
 destructor. More...

int good_bit (void) const
 Returns 0 if an error has ocurred, the only expected error is to run out of memory. More...

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

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

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

const ACE_Message_Blockcurrent (void) const
 Return the <current_> message block in chain. More...

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! More...

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

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

size_t current_alignment (void) const
int adjust (size_t size, char *&buf)
int adjust (size_t size, size_t align, char *&buf)
 As above, but now the size and alignment requirements may be different. More...

int 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. More...

void 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. More...

int set_version (ACE_CDR::Octet major, ACE_CDR::Octet minor)
 set GIOP version info. More...

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

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 write_string (const ACE_CDR::Char *x)
 For string we offer methods that accept a precomputed length. More...

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)
 Write an octet array contained inside a MB, this can be optimized to minimize copies. More...

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 Methods

void wchar_maxbytes (int)
 set the global size of serialized wchars. This may be different than the size of a wchar_t. More...

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


Protected Attributes

ACE_CDR::Octet major_version_
 GIOP version information. More...

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

ACE_WChar_Codeset_Translatorwchar_translator_

Static Protected Attributes

int wchar_maxbytes_ = sizeof (ACE_CDR::WChar)

Private Methods

 ACE_OutputCDR (const ACE_OutputCDR &rhs)
 disallow copying... More...

ACE_OutputCDR & operator= (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. More...

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

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

size_t memcpy_tradeoff_
 Break-even point for copying. More...


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 76 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 <size> bytes in the internal buffer, if <size> == 0 it allocates the default size.

Definition at line 17 of file CDR_Stream.cpp.

References ACE_CDR_BYTE_ORDER, current_, ACE_CDR::mb_align, ACE_CDR::Octet, and start_.

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

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
 

Build a CDR stream with an initial buffer, it will *not* remove <data>, since it did not allocated it. It's important to be careful with the alignment of <data>.

Create an output stream from an arbitrary buffer, care must be exercised with alignment, because this contructor will align if needed. In this case <data> 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 51 of file CDR_Stream.cpp.

References ACE_CDR_BYTE_ORDER, current_, ACE_CDR::mb_align, ACE_CDR::Octet, and start_.

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

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 <data>, since it did not allocate it.

Definition at line 85 of file CDR_Stream.cpp.

References ACE_CDR_BYTE_ORDER, current_, ACE_CDR::mb_align, ACE_CDR::Octet, and start_.

00090   :  start_ (data->data_block ()->duplicate ()),
00091      current_is_writable_ (1),
00092      current_alignment_ (0),
00093      do_byte_swap_ (byte_order != ACE_CDR_BYTE_ORDER),
00094      good_bit_ (1),
00095      memcpy_tradeoff_ (memcpy_tradeoff),
00096      major_version_ (major_version),
00097      minor_version_ (minor_version),
00098      char_translator_ (0),
00099      wchar_translator_ (0)
00100 {
00101   // We cannot trust the buffer to be properly aligned
00102   ACE_CDR::mb_align (&this->start_);
00103   this->current_ = &this->start_;
00104 }

ACE_INLINE ACE_OutputCDR::~ACE_OutputCDR void   
 

destructor.

Definition at line 136 of file CDR_Stream.i.

References ACE_Message_Block::cont, current_, ACE_Message_Block::release, and start_.

00137 {
00138   if (this->start_.cont () != 0)
00139     {
00140       ACE_Message_Block::release (this->start_.cont ());
00141       this->start_.cont (0);
00142     }
00143   this->current_ = 0;
00144 }

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 406 of file CDR_Stream.i.

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

00409 {
00410   if (!this->current_is_writable_)
00411     return this->grow_and_adjust (size, align, buf);
00412 
00413   size_t offset =
00414     ACE_align_binary (this->current_alignment_, align)
00415     - this->current_alignment_;
00416 
00417   buf = this->current_->wr_ptr () + offset;
00418   char *end = buf + size;
00419 
00420   if (end <= this->current_->end () &&
00421       end >= buf)
00422     {
00423       this->current_alignment_ += offset + size;
00424       this->current_->wr_ptr (end);
00425       return 0;
00426     }
00427 
00428   return this->grow_and_adjust (size, align, buf);
00429 }

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

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

Definition at line 432 of file CDR_Stream.i.

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.

00433 {
00434   return this->adjust (size, size, buf);
00435 }

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 <alignment>-byte boundary. Argument MUST be a power of 2. Returns 0 on success and -1 on failure.

Definition at line 510 of file CDR_Stream.i.

References adjust.

00511 {
00512   char *dummy;
00513   return this->adjust (0, alignment, dummy);
00514 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::append_boolean ACE_InputCDR  
 

Return 0 on failure and 1 on success.

Definition at line 1281 of file CDR_Stream.i.

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

01282 {
01283   ACE_CDR::Boolean x;
01284   return stream.read_boolean (x) ? this->write_boolean (x) : (ACE_CDR::Boolean) 0;
01285 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::append_char ACE_InputCDR  
 

Return 0 on failure and 1 on success.

Definition at line 1288 of file CDR_Stream.i.

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

01289 {
01290   ACE_CDR::Char x;
01291   return stream.read_char (x) ? this->write_char (x) : (ACE_CDR::Boolean) 0;
01292 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::append_double ACE_InputCDR  
 

Return 0 on failure and 1 on success.

Definition at line 1358 of file CDR_Stream.i.

References ACE_InputCDR::read_double, and write_double.

01359 {
01360   ACE_CDR::Double x;
01361   return stream.read_double (x) ? this->write_double (x) : (ACE_CDR::Boolean) 0;
01362 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::append_float ACE_InputCDR  
 

Return 0 on failure and 1 on success.

Definition at line 1351 of file CDR_Stream.i.

References ACE_InputCDR::read_float, and write_float.

01352 {
01353   ACE_CDR::Float x;
01354   return stream.read_float (x) ? this->write_float (x) : (ACE_CDR::Boolean) 0;
01355 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::append_long ACE_InputCDR  
 

Return 0 on failure and 1 on success.

Definition at line 1323 of file CDR_Stream.i.

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

01324 {
01325   ACE_CDR::Long x;
01326   return stream.read_long (x) ? this->write_long (x) : (ACE_CDR::Boolean) 0;
01327 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::append_longdouble ACE_InputCDR  
 

Return 0 on failure and 1 on success.

Definition at line 1365 of file CDR_Stream.i.

References ACE_InputCDR::read_longdouble, and write_longdouble.

01366 {
01367   ACE_CDR::LongDouble x;
01368   return stream.read_longdouble (x) ? this->write_longdouble (x) : (ACE_CDR::Boolean) 0;
01369 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::append_longlong ACE_InputCDR  
 

Return 0 on failure and 1 on success.

Definition at line 1337 of file CDR_Stream.i.

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

01338 {
01339   ACE_CDR::LongLong x;
01340   return stream.read_longlong (x) ? this->write_longlong (x) : (ACE_CDR::Boolean) 0;
01341 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::append_octet ACE_InputCDR  
 

Return 0 on failure and 1 on success.

Definition at line 1302 of file CDR_Stream.i.

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

01303 {
01304   ACE_CDR::Octet x;
01305   return stream.read_octet (x) ? this->write_octet (x) : (ACE_CDR::Boolean) 0;
01306 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::append_short ACE_InputCDR  
 

Return 0 on failure and 1 on success.

Definition at line 1309 of file CDR_Stream.i.

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

01310 {
01311   ACE_CDR::Short x;
01312   return stream.read_short (x) ? this->write_short (x) : (ACE_CDR::Boolean) 0;
01313 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::append_string ACE_InputCDR  
 

Return 0 on failure and 1 on success.

Definition at line 1372 of file CDR_Stream.i.

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

01373 {
01374   ACE_CDR::Char *x;
01375   ACE_CDR::Boolean flag =
01376     (stream.read_string (x) ? this->write_string (x) : (ACE_CDR::Boolean) 0);
01377   delete [] x;
01378   return flag;
01379 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::append_ulong ACE_InputCDR  
 

Return 0 on failure and 1 on success.

Definition at line 1330 of file CDR_Stream.i.

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

01331 {
01332   ACE_CDR::ULong x;
01333   return stream.read_ulong (x) ? this->write_ulong (x) : (ACE_CDR::Boolean) 0;
01334 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::append_ulonglong ACE_InputCDR  
 

Return 0 on failure and 1 on success.

Definition at line 1344 of file CDR_Stream.i.

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

01345 {
01346   ACE_CDR::ULongLong x;
01347   return stream.read_ulonglong (x) ? this->write_ulonglong (x) : (ACE_CDR::Boolean) 0;
01348 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::append_ushort ACE_InputCDR  
 

Return 0 on failure and 1 on success.

Definition at line 1316 of file CDR_Stream.i.

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

01317 {
01318   ACE_CDR::UShort x;
01319   return stream.read_ushort (x) ? this->write_ushort (x) : (ACE_CDR::Boolean) 0;
01320 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::append_wchar ACE_InputCDR  
 

Return 0 on failure and 1 on success.

Definition at line 1295 of file CDR_Stream.i.

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

01296 {
01297   ACE_CDR::WChar x;
01298   return stream.read_wchar (x) ? this->write_wchar (x) : (ACE_CDR::Boolean) 0;
01299 }

ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::append_wstring ACE_InputCDR  
 

Return 0 on failure and 1 on success.

Definition at line 1382 of file CDR_Stream.i.

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

01383 {
01384   ACE_CDR::WChar *x;
01385   ACE_CDR::Boolean flag =
01386     (stream.read_wstring (x) ? this->write_wstring (x) : (ACE_CDR::Boolean) 0);
01387   delete [] x;
01388   return flag;
01389 }

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 456 of file CDR_Stream.i.

References start_.

Referenced by ACE_InputCDR::ACE_InputCDR.

00457 {
00458   return &this->start_;
00459 }

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 480 of file CDR_Stream.i.

References ACE_Message_Block::rd_ptr, and start_.

00481 {
00482   return this->start_.rd_ptr ();
00483 }

ACE_INLINE void ACE_OutputCDR::char_translator ACE_Char_Codeset_Translator  
 

Set the char codeset translator.

Definition at line 529 of file CDR_Stream.i.

References char_translator_.

00530 {
00531   this->char_translator_ = ctran;
00532 }

ACE_INLINE ACE_Char_Codeset_Translator * ACE_OutputCDR::char_translator void    const
 

Access the codeset translators. They can be null!

Definition at line 517 of file CDR_Stream.i.

References char_translator_.

00518 {
00519   return this->char_translator_;
00520 }

ACE_INLINE const ACE_Message_Block * ACE_OutputCDR::current void    const
 

Return the <current_> message block in chain.

Definition at line 468 of file CDR_Stream.i.

References current_.

00469 {
00470   return this->current_;
00471 }

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 504 of file CDR_Stream.i.

References current_alignment_.

00505 {
00506   return this->current_alignment_;
00507 }

ACE_INLINE int 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 492 of file CDR_Stream.i.

References do_byte_swap_.

00493 {
00494   return this->do_byte_swap_;
00495 }

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 462 of file CDR_Stream.i.

References ACE_Message_Block::cont, and current_.

Referenced by ACE_InputCDR::ACE_InputCDR, adjust, total_length, and write_boolean_array.

00463 {
00464   return this->current_->cont ();
00465 }

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

Set the underlying GIOP version..

Definition at line 446 of file CDR_Stream.i.

References major_version_, minor_version_, and ACE_CDR::Octet.

00448 {
00449   major = this->major_version_;
00450   minor = this->minor_version_;
00451   return 0;
00452 }

ACE_INLINE int ACE_OutputCDR::good_bit void    const
 

Returns 0 if an error has ocurred, the only expected error is to run out of memory.

Definition at line 400 of file CDR_Stream.i.

References good_bit_.

Referenced by operator<<, and write_boolean_array.

00401 {
00402   return this->good_bit_;
00403 }

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

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

Definition at line 119 of file CDR_Stream.cpp.

References ACE_NEW_RETURN, adjust, ACE_Message_Block::cont, current_, current_is_writable_, ACE_Message_Block::data_block, ACE_Data_Block::data_block_allocator, good_bit_, ACE_CDR::MAX_ALIGNMENT, ACE_Time_Value::max_time, ACE_Message_Block::MB_DATA, ACE_CDR::next_size, ACE_Message_Block::rd_ptr, ACE_Message_Block::size, ACE_Message_Block::wr_ptr, and ACE_Time_Value::zero.

Referenced by adjust.

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

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 486 of file CDR_Stream.i.

References ACE_Message_Block::length, and start_.

Referenced by write_array, write_boolean_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, write_wchar_array, and write_wchar_array_i.

00487 {
00488   return this->start_.length ();
00489 }

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

ACE_INLINE void ACE_OutputCDR::reset void   
 

Reuse the CDR stream to write on the old buffer.

Definition at line 147 of file CDR_Stream.i.

References ACE_Message_Block::cont, current_, current_alignment_, current_is_writable_, ACE_CDR::mb_align, ACE_Message_Block::release, and start_.

00148 {
00149   this->current_ = &this->start_;
00150   this->current_is_writable_ = 1;
00151   ACE_CDR::mb_align (&this->start_);
00152   this->current_alignment_ = 0;
00153 
00154   // It is tempting not to remove the memory, but we need to do so to
00155   // release any potential user buffers chained in the continuation
00156   // field.
00157 
00158   ACE_Message_Block *cont = this->start_.cont ();
00159   if (cont != 0)
00160     {
00161       ACE_Message_Block::release (cont);
00162       this->start_.cont (0);
00163     }
00164 
00165 }

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 498 of file CDR_Stream.i.

References ACE_CDR_BYTE_ORDER, and do_byte_swap_.

00499 {
00500   this->do_byte_swap_ = (byte_order != ACE_CDR_BYTE_ORDER);
00501 }

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

set GIOP version info.

Definition at line 438 of file CDR_Stream.i.

References major_version_, minor_version_, and ACE_CDR::Octet.

00439 {
00440   this->major_version_ = major;
00441   this->minor_version_ = minor;
00442   return 0;
00443 }

ACE_INLINE size_t ACE_OutputCDR::total_length void    const
 

Add the length of each message block in the chain.

Definition at line 474 of file CDR_Stream.i.

References end, and ACE_CDR::total_length.

00475 {
00476   return ACE_CDR::total_length (this->begin (), this->end ());
00477 }

int ACE_OutputCDR::wchar_maxbytes void    [static]
 

access the serialized size of wchars.

Definition at line 113 of file CDR_Stream.cpp.

References wchar_maxbytes_.

00114 {
00115   return ACE_OutputCDR::wchar_maxbytes_;
00116 }

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 107 of file CDR_Stream.cpp.

References wchar_maxbytes_.

00108 {
00109   ACE_OutputCDR::wchar_maxbytes_ = maxbytes;
00110 }

ACE_INLINE void ACE_OutputCDR::wchar_translator ACE_WChar_Codeset_Translator  
 

Set the wchar codeset translator.

Definition at line 535 of file CDR_Stream.i.

References wchar_translator_.

00536 {
00537   this->wchar_translator_ = wctran;
00538 }

ACE_INLINE ACE_WChar_Codeset_Translator * ACE_OutputCDR::wchar_translator void    const
 

Definition at line 523 of file CDR_Stream.i.

References wchar_translator_.

00524 {
00525   return this->wchar_translator_;
00526 }

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

Definition at line 382 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.

00383 {
00384   char *buf;
00385   if (this->adjust (1, buf) == 0)
00386     {
00387       *ACE_reinterpret_cast(ACE_CDR::Octet*, buf) = *x;
00388       return 1;
00389     }
00390 
00391   return 0;
00392 }

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

Definition at line 487 of file CDR_Stream.cpp.

References adjust, do_byte_swap_, ACE_CDR::LONGDOUBLE_ALIGN, ACE_CDR::LONGDOUBLE_SIZE, and ACE_CDR::swap_16.

Referenced by write_longdouble.

00488 {
00489   char* buf;
00490   if (this->adjust (ACE_CDR::LONGDOUBLE_SIZE,
00491                     ACE_CDR::LONGDOUBLE_ALIGN,
00492                     buf) == 0)
00493     {
00494 #if !defined (ACE_ENABLE_SWAP_ON_WRITE)
00495       *ACE_reinterpret_cast(ACE_CDR::LongDouble*,buf) = *x;
00496       return 1;
00497 #else
00498       if (!this->do_byte_swap_)
00499         {
00500           *ACE_reinterpret_cast (ACE_CDR::LongDouble *, buf) = *x;
00501           return 1;
00502         }
00503       else
00504         {
00505           ACE_CDR::swap_16 (ACE_reinterpret_cast (const char*, x), buf);
00506           return 1;
00507         }
00508 #endif /* ACE_ENABLE_SWAP_ON_WRITE */
00509     }
00510 
00511   return 0;
00512 }

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

Definition at line 395 of file CDR_Stream.cpp.

References adjust, do_byte_swap_, ACE_CDR::SHORT_SIZE, ACE_CDR::swap_2, and ACE_CDR::UShort.

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

00396 {
00397   char *buf;
00398   if (this->adjust (ACE_CDR::SHORT_SIZE, buf) == 0)
00399     {
00400 #if !defined (ACE_ENABLE_SWAP_ON_WRITE)
00401       *ACE_reinterpret_cast(ACE_CDR::UShort*,buf) = *x;
00402       return 1;
00403 #else
00404       if (!this->do_byte_swap_)
00405         {
00406           *ACE_reinterpret_cast (ACE_CDR::UShort *, buf) = *x;
00407           return 1;
00408         }
00409       else
00410         {
00411           ACE_CDR::swap_2 (ACE_reinterpret_cast (const char*, x), buf);
00412           return 1;
00413         }
00414 #endif /* ACE_ENABLE_SWAP_ON_WRITE */
00415     }
00416 
00417   return 0;
00418 }

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

Definition at line 421 of file CDR_Stream.cpp.

References adjust, do_byte_swap_, ACE_CDR::LONG_SIZE, 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.

00422 {
00423   char *buf;
00424   if (this->adjust (ACE_CDR::LONG_SIZE, buf) == 0)
00425     {
00426 #if !defined (ACE_ENABLE_SWAP_ON_WRITE)
00427       *ACE_reinterpret_cast(ACE_CDR::ULong*,buf) = *x;
00428       return 1;
00429 #else
00430       if (!this->do_byte_swap_)
00431         {
00432           *ACE_reinterpret_cast (ACE_CDR::ULong *, buf) = *x;
00433           return 1;
00434         }
00435       else
00436         {
00437           ACE_CDR::swap_4 (ACE_reinterpret_cast (const char*, x), buf);
00438           return 1;
00439         }
00440 #endif /* ACE_ENABLE_SWAP_ON_WRITE */
00441     }
00442 
00443   return 0;
00444 }

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

Definition at line 447 of file CDR_Stream.cpp.

References adjust, do_byte_swap_, ACE_CDR::LONGLONG_SIZE, ACE_CDR::swap_8, and ACE_CDR::ULongLong.

Referenced by write_double, write_longlong, and write_ulonglong.

00448 {
00449   char *buf;
00450 
00451   if (this->adjust (ACE_CDR::LONGLONG_SIZE, buf) == 0)
00452     {
00453 #if defined (__arm__)
00454       // Convert to Intel format (12345678 => 56781234)
00455       const char *orig = ACE_reinterpret_cast (const char *, x);
00456       char *target = buf;
00457       register ACE_UINT32 x =
00458         *ACE_reinterpret_cast (const ACE_UINT32 *, orig);
00459       register ACE_UINT32 y =
00460         *ACE_reinterpret_cast (const ACE_UINT32 *, orig + 4);
00461       *ACE_reinterpret_cast (ACE_UINT32 *, target) = y;
00462       *ACE_reinterpret_cast (ACE_UINT32 *, target + 4) = x;
00463       return 1;
00464 #else
00465 #  if !defined (ACE_ENABLE_SWAP_ON_WRITE)
00466       *ACE_reinterpret_cast (ACE_CDR::ULongLong *,buf) = *x;
00467       return 1;
00468 #  else
00469       if (!this->do_byte_swap_)
00470         {
00471           *ACE_reinterpret_cast (ACE_CDR::ULongLong *, buf) = *x;
00472           return 1;
00473         }
00474       else
00475         {
00476           ACE_CDR::swap_8 (ACE_reinterpret_cast (const char*, x), buf);
00477           return 1;
00478         }
00479 #  endif /* ACE_ENABLE_SWAP_ON_WRITE */
00480 #endif /* !__arm__ */
00481     }
00482 
00483   return 0;
00484 }

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 <length> elements, each of <size> bytes and the start aligned at a multiple of <align>. 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 <memcpy>; as explained above it is expected that using assignment is faster that <memcpy> for one element, but for several elements <memcpy> 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 555 of file CDR_Stream.cpp.

References adjust, do_byte_swap_, good_bit_, length, ACE_OS_String::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.

00559 {
00560   if (length == 0)
00561     return 1;
00562   char *buf;
00563   if (this->adjust (size * length, align, buf) == 0)
00564     {
00565 #if !defined (ACE_ENABLE_SWAP_ON_WRITE)
00566       ACE_OS::memcpy (buf, x, size*length);
00567       return 1;
00568 #else
00569       if (!this->do_byte_swap_ || size == 1)
00570         {
00571           ACE_OS::memcpy (buf, x, size*length);
00572           return 1;
00573         }
00574       else
00575         {
00576           const char *source = ACE_reinterpret_cast (const char *, x);
00577           switch (size)
00578             {
00579             case 2:
00580               ACE_CDR::swap_2_array (source, buf, length);
00581               return 1;
00582             case 4:
00583               ACE_CDR::swap_4_array (source, buf, length);
00584               return 1;
00585             case 8:
00586               ACE_CDR::swap_8_array (source, buf, length);
00587               return 1;
00588             case 16:
00589               ACE_CDR::swap_16_array (source, buf, length);
00590               return 1;
00591             default:
00592               // TODO: print something?
00593               this->good_bit_ = 0;
00594               return 0;
00595             }
00596         }
00597 #endif /* ACE_ENABLE_SWAP_ON_WRITE */
00598     }
00599   this->good_bit_ = 0;
00600   return 0;
00601 }

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

Definition at line 176 of file CDR_Stream.i.

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

Referenced by append_boolean, operator<<, and write_boolean_array.

00177 {
00178   return (ACE_CDR::Boolean) this->write_octet (x ? (ACE_CDR::Octet) 1 : (ACE_CDR::Octet) 0);
00179 }

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

Definition at line 604 of file CDR_Stream.cpp.

References ACE_CDR::Boolean, end, good_bit, length, ACE_CDR::ULong, and write_boolean.

00606 {
00607   // It is hard to optimize this, the spec requires that on the wire
00608   // booleans be represented as a byte with value 0 or 1, but in
00609   // memoery it is possible (though very unlikely) that a boolean has
00610   // a non-zero value (different from 1).
00611   // We resort to a simple loop.
00612   const ACE_CDR::Boolean* end = x + length;
00613 
00614   for (const ACE_CDR::Boolean* i = x;
00615        i != end && this->good_bit ();
00616        ++i)
00617     this->write_boolean (*i);
00618 
00619   return this->good_bit ();
00620 }

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

Definition at line 182 of file CDR_Stream.i.

References ACE_CDR::Char, char_translator_, ACE_CDR::Octet, write_1, and ACE_Char_Codeset_Translator::write_char.

Referenced by append_char, operator<<, and write_string.

00183 {
00184   if (this->char_translator_ == 0)
00185     return this->write_1 (ACE_reinterpret_cast (const ACE_CDR::Octet*, &x));
00186   return this->char_translator_->write_char (*this, x);
00187 }

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

Definition at line 266 of file CDR_Stream.i.

References ACE_CDR::Char, char_translator_, length, ACE_CDR::OCTET_ALIGN, ACE_CDR::OCTET_SIZE, ACE_CDR::ULong, write_array, and ACE_Char_Codeset_Translator::write_char_array.

Referenced by write_string.

00268 {
00269   if (this->char_translator_ == 0)
00270     return this->write_array (x,
00271                               ACE_CDR::OCTET_SIZE,
00272                               ACE_CDR::OCTET_ALIGN,
00273                               length);
00274   return this->char_translator_->write_char_array (*this, x, length);
00275 }

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

Definition at line 234 of file CDR_Stream.i.

References ACE_CDR::ULongLong, and write_8.

Referenced by append_double, and operator<<.

00235 {
00236   return this->write_8 (ACE_reinterpret_cast (const ACE_CDR::ULongLong*, &x));
00237 }

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

Definition at line 380 of file CDR_Stream.i.

References length, ACE_CDR::LONGLONG_ALIGN, ACE_CDR::LONGLONG_SIZE, ACE_CDR::ULong, and write_array.

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

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

Definition at line 227 of file CDR_Stream.i.

References ACE_CDR::ULong, and write_4.

Referenced by append_float, and operator<<.

00228 {
00229   return this->write_4 (ACE_reinterpret_cast (const ACE_CDR::ULong*, &x));
00230 }

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

Definition at line 369 of file CDR_Stream.i.

References length, ACE_CDR::LONG_ALIGN, ACE_CDR::LONG_SIZE, ACE_CDR::ULong, and write_array.

00371 {
00372   return this->write_array (x,
00373                             ACE_CDR::LONG_SIZE,
00374                             ACE_CDR::LONG_ALIGN,
00375                             length);
00376 }

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

Definition at line 202 of file CDR_Stream.i.

References ACE_CDR::Long, ACE_CDR::ULong, and write_4.

Referenced by append_long, and operator<<.

00203 {
00204   return this->write_4 (ACE_reinterpret_cast (const ACE_CDR::ULong*, &x));
00205 }

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

Definition at line 329 of file CDR_Stream.i.

References length, ACE_CDR::Long, ACE_CDR::LONG_ALIGN, ACE_CDR::LONG_SIZE, ACE_CDR::ULong, and write_array.

00331 {
00332   return this->write_array (x,
00333                             ACE_CDR::LONG_SIZE,
00334                             ACE_CDR::LONG_ALIGN,
00335                             length);
00336 }

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

Definition at line 240 of file CDR_Stream.i.

References write_16.

Referenced by append_longdouble, and operator<<.

00241 {
00242   return this->write_16 (ACE_reinterpret_cast (const ACE_CDR::LongDouble*,&x));
00243 }

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

Definition at line 390 of file CDR_Stream.i.

References length, ACE_CDR::LONGDOUBLE_ALIGN, ACE_CDR::LONGDOUBLE_SIZE, ACE_CDR::ULong, and write_array.

00392 {
00393   return this->write_array (x,
00394                             ACE_CDR::LONGDOUBLE_SIZE,
00395                             ACE_CDR::LONGDOUBLE_ALIGN,
00396                             length);
00397 }

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

Definition at line 214 of file CDR_Stream.i.

References ACE_CDR::LongLong, ACE_CDR::ULongLong, and write_8.

Referenced by append_longlong, and operator<<.

00215 {
00216   return this->write_8 (ACE_reinterpret_cast (const ACE_CDR::ULongLong*, &x));
00217 }

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

Definition at line 349 of file CDR_Stream.i.

References length, ACE_CDR::LongLong, ACE_CDR::LONGLONG_ALIGN, ACE_CDR::LONGLONG_SIZE, ACE_CDR::ULong, and write_array.

00351 {
00352   return this->write_array (x,
00353                             ACE_CDR::LONGLONG_SIZE,
00354                             ACE_CDR::LONGLONG_ALIGN,
00355                             length);
00356 }

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

Definition at line 170 of file CDR_Stream.i.

References ACE_CDR::Octet, and write_1.

Referenced by append_octet, operator<<, and write_boolean.

00171 {
00172   return this->write_1 (ACE_reinterpret_cast (const ACE_CDR::Octet *, &x));
00173 }

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

Definition at line 299 of file CDR_Stream.i.

References length, ACE_CDR::Octet, ACE_CDR::OCTET_ALIGN, ACE_CDR::OCTET_SIZE, ACE_CDR::ULong, and write_array.

Referenced by write_wchar.

00301 {
00302   return this->write_array (x,
00303                             ACE_CDR::OCTET_SIZE,
00304                             ACE_CDR::OCTET_ALIGN,
00305                             length);
00306 }

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 319 of file CDR_Stream.cpp.

References ACE_BIT_ENABLED, ACE_NEW_RETURN, ACE_Message_Block::cont, current_, current_alignment_, current_is_writable_, ACE_Message_Block::data_block, ACE_Message_Block::DONT_DELETE, ACE_Data_Block::duplicate, ACE_Message_Block::end, ACE_Message_Block::flags, good_bit_, ACE_Message_Block::length, length, ACE_CDR::MAX_ALIGNMENT, memcpy_tradeoff_, ACE_CDR::OCTET_ALIGN, ACE_CDR::OCTET_SIZE, ACE_Message_Block::rd_ptr, ACE_Message_Block::release, ACE_CDR::ULong, ACE_Message_Block::wr_ptr, and write_array.

00320 {
00321   // If the buffer is small and it fits in the current message
00322   // block it is be cheaper just to copy the buffer.
00323   for (const ACE_Message_Block* i = mb;
00324        i != 0;
00325        i = i->cont ())
00326     {
00327       size_t length = i->length ();
00328 
00329       // If the mb does not own its data we are forced to make a copy.
00330       if (ACE_BIT_ENABLED (i->flags (),
00331                            ACE_Message_Block::DONT_DELETE))
00332         {
00333           if (! this->write_array (i->rd_ptr (),
00334                                    ACE_CDR::OCTET_SIZE,
00335                                    ACE_CDR::OCTET_ALIGN,
00336                                    ACE_static_cast (ACE_CDR::ULong, length)))
00337             return (this->good_bit_ = 0);
00338           continue;
00339         }
00340 
00341       if (length < this->memcpy_tradeoff_
00342           && this->current_->wr_ptr () + length < this->current_->end ())
00343         {
00344           if (! this->write_array (i->rd_ptr (),
00345                                    ACE_CDR::OCTET_SIZE,
00346                                    ACE_CDR::OCTET_ALIGN,
00347                                    ACE_static_cast (ACE_CDR::ULong, length)))
00348             return (this->good_bit_ = 0);
00349           continue;
00350         }
00351 
00352       ACE_Message_Block* cont;
00353       this->good_bit_ = 0;
00354       ACE_NEW_RETURN (cont,
00355                       ACE_Message_Block (i->data_block ()->duplicate ()),
00356                       0);
00357       this->good_bit_ = 1;
00358 
00359       if (cont != 0)
00360         {
00361           if (this->current_->cont () != 0)
00362             ACE_Message_Block::release (this->current_->cont ());
00363           cont->rd_ptr (i->rd_ptr ());
00364           cont->wr_ptr (i->wr_ptr ());
00365 
00366           this->current_->cont (cont);
00367           this->current_ = cont;
00368           this->current_is_writable_ = 0;
00369           this->current_alignment_ =
00370             (this->current_alignment_ + cont->length ()) % ACE_CDR::MAX_ALIGNMENT;
00371         }
00372       else
00373         {
00374           this->good_bit_ = 0;
00375           return 0;
00376         }
00377     }
00378   return 1;
00379 }

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

Definition at line 190 of file CDR_Stream.i.

References ACE_CDR::Short, ACE_CDR::UShort, and write_2.

Referenced by append_short, and operator<<.

00191 {
00192   return this->write_2 (ACE_reinterpret_cast (const ACE_CDR::UShort*, &x));
00193 }

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

Definition at line 309 of file CDR_Stream.i.

References length, ACE_CDR::Short, ACE_CDR::SHORT_ALIGN, ACE_CDR::SHORT_SIZE, ACE_CDR::ULong, and write_array.

00311 {
00312   return this->write_array (x,
00313                             ACE_CDR::SHORT_SIZE,
00314                             ACE_CDR::SHORT_ALIGN,
00315                             length);
00316 }

ACE_CDR::Boolean ACE_OutputCDR::write_string const ACE_CString   x
 

Definition at line 267 of file CDR_Stream.cpp.

References ACE_String_Base< char >::c_str, ACE_String_Base< char >::length, ACE_CDR::ULong, and write_string.

00268 {
00269   // @@ Leave this method in here, not the `.i' file so that we don't
00270   //    have to unnecessarily pull in the `ace/SString.h' header.
00271   return this->write_string (ACE_static_cast (ACE_CDR::ULong, x.length()),
00272                              x.c_str());
00273 }

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

Definition at line 239 of file CDR_Stream.cpp.

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

00241 {
00242   // @@ This is a slight violation of "Optimize for the common case",
00243   // i.e. normally the translator will be 0, but OTOH the code is
00244   // smaller and should be better for the cache ;-) ;-)
00245   if (this->char_translator_ != 0)
00246     return this->char_translator_->write_string (*this, len, x);
00247 
00248   if (len != 0)
00249     {
00250       if (this->write_ulong (len + 1))
00251         return this->write_char_array (x, len + 1);
00252     }
00253   else
00254     {
00255       // Be nice to programmers: treat nulls as empty strings not
00256       // errors. (OMG-IDL supports languages that don't use the C/C++
00257       // notion of null v. empty strings; nulls aren't part of the OMG-IDL
00258       // string model.)
00259       if (this->write_ulong (1))
00260         return this->write_char (0);
00261     }
00262 
00263   return (this->good_bit_ = 0);
00264 }

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 246 of file CDR_Stream.i.

References ACE_CDR::Char, ACE_OS_String::strlen, and ACE_CDR::ULong.

Referenced by append_string, operator<<, and write_string.

00247 {
00248   if (x != 0)
00249     {
00250       ACE_CDR::ULong len =
00251         ACE_static_cast (ACE_CDR::ULong, ACE_OS_String::strlen (x));
00252       return this->write_string (len, x);
00253     }
00254   return this->write_string (0, 0);
00255 }

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

Definition at line 208 of file CDR_Stream.i.

References ACE_CDR::ULong, and write_4.

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

00209 {
00210   return this->write_4 (ACE_reinterpret_cast (const ACE_CDR::ULong*, &x));
00211 }

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

Definition at line 339 of file CDR_Stream.i.

References length, ACE_CDR::LONG_ALIGN, ACE_CDR::LONG_SIZE, ACE_CDR::ULong, and write_array.

00341 {
00342   return this->write_array (x,
00343                             ACE_CDR::LONG_SIZE,
00344                             ACE_CDR::LONG_ALIGN,
00345                             length);
00346 }

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

Definition at line 220 of file CDR_Stream.i.

References ACE_CDR::ULongLong, and write_8.

Referenced by append_ulonglong, and operator<<.

00221 {
00222   return this->write_8 (ACE_reinterpret_cast (const ACE_CDR::ULongLong*,&x));
00223 }

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

Definition at line 359 of file CDR_Stream.i.

References length, ACE_CDR::LONGLONG_ALIGN, ACE_CDR::LONGLONG_SIZE, ACE_CDR::ULong, ACE_CDR::ULongLong, and write_array.

00361 {
00362   return this->write_array (x,
00363                             ACE_CDR::LONGLONG_SIZE,
00364                             ACE_CDR::LONGLONG_ALIGN,
00365                             length);
00366 }

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

Definition at line 196 of file CDR_Stream.i.

References ACE_CDR::UShort, and write_2.

Referenced by append_ushort, and operator<<.

00197 {
00198   return this->write_2 (ACE_reinterpret_cast (const ACE_CDR::UShort*, &x));
00199 }

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

Definition at line 319 of file CDR_Stream.i.

References length, ACE_CDR::SHORT_ALIGN, ACE_CDR::SHORT_SIZE, ACE_CDR::ULong, ACE_CDR::UShort, and write_array.

00321 {
00322   return this->write_array (x,
00323                             ACE_CDR::SHORT_SIZE,
00324                             ACE_CDR::SHORT_ALIGN,
00325                             length);
00326 }

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

Definition at line 181 of file CDR_Stream.cpp.

References good_bit_, major_version_, minor_version_, ACE_CDR::Octet, ACE_CDR::Short, ACE_CDR::ULong, ACE_CDR::UShort, 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.

00182 {
00183   if (this->wchar_translator_ != 0)
00184     return (this->good_bit_ = this->wchar_translator_->write_wchar (*this, x));
00185   if (ACE_OutputCDR::wchar_maxbytes_ == 0)
00186     {
00187       errno = EACCES;
00188       return (this->good_bit_ = 0);
00189     }
00190   if (ACE_static_cast (ACE_CDR::Short, major_version_) == 1
00191       && ACE_static_cast (ACE_CDR::Short, minor_version_) == 2)
00192     {
00193       ACE_CDR::Octet len = ACE_static_cast (ACE_CDR::Octet,
00194                                             ACE_OutputCDR::wchar_maxbytes_);
00195       if (this->write_1 (&len))
00196         {
00197           if (ACE_OutputCDR::wchar_maxbytes_ == sizeof(ACE_CDR::WChar))
00198             return this->write_octet_array (ACE_reinterpret_cast
00199                                             (const ACE_CDR::Octet*, &x),
00200                                             ACE_static_cast (ACE_CDR::ULong,
00201                                                              len));
00202           else
00203             if (ACE_OutputCDR::wchar_maxbytes_ == 2)
00204               {
00205                 ACE_CDR::Short sx = ACE_static_cast(ACE_CDR::Short,x);
00206                 return this->write_octet_array(ACE_reinterpret_cast
00207                                                (const ACE_CDR::Octet*, &sx),
00208                                                ACE_static_cast (ACE_CDR::ULong,
00209                                                                 len));
00210               }
00211             else
00212               {
00213                 ACE_CDR::Octet ox = ACE_static_cast(ACE_CDR::Octet,x);
00214                 return this->write_octet_array(ACE_reinterpret_cast
00215                                                (const ACE_CDR::Octet*, &ox),
00216                                                ACE_static_cast (ACE_CDR::ULong,
00217                                                                 len));
00218               }
00219         }
00220     }
00221   else if (ACE_static_cast (ACE_CDR::Short, minor_version_) == 0)
00222     { // wchar is not allowed with GIOP 1.0.
00223       errno = EINVAL;
00224       return (this->good_bit_ = 0);
00225     }
00226   if (ACE_OutputCDR::wchar_maxbytes_ == sizeof (ACE_CDR::WChar))
00227     return this->write_4 (ACE_reinterpret_cast (const ACE_CDR::ULong *, &x));
00228   else if (ACE_OutputCDR::wchar_maxbytes_ == 2)
00229     {
00230       ACE_CDR::Short sx = ACE_static_cast(ACE_CDR::Short,x);
00231       return this->write_2 (ACE_reinterpret_cast (const ACE_CDR::UShort *,
00232                                                   &sx));
00233     }
00234   ACE_CDR::Octet ox = ACE_static_cast (ACE_CDR::Octet,x);
00235   return this->write_1 (ACE_reinterpret_cast (const ACE_CDR::Octet *, &ox));
00236 }

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

Definition at line 278 of file CDR_Stream.i.

References good_bit_, length, ACE_CDR::LONG_ALIGN, ACE_CDR::SHORT_ALIGN, 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 write_wstring.

00280 {
00281   if (this->wchar_translator_)
00282     return this->wchar_translator_->write_wchar_array (*this, x, length);
00283   if (ACE_OutputCDR::wchar_maxbytes_ == 0)
00284     {
00285       errno = EACCES;
00286       return (this->good_bit_ = 0);
00287     }
00288   if (ACE_OutputCDR::wchar_maxbytes_ == sizeof (ACE_CDR::WChar))
00289     return this->write_array (x,
00290                               sizeof (ACE_CDR::WChar),
00291                               sizeof (ACE_CDR::WChar) == 2
00292                               ? ACE_CDR::SHORT_ALIGN
00293                               : ACE_CDR::LONG_ALIGN,
00294                               length);
00295   return this->write_wchar_array_i (x,length);
00296 }

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

Definition at line 515 of file CDR_Stream.cpp.

References adjust, do_byte_swap_, good_bit_, length, ACE_CDR::Octet, ACE_CDR::OCTET_ALIGN, ACE_CDR::SHORT_ALIGN, ACE_CDR::swap_2, ACE_CDR::ULong, ACE_CDR::UShort, ACE_CDR::WChar, and wchar_maxbytes_.

Referenced by write_wchar_array.

00517 {
00518   if (length == 0)
00519     return 1;
00520   char* buf;
00521   size_t align = (ACE_OutputCDR::wchar_maxbytes_ == 2) ?
00522     ACE_CDR::SHORT_ALIGN :
00523     ACE_CDR::OCTET_ALIGN;
00524 
00525   if (this->adjust (ACE_OutputCDR::wchar_maxbytes_ * length, align, buf) == 0)
00526     {
00527       if (ACE_OutputCDR::wchar_maxbytes_ == 2)
00528         {
00529           ACE_CDR::UShort *sb = ACE_reinterpret_cast(ACE_CDR::UShort *, buf);
00530           for (size_t i = 0; i < length; i++)
00531 #if !defined (ACE_ENABLE_SWAP_ON_WRITE)
00532             sb[i] = ACE_static_cast (ACE_CDR::UShort, x[i]);
00533 #else
00534           if (!this->do_byte_swap_)
00535             sb[i] = ACE_static_cast (ACE_CDR::UShort, x[i]);;
00536           else
00537             {
00538               ACE_CDR::UShort sx = ACE_static_cast (ACE_CDR::UShort, x[i]);
00539               ACE_CDR::swap_2 (ACE_reinterpret_cast(char *,&sx),&buf[i*2]);
00540             }
00541 #endif /* ACE_DISABLE_SWAP_ON_READ */
00542         }
00543       else
00544         {
00545           for (size_t i = 0; i < length; i++)
00546             buf[i] = ACE_static_cast (ACE_CDR::Octet, x[i]);
00547         }
00548       return this->good_bit_;
00549     }
00550   return 0;
00551 }

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

Definition at line 276 of file CDR_Stream.cpp.

References good_bit_, ACE_CDR::Short, ACE_CDR::ULong, ACE_CDR::WChar, wchar_maxbytes_, wchar_translator_, write_ulong, write_wchar, write_wchar_array, and ACE_WChar_Codeset_Translator::write_wstring.

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

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

Definition at line 258 of file CDR_Stream.i.

References ACE_CDR::WChar, and ACE_OS::wslen.

Referenced by append_wstring, and operator<<.

00259 {
00260   if (x != 0)
00261     return this->write_wstring (ACE_OS::wslen (x), x);
00262   return this->write_wstring (0, 0);
00263 }


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 84 of file CDR_Stream.h.

friend class ACE_InputCDR [friend]
 

Definition at line 86 of file CDR_Stream.h.

friend class ACE_WChar_Codeset_Translator [friend]
 

Definition at line 85 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 472 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 429 of file CDR_Stream.h.

Referenced by ACE_OutputCDR, adjust, current, end, grow_and_adjust, reset, write_octet_array_mb, and ~ACE_OutputCDR.

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 447 of file CDR_Stream.h.

Referenced by adjust, current_alignment, reset, and write_octet_array_mb.

int 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 437 of file CDR_Stream.h.

Referenced by adjust, grow_and_adjust, reset, and write_octet_array_mb.

int 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 responsability in the writers. THIS IS NOT A STANDARD IN CORBA, USE AT YOUR OWN RISK

Definition at line 458 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.

int ACE_OutputCDR::good_bit_ [private]
 

Set to 0 when an error ocurrs.

Definition at line 461 of file CDR_Stream.h.

Referenced by ACE_WChar_Codeset_Translator::good_bit, ACE_Char_Codeset_Translator::good_bit, good_bit, grow_and_adjust, write_array, write_octet_array_mb, write_string, write_wchar, write_wchar_array, write_wchar_array_i, and write_wstring.

ACE_CDR::Octet ACE_OutputCDR::major_version_ [protected]
 

GIOP version information.

Definition at line 468 of file CDR_Stream.h.

Referenced by get_version, ACE_WChar_Codeset_Translator::major_version, ACE_Char_Codeset_Translator::major_version, set_version, and write_wchar.

size_t ACE_OutputCDR::memcpy_tradeoff_ [private]
 

Break-even point for copying.

Definition at line 464 of file CDR_Stream.h.

Referenced by write_octet_array_mb.

ACE_CDR::Octet ACE_OutputCDR::minor_version_ [protected]
 

Definition at line 469 of file CDR_Stream.h.

Referenced by get_version, ACE_WChar_Codeset_Translator::minor_version, ACE_Char_Codeset_Translator::minor_version, set_version, and write_wchar.

ACE_Message_Block ACE_OutputCDR::start_ [private]
 

The start of the chain of message blocks.

Definition at line 426 of file CDR_Stream.h.

Referenced by ACE_OutputCDR, begin, buffer, length, reset, and ~ACE_OutputCDR.

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 15 of file CDR_Stream.cpp.

Referenced by ACE_InputCDR::read_wchar, ACE_InputCDR::read_wchar_array, ACE_InputCDR::read_wchar_array_i, ACE_InputCDR::read_wstring, 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 473 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 Mon Jun 16 12:51:56 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002