Classes | Public Member Functions | Protected Attributes | Private Member Functions | Friends

ACE_InputCDR Class Reference

A CDR stream for demarshalling CDR-encoded data. More...

#include <CDR_Stream.h>

Collaboration diagram for ACE_InputCDR:
Collaboration graph
[legend]

List of all members.

Classes

struct  to_boolean
struct  to_char
struct  to_octet
struct  to_string
struct  to_wchar
struct  to_wstring
struct  Transfer_Contents

Public Member Functions

 ACE_InputCDR (const char *buf, size_t bufsiz, int byte_order=ACE_CDR::BYTE_ORDER_NATIVE, ACE_CDR::Octet major_version=ACE_CDR_GIOP_MAJOR_VERSION, ACE_CDR::Octet minor_version=ACE_CDR_GIOP_MINOR_VERSION)
 ACE_InputCDR (size_t bufsiz, int byte_order=ACE_CDR::BYTE_ORDER_NATIVE, ACE_CDR::Octet major_version=ACE_CDR_GIOP_MAJOR_VERSION, ACE_CDR::Octet minor_version=ACE_CDR_GIOP_MINOR_VERSION)
 ACE_InputCDR (const ACE_Message_Block *data, int byte_order=ACE_CDR::BYTE_ORDER_NATIVE, ACE_CDR::Octet major_version=ACE_CDR_GIOP_MAJOR_VERSION, ACE_CDR::Octet minor_version=ACE_CDR_GIOP_MINOR_VERSION, ACE_Lock *lock=0)
 Create an input stream from an ACE_Message_Block.
 ACE_InputCDR (ACE_Data_Block *data, ACE_Message_Block::Message_Flags flag=0, int byte_order=ACE_CDR::BYTE_ORDER_NATIVE, ACE_CDR::Octet major_version=ACE_CDR_GIOP_MAJOR_VERSION, ACE_CDR::Octet minor_version=ACE_CDR_GIOP_MINOR_VERSION)
 ACE_InputCDR (ACE_Data_Block *data, ACE_Message_Block::Message_Flags flag, size_t read_pointer_position, size_t write_pointer_position, int byte_order=ACE_CDR::BYTE_ORDER_NATIVE, ACE_CDR::Octet major_version=ACE_CDR_GIOP_MAJOR_VERSION, ACE_CDR::Octet minor_version=ACE_CDR_GIOP_MINOR_VERSION)
 ACE_InputCDR (const ACE_InputCDR &rhs)
ACE_InputCDRoperator= (const ACE_InputCDR &rhs)
 ACE_InputCDR (const ACE_InputCDR &rhs, size_t size, ACE_CDR::Long offset)
 ACE_InputCDR (const ACE_InputCDR &rhs, size_t size)
 ACE_InputCDR (const ACE_OutputCDR &rhs, ACE_Allocator *buffer_allocator=0, ACE_Allocator *data_block_allocator=0, ACE_Allocator *message_block_allocator=0)
 Create an input CDR from an output CDR.
 ACE_InputCDR (Transfer_Contents rhs)
 Transfer the contents from <rhs> to a new CDR.
 ~ACE_InputCDR (void)
 Destructor.
ACE_CDR::Boolean skip_wstring (void)
ACE_CDR::Boolean skip_string (void)
ACE_CDR::Boolean skip_bytes (size_t n)
 Skip n bytes in the CDR stream.
bool good_bit (void) const
 returns false if a problem has been detected.
const ACE_Message_Blockstart (void) const
int grow (size_t newsize)
void reset_byte_order (int byte_order)
void reset (const ACE_Message_Block *data, int byte_order)
ACE_Message_Blocksteal_contents (void)
 Steal the contents from the current CDR.
void steal_from (ACE_InputCDR &cdr)
void exchange_data_blocks (ACE_InputCDR &cdr)
ACE_Data_Blockclone_from (ACE_InputCDR &cdr)
void reset_contents (void)
char * rd_ptr (void)
 Returns the current position for the rd_ptr.
char * wr_ptr (void)
 Returns the current position for the wr_ptr.
size_t length (void) const
 Return how many bytes are left in the stream.
int align_read_ptr (size_t alignment)
bool do_byte_swap (void) const
int byte_order (void) const
ACE_Char_Codeset_Translatorchar_translator (void) const
 Access the codeset translators. They can be nil!
ACE_WChar_Codeset_Translatorwchar_translator (void) const
void char_translator (ACE_Char_Codeset_Translator *)
 Set the codeset translators.
void wchar_translator (ACE_WChar_Codeset_Translator *)
int adjust (size_t size, char *&buf)
int adjust (size_t size, size_t align, char *&buf)
void set_version (ACE_CDR::Octet major, ACE_CDR::Octet minor)
 Set the underlying GIOP version..
void get_version (ACE_CDR::Octet &major, ACE_CDR::Octet &minor)
 Set the underlying GIOP version..

ACE_CDR::Boolean read_boolean (ACE_CDR::Boolean &x)
ACE_CDR::Boolean read_char (ACE_CDR::Char &x)
ACE_CDR::Boolean read_wchar (ACE_CDR::WChar &x)
ACE_CDR::Boolean read_octet (ACE_CDR::Octet &x)
ACE_CDR::Boolean read_short (ACE_CDR::Short &x)
ACE_CDR::Boolean read_ushort (ACE_CDR::UShort &x)
ACE_CDR::Boolean read_long (ACE_CDR::Long &x)
ACE_CDR::Boolean read_ulong (ACE_CDR::ULong &x)
ACE_CDR::Boolean read_longlong (ACE_CDR::LongLong &x)
ACE_CDR::Boolean read_ulonglong (ACE_CDR::ULongLong &x)
ACE_CDR::Boolean read_float (ACE_CDR::Float &x)
ACE_CDR::Boolean read_double (ACE_CDR::Double &x)
ACE_CDR::Boolean read_longdouble (ACE_CDR::LongDouble &x)
ACE_CDR::Boolean read_string (ACE_CDR::Char *&x)
ACE_CDR::Boolean read_string (ACE_CString &x)
ACE_CDR::Boolean read_wstring (ACE_CDR::WChar *&x)

ACE_CDR::Boolean read_boolean_array (ACE_CDR::Boolean *x, ACE_CDR::ULong length)
ACE_CDR::Boolean read_char_array (ACE_CDR::Char *x, ACE_CDR::ULong length)
ACE_CDR::Boolean read_wchar_array (ACE_CDR::WChar *x, ACE_CDR::ULong length)
ACE_CDR::Boolean read_octet_array (ACE_CDR::Octet *x, ACE_CDR::ULong length)
ACE_CDR::Boolean read_short_array (ACE_CDR::Short *x, ACE_CDR::ULong length)
ACE_CDR::Boolean read_ushort_array (ACE_CDR::UShort *x, ACE_CDR::ULong length)
ACE_CDR::Boolean read_long_array (ACE_CDR::Long *x, ACE_CDR::ULong length)
ACE_CDR::Boolean read_ulong_array (ACE_CDR::ULong *x, ACE_CDR::ULong length)
ACE_CDR::Boolean read_longlong_array (ACE_CDR::LongLong *x, ACE_CDR::ULong length)
ACE_CDR::Boolean read_ulonglong_array (ACE_CDR::ULongLong *x, ACE_CDR::ULong length)
ACE_CDR::Boolean read_float_array (ACE_CDR::Float *x, ACE_CDR::ULong length)
ACE_CDR::Boolean read_double_array (ACE_CDR::Double *x, ACE_CDR::ULong length)
ACE_CDR::Boolean read_longdouble_array (ACE_CDR::LongDouble *x, ACE_CDR::ULong length)

ACE_CDR::Boolean skip_boolean (void)
ACE_CDR::Boolean skip_char (void)
ACE_CDR::Boolean skip_wchar (void)
ACE_CDR::Boolean skip_octet (void)
ACE_CDR::Boolean skip_short (void)
ACE_CDR::Boolean skip_ushort (void)
ACE_CDR::Boolean skip_long (void)
ACE_CDR::Boolean skip_ulong (void)
ACE_CDR::Boolean skip_longlong (void)
ACE_CDR::Boolean skip_ulonglong (void)
ACE_CDR::Boolean skip_float (void)
ACE_CDR::Boolean skip_double (void)
ACE_CDR::Boolean skip_longdouble (void)

Protected Attributes

ACE_Message_Block start_
bool do_byte_swap_
bool good_bit_
 set to false when an error occurs.
ACE_CDR::Octet major_version_
 The GIOP versions for this stream.
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_

Private Member Functions

ACE_CDR::Boolean read_1 (ACE_CDR::Octet *x)
ACE_CDR::Boolean read_2 (ACE_CDR::UShort *x)
ACE_CDR::Boolean read_4 (ACE_CDR::ULong *x)
ACE_CDR::Boolean read_8 (ACE_CDR::ULongLong *x)
ACE_CDR::Boolean read_16 (ACE_CDR::LongDouble *x)
ACE_CDR::Boolean read_array (void *x, size_t size, size_t align, ACE_CDR::ULong length)
ACE_CDR::Boolean read_wchar_array_i (ACE_CDR::WChar *x, ACE_CDR::ULong length)
void rd_ptr (size_t offset)
 Move the rd_ptr ahead by offset bytes.
char * end (void)
 Points to the continuation field of the current message block.

Friends

class ACE_Char_Codeset_Translator
class ACE_WChar_Codeset_Translator

Detailed Description

A CDR stream for demarshalling CDR-encoded data.

This class is based on the the CORBA spec for Java (98-02-29), java class omg.org.CORBA.portable.InputStream. It diverts in a few ways:

Definition at line 623 of file CDR_Stream.h.


Constructor & Destructor Documentation

ACE_InputCDR::ACE_InputCDR ( const char *  buf,
size_t  bufsiz,
int  byte_order = ACE_CDR::BYTE_ORDER_NATIVE,
ACE_CDR::Octet  major_version = ACE_CDR_GIOP_MAJOR_VERSION,
ACE_CDR::Octet  minor_version = ACE_CDR_GIOP_MINOR_VERSION 
)

Create an input stream from an arbitrary buffer. The buffer must be properly aligned because this contructor will *not* work if the buffer is aligned unproperly.See ACE_ptr_align_binary() for instructions on how to align a pointer properly and use ACE_CDR::MAX_ALIGNMENT for the correct alignment.

Definition at line 853 of file CDR_Stream.cpp.

  : start_ (buf, bufsiz),
    do_byte_swap_ (byte_order != ACE_CDR_BYTE_ORDER),
    good_bit_ (true),
    major_version_ (major_version),
    minor_version_ (minor_version),
    char_translator_ (0),
    wchar_translator_ (0)
{
  this->start_.wr_ptr (bufsiz);

#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
  ACE_NEW (this->monitor_,
           ACE::Monitor_Control::Size_Monitor);
  this->monitor_->receive (bufsiz);
#endif /* ACE_HAS_MONITOR_POINTS==1 */
}

ACE_InputCDR::ACE_InputCDR ( size_t  bufsiz,
int  byte_order = ACE_CDR::BYTE_ORDER_NATIVE,
ACE_CDR::Octet  major_version = ACE_CDR_GIOP_MAJOR_VERSION,
ACE_CDR::Octet  minor_version = ACE_CDR_GIOP_MINOR_VERSION 
)

Create an empty input stream. The caller is responsible for putting the right data and providing the right alignment.

Definition at line 875 of file CDR_Stream.cpp.

  : start_ (bufsiz),
    do_byte_swap_ (byte_order != ACE_CDR_BYTE_ORDER),
    good_bit_ (true),
    major_version_ (major_version),
    minor_version_ (minor_version),
    char_translator_ (0),
    wchar_translator_ (0)
{
#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
  ACE_NEW (this->monitor_,
           ACE::Monitor_Control::Size_Monitor);
  this->monitor_->receive (bufsiz);
#endif /* ACE_HAS_MONITOR_POINTS==1 */
}

ACE_InputCDR::ACE_InputCDR ( const ACE_Message_Block data,
int  byte_order = ACE_CDR::BYTE_ORDER_NATIVE,
ACE_CDR::Octet  major_version = ACE_CDR_GIOP_MAJOR_VERSION,
ACE_CDR::Octet  minor_version = ACE_CDR_GIOP_MINOR_VERSION,
ACE_Lock lock = 0 
)

Create an input stream from an ACE_Message_Block.

The alignment of the data block is carried into the new ACE_InputCDR object. This constructor either increments the data reference count, or copies the data (if it's a compound message block) so the caller can release the block immediately upon return.

Definition at line 894 of file CDR_Stream.cpp.

  : start_ (0, ACE_Message_Block::MB_DATA, 0, 0, 0, lock),
    good_bit_ (true),
    major_version_ (major_version),
    minor_version_ (minor_version),
    char_translator_ (0),
    wchar_translator_ (0)
{
#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
  ACE_NEW (this->monitor_,
           ACE::Monitor_Control::Size_Monitor);
  this->monitor_->receive (this->start_.total_size ());
#endif /* ACE_HAS_MONITOR_POINTS==1 */

  this->reset (data, byte_order);
}

ACE_InputCDR::ACE_InputCDR ( ACE_Data_Block data,
ACE_Message_Block::Message_Flags  flag = 0,
int  byte_order = ACE_CDR::BYTE_ORDER_NATIVE,
ACE_CDR::Octet  major_version = ACE_CDR_GIOP_MAJOR_VERSION,
ACE_CDR::Octet  minor_version = ACE_CDR_GIOP_MINOR_VERSION 
)

Create an input stream from an ACE_Data_Block. The <flag> indicates whether the data can be deleted by the CDR stream or not

Definition at line 915 of file CDR_Stream.cpp.

  : start_ (data, flag),
    do_byte_swap_ (byte_order != ACE_CDR_BYTE_ORDER),
    good_bit_ (true),
    major_version_ (major_version),
    minor_version_ (minor_version),
    char_translator_ (0),
    wchar_translator_ (0)
{
#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
  ACE_NEW (this->monitor_,
           ACE::Monitor_Control::Size_Monitor);
  this->monitor_->receive (data->size ());
#endif /* ACE_HAS_MONITOR_POINTS==1 */
}

ACE_InputCDR::ACE_InputCDR ( ACE_Data_Block data,
ACE_Message_Block::Message_Flags  flag,
size_t  read_pointer_position,
size_t  write_pointer_position,
int  byte_order = ACE_CDR::BYTE_ORDER_NATIVE,
ACE_CDR::Octet  major_version = ACE_CDR_GIOP_MAJOR_VERSION,
ACE_CDR::Octet  minor_version = ACE_CDR_GIOP_MINOR_VERSION 
)

Create an input stream from an ACE_Data_Block. It also sets the read and write pointers at the desired positions. This would be helpful if the applications desires to create a new CDR stream from a semi-processed datablock.

Definition at line 935 of file CDR_Stream.cpp.

  : start_ (data, flag),
    do_byte_swap_ (byte_order != ACE_CDR_BYTE_ORDER),
    good_bit_ (true),
    major_version_ (major_version),
    minor_version_ (minor_version),
    char_translator_ (0),
    wchar_translator_ (0)
{
  // Set the read pointer
  this->start_.rd_ptr (rd_pos);

  // Set the write pointer after doing a sanity check.
  char* wrpos = this->start_.base () + wr_pos;

  if (this->start_.end () >= wrpos)
    {
      this->start_.wr_ptr (wr_pos);
    }

#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
  ACE_NEW (this->monitor_,
           ACE::Monitor_Control::Size_Monitor);
  this->monitor_->receive (data->size ());
#endif /* ACE_HAS_MONITOR_POINTS==1 */
}

ACE_InputCDR::ACE_InputCDR ( const ACE_InputCDR rhs  ) 

These make a copy of the current stream state, but do not copy the internal buffer, so the same stream can be read multiple times efficiently.

Definition at line 1057 of file CDR_Stream.cpp.

  : start_ (rhs.start_,
            ACE_CDR::MAX_ALIGNMENT),
    do_byte_swap_ (rhs.do_byte_swap_),
    good_bit_ (true),
    major_version_ (rhs.major_version_),
    minor_version_ (rhs.minor_version_),
    char_translator_ (rhs.char_translator_),
    wchar_translator_ (rhs.wchar_translator_)
{
#if !defined (ACE_LACKS_CDR_ALIGNMENT)
  char *buf = ACE_ptr_align_binary (rhs.start_.base (),
                                    ACE_CDR::MAX_ALIGNMENT);
#else
  char *buf = rhs.start_.base ();
#endif /* ACE_LACKS_CDR_ALIGNMENT */

  size_t rd_offset = rhs.start_.rd_ptr () - buf;
  size_t wr_offset = rhs.start_.wr_ptr () - buf;
  this->start_.rd_ptr (rd_offset);
  this->start_.wr_ptr (wr_offset);

#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
  ACE_NEW (this->monitor_,
           ACE::Monitor_Control::Size_Monitor);
  this->monitor_->receive (this->start_.total_size ());
#endif /* ACE_HAS_MONITOR_POINTS==1 */
}

ACE_InputCDR::ACE_InputCDR ( const ACE_InputCDR rhs,
size_t  size,
ACE_CDR::Long  offset 
)

When interpreting indirected TypeCodes it is useful to make a "copy" of the stream starting in the new position.

Definition at line 968 of file CDR_Stream.cpp.

  : start_ (rhs.start_,
            ACE_CDR::MAX_ALIGNMENT),
    do_byte_swap_ (rhs.do_byte_swap_),
    good_bit_ (true),
    major_version_ (rhs.major_version_),
    minor_version_ (rhs.minor_version_),
    char_translator_ (rhs.char_translator_),
    wchar_translator_ (rhs.wchar_translator_)
{
#if !defined (ACE_LACKS_CDR_ALIGNMENT)
  // Align the base pointer assuming that the incoming stream is also
  // aligned the way we are aligned
  char *incoming_start = ACE_ptr_align_binary (rhs.start_.base (),
                                               ACE_CDR::MAX_ALIGNMENT);
#else
  char *incoming_start = rhs.start_.base ();
#endif /* ACE_LACKS_CDR_ALIGNMENT */

  const size_t newpos =
    (rhs.start_.rd_ptr() - incoming_start)  + offset;

  if (newpos <= this->start_.space ()
      && newpos + size <= this->start_.space ())
    {
      this->start_.rd_ptr (newpos);
      this->start_.wr_ptr (newpos + size);
    }
  else
    {
      this->good_bit_ = false;
    }

#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
  ACE_NEW (this->monitor_,
           ACE::Monitor_Control::Size_Monitor);
  this->monitor_->receive (this->start_.total_size ());
#endif /* ACE_HAS_MONITOR_POINTS==1 */
}

ACE_InputCDR::ACE_InputCDR ( const ACE_InputCDR rhs,
size_t  size 
)

This creates an encapsulated stream, the first byte must be (per the spec) the byte order of the encapsulation.

Definition at line 1010 of file CDR_Stream.cpp.

  : start_ (rhs.start_,
            ACE_CDR::MAX_ALIGNMENT),
    do_byte_swap_ (rhs.do_byte_swap_),
    good_bit_ (true),
    major_version_ (rhs.major_version_),
    minor_version_ (rhs.minor_version_),
    char_translator_ (rhs.char_translator_),
    wchar_translator_ (rhs.wchar_translator_)
{
#if !defined (ACE_LACKS_CDR_ALIGNMENT)
  // Align the base pointer assuming that the incoming stream is also
  // aligned the way we are aligned
  char *incoming_start = ACE_ptr_align_binary (rhs.start_.base (),
                                               ACE_CDR::MAX_ALIGNMENT);
#else
  char *incoming_start = rhs.start_.base ();
#endif /* ACE_LACKS_CDR_ALIGNMENT */

  const size_t newpos =
    rhs.start_.rd_ptr() - incoming_start;

  if (newpos <= this->start_.space ()
      && newpos + size <= this->start_.space ())
    {
      // Notice that ACE_Message_Block::duplicate may leave the
      // wr_ptr() with a higher value than what we actually want.
      this->start_.rd_ptr (newpos);
      this->start_.wr_ptr (newpos + size);

      ACE_CDR::Octet byte_order = 0;
      (void) this->read_octet (byte_order);
      this->do_byte_swap_ = (byte_order != ACE_CDR_BYTE_ORDER);
    }
  else
    {
      this->good_bit_ = false;
    }

#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
  ACE_NEW (this->monitor_,
           ACE::Monitor_Control::Size_Monitor);
  this->monitor_->receive (this->start_.total_size ());
#endif /* ACE_HAS_MONITOR_POINTS==1 */
}

ACE_InputCDR::ACE_InputCDR ( const ACE_OutputCDR rhs,
ACE_Allocator buffer_allocator = 0,
ACE_Allocator data_block_allocator = 0,
ACE_Allocator message_block_allocator = 0 
)

Create an input CDR from an output CDR.

Definition at line 1130 of file CDR_Stream.cpp.

  : start_ (rhs.total_length () + ACE_CDR::MAX_ALIGNMENT,
            ACE_Message_Block::MB_DATA,
            0,
            0,
            buffer_allocator,
            0,
            0,
            ACE_Time_Value::zero,
            ACE_Time_Value::max_time,
            data_block_allocator,
            message_block_allocator),
    do_byte_swap_ (rhs.do_byte_swap_),
    good_bit_ (true),
    major_version_ (rhs.major_version_),
    minor_version_ (rhs.minor_version_),
    char_translator_ (rhs.char_translator_),
    wchar_translator_ (rhs.wchar_translator_)
{
  ACE_CDR::mb_align (&this->start_);
  for (const ACE_Message_Block *i = rhs.begin ();
       i != rhs.end ();
       i = i->cont ())
    {
      this->start_.copy (i->rd_ptr (), i->length ());
    }

#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
  ACE_NEW (this->monitor_,
           ACE::Monitor_Control::Size_Monitor);
  this->monitor_->receive (this->start_.total_size ());
#endif /* ACE_HAS_MONITOR_POINTS==1 */
}

ACE_InputCDR::ACE_InputCDR ( ACE_InputCDR::Transfer_Contents  x  ) 

Transfer the contents from <rhs> to a new CDR.

Definition at line 1086 of file CDR_Stream.cpp.

  : start_ (x.rhs_.start_.data_block ()),
    do_byte_swap_ (x.rhs_.do_byte_swap_),
    good_bit_ (true),
    major_version_ (x.rhs_.major_version_),
    minor_version_ (x.rhs_.minor_version_),
    char_translator_ (x.rhs_.char_translator_),
    wchar_translator_ (x.rhs_.wchar_translator_)
{
  this->start_.rd_ptr (x.rhs_.start_.rd_ptr ());
  this->start_.wr_ptr (x.rhs_.start_.wr_ptr ());

  ACE_Data_Block* db = this->start_.data_block ()->clone_nocopy ();
  (void) x.rhs_.start_.replace_data_block (db);

#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
  ACE_NEW (this->monitor_,
           ACE::Monitor_Control::Size_Monitor);
  this->monitor_->receive (this->start_.total_size ());
#endif /* ACE_HAS_MONITOR_POINTS==1 */
}

ACE_InputCDR::~ACE_InputCDR ( void   )  [inline]

Destructor.

Definition at line 619 of file CDR_Stream.inl.

{
#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
  this->monitor_->remove_ref ();
#endif /* ACE_HAS_MONITOR_POINTS==1 */
}


Member Function Documentation

int ACE_InputCDR::adjust ( size_t  size,
char *&  buf 
) [inline]

Returns (in buf) the next position in the buffer aligned to size. It advances the Message_Block rd_ptr past the data (i.e., buf + size). Sets the good_bit to false and returns a -1 on failure.

Definition at line 1072 of file CDR_Stream.inl.

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

int ACE_InputCDR::adjust ( size_t  size,
size_t  align,
char *&  buf 
) [inline]

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

Definition at line 1047 of file CDR_Stream.inl.

{
#if !defined (ACE_LACKS_CDR_ALIGNMENT)
  buf = ACE_ptr_align_binary (this->rd_ptr (), align);
#else
  buf = this->rd_ptr ();
#endif /* ACE_LACKS_CDR_ALIGNMENT */

  char * const end = buf + size;
  if (end <= this->wr_ptr ())
    {
      this->start_.rd_ptr (end);
      return 0;
    }

  this->good_bit_ = false;
  return -1;
#if defined (ACE_LACKS_CDR_ALIGNMENT)
  ACE_UNUSED_ARG (align);
#endif /* ACE_LACKS_CDR_ALIGNMENT */
}

int ACE_InputCDR::align_read_ptr ( size_t  alignment  )  [inline]

Utility function to allow the user more flexibility. Skips 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 1491 of file CDR_Stream.inl.

{
#if !defined (ACE_LACKS_CDR_ALIGNMENT)
  char *buf = ACE_ptr_align_binary (this->rd_ptr (),
                                    alignment);
#else
  char *buf = this->rd_ptr ();
#endif /* ACE_LACKS_CDR_ALIGNMENT */

  if (buf <= this->wr_ptr ())
    {
      this->start_.rd_ptr (buf);
      return 0;
    }

  this->good_bit_ = false;
  return -1;
}

int ACE_InputCDR::byte_order ( void   )  const [inline]

If do_byte_swap() returns false, this returns ACE_CDR_BYTE_ORDER else it returns !ACE_CDR_BYTE_ORDER.

Definition at line 1485 of file CDR_Stream.inl.

{
  return this->do_byte_swap () ? !ACE_CDR_BYTE_ORDER : ACE_CDR_BYTE_ORDER;
}

void ACE_InputCDR::char_translator ( ACE_Char_Codeset_Translator ctran  )  [inline]

Set the codeset translators.

Definition at line 1538 of file CDR_Stream.inl.

{
  this->char_translator_ = ctran;
}

ACE_Char_Codeset_Translator * ACE_InputCDR::char_translator ( void   )  const [inline]

Access the codeset translators. They can be nil!

Definition at line 1525 of file CDR_Stream.inl.

{
  return this->char_translator_;
}

ACE_Data_Block * ACE_InputCDR::clone_from ( ACE_InputCDR cdr  ) 

Copy the data portion from the cdr to this cdr and return the data content (ie. the ACE_Data_Block) from this CDR to the caller.

Note:
The caller is responsible for managing the memory of the returned ACE_Data_Block.

Definition at line 1854 of file CDR_Stream.cpp.

{
  this->do_byte_swap_ = cdr.do_byte_swap_;

  // Get the read & write pointer positions in the incoming CDR
  // streams
  char *rd_ptr = cdr.start_.rd_ptr ();
  char *wr_ptr = cdr.start_.wr_ptr ();

  // Now reset the incoming CDR stream
  cdr.start_.reset ();

  // As we have reset the stream, try to align the underlying message
  // block in the incoming stream
  ACE_CDR::mb_align (&cdr.start_);

  // Get the read & write pointer positions again
  char *nrd_ptr = cdr.start_.rd_ptr ();
  char *nwr_ptr = cdr.start_.wr_ptr ();

  // Actual length of the stream is..
  // @todo: This will look idiotic, but we dont seem to have much of a
  // choice. How do we calculate the length of the incoming stream?
  // Calling the method before calling reset () would give us the
  // wrong length of the stream that needs copying.  So we do the
  // calulation like this
  // (1) We get the <rd_ptr> and <wr_ptr> positions of the incoming
  // stream.
  // (2) Then we reset the <incoming> stream and then align it.
  // (3) We get the <rd_ptr> and <wr_ptr> positions again. (Points #1
  // thru #3 has been done already)
  // (4) The difference in the <rd_ptr> and <wr_ptr> positions gives
  // us the following, the actual bytes traversed by the <rd_ptr> and
  // <wr_ptr>.
  // (5) The bytes traversed by the <wr_ptr> is the actual length of
  // the stream.

  // Actual bytes traversed
  size_t rd_bytes = rd_ptr - nrd_ptr;
  size_t wr_bytes = wr_ptr - nwr_ptr;

  ACE_CDR::mb_align (&this->start_);

  ACE_Data_Block *db = this->start_.data_block ();

  // If the size of the data that needs to be copied are higher than
  // what is available, then do a reallocation.
  if (wr_bytes > (this->start_.size () - ACE_CDR::MAX_ALIGNMENT))
    {
      // @@NOTE: We need to probably add another method to the message
      // block interface to simplify this
      db = cdr.start_.data_block ()->clone_nocopy ();

      if (db == 0 || db->size ((wr_bytes) +
                               ACE_CDR::MAX_ALIGNMENT) == -1)
        return 0;

      // Replace our data block by using the incoming CDR stream.
      db = this->start_.replace_data_block (db);

      // Align the start_ message block.
      ACE_CDR::mb_align (&this->start_);

      // Clear the DONT_DELETE flag if it has been set
      this->start_.clr_self_flags (ACE_Message_Block::DONT_DELETE);
    }

  // Now do the copy
  (void) ACE_OS::memcpy (this->start_.wr_ptr (),
                         cdr.start_.rd_ptr (),
                         wr_bytes);

  // Set the read pointer position to the same point as that was in
  // <incoming> cdr.
  this->start_.rd_ptr (rd_bytes);
  this->start_.wr_ptr (wr_bytes);

  // We have changed the read & write pointers for the incoming
  // stream. Set them back to the positions that they were before..
  cdr.start_.rd_ptr (rd_bytes);
  cdr.start_.wr_ptr (wr_bytes);

  this->major_version_ = cdr.major_version_;
  this->minor_version_ = cdr.minor_version_;

  // Copy the char/wchar translators
  this->char_translator_ = cdr.char_translator_;
  this->wchar_translator_ = cdr.wchar_translator_;

#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
  this->monitor_->receive (this->start_.total_size ());
#endif /* ACE_HAS_MONITOR_POINTS==1 */

  return db;
}

bool ACE_InputCDR::do_byte_swap ( void   )  const [inline]

If true 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 1479 of file CDR_Stream.inl.

{
  return this->do_byte_swap_;
}

char * ACE_InputCDR::end ( void   )  [inline, private]

Points to the continuation field of the current message block.

Definition at line 1023 of file CDR_Stream.inl.

{
  return this->start_.end ();
}

void ACE_InputCDR::exchange_data_blocks ( ACE_InputCDR cdr  ) 

Exchange data blocks with the caller of this method. The read and write pointers are also exchanged.

Note:
We now do only with the start_ message block.

Definition at line 1779 of file CDR_Stream.cpp.

{
  // Exchange byte orders
  int const byte_order = cdr.do_byte_swap_;
  cdr.do_byte_swap_ = this->do_byte_swap_;
  this->do_byte_swap_ = byte_order;

  // Get the destination read and write pointers
  size_t const drd_pos =
    cdr.start_.rd_ptr () - cdr.start_.base ();
  size_t const dwr_pos =
    cdr.start_.wr_ptr () - cdr.start_.base ();

  // Get the source read & write pointers
  size_t const srd_pos =
    this->start_.rd_ptr () - this->start_.base ();
  size_t const swr_pos =
    this->start_.wr_ptr () - this->start_.base ();

  // Exchange data_blocks. Dont release any of the data blocks.
  ACE_Data_Block *dnb =
    this->start_.replace_data_block (cdr.start_.data_block ());
  cdr.start_.replace_data_block (dnb);

  // Exchange the flags information..
  ACE_Message_Block::Message_Flags df = cdr.start_.self_flags ();
  ACE_Message_Block::Message_Flags sf = this->start_.self_flags ();

  cdr.start_.clr_self_flags (df);
  this->start_.clr_self_flags (sf);

  cdr.start_.set_self_flags (sf);
  this->start_.set_self_flags (df);

  // Reset the <cdr> pointers to zero before it is set again.
  cdr.start_.reset ();
  this->start_.reset ();

  // Set the read and write pointers.
  if (cdr.start_.size () >= srd_pos)
    {
      cdr.start_.rd_ptr (srd_pos);
    }

  if (cdr.start_.size () >= swr_pos)
    {
      cdr.start_.wr_ptr (swr_pos);
    }

  if (this->start_.size () >= drd_pos)
    {
      this->start_.rd_ptr (drd_pos);
    }

  if (this->start_.size () >= dwr_pos)
    {
      this->start_.wr_ptr (dwr_pos);
    }

  ACE_CDR::Octet const dmajor = cdr.major_version_;
  ACE_CDR::Octet const dminor = cdr.minor_version_;

  // Exchange the GIOP version info
  cdr.major_version_ = this->major_version_;
  cdr.minor_version_ = this->minor_version_;

  this->major_version_ = dmajor;
  this->minor_version_ = dminor;

#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
  this->monitor_->receive (this->start_.total_size ());
#endif /* ACE_HAS_MONITOR_POINTS==1 */
}

void ACE_InputCDR::get_version ( ACE_CDR::Octet major,
ACE_CDR::Octet minor 
) [inline]

Set the underlying GIOP version..

Definition at line 1518 of file CDR_Stream.inl.

{
  major = this->major_version_;
  minor = this->minor_version_;
}

bool ACE_InputCDR::good_bit ( void   )  const [inline]

returns false if a problem has been detected.

Definition at line 1085 of file CDR_Stream.inl.

{
  return this->good_bit_;
}

int ACE_InputCDR::grow ( size_t  newsize  ) 

Grow the internal buffer, reset rd_ptr to the first byte in the new buffer that is properly aligned, and set wr_ptr to rd_ptr + newsize

Definition at line 1728 of file CDR_Stream.cpp.

{
  if (ACE_CDR::grow (&this->start_, newsize) == -1)
    return -1;

  ACE_CDR::mb_align (&this->start_);
  this->start_.wr_ptr (newsize);

#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
  if (newsize > this->start_.total_size ())
    {
      this->monitor_->receive (newsize);
    }
#endif /* ACE_HAS_MONITOR_POINTS==1 */

  return 0;
}

size_t ACE_InputCDR::length ( void   )  const [inline]

Return how many bytes are left in the stream.

Definition at line 716 of file CDR_Stream.inl.

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

ACE_InputCDR & ACE_InputCDR::operator= ( const ACE_InputCDR rhs  ) 

Definition at line 1109 of file CDR_Stream.cpp.

{
  if (this != &rhs)
    {
      this->start_.data_block (rhs.start_.data_block ()->duplicate ());
      this->start_.rd_ptr (rhs.start_.rd_ptr ());
      this->start_.wr_ptr (rhs.start_.wr_ptr ());
      this->do_byte_swap_ = rhs.do_byte_swap_;
      this->good_bit_ = true;
      this->char_translator_ = rhs.char_translator_;
      this->major_version_ = rhs.major_version_;
      this->minor_version_ = rhs.minor_version_;
    }

#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
  this->monitor_->receive (this->start_.total_size ());
#endif /* ACE_HAS_MONITOR_POINTS==1 */

  return *this;
}

void ACE_InputCDR::rd_ptr ( size_t  offset  )  [inline, private]

Move the rd_ptr ahead by offset bytes.

Definition at line 1029 of file CDR_Stream.inl.

{
  this->start_.rd_ptr (offset);
}

char * ACE_InputCDR::rd_ptr ( void   )  [inline]

Returns the current position for the rd_ptr.

Definition at line 1035 of file CDR_Stream.inl.

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

ACE_CDR::Boolean ACE_InputCDR::read_1 ( ACE_CDR::Octet x  )  [private]

Definition at line 1554 of file CDR_Stream.cpp.

{
  if (this->rd_ptr () < this->wr_ptr ())
    {
      *x = *reinterpret_cast<ACE_CDR::Octet*> (this->rd_ptr ());
      this->start_.rd_ptr (1);
      return true;
    }

  this->good_bit_ = false;
  return false;
}

ACE_CDR::Boolean ACE_InputCDR::read_16 ( ACE_CDR::LongDouble x  )  [private]

Definition at line 1659 of file CDR_Stream.cpp.

{
  char *buf = 0;
  if (this->adjust (ACE_CDR::LONGDOUBLE_SIZE,
                    ACE_CDR::LONGDOUBLE_ALIGN,
                    buf) == 0)
    {
#if !defined (ACE_DISABLE_SWAP_ON_READ)
      if (!this->do_byte_swap_)
        *x = *reinterpret_cast<ACE_CDR::LongDouble *> (buf);
      else
        ACE_CDR::swap_16 (buf, reinterpret_cast<char*> (x));
#else
      *x = *reinterpret_cast<ACE_CDR::LongDouble*> (buf);
#endif /* ACE_DISABLE_SWAP_ON_READ */
      return true;
    }

  this->good_bit_ = false;
  return false;
}

ACE_CDR::Boolean ACE_InputCDR::read_2 ( ACE_CDR::UShort x  )  [private]

Definition at line 1568 of file CDR_Stream.cpp.

{
  char *buf = 0;
  if (this->adjust (ACE_CDR::SHORT_SIZE, buf) == 0)
    {
#if !defined (ACE_DISABLE_SWAP_ON_READ)
      if (!this->do_byte_swap_)
        *x = *reinterpret_cast<ACE_CDR::UShort*> (buf);
      else
        ACE_CDR::swap_2 (buf, reinterpret_cast<char*> (x));
#else
      *x = *reinterpret_cast<ACE_CDR::UShort*> (buf);
#endif /* ACE_DISABLE_SWAP_ON_READ */
      return true;
    }
  this->good_bit_ = false;
  return false;
}

ACE_CDR::Boolean ACE_InputCDR::read_4 ( ACE_CDR::ULong x  )  [private]

Definition at line 1588 of file CDR_Stream.cpp.

{
  char *buf = 0;
  if (this->adjust (ACE_CDR::LONG_SIZE, buf) == 0)
    {
#if !defined (ACE_DISABLE_SWAP_ON_READ)
      if (!this->do_byte_swap_)
        *x = *reinterpret_cast<ACE_CDR::ULong*> (buf);
      else
        ACE_CDR::swap_4 (buf, reinterpret_cast<char*> (x));
#else
      *x = *reinterpret_cast<ACE_CDR::ULong*> (buf);
#endif /* ACE_DISABLE_SWAP_ON_READ */
      return true;
    }
  this->good_bit_ = false;
  return false;
}

ACE_CDR::Boolean ACE_InputCDR::read_8 ( ACE_CDR::ULongLong x  )  [private]

Definition at line 1608 of file CDR_Stream.cpp.

{
  char *buf = 0;

  if (this->adjust (ACE_CDR::LONGLONG_SIZE, buf) == 0)
    {
#if !defined (ACE_DISABLE_SWAP_ON_READ)
#  if defined (__arm__) && !defined (ACE_HAS_IPHONE)
      if (!this->do_byte_swap_)
        {
          // Convert from Intel format (12345678 => 56781234)
          const char *orig = buf;
          char *target = reinterpret_cast<char *> (x);
          register ACE_UINT32 x =
            *reinterpret_cast<const ACE_UINT32 *> (orig);
          register ACE_UINT32 y =
            *reinterpret_cast<const ACE_UINT32 *> (orig + 4);
          *reinterpret_cast<ACE_UINT32 *> (target) = y;
          *reinterpret_cast<ACE_UINT32 *> (target + 4) = x;
        }
      else
        {
          // Convert from Sparc format (12345678 => 43218765)
          const char *orig = buf;
          char *target = reinterpret_cast<char *> (x);
          register ACE_UINT32 x =
            *reinterpret_cast<const ACE_UINT32 *> (orig);
          register ACE_UINT32 y =
            *reinterpret_cast<const ACE_UINT32 *> (orig + 4);
          x = (x << 24) | ((x & 0xff00) << 8) | ((x & 0xff0000) >> 8) | (x >> 24);
          y = (y << 24) | ((y & 0xff00) << 8) | ((y & 0xff0000) >> 8) | (y >> 24);
          *reinterpret_cast<ACE_UINT32 *> (target) = x;
          *reinterpret_cast<ACE_UINT32 *> (target + 4) = y;
        }
#  else
      if (!this->do_byte_swap_)
        *x = *reinterpret_cast<ACE_CDR::ULongLong *> (buf);
      else
        ACE_CDR::swap_8 (buf, reinterpret_cast<char *> (x));
#  endif /* !__arm__ */
#else
      *x = *reinterpret_cast<ACE_CDR::ULongLong *> (buf);
#endif /* ACE_DISABLE_SWAP_ON_READ */
      return true;
    }

  this->good_bit_ = false;
  return false;
}

ACE_CDR::Boolean ACE_InputCDR::read_array ( void *  x,
size_t  size,
size_t  align,
ACE_CDR::ULong  length 
) [private]

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

{
  if (length == 0)
    return true;
  char* buf = 0;

  if (this->adjust (size * length, align, buf) == 0)
    {
#if defined (ACE_DISABLE_SWAP_ON_READ)
      ACE_OS::memcpy (x, buf, size*length);
#else
      if (!this->do_byte_swap_ || size == 1)
        ACE_OS::memcpy (x, buf, size*length);
      else
        {
          char *target = reinterpret_cast<char*> (x);
          switch (size)
            {
            case 2:
              ACE_CDR::swap_2_array (buf, target, length);
              break;
            case 4:
              ACE_CDR::swap_4_array (buf, target, length);
              break;
            case 8:
              ACE_CDR::swap_8_array (buf, target, length);
              break;
            case 16:
              ACE_CDR::swap_16_array (buf, target, length);
              break;
            default:
              // TODO: print something?
              this->good_bit_ = false;
              return false;
            }
        }
#endif /* ACE_DISABLE_SWAP_ON_READ */
      return this->good_bit_;
    }
  return false;
}

ACE_CDR::Boolean ACE_InputCDR::read_boolean ( ACE_CDR::Boolean x  )  [inline]

Return false on failure and true on success.

Definition at line 633 of file CDR_Stream.inl.

{
  ACE_CDR::Octet tmp = 0;
  (void) this->read_octet (tmp);
  x = tmp ? true : false;
  return (ACE_CDR::Boolean) this->good_bit_;
}

ACE_CDR::Boolean ACE_InputCDR::read_boolean_array ( ACE_CDR::Boolean x,
ACE_CDR::ULong  length 
)

The buffer x must be large enough to contain length elements. Return false on failure and true on success.

Definition at line 1531 of file CDR_Stream.cpp.

{
  // Make sure the length of the array isn't greater than the length of
  // the stream.
  if (length > this->length ())
    {
      this->good_bit_ = false;
      return false;
    }

  // It is hard to optimize this, the spec requires that on the wire
  // booleans be represented as a byte with value 0 or 1, but in
  // memory it is possible (though very unlikely) that a boolean has
  // a non-zero value (different from 1).
  // We resort to a simple loop.
  for (ACE_CDR::ULong i = 0; i != length && this->good_bit_; ++i)
    (void) this->read_boolean (x[i]);

  return this->good_bit_;
}

ACE_CDR::Boolean ACE_InputCDR::read_char ( ACE_CDR::Char x  )  [inline]

Return false on failure and true on success.

Definition at line 642 of file CDR_Stream.inl.

{
  if (this->char_translator_ == 0)
    {
      void *temp = &x;
      return this->read_1 (reinterpret_cast<ACE_CDR::Octet*> (temp));
    }
  return this->char_translator_->read_char (*this, x);
}

ACE_CDR::Boolean ACE_InputCDR::read_char_array ( ACE_CDR::Char x,
ACE_CDR::ULong  length 
) [inline]

The buffer x must be large enough to contain length elements. Return false on failure and true on success.

Definition at line 722 of file CDR_Stream.inl.

{
  // Make sure the length of the array isn't greater than the length of
  // the stream.
  if (length > this->length ())
    {
      this->good_bit_ = false;
      return false;
    }

  if (this->char_translator_ == 0)
    return this->read_array (x,
                             ACE_CDR::OCTET_SIZE,
                             ACE_CDR::OCTET_ALIGN,
                             length);
  return this->char_translator_->read_char_array (*this, x, length);
}

ACE_CDR::Boolean ACE_InputCDR::read_double ( ACE_CDR::Double x  )  [inline]

Return false on failure and true on success.

Definition at line 703 of file CDR_Stream.inl.

{
  void *temp = &x;
  return this->read_8 (reinterpret_cast<ACE_CDR::ULongLong*> (temp));
}

ACE_CDR::Boolean ACE_InputCDR::read_double_array ( ACE_CDR::Double x,
ACE_CDR::ULong  length 
) [inline]

The buffer x must be large enough to contain length elements. Return false on failure and true on success.

Definition at line 911 of file CDR_Stream.inl.

{
  // Make sure the length of the array isn't greater than the length of
  // the stream.
  if (length * ACE_CDR::LONGLONG_SIZE > this->length ())
    {
      this->good_bit_ = false;
      return false;
    }

  return this->read_array (x,
                           ACE_CDR::LONGLONG_SIZE,
                           ACE_CDR::LONGLONG_ALIGN,
                           length);
}

ACE_CDR::Boolean ACE_InputCDR::read_float ( ACE_CDR::Float x  )  [inline]

Return false on failure and true on success.

Definition at line 696 of file CDR_Stream.inl.

{
  void *temp = &x;
  return this->read_4 (reinterpret_cast<ACE_CDR::ULong*> (temp));
}

ACE_CDR::Boolean ACE_InputCDR::read_float_array ( ACE_CDR::Float x,
ACE_CDR::ULong  length 
) [inline]

The buffer x must be large enough to contain length elements. Return false on failure and true on success.

Definition at line 892 of file CDR_Stream.inl.

{
  // Make sure the length of the array isn't greater than the length of
  // the stream.
  if (length * ACE_CDR::LONG_SIZE > this->length ())
    {
      this->good_bit_ = false;
      return false;
    }

  return this->read_array (x,
                           ACE_CDR::LONG_SIZE,
                           ACE_CDR::LONG_ALIGN,
                           length);
}

ACE_CDR::Boolean ACE_InputCDR::read_long ( ACE_CDR::Long x  )  [inline]

Return false on failure and true on success.

Definition at line 668 of file CDR_Stream.inl.

{
  void *temp = &x;
  return this->read_4 (reinterpret_cast<ACE_CDR::ULong*> (temp));
}

ACE_CDR::Boolean ACE_InputCDR::read_long_array ( ACE_CDR::Long x,
ACE_CDR::ULong  length 
) [inline]

The buffer x must be large enough to contain length elements. Return false on failure and true on success.

Definition at line 820 of file CDR_Stream.inl.

{
  // Make sure the length of the array isn't greater than the length of
  // the stream.
  if (length * ACE_CDR::LONG_SIZE > this->length ())
    {
      this->good_bit_ = false;
      return false;
    }

  return this->read_array (x,
                           ACE_CDR::LONG_SIZE,
                           ACE_CDR::LONG_ALIGN,
                           length);
}

ACE_CDR::Boolean ACE_InputCDR::read_longdouble ( ACE_CDR::LongDouble x  )  [inline]

Return false on failure and true on success.

Definition at line 710 of file CDR_Stream.inl.

{
  return this->read_16 (&x);
}

ACE_CDR::Boolean ACE_InputCDR::read_longdouble_array ( ACE_CDR::LongDouble x,
ACE_CDR::ULong  length 
) [inline]

The buffer x must be large enough to contain length elements. Return false on failure and true on success.

Definition at line 929 of file CDR_Stream.inl.

{
  // Make sure the length of the array isn't greater than the length of
  // the stream.
  if (length * ACE_CDR::LONGDOUBLE_SIZE > this->length ())
    {
      this->good_bit_ = false;
      return false;
    }
  return this->read_array (x,
                           ACE_CDR::LONGDOUBLE_SIZE,
                           ACE_CDR::LONGDOUBLE_ALIGN,
                           length);
}

ACE_CDR::Boolean ACE_InputCDR::read_longlong ( ACE_CDR::LongLong x  )  [inline]

Return false on failure and true on success.

Definition at line 683 of file CDR_Stream.inl.

{
  void *temp = &x;
  return this->read_8 (reinterpret_cast<ACE_CDR::ULongLong*> (temp));
}

ACE_CDR::Boolean ACE_InputCDR::read_longlong_array ( ACE_CDR::LongLong x,
ACE_CDR::ULong  length 
) [inline]

The buffer x must be large enough to contain length elements. Return false on failure and true on success.

Definition at line 856 of file CDR_Stream.inl.

{
  // Make sure the length of the array isn't greater than the length of
  // the stream.
  if (length * ACE_CDR::LONGLONG_SIZE > this->length ())
    {
      this->good_bit_ = false;
      return false;
    }

  return this->read_array (x,
                           ACE_CDR::LONGLONG_SIZE,
                           ACE_CDR::LONGLONG_ALIGN,
                           length);
}

ACE_CDR::Boolean ACE_InputCDR::read_octet ( ACE_CDR::Octet x  )  [inline]

Return false on failure and true on success.

Definition at line 627 of file CDR_Stream.inl.

{
  return this->read_1 (&x);
}

ACE_CDR::Boolean ACE_InputCDR::read_octet_array ( ACE_CDR::Octet x,
ACE_CDR::ULong  length 
) [inline]

The buffer x must be large enough to contain length elements. Return false on failure and true on success.

Definition at line 766 of file CDR_Stream.inl.

{
  // Make sure the length of the array isn't greater than the length of
  // the stream.
  if (length * ACE_CDR::OCTET_SIZE > this->length ())
    {
      this->good_bit_ = false;
      return false;
    }

  return this->read_array (x,
                           ACE_CDR::OCTET_SIZE,
                           ACE_CDR::OCTET_ALIGN,
                           length);
}

ACE_CDR::Boolean ACE_InputCDR::read_short ( ACE_CDR::Short x  )  [inline]

Return false on failure and true on success.

Definition at line 654 of file CDR_Stream.inl.

{
  void *temp = &x;
  return this->read_2 (reinterpret_cast<ACE_CDR::UShort*> (temp));
}

ACE_CDR::Boolean ACE_InputCDR::read_short_array ( ACE_CDR::Short x,
ACE_CDR::ULong  length 
) [inline]

The buffer x must be large enough to contain length elements. Return false on failure and true on success.

Definition at line 784 of file CDR_Stream.inl.

{
  // Make sure the length of the array isn't greater than the length of
  // the stream.
  if (length * ACE_CDR::SHORT_SIZE > this->length ())
    {
      this->good_bit_ = false;
      return false;
    }

  return this->read_array (x,
                           ACE_CDR::SHORT_SIZE,
                           ACE_CDR::SHORT_ALIGN,
                           length);
}

ACE_CDR::Boolean ACE_InputCDR::read_string ( ACE_CString x  ) 

Return false on failure and true on success.

Definition at line 1339 of file CDR_Stream.cpp.

{
  ACE_CDR::Char * data = 0;
  if (this->read_string (data))
    {
      ACE_Auto_Basic_Array_Ptr<ACE_CDR::Char> safe_data (data);
      x = data;
      return true;
    }

  x = "";
  return (this->good_bit_ = false);
}

ACE_CDR::Boolean ACE_InputCDR::read_string ( ACE_CDR::Char *&  x  ) 

Return false on failure and true on success.

Definition at line 1290 of file CDR_Stream.cpp.

{
  // @@ This is a slight violation of "Optimize for the common case",
  // i.e. normally the translator will be 0, but OTOH the code is
  // smaller and should be better for the cache ;-) ;-)
  if (this->char_translator_ != 0)
    {
      this->good_bit_ = this->char_translator_->read_string (*this, x);
      return this->good_bit_;
    }

  ACE_CDR::ULong len = 0;

  if (!this->read_ulong (len))
    return false;

  // A check for the length being too great is done later in the
  // call to read_char_array but we want to have it done before
  // the memory is allocated.
  if (len > 0 && len <= this->length())
    {
      ACE_NEW_RETURN (x,
                      ACE_CDR::Char[len],
                      0);

      ACE_Auto_Basic_Array_Ptr<ACE_CDR::Char> safe_data (x);

      if (this->read_char_array (x, len))
        {
          (void) safe_data.release ();
          return true;
        }
    }
  else if (len == 0)
    {
      // Convert any null strings to empty strings since empty
      // strings can cause crashes. (See bug 58.)
      ACE_NEW_RETURN (x,
                      ACE_CDR::Char[1],
                      0);
      ACE_OS::strcpy (const_cast<char *&> (x), "");
      return true;
    }

  x = 0;
  return (this->good_bit_ = false);
}

ACE_CDR::Boolean ACE_InputCDR::read_ulong ( ACE_CDR::ULong x  )  [inline]

Return false on failure and true on success.

Definition at line 676 of file CDR_Stream.inl.

{
  return this->read_4 (&x);
}

ACE_CDR::Boolean ACE_InputCDR::read_ulong_array ( ACE_CDR::ULong x,
ACE_CDR::ULong  length 
) [inline]

The buffer x must be large enough to contain length elements. Return false on failure and true on success.

Definition at line 838 of file CDR_Stream.inl.

{
  // Make sure the length of the array isn't greater than the length of
  // the stream.
  if (length * ACE_CDR::LONG_SIZE > this->length ())
    {
      this->good_bit_ = false;
      return false;
    }

  return this->read_array (x,
                           ACE_CDR::LONG_SIZE,
                           ACE_CDR::LONG_ALIGN,
                           length);
}

ACE_CDR::Boolean ACE_InputCDR::read_ulonglong ( ACE_CDR::ULongLong x  )  [inline]

Return false on failure and true on success.

Definition at line 690 of file CDR_Stream.inl.

{
  return this->read_8 (&x);
}

ACE_CDR::Boolean ACE_InputCDR::read_ulonglong_array ( ACE_CDR::ULongLong x,
ACE_CDR::ULong  length 
) [inline]

The buffer x must be large enough to contain length elements. Return false on failure and true on success.

Definition at line 874 of file CDR_Stream.inl.

{
  // Make sure the length of the array isn't greater than the length of
  // the stream.
  if (length * ACE_CDR::LONGLONG_SIZE > this->length ())
    {
      this->good_bit_ = false;
      return false;
    }

  return this->read_array (x,
                           ACE_CDR::LONGLONG_SIZE,
                           ACE_CDR::LONGLONG_ALIGN,
                           length);
}

ACE_CDR::Boolean ACE_InputCDR::read_ushort ( ACE_CDR::UShort x  )  [inline]

Return false on failure and true on success.

Definition at line 661 of file CDR_Stream.inl.

{
  return this->read_2 (&x);
}

ACE_CDR::Boolean ACE_InputCDR::read_ushort_array ( ACE_CDR::UShort x,
ACE_CDR::ULong  length 
) [inline]

The buffer x must be large enough to contain length elements. Return false on failure and true on success.

Definition at line 802 of file CDR_Stream.inl.

{
  // Make sure the length of the array isn't greater than the length of
  // the stream.
  if (length * ACE_CDR::SHORT_SIZE > this->length ())
    {
      this->good_bit_ = false;
      return false;
    }

  return this->read_array (x,
                           ACE_CDR::SHORT_SIZE,
                           ACE_CDR::SHORT_ALIGN,
                           length);
}

ACE_CDR::Boolean ACE_InputCDR::read_wchar ( ACE_CDR::WChar x  ) 

Return false on failure and true on success.

Definition at line 1191 of file CDR_Stream.cpp.

{
  if (this->wchar_translator_ != 0)
    {
      this->good_bit_ = this->wchar_translator_->read_wchar (*this,x);
      return this->good_bit_;
    }
  if (ACE_OutputCDR::wchar_maxbytes_ == 0)
    {
      errno = EACCES;
      return (this->good_bit_ = false);
    }

  if (ACE_OutputCDR::wchar_maxbytes_ == sizeof (ACE_CDR::WChar))
    {
      if (static_cast<ACE_CDR::Short> (major_version_) == 1
          && static_cast<ACE_CDR::Short> (minor_version_) == 2)
        {
          ACE_CDR::Octet len;

          if (this->read_1 (&len))
            return this->read_array
              (reinterpret_cast<ACE_CDR::Octet*> (&x),
               static_cast<ACE_CDR::ULong> (len),
               ACE_CDR::OCTET_ALIGN,
               1);

          else
            return (this->good_bit_ = false);
        }

      void * const temp = &x;
      if (sizeof (ACE_CDR::WChar) == 2)
        return this->read_2 (reinterpret_cast<ACE_CDR::UShort *> (temp));
      else
        return this->read_4 (reinterpret_cast<ACE_CDR::ULong *> (temp));
    }

  if (static_cast<ACE_CDR::Short> (major_version_) == 1
      && static_cast<ACE_CDR::Short> (minor_version_) == 2)
    {
      ACE_CDR::Octet len;

      if (this->read_1 (&len))
        {
          if (len == 2)
            {
              ACE_CDR::Short sx;
              if (this->read_array
                  (reinterpret_cast<ACE_CDR::Octet*> (&sx),
                   static_cast<ACE_CDR::ULong> (len),
                   ACE_CDR::OCTET_ALIGN,
                   1))
                {
                  x = static_cast<ACE_CDR::WChar> (sx);
                  return true;
                }
            }
          else
            {
              ACE_CDR::Octet ox;
              if (this->read_array
                  (reinterpret_cast<ACE_CDR::Octet*> (&ox),
                   static_cast<ACE_CDR::ULong> (len),
                   ACE_CDR::OCTET_ALIGN,
                   1))
                {
                  x = static_cast<ACE_CDR::WChar> (ox);
                  return true;
                }
            }
        }
    }
  else
    {
      if (ACE_OutputCDR::wchar_maxbytes_ == 2)
        {
          ACE_CDR::UShort sx;
          if (this->read_2 (reinterpret_cast<ACE_CDR::UShort *> (&sx)))
            {
              x = static_cast<ACE_CDR::WChar> (sx);
              return true;
            }
        }
      else
        {
          ACE_CDR::Octet ox;
          if (this->read_1 (&ox))
            {
              x = static_cast<ACE_CDR::WChar> (ox);
              return true;
            }

        }
    }
  return (this->good_bit_ = false);
}

ACE_CDR::Boolean ACE_InputCDR::read_wchar_array ( ACE_CDR::WChar x,
ACE_CDR::ULong  length 
) [inline]

The buffer x must be large enough to contain length elements. Return false on failure and true on success.

Definition at line 742 of file CDR_Stream.inl.

{
  // Make sure the length of the array isn't greater than the length of
  // the stream.
  if (length * ACE_OutputCDR::wchar_maxbytes_ > this->length ())
    {
      this->good_bit_ = false;
      return false;
    }

  if (this->wchar_translator_ != 0)
    return this->wchar_translator_->read_wchar_array (*this, x, length);
  if (ACE_OutputCDR::wchar_maxbytes_ != sizeof (ACE_CDR::WChar))
    return this->read_wchar_array_i (x, length);
  return this->read_array (x,
                           sizeof (ACE_CDR::WChar),
                           sizeof (ACE_CDR::WChar) == 2
                           ? ACE_CDR::SHORT_ALIGN
                           : ACE_CDR::LONG_ALIGN,
                           length);
}

ACE_CDR::Boolean ACE_InputCDR::read_wchar_array_i ( ACE_CDR::WChar x,
ACE_CDR::ULong  length 
) [private]

On those occasions when the native codeset for wchar is smaller than the size of a wchar_t, such as using UTF-16 with a 4-byte wchar_t, a special form of reading the array is needed. Actually, this should be a default translator.

Definition at line 1490 of file CDR_Stream.cpp.

{
  if (length == 0)
    return true;
  char* buf = 0;
  size_t const align = (ACE_OutputCDR::wchar_maxbytes_ == 2) ?
    ACE_CDR::SHORT_ALIGN :
    ACE_CDR::OCTET_ALIGN;

  if (this->adjust (ACE_OutputCDR::wchar_maxbytes_ * length, align, buf) == 0)
    {
      if (ACE_OutputCDR::wchar_maxbytes_ == 2)
        {
          ACE_CDR::UShort *sb = reinterpret_cast<ACE_CDR::UShort *> (buf);
          for (size_t i = 0; i < length; ++i)
#if defined (ACE_DISABLE_SWAP_ON_READ)
            x[i] = static_cast<ACE_CDR::WChar> (sb[i]);
#else
            if (!this->do_byte_swap_)
              x[i] = static_cast<ACE_CDR::WChar> (sb[i]);
            else
              {
                ACE_CDR::UShort sx;
                ACE_CDR::swap_2 (&buf[i * 2], reinterpret_cast<char *> (&sx));
                x[i] = static_cast<ACE_CDR::WChar> (sx);
              }
#endif /* ACE_DISABLE_SWAP_ON_READ */
        }
      else
        {
          for (size_t i = 0; i < length; ++i)
            x[i] = static_cast<ACE_CDR::Octet> (buf[i]);
        }
      return this->good_bit_;
    }
  return false;
}

ACE_CDR::Boolean ACE_InputCDR::read_wstring ( ACE_CDR::WChar *&  x  ) 

Return false on failure and true on success.

Definition at line 1354 of file CDR_Stream.cpp.

{
  // @@ This is a slight violation of "Optimize for the common case",
  // i.e. normally the translator will be 0, but OTOH the code is
  // smaller and should be better for the cache ;-) ;-)
  if (this->wchar_translator_ != 0)
    {
      this->good_bit_ = this->wchar_translator_->read_wstring (*this, x);
      return this->good_bit_;
    }
  if (ACE_OutputCDR::wchar_maxbytes_ == 0)
    {
      errno = EACCES;
      return (this->good_bit_ = false);
    }

  ACE_CDR::ULong len = 0;

  if (!this->read_ulong (len))
    {
      return false;
    }

  // A check for the length being too great is done later in the
  // call to read_char_array but we want to have it done before
  // the memory is allocated.
  if (len > 0 && len <= this->length ())
    {
      ACE_Auto_Basic_Array_Ptr<ACE_CDR::WChar> safe_data;

      if (static_cast<ACE_CDR::Short> (this->major_version_) == 1
          && static_cast<ACE_CDR::Short> (this->minor_version_) == 2)
        {
          len /=
            ACE_Utils::truncate_cast<ACE_CDR::ULong> (
              ACE_OutputCDR::wchar_maxbytes_);

          //allocating one extra for the null character needed by applications
          ACE_NEW_RETURN (x,
                          ACE_CDR::WChar [len + 1],
                          false);

          ACE_auto_ptr_reset (safe_data, x);

          if (this->read_wchar_array (x, len))
            {

              //Null character used by applications to find the end of
              //the wstring
              //Is this okay with the GIOP 1.2 spec??
              x[len] = '\x00';

              (void) safe_data.release ();

              return true;
            }
        }
      else
        {
          ACE_NEW_RETURN (x,
                          ACE_CDR::WChar [len],
                          false);

          ACE_auto_ptr_reset (safe_data, x);

          if (this->read_wchar_array (x, len))
            {
              (void) safe_data.release ();

              return true;
            }
        }
    }
  else if (len == 0)
    {
      // Convert any null strings to empty strings since empty
      // strings can cause crashes. (See bug 58.)
      ACE_NEW_RETURN (x,
                      ACE_CDR::WChar[1],
                      false);
      x[0] = '\x00';
      return true;
    }

  this->good_bit_ = false;
  x = 0;
  return false;
}

void ACE_InputCDR::reset ( const ACE_Message_Block data,
int  byte_order 
)

Re-initialize the CDR stream, copying the contents of the chain of message_blocks starting from data.

Definition at line 1747 of file CDR_Stream.cpp.

{
  this->reset_byte_order (byte_order);
  ACE_CDR::consolidate (&this->start_, data);

#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
  this->monitor_->receive (this->start_.total_size ());
#endif /* ACE_HAS_MONITOR_POINTS==1 */
}

void ACE_InputCDR::reset_byte_order ( int  byte_order  )  [inline]

After reading and partially parsing the contents the user can detect a change in the byte order, this method will let him/her change it.

Definition at line 1473 of file CDR_Stream.inl.

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

void ACE_InputCDR::reset_contents ( void   ) 

Re-initialize the CDR stream, forgetting about the old contents of the stream and allocating a new buffer (from the allocators).

Definition at line 1970 of file CDR_Stream.cpp.

{
  this->start_.data_block (this->start_.data_block ()->clone_nocopy ());

  // Reset the flags...
  this->start_.clr_self_flags (ACE_Message_Block::DONT_DELETE);

#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
  this->monitor_->receive (this->start_.total_size ());
#endif /* ACE_HAS_MONITOR_POINTS==1 */
}

void ACE_InputCDR::set_version ( ACE_CDR::Octet  major,
ACE_CDR::Octet  minor 
) [inline]

Set the underlying GIOP version..

Definition at line 1511 of file CDR_Stream.inl.

{
  this->major_version_ = major;
  this->minor_version_ = minor;
}

ACE_CDR::Boolean ACE_InputCDR::skip_boolean ( void   )  [inline]

Return false on failure and true on success.

Definition at line 959 of file CDR_Stream.inl.

{
  return this->skip_octet () && this->good_bit_;
}

ACE_CDR::Boolean ACE_InputCDR::skip_bytes ( size_t  n  ) 

Skip n bytes in the CDR stream.

Returns:
false on failure and true on success.

Definition at line 1716 of file CDR_Stream.cpp.

{
  if (this->rd_ptr () + len <= this->wr_ptr ())
    {
      this->rd_ptr (len);
      return true;
    }
  this->good_bit_ = false;
  return false;
}

ACE_CDR::Boolean ACE_InputCDR::skip_char ( void   )  [inline]

Return false on failure and true on success.

Definition at line 953 of file CDR_Stream.inl.

{
  return this->skip_octet ();  // sizeof (Char) == sizeof (Octet)
}

ACE_CDR::Boolean ACE_InputCDR::skip_double ( void   )  [inline]

Return false on failure and true on success.

Definition at line 1010 of file CDR_Stream.inl.

{
  return this->skip_ulonglong ();  // sizeof(Double) == sizeof (ULongLong)
}

ACE_CDR::Boolean ACE_InputCDR::skip_float ( void   )  [inline]

Return false on failure and true on success.

Definition at line 1004 of file CDR_Stream.inl.

{
  return this->skip_ulong ();  // sizeof(Float) == sizeof (ULong)
}

ACE_CDR::Boolean ACE_InputCDR::skip_long ( void   )  [inline]

Return false on failure and true on success.

Definition at line 985 of file CDR_Stream.inl.

{
  return this->skip_ulong ();  // sizeof (Long) == sizeof (ULong)
}

ACE_CDR::Boolean ACE_InputCDR::skip_longdouble ( void   )  [inline]

Return false on failure and true on success.

Definition at line 1016 of file CDR_Stream.inl.

{
  ACE_CDR::LongDouble x;
  return this->read_16 (&x);
}

ACE_CDR::Boolean ACE_InputCDR::skip_longlong ( void   )  [inline]

Return false on failure and true on success.

Definition at line 998 of file CDR_Stream.inl.

{
  return this->skip_ulonglong ();  // sizeof (LongLong) == sizeof (ULongLong)
}

ACE_CDR::Boolean ACE_InputCDR::skip_octet ( void   )  [inline]

Return false on failure and true on success.

Definition at line 946 of file CDR_Stream.inl.

{
  ACE_CDR::Octet x;
  return this->read_1 (&x);
}

ACE_CDR::Boolean ACE_InputCDR::skip_short ( void   )  [inline]

Return false on failure and true on success.

Definition at line 972 of file CDR_Stream.inl.

{
  return this->skip_ushort ();
}

ACE_CDR::Boolean ACE_InputCDR::skip_string ( void   ) 

Definition at line 1682 of file CDR_Stream.cpp.

{
  ACE_CDR::ULong len = 0;
  if (this->read_ulong (len))
    {
      if (this->rd_ptr () + len <= this->wr_ptr ())
        {
          this->rd_ptr (len);
          return true;
        }
      this->good_bit_ = false;
    }
  return false;
}

ACE_CDR::Boolean ACE_InputCDR::skip_ulong ( void   )  [inline]

Return false on failure and true on success.

Definition at line 978 of file CDR_Stream.inl.

{
  ACE_CDR::ULong x;
  return this->read_4 (&x);
}

ACE_CDR::Boolean ACE_InputCDR::skip_ulonglong ( void   )  [inline]

Return false on failure and true on success.

Definition at line 991 of file CDR_Stream.inl.

{
  ACE_CDR::ULongLong x;
  return this->read_8 (&x);
}

ACE_CDR::Boolean ACE_InputCDR::skip_ushort ( void   )  [inline]

Return false on failure and true on success.

Definition at line 965 of file CDR_Stream.inl.

{
  ACE_CDR::UShort x;
  return this->read_2 (&x);
}

ACE_CDR::Boolean ACE_InputCDR::skip_wchar ( void   ) 

Return false on failure and true on success.

Definition at line 1168 of file CDR_Stream.cpp.

{
  if (static_cast<ACE_CDR::Short> (major_version_) == 1
      && static_cast<ACE_CDR::Short> (minor_version_) == 2)
    {
      ACE_CDR::Octet len;
      if (this->read_1 (&len))
        return this->skip_bytes (static_cast<size_t> (len));
    }
  else
    {
      ACE_CDR::WChar x;
      void * const temp = &x;
      if (ACE_OutputCDR::wchar_maxbytes_ == 2)
        return this->read_2 (reinterpret_cast<ACE_CDR::UShort *> (temp));
      else
        return this->read_4 (reinterpret_cast<ACE_CDR::ULong *> (temp));
    }

  return (this->good_bit_ = false);
}

ACE_CDR::Boolean ACE_InputCDR::skip_wstring ( void   ) 

The next field must be a string, this method skips it. It is useful in parsing a TypeCode.

Returns:
false on failure and true on success.

Definition at line 1698 of file CDR_Stream.cpp.

{
  ACE_CDR::ULong len = 0;
  ACE_CDR::Boolean continue_skipping = read_ulong (len);

  if (continue_skipping && len != 0)
    {
      if (static_cast<ACE_CDR::Short> (this->major_version_) == 1
            && static_cast<ACE_CDR::Short> (this->minor_version_) == 2)
          continue_skipping = this->skip_bytes ((size_t)len);
      else
        while (continue_skipping && len--)
          continue_skipping = this->skip_wchar ();
    }
  return continue_skipping;
}

const ACE_Message_Block * ACE_InputCDR::start ( void   )  const [inline]
Returns:
The start of the message block chain for this CDR stream.
Note:
In the current implementation the chain has length 1, but we are planning to change that.

Definition at line 1079 of file CDR_Stream.inl.

{
  return &this->start_;
}

ACE_Message_Block * ACE_InputCDR::steal_contents ( void   ) 

Steal the contents from the current CDR.

Definition at line 1951 of file CDR_Stream.cpp.

{
  ACE_Message_Block* block = this->start_.clone ();
  this->start_.data_block (block->data_block ()->clone ());

  // If at all our message had a DONT_DELETE flag set, just clear it
  // off.
  this->start_.clr_self_flags (ACE_Message_Block::DONT_DELETE);

  ACE_CDR::mb_align (&this->start_);

#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
  this->monitor_->receive (this->start_.total_size ());
#endif /* ACE_HAS_MONITOR_POINTS==1 */

  return block;
}

void ACE_InputCDR::steal_from ( ACE_InputCDR cdr  ) 

Steal the contents of cdr and make a shallow copy into this stream.

Definition at line 1759 of file CDR_Stream.cpp.

{
  this->do_byte_swap_ = cdr.do_byte_swap_;
  this->start_.data_block (cdr.start_.data_block ()->duplicate ());

  // If the message block had a DONT_DELETE flags, just clear it off..
  this->start_.clr_self_flags (ACE_Message_Block::DONT_DELETE);
  this->start_.rd_ptr (cdr.start_.rd_ptr ());

  this->start_.wr_ptr (cdr.start_.wr_ptr ());
  this->major_version_ = cdr.major_version_;
  this->minor_version_ = cdr.minor_version_;
  cdr.reset_contents ();

#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
  this->monitor_->receive (this->start_.total_size ());
#endif /* ACE_HAS_MONITOR_POINTS==1 */
}

void ACE_InputCDR::wchar_translator ( ACE_WChar_Codeset_Translator wctran  )  [inline]

Definition at line 1544 of file CDR_Stream.inl.

{
  this->wchar_translator_ = wctran;
}

ACE_WChar_Codeset_Translator * ACE_InputCDR::wchar_translator ( void   )  const [inline]

Definition at line 1531 of file CDR_Stream.inl.

{
  return this->wchar_translator_;
}

char * ACE_InputCDR::wr_ptr ( void   )  [inline]

Returns the current position for the wr_ptr.

Definition at line 1041 of file CDR_Stream.inl.

{
  return this->start_.wr_ptr ();
}


Friends And Related Function Documentation

friend class ACE_Char_Codeset_Translator [friend]

Definition at line 628 of file CDR_Stream.h.

friend class ACE_WChar_Codeset_Translator [friend]

Definition at line 629 of file CDR_Stream.h.


Member Data Documentation

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

Definition at line 1014 of file CDR_Stream.h.

bool ACE_InputCDR::do_byte_swap_ [protected]

The CDR stream byte order does not match the one on the machine, swapping is needed while reading.

Definition at line 1004 of file CDR_Stream.h.

bool ACE_InputCDR::good_bit_ [protected]

set to false when an error occurs.

Definition at line 1007 of file CDR_Stream.h.

The GIOP versions for this stream.

Definition at line 1010 of file CDR_Stream.h.

Definition at line 1011 of file CDR_Stream.h.

The start of the chain of message blocks, even though in the current version the chain always has length 1.

Definition at line 1000 of file CDR_Stream.h.

Definition at line 1015 of file CDR_Stream.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines