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

ACE_CDR Class Reference

Keep constants and some routines common to both Output and Input CDR streams. More...

#include <CDR_Base.h>

List of all members.

Public Types

typedef u_char Boolean
typedef u_char Octet
typedef char Char
typedef ACE_OS::WChar WChar
typedef ACE_INT16 Short
typedef ACE_UINT16 UShort
typedef ACE_INT32 Long
typedef ACE_UINT32 ULong
typedef ACE_UINT64 ULongLong
typedef long long LongLong
enum  {
  OCTET_SIZE = 1, SHORT_SIZE = 2, LONG_SIZE = 4, LONGLONG_SIZE = 8,
  LONGDOUBLE_SIZE = 16, OCTET_ALIGN = 1, SHORT_ALIGN = 2, LONG_ALIGN = 4,
  LONGLONG_ALIGN = 8, LONGDOUBLE_ALIGN = 8, MAX_ALIGNMENT = 8, DEFAULT_BUFSIZE = ACE_DEFAULT_CDR_BUFSIZE,
  EXP_GROWTH_MAX = ACE_DEFAULT_CDR_EXP_GROWTH_MAX, LINEAR_GROWTH_CHUNK = ACE_DEFAULT_CDR_LINEAR_GROWTH_CHUNK
}

Static Public Methods

void swap_2 (const char *orig, char *target)
void swap_4 (const char *orig, char *target)
void swap_8 (const char *orig, char *target)
void swap_16 (const char *orig, char *target)
void swap_2_array (const char *orig, char *target, size_t length)
void swap_4_array (const char *orig, char *target, size_t length)
void swap_8_array (const char *orig, char *target, size_t length)
void swap_16_array (const char *orig, char *target, size_t length)
void mb_align (ACE_Message_Block *mb)
 Align the message block to ACE_CDR::MAX_ALIGNMENT, set by the CORBA spec at 8 bytes. More...

size_t first_size (size_t minsize)
size_t next_size (size_t minsize)
 Compute not the smallest, but the second smallest buffer that will fir <minsize> bytes. More...

int grow (ACE_Message_Block *mb, size_t minsize)
void consolidate (ACE_Message_Block *dst, const ACE_Message_Block *src)
 Copy a message block chain into a single message block, preserving the alignment of the first message block of the original stream, not the following message blocks. More...

size_t total_length (const ACE_Message_Block *begin, const ACE_Message_Block *end)


Detailed Description

Keep constants and some routines common to both Output and Input CDR streams.

Definition at line 48 of file CDR_Base.h.


Member Typedef Documentation

typedef u_char ACE_CDR::Boolean
 

Definition at line 166 of file CDR_Base.h.

Referenced by ACE_OutputCDR::append_boolean, ACE_OutputCDR::append_string, ACE_OutputCDR::append_wstring, ACE_OutputCDR::from_boolean::from_boolean, ACE_OutputCDR::from_string::from_string, ACE_OutputCDR::from_wstring::from_wstring, operator<<, operator>>, ACE_InputCDR::read_boolean, ACE_InputCDR::read_boolean_array, ACE_InputCDR::skip_wstring, ACE_InputCDR::to_boolean::to_boolean, ACE_OutputCDR::write_boolean, and ACE_OutputCDR::write_boolean_array.

typedef char ACE_CDR::Char
 

Definition at line 170 of file CDR_Base.h.

Referenced by ACE_OutputCDR::append_char, ACE_OutputCDR::append_string, ACE_OutputCDR::from_char::from_char, ACE_OutputCDR::from_string::from_string, operator<<, operator>>, ACE_InputCDR::read_char, ACE_InputCDR::read_char_array, ACE_InputCDR::read_string, ACE_InputCDR::skip_char, ACE_InputCDR::to_char::to_char, ACE_InputCDR::to_string::to_string, ACE_OutputCDR::write_char, ACE_OutputCDR::write_char_array, and ACE_OutputCDR::write_string.

typedef ACE_INT32 ACE_CDR::Long
 

Definition at line 174 of file CDR_Base.h.

Referenced by ACE_InputCDR::ACE_InputCDR, ACE_OutputCDR::append_long, operator<<, operator>>, ACE_InputCDR::read_long, ACE_InputCDR::read_long_array, ACE_InputCDR::skip_long, ACE_OutputCDR::write_long, and ACE_OutputCDR::write_long_array.

typedef long long ACE_CDR::LongLong
 

Definition at line 191 of file CDR_Base.h.

Referenced by ACE_OutputCDR::append_longlong, operator<<, operator>>, ACE_InputCDR::read_longlong, ACE_InputCDR::read_longlong_array, ACE_InputCDR::skip_longlong, ACE_OutputCDR::write_longlong, and ACE_OutputCDR::write_longlong_array.

typedef u_char ACE_CDR::Octet
 

Definition at line 169 of file CDR_Base.h.

Referenced by ACE_InputCDR::ACE_InputCDR, ACE_OutputCDR::ACE_OutputCDR, ACE_OutputCDR::append_octet, ACE_InputCDR::exchange_data_blocks, ACE_OutputCDR::from_octet::from_octet, ACE_InputCDR::get_version, ACE_OutputCDR::get_version, operator<<, ACE_WChar_Codeset_Translator::read_1, ACE_Char_Codeset_Translator::read_1, ACE_InputCDR::read_1, ACE_InputCDR::read_boolean, ACE_InputCDR::read_char, ACE_InputCDR::read_octet, ACE_InputCDR::read_octet_array, ACE_InputCDR::read_wchar, ACE_InputCDR::read_wchar_array_i, ACE_InputCDR::set_version, ACE_OutputCDR::set_version, ACE_InputCDR::skip_boolean, ACE_InputCDR::skip_char, ACE_InputCDR::skip_octet, ACE_InputCDR::skip_wchar, ACE_InputCDR::to_octet::to_octet, ACE_WChar_Codeset_Translator::write_1, ACE_Char_Codeset_Translator::write_1, ACE_OutputCDR::write_1, ACE_OutputCDR::write_boolean, ACE_OutputCDR::write_char, ACE_OutputCDR::write_octet, ACE_OutputCDR::write_octet_array, ACE_OutputCDR::write_wchar, and ACE_OutputCDR::write_wchar_array_i.

typedef ACE_INT16 ACE_CDR::Short
 

Definition at line 172 of file CDR_Base.h.

Referenced by ACE_OutputCDR::append_short, operator<<, operator>>, ACE_InputCDR::read_short, ACE_InputCDR::read_short_array, ACE_InputCDR::read_wchar, ACE_InputCDR::read_wstring, ACE_InputCDR::skip_short, ACE_InputCDR::skip_wchar, ACE_InputCDR::skip_wstring, ACE_OutputCDR::write_short, ACE_OutputCDR::write_short_array, ACE_OutputCDR::write_wchar, and ACE_OutputCDR::write_wstring.

typedef ACE_UINT32 ACE_CDR::ULong
 

Definition at line 175 of file CDR_Base.h.

Referenced by ACE_OutputCDR::append_ulong, ACE_OutputCDR::from_string::from_string, ACE_OutputCDR::from_wstring::from_wstring, ACE_Codeset_Registry::get_max_bytes, ACE_Codeset_Registry::get_max_bytes_i, ACE_Codeset_Registry::is_compatible, ACE_Codeset_Registry::is_compatible_i, ACE_Codeset_Registry::locale_to_registry, ACE_Codeset_Registry::locale_to_registry_i, operator<<, operator>>, ACE_WChar_Codeset_Translator::read_4, ACE_InputCDR::read_4, ACE_WChar_Codeset_Translator::read_array, ACE_Char_Codeset_Translator::read_array, ACE_InputCDR::read_array, ACE_InputCDR::read_boolean_array, ACE_InputCDR::read_char_array, ACE_InputCDR::read_double_array, ACE_InputCDR::read_float, ACE_InputCDR::read_float_array, ACE_InputCDR::read_long, ACE_InputCDR::read_long_array, ACE_InputCDR::read_longdouble_array, ACE_InputCDR::read_longlong_array, ACE_InputCDR::read_octet_array, ACE_InputCDR::read_short_array, ACE_InputCDR::read_string, ACE_InputCDR::read_ulong, ACE_InputCDR::read_ulong_array, ACE_InputCDR::read_ulonglong_array, ACE_InputCDR::read_ushort_array, ACE_InputCDR::read_wchar, ACE_InputCDR::read_wchar_array, ACE_InputCDR::read_wchar_array_i, ACE_InputCDR::read_wstring, ACE_Codeset_Registry::registry_to_locale, ACE_Codeset_Registry::registry_to_locale_i, ACE_InputCDR::skip_float, ACE_InputCDR::skip_long, ACE_InputCDR::skip_string, ACE_InputCDR::skip_ulong, ACE_InputCDR::skip_wchar, ACE_InputCDR::skip_wstring, ACE_InputCDR::to_string::to_string, ACE_InputCDR::to_wstring::to_wstring, ACE_WChar_Codeset_Translator::write_4, ACE_OutputCDR::write_4, ACE_WChar_Codeset_Translator::write_array, ACE_Char_Codeset_Translator::write_array, ACE_OutputCDR::write_array, ACE_OutputCDR::write_boolean_array, ACE_OutputCDR::write_char_array, ACE_OutputCDR::write_double_array, ACE_OutputCDR::write_float, ACE_OutputCDR::write_float_array, ACE_OutputCDR::write_long, ACE_OutputCDR::write_long_array, ACE_OutputCDR::write_longdouble_array, ACE_OutputCDR::write_longlong_array, ACE_OutputCDR::write_octet_array, ACE_OutputCDR::write_octet_array_mb, ACE_OutputCDR::write_short_array, ACE_OutputCDR::write_string, ACE_OutputCDR::write_ulong, ACE_OutputCDR::write_ulong_array, ACE_OutputCDR::write_ulonglong_array, ACE_OutputCDR::write_ushort_array, ACE_OutputCDR::write_wchar, ACE_OutputCDR::write_wchar_array, ACE_OutputCDR::write_wchar_array_i, and ACE_OutputCDR::write_wstring.

typedef ACE_UINT64 ACE_CDR::ULongLong
 

Definition at line 176 of file CDR_Base.h.

Referenced by ACE_OutputCDR::append_ulonglong, operator<<, operator>>, ACE_InputCDR::read_8, ACE_InputCDR::read_double, ACE_InputCDR::read_longlong, ACE_InputCDR::read_ulonglong, ACE_InputCDR::read_ulonglong_array, ACE_InputCDR::skip_double, ACE_InputCDR::skip_longlong, ACE_InputCDR::skip_ulonglong, ACE_OutputCDR::write_8, ACE_OutputCDR::write_double, ACE_OutputCDR::write_longlong, ACE_OutputCDR::write_ulonglong, and ACE_OutputCDR::write_ulonglong_array.

typedef ACE_UINT16 ACE_CDR::UShort
 

Definition at line 173 of file CDR_Base.h.

Referenced by ACE_OutputCDR::append_ushort, ACE_Codeset_Registry::is_compatible_i, ACE_Codeset_Registry::locale_to_registry, ACE_Codeset_Registry::locale_to_registry_i, operator<<, operator>>, ACE_WChar_Codeset_Translator::read_2, ACE_InputCDR::read_2, ACE_InputCDR::read_short, ACE_InputCDR::read_ushort, ACE_InputCDR::read_ushort_array, ACE_InputCDR::read_wchar, ACE_InputCDR::read_wchar_array_i, ACE_Codeset_Registry::registry_to_locale, ACE_Codeset_Registry::registry_to_locale_i, ACE_InputCDR::skip_short, ACE_InputCDR::skip_ushort, ACE_InputCDR::skip_wchar, ACE_WChar_Codeset_Translator::write_2, ACE_OutputCDR::write_2, ACE_OutputCDR::write_short, ACE_OutputCDR::write_ushort, ACE_OutputCDR::write_ushort_array, ACE_OutputCDR::write_wchar, and ACE_OutputCDR::write_wchar_array_i.

typedef ACE_OS::WChar ACE_CDR::WChar
 

Definition at line 171 of file CDR_Base.h.

Referenced by ACE_OutputCDR::append_wchar, ACE_OutputCDR::append_wstring, ACE_OutputCDR::from_wchar::from_wchar, ACE_OutputCDR::from_wstring::from_wstring, operator<<, operator>>, ACE_InputCDR::read_wchar, ACE_InputCDR::read_wchar_array, ACE_InputCDR::read_wchar_array_i, ACE_InputCDR::read_wstring, ACE_InputCDR::skip_wchar, ACE_InputCDR::to_wchar::to_wchar, ACE_InputCDR::to_wstring::to_wstring, ACE_OutputCDR::write_wchar, ACE_OutputCDR::write_wchar_array, ACE_OutputCDR::write_wchar_array_i, and ACE_OutputCDR::write_wstring.


Member Enumeration Documentation

anonymous enum
 

Enumeration values:
OCTET_SIZE 
SHORT_SIZE 
LONG_SIZE 
LONGLONG_SIZE 
LONGDOUBLE_SIZE 
OCTET_ALIGN 
SHORT_ALIGN 
LONG_ALIGN 
LONGLONG_ALIGN 
LONGDOUBLE_ALIGN 
Note:
the CORBA LongDouble alignment requirements do not match its size...
MAX_ALIGNMENT  Maximal CDR 1.1 alignment: "quad precision" FP (i.e. "CDR::Long double", size as above).
DEFAULT_BUFSIZE  The default buffer size.

Todo:
We want to add options to control this default value, so this constant should be read as the default default value ;-)
EXP_GROWTH_MAX  The buffer size grows exponentially until it reaches this size; afterwards it grows linearly using the next constant.
LINEAR_GROWTH_CHUNK  Once exponential growth is ruled out the buffer size increases in chunks of this size, note that this constants have the same value right now, but it does not need to be so.

Definition at line 56 of file CDR_Base.h.

00057   {
00058     // Note that some of these get reused as part of the standard
00059     // binary format: unsigned is the same size as its signed cousin,
00060     // float is LONG_SIZE, and double is LONGLONG_SIZE.
00061 
00062     OCTET_SIZE = 1,
00063     SHORT_SIZE = 2,
00064     LONG_SIZE = 4,
00065     LONGLONG_SIZE = 8,
00066     LONGDOUBLE_SIZE = 16,
00067 
00068     OCTET_ALIGN = 1,
00069     SHORT_ALIGN = 2,
00070     LONG_ALIGN = 4,
00071     LONGLONG_ALIGN = 8,
00072     /// @note the CORBA LongDouble alignment requirements do not
00073     /// match its size...
00074     LONGDOUBLE_ALIGN = 8,
00075 
00076     /// Maximal CDR 1.1 alignment: "quad precision" FP (i.e. "CDR::Long
00077     /// double", size as above).
00078     MAX_ALIGNMENT = 8,
00079 
00080     /// The default buffer size.
00081     /**
00082      * @todo We want to add options to control this
00083      *   default value, so this constant should be read as the default
00084      *   default value ;-)
00085      */
00086     DEFAULT_BUFSIZE = ACE_DEFAULT_CDR_BUFSIZE,
00087 
00088     /// The buffer size grows exponentially until it reaches this size;
00089     /// afterwards it grows linearly using the next constant
00090     EXP_GROWTH_MAX = ACE_DEFAULT_CDR_EXP_GROWTH_MAX,
00091 
00092     /// Once exponential growth is ruled out the buffer size increases
00093     /// in chunks of this size, note that this constants have the same
00094     /// value right now, but it does not need to be so.
00095     LINEAR_GROWTH_CHUNK = ACE_DEFAULT_CDR_LINEAR_GROWTH_CHUNK
00096   };


Member Function Documentation

void ACE_CDR::consolidate ACE_Message_Block   dst,
const ACE_Message_Block   src
[static]
 

Copy a message block chain into a single message block, preserving the alignment of the first message block of the original stream, not the following message blocks.

Definition at line 506 of file CDR_Base.cpp.

References ACE_Message_Block::cont, ACE_Message_Block::copy, first_size, ACE_Message_Block::length, MAX_ALIGNMENT, ACE_Message_Block::rd_ptr, ACE_Message_Block::size, total_length, and ACE_Message_Block::wr_ptr.

Referenced by ACE_InputCDR::reset.

00508 {
00509   if (src == 0)
00510     return;
00511 
00512   size_t newsize =
00513     ACE_CDR::first_size (ACE_CDR::total_length (src, 0)
00514                          + ACE_CDR::MAX_ALIGNMENT);
00515   dst->size (newsize);
00516 
00517   // We must copy the contents of <src> into the new buffer, but
00518   // respecting the alignment.
00519   ptrdiff_t srcalign =
00520     ptrdiff_t(src->rd_ptr ()) % ACE_CDR::MAX_ALIGNMENT;
00521   ptrdiff_t dstalign =
00522     ptrdiff_t(dst->rd_ptr ()) % ACE_CDR::MAX_ALIGNMENT;
00523   int offset = srcalign - dstalign;
00524   if (offset < 0)
00525     offset += ACE_CDR::MAX_ALIGNMENT;
00526   dst->rd_ptr (offset);
00527   dst->wr_ptr (dst->rd_ptr ());
00528 
00529   for (const ACE_Message_Block* i = src;
00530        i != 0;
00531        i = i->cont ())
00532     {
00533       dst->copy (i->rd_ptr (), i->length ());
00534     }
00535 }

ACE_INLINE size_t ACE_CDR::first_size size_t    minsize [static]
 

Compute the size of the smallest buffer that can contain at least <minsize> bytes. To understand how a "best fit" is computed look at the algorithm in the code. Basically the buffers grow exponentially, up to a certain point, then the buffer size grows linearly. The advantage of this algorithm is that is rapidly grows to a large value, but does not explode at the end.

Definition at line 162 of file CDR_Base.inl.

References DEFAULT_BUFSIZE, EXP_GROWTH_MAX, and LINEAR_GROWTH_CHUNK.

Referenced by consolidate, grow, and next_size.

00163 {
00164   if (minsize == 0)
00165     return ACE_CDR::DEFAULT_BUFSIZE;
00166 
00167   size_t newsize = ACE_CDR::DEFAULT_BUFSIZE;
00168   while (newsize < minsize)
00169     {
00170       if (newsize < ACE_CDR::EXP_GROWTH_MAX)
00171         {
00172           // We grow exponentially at the beginning, this is fast and
00173           // reduces the number of allocations.
00174           newsize *= 2;
00175         }
00176       else
00177         {
00178           // but continuing with exponential growth can result in over
00179           // allocations and easily yield an allocation failure.
00180           // So we grow linearly when the buffer is too big.
00181           newsize += ACE_CDR::LINEAR_GROWTH_CHUNK;
00182         }
00183     }
00184   return newsize;
00185 }

int ACE_CDR::grow ACE_Message_Block   mb,
size_t    minsize
[static]
 

Increase the capacity of mb to contain at least <minsize> bytes. If <minsize> is zero the size is increased by an amount at least large enough to contain any of the basic IDL types. Return -1 on failure, 0 on success.

Definition at line 464 of file CDR_Base.cpp.

References ACE_Data_Block::clone_nocopy, ACE_Message_Block::clr_self_flags, ACE_Message_Block::copy, ACE_Message_Block::data_block, ACE_Message_Block::DONT_DELETE, ACE_Data_Block::duplicate, first_size, ACE_Message_Block::length, MAX_ALIGNMENT, mb_align, ACE_Message_Block::rd_ptr, ACE_Data_Block::size, ACE_Message_Block::size, and ACE_Message_Block::wr_ptr.

Referenced by ACE_InputCDR::grow.

00465 {
00466   size_t newsize =
00467     ACE_CDR::first_size (minsize + ACE_CDR::MAX_ALIGNMENT);
00468 
00469   if (newsize <= mb->size ())
00470     return 0;
00471 
00472   ACE_Data_Block *db =
00473     mb->data_block ()->clone_nocopy ();
00474 
00475   if (db->size (newsize) == -1)
00476     return -1;
00477 
00478   ACE_Message_Block tmp (db);
00479   ACE_CDR::mb_align (&tmp);
00480 
00481   tmp.copy (mb->rd_ptr (), mb->length());
00482   mb->data_block (tmp.data_block ()->duplicate ());
00483   mb->rd_ptr (tmp.rd_ptr ());
00484   mb->wr_ptr (tmp.wr_ptr ());
00485 
00486   // Remove the DONT_DELETE flags from mb
00487   mb->clr_self_flags (ACE_Message_Block::DONT_DELETE);
00488 
00489   return 0;
00490 }

ACE_INLINE void ACE_CDR::mb_align ACE_Message_Block   mb [static]
 

Align the message block to ACE_CDR::MAX_ALIGNMENT, set by the CORBA spec at 8 bytes.

Definition at line 153 of file CDR_Base.inl.

References ACE_ptr_align_binary, ACE_Message_Block::base, MAX_ALIGNMENT, ACE_Message_Block::rd_ptr, and ACE_Message_Block::wr_ptr.

Referenced by ACE_InputCDR::ACE_InputCDR, ACE_OutputCDR::ACE_OutputCDR, ACE_InputCDR::clone_from, ACE_InputCDR::grow, grow, ACE_OutputCDR::reset, and ACE_InputCDR::steal_contents.

00154 {
00155   char *start = ACE_ptr_align_binary (mb->base (),
00156                                       ACE_CDR::MAX_ALIGNMENT);
00157   mb->rd_ptr (start);
00158   mb->wr_ptr (start);
00159 }

ACE_INLINE size_t ACE_CDR::next_size size_t    minsize [static]
 

Compute not the smallest, but the second smallest buffer that will fir <minsize> bytes.

Definition at line 188 of file CDR_Base.inl.

References EXP_GROWTH_MAX, first_size, and LINEAR_GROWTH_CHUNK.

Referenced by ACE_OutputCDR::grow_and_adjust.

00189 {
00190   size_t newsize =
00191     ACE_CDR::first_size (minsize);
00192 
00193   if (newsize == minsize)
00194     {
00195       // If necessary increment the size
00196       if (newsize < ACE_CDR::EXP_GROWTH_MAX)
00197         newsize *= 2;
00198       else
00199         newsize += ACE_CDR::LINEAR_GROWTH_CHUNK;
00200     }
00201 
00202   return newsize;
00203 }

ACE_INLINE void ACE_CDR::swap_16 const char *    orig,
char *    target
[static]
 

Definition at line 146 of file CDR_Base.inl.

References swap_8.

Referenced by ACE_InputCDR::read_16, swap_16_array, and ACE_OutputCDR::write_16.

00147 {
00148   swap_8 (orig + 8, target);
00149   swap_8 (orig, target + 8);
00150 }

void ACE_CDR::swap_16_array const char *    orig,
char *    target,
size_t    length
[static]
 

Definition at line 450 of file CDR_Base.cpp.

References swap_16.

Referenced by ACE_InputCDR::read_array, and ACE_OutputCDR::write_array.

00451 {
00452   // ACE_ASSERT(n > 0); The caller checks that n > 0
00453 
00454   const char* const end = orig + 16*n;
00455   while (orig < end)
00456     {
00457       swap_16(orig, target);
00458       orig += 16;
00459       target += 16;
00460     }
00461 }

ACE_INLINE void ACE_CDR::swap_2 const char *    orig,
char *    target
[static]
 

Do byte swapping for each basic IDL type size. There exist only routines to put byte, halfword (2 bytes), word (4 bytes), doubleword (8 bytes) and quadword (16 byte); because those are the IDL basic type sizes.

Definition at line 48 of file CDR_Base.inl.

Referenced by ACE_InputCDR::read_2, ACE_InputCDR::read_wchar_array_i, swap_2_array, ACE_OutputCDR::write_2, and ACE_OutputCDR::write_wchar_array_i.

00049 {
00050 #if defined(ACE_HAS_PENTIUM)
00051 # if defined(__GNUG__)
00052   unsigned short a =
00053     *ACE_reinterpret_cast(const unsigned short*, orig);
00054   asm( "rolw $8, %0" : "=r" (a) : "0" (a) );
00055   *ACE_reinterpret_cast(unsigned short*, target) = a;
00056 # elif (defined(_MSC_VER) || defined(__BORLANDC__)) \
00057        && !defined(ACE_LACKS_INLINE_ASSEMBLY)
00058   __asm mov ebx, orig;
00059   __asm mov ecx, target;
00060   __asm mov ax, [ebx];
00061   __asm rol ax, 8;
00062   __asm mov [ecx], ax;
00063 # else
00064   // For CISC Platforms this is faster than shift/masks.
00065   target[1] = orig[0];
00066   target[0] = orig[1];
00067 # endif
00068 #else
00069   register ACE_UINT16 usrc = * ACE_reinterpret_cast(const ACE_UINT16*, orig);
00070   register ACE_UINT16* udst = ACE_reinterpret_cast(ACE_UINT16*, target);
00071   *udst = (usrc << 8) | (usrc >> 8);
00072 #endif /* ACE_HAS_PENTIUM */
00073 }

void ACE_CDR::swap_2_array const char *    orig,
char *    target,
size_t    length
[static]
 

Definition at line 21 of file CDR_Base.cpp.

References ACE_ptr_align_binary, and swap_2.

Referenced by ACE_InputCDR::read_array, and ACE_OutputCDR::write_array.

00022 {
00023   // ACE_ASSERT(n > 0); The caller checks that n > 0
00024 
00025   // Later, we try to read in 32 or 64 bit chunks,
00026   // so make sure we don't do that for unaligned addresses.
00027 #if ACE_SIZEOF_LONG == 8
00028   const char* const o8 = ACE_ptr_align_binary(orig, 8);
00029   while (orig < o8 && n > 0)
00030     {
00031       ACE_CDR::swap_2 (orig, target);
00032       orig += 2;
00033       target += 2;
00034       --n;
00035     }
00036 #else
00037   const char* const o4 = ACE_ptr_align_binary(orig, 4);
00038   // this is an _if_, not a _while_. The mistmatch can only be by 2.
00039   if (orig != o4)
00040     {
00041       ACE_CDR::swap_2 (orig, target);
00042       orig += 2;
00043       target += 2;
00044       --n;
00045     }
00046 #endif
00047   if (n == 0)
00048     return;
00049 
00050   //
00051   // Loop unrolling. Here be dragons.
00052   //
00053 
00054   // (n & (~3)) is the greatest multiple of 4 not bigger than n.
00055   // In the while loop ahead, orig will move over the array by 8 byte
00056   // increments (4 elements of 2 bytes).
00057   // end marks our barrier for not falling outside.
00058   const char* const end = orig + 2*(n & (~3));
00059 
00060   // See if we're aligned for writting in 64 or 32 bit chunks...
00061 #if ACE_SIZEOF_LONG == 8
00062   if (target == ACE_ptr_align_binary(target, 8))
00063 #else
00064   if (target == ACE_ptr_align_binary(target, 4))
00065 #endif
00066     {
00067       while (orig < end)
00068         {
00069 #if defined(ACE_HAS_PENTIUM) && defined(__GNUG__)
00070           unsigned int a =
00071             * ACE_reinterpret_cast(const unsigned int*, orig);
00072           unsigned int b =
00073             * ACE_reinterpret_cast(const unsigned int*, orig + 4);
00074           asm( "bswap %1"      : "=r" (a) : "0" (a) );
00075           asm( "bswap %1"      : "=r" (b) : "0" (b) );
00076           asm( "rol $16, %1"   : "=r" (a) : "0" (a) );
00077           asm( "rol $16, %1"   : "=r" (b) : "0" (b) );
00078           * ACE_reinterpret_cast(unsigned int*, target) = a;
00079           * ACE_reinterpret_cast(unsigned int*, target + 4) = b;
00080 #elif defined(ACE_HAS_PENTIUM) \
00081       && (defined(_MSC_VER) || defined(__BORLANDC__)) \
00082       && !defined(ACE_LACKS_INLINE_ASSEMBLY)
00083           __asm mov ecx, orig;
00084           __asm mov edx, target;
00085           __asm mov eax, [ecx];
00086           __asm mov ebx, 4[ecx];
00087           __asm bswap eax;
00088           __asm bswap ebx;
00089           __asm rol eax, 16;
00090           __asm rol ebx, 16;
00091           __asm mov [edx], eax;
00092           __asm mov 4[edx], ebx;
00093 #elif ACE_SIZEOF_LONG == 8
00094           // 64 bit architecture.
00095           register unsigned long a =
00096             * ACE_reinterpret_cast(const unsigned long*, orig);
00097 
00098           register unsigned long a1 = (a & 0x00ff00ff00ff00ffUL) << 8;
00099           register unsigned long a2 = (a & 0xff00ff00ff00ff00UL) >> 8;
00100 
00101           a = (a1 | a2);
00102 
00103           * ACE_reinterpret_cast(unsigned long*, target) = a;
00104 #else
00105           register ACE_UINT32 a =
00106             * ACE_reinterpret_cast(const ACE_UINT32*, orig);
00107           register ACE_UINT32 b =
00108             * ACE_reinterpret_cast(const ACE_UINT32*, orig + 4);
00109 
00110           register ACE_UINT32 a1 = (a & 0x00ff00ffU) << 8;
00111           register ACE_UINT32 b1 = (b & 0x00ff00ffU) << 8;
00112           register ACE_UINT32 a2 = (a & 0xff00ff00U) >> 8;
00113           register ACE_UINT32 b2 = (b & 0xff00ff00U) >> 8;
00114 
00115           a = (a1 | a2);
00116           b = (b1 | b2);
00117 
00118           * ACE_reinterpret_cast(ACE_UINT32*, target) = a;
00119           * ACE_reinterpret_cast(ACE_UINT32*, target + 4) = b;
00120 #endif
00121           orig += 8;
00122           target += 8;
00123         }
00124     }
00125   else
00126     {
00127       // We're out of luck. We have to write in 2 byte chunks.
00128       while (orig < end)
00129         {
00130 #if defined(ACE_HAS_PENTIUM) && defined(__GNUG__)
00131           unsigned int a =
00132             * ACE_reinterpret_cast(const unsigned int*, orig);
00133           unsigned int b =
00134             * ACE_reinterpret_cast(const unsigned int*, orig + 4);
00135           asm( "bswap %1" : "=r" (a) : "0" (a) );
00136           asm( "bswap %1" : "=r" (b) : "0" (b) );
00137           // We're little endian.
00138           * ACE_reinterpret_cast(unsigned short*, target + 2)
00139               = (unsigned short) (a & 0xffff);
00140           * ACE_reinterpret_cast(unsigned short*, target + 6)
00141               = (unsigned short) (b & 0xffff);
00142           asm( "shrl $16, %1" : "=r" (a) : "0" (a) );
00143           asm( "shrl $16, %1" : "=r" (b) : "0" (b) );
00144           * ACE_reinterpret_cast(unsigned short*, target + 0)
00145               = (unsigned short) (a & 0xffff);
00146           * ACE_reinterpret_cast(unsigned short*, target + 4)
00147               = (unsigned short) (b & 0xffff);
00148 #elif defined(ACE_HAS_PENTIUM) \
00149       && (defined(_MSC_VER) || defined(__BORLANDC__)) \
00150       && !defined(ACE_LACKS_INLINE_ASSEMBLY)
00151           __asm mov ecx, orig;
00152           __asm mov edx, target;
00153           __asm mov eax, [ecx];
00154           __asm mov ebx, 4[ecx];
00155           __asm bswap eax;
00156           __asm bswap ebx;
00157           // We're little endian.
00158           __asm mov 2[edx], ax;
00159           __asm mov 6[edx], bx;
00160           __asm shr eax, 16;
00161           __asm shr ebx, 16;
00162           __asm mov 0[edx], ax;
00163           __asm mov 4[edx], bx;
00164 #elif ACE_SIZEOF_LONG == 8
00165           // 64 bit architecture.
00166           register unsigned long a =
00167             * ACE_reinterpret_cast(const unsigned long*, orig);
00168 
00169           register unsigned long a1 = (a & 0x00ff00ff00ff00ffUL) << 8;
00170           register unsigned long a2 = (a & 0xff00ff00ff00ff00UL) >> 8;
00171 
00172           a = (a1 | a2);
00173 
00174           ACE_UINT16 b1 = ACE_static_cast(ACE_UINT16, (a >> 48));
00175           ACE_UINT16 b2 = ACE_static_cast(ACE_UINT16, ((a >> 32) & 0xffff));
00176           ACE_UINT16 b3 = ACE_static_cast(ACE_UINT16, ((a >> 16) & 0xffff));
00177           ACE_UINT16 b4 = ACE_static_cast(ACE_UINT16, (a & 0xffff));
00178 
00179 #if defined(ACE_LITTLE_ENDIAN)
00180           * ACE_reinterpret_cast(ACE_UINT16*, target) = b4;
00181           * ACE_reinterpret_cast(ACE_UINT16*, target + 2) = b3;
00182           * ACE_reinterpret_cast(ACE_UINT16*, target + 4) = b2;
00183           * ACE_reinterpret_cast(ACE_UINT16*, target + 6) = b1;
00184 #else
00185           * ACE_reinterpret_cast(ACE_UINT16*, target) = b1;
00186           * ACE_reinterpret_cast(ACE_UINT16*, target + 2) = b2;
00187           * ACE_reinterpret_cast(ACE_UINT16*, target + 4) = b3;
00188           * ACE_reinterpret_cast(ACE_UINT16*, target + 6) = b4;
00189 #endif
00190 #else
00191           register ACE_UINT32 a =
00192             * ACE_reinterpret_cast(const ACE_UINT32*, orig);
00193           register ACE_UINT32 b =
00194             * ACE_reinterpret_cast(const ACE_UINT32*, orig + 4);
00195 
00196           register ACE_UINT32 a1 = (a & 0x00ff00ff) << 8;
00197           register ACE_UINT32 b1 = (b & 0x00ff00ff) << 8;
00198           register ACE_UINT32 a2 = (a & 0xff00ff00) >> 8;
00199           register ACE_UINT32 b2 = (b & 0xff00ff00) >> 8;
00200 
00201           a = (a1 | a2);
00202           b = (b1 | b2);
00203 
00204           ACE_UINT32 c1 = ACE_static_cast(ACE_UINT16, (a >> 16));
00205           ACE_UINT32 c2 = ACE_static_cast(ACE_UINT16, (a & 0xffff));
00206           ACE_UINT32 c3 = ACE_static_cast(ACE_UINT16, (b >> 16));
00207           ACE_UINT32 c4 = ACE_static_cast(ACE_UINT16, (b & 0xffff));
00208 
00209 #if defined(ACE_LITTLE_ENDIAN)
00210           * ACE_reinterpret_cast(ACE_UINT16*, target) = c2;
00211           * ACE_reinterpret_cast(ACE_UINT16*, target + 2) = c1;
00212           * ACE_reinterpret_cast(ACE_UINT16*, target + 4) = c4;
00213           * ACE_reinterpret_cast(ACE_UINT16*, target + 6) = c3;
00214 #else
00215           * ACE_reinterpret_cast(ACE_UINT16*, target) = c1;
00216           * ACE_reinterpret_cast(ACE_UINT16*, target + 2) = c2;
00217           * ACE_reinterpret_cast(ACE_UINT16*, target + 4) = c3;
00218           * ACE_reinterpret_cast(ACE_UINT16*, target + 6) = c4;
00219 #endif
00220 #endif
00221 
00222           orig += 8;
00223           target += 8;
00224         }
00225     }
00226 
00227   // (n & 3) == (n % 4).
00228   switch (n&3) {
00229   case 3:
00230     ACE_CDR::swap_2 (orig, target);
00231     orig += 2;
00232     target += 2;
00233   case 2:
00234     ACE_CDR::swap_2 (orig, target);
00235     orig += 2;
00236     target += 2;
00237   case 1:
00238     ACE_CDR::swap_2 (orig, target);
00239   }
00240 }

ACE_INLINE void ACE_CDR::swap_4 const char *    orig,
char *    target
[static]
 

Definition at line 76 of file CDR_Base.inl.

Referenced by ACE_InputCDR::read_4, swap_4_array, and ACE_OutputCDR::write_4.

00077 {
00078 #if defined(ACE_HAS_PENTIUM) && defined(__GNUG__)
00079   // We have ACE_HAS_PENTIUM, so we know the sizeof's.
00080   register unsigned int j =
00081     *ACE_reinterpret_cast(const unsigned int*, orig);
00082   asm ("bswap %1" : "=r" (j) : "0" (j));
00083   *ACE_reinterpret_cast(unsigned int*, target) = j;
00084 #elif defined(ACE_HAS_PENTIUM) \
00085       && (defined(_MSC_VER) || defined(__BORLANDC__)) \
00086       && !defined(ACE_LACKS_INLINE_ASSEMBLY)
00087   __asm mov ebx, orig;
00088   __asm mov ecx, target;
00089   __asm mov eax, [ebx];
00090   __asm bswap eax;
00091   __asm mov [ecx], eax;
00092 #else
00093   register ACE_UINT32 x = * ACE_reinterpret_cast(const ACE_UINT32*, orig);
00094   x = (x << 24) | ((x & 0xff00) << 8) | ((x & 0xff0000) >> 8) | (x >> 24);
00095   * ACE_reinterpret_cast(ACE_UINT32*, target) = x;
00096 #endif
00097 }

void ACE_CDR::swap_4_array const char *    orig,
char *    target,
size_t    length
[static]
 

Definition at line 243 of file CDR_Base.cpp.

References ACE_ptr_align_binary, and swap_4.

Referenced by ACE_InputCDR::read_array, and ACE_OutputCDR::write_array.

00244 {
00245   // ACE_ASSERT(n > 0); The caller checks that n > 0
00246 
00247 #if ACE_LONG_SIZE == 8
00248   // Later, we read from *orig in 64 bit chunks,
00249   // so make sure we don't generate unaligned readings.
00250   const char* const o8 = ACE_ptr_align_binary(orig, 8);
00251   // The mistmatch can only be by 4.
00252   if (orig != o8)
00253     {
00254       ACE_CDR::swap_4 (orig, target);
00255       orig += 4;
00256       target += 4;
00257       --n;
00258     }
00259 #endif
00260   if (n == 0)
00261     return;
00262 
00263   //
00264   // Loop unrolling. Here be dragons.
00265   //
00266 
00267   // (n & (~3)) is the greatest multiple of 4 not bigger than n.
00268   // In the while loop, orig will move over the array by 16 byte
00269   // increments (4 elements of 4 bytes).
00270   // ends marks our barrier for not falling outside.
00271   const char* const end = orig + 4*(n & (~3));
00272 
00273 #if ACE_LONG_SIZE == 8
00274   // 64 bits architecture.
00275   // See if we can write in 8 byte chunks.
00276   if (target == ACE_ptr_align_binary(target, 8))
00277     {
00278       while (orig < end)
00279         {
00280           register unsigned long a =
00281             * ACE_reinterpret_cast(const long*, orig);
00282           register unsigned long b =
00283             * ACE_reinterpret_cast(const long*, orig + 8);
00284 
00285           register unsigned long a84 = (a & 0x000000ff000000ffL) << 24;
00286           register unsigned long b84 = (b & 0x000000ff000000ffL) << 24;
00287           register unsigned long a73 = (a & 0x0000ff000000ff00L) << 8;
00288           register unsigned long b73 = (b & 0x0000ff000000ff00L) << 8;
00289           register unsigned long a62 = (a & 0x00ff000000ff0000L) >> 8;
00290           register unsigned long b62 = (b & 0x00ff000000ff0000L) >> 8;
00291           register unsigned long a51 = (a & 0xff000000ff000000L) >> 24;
00292           register unsigned long b51 = (b & 0xff000000ff000000L) >> 24;
00293 
00294           a = (a84 | a73 | a62 | a51);
00295           b = (b84 | b73 | b62 | b51);
00296 
00297           * ACE_reinterpret_cast(long*, target) = a;
00298           * ACE_reinterpret_cast(long*, target + 8) = b;
00299 
00300           orig += 16;
00301           target += 16;
00302         }
00303     }
00304   else
00305     {
00306       // We are out of luck, we have to write in 4 byte chunks.
00307       while (orig < end)
00308         {
00309           register unsigned long a =
00310             * ACE_reinterpret_cast(const long*, orig);
00311           register unsigned long b =
00312             * ACE_reinterpret_cast(const long*, orig + 8);
00313 
00314           register unsigned long a84 = (a & 0x000000ff000000ffL) << 24;
00315           register unsigned long b84 = (b & 0x000000ff000000ffL) << 24;
00316           register unsigned long a73 = (a & 0x0000ff000000ff00L) << 8;
00317           register unsigned long b73 = (b & 0x0000ff000000ff00L) << 8;
00318           register unsigned long a62 = (a & 0x00ff000000ff0000L) >> 8;
00319           register unsigned long b62 = (b & 0x00ff000000ff0000L) >> 8;
00320           register unsigned long a51 = (a & 0xff000000ff000000L) >> 24;
00321           register unsigned long b51 = (b & 0xff000000ff000000L) >> 24;
00322 
00323           a = (a84 | a73 | a62 | a51);
00324           b = (b84 | b73 | b62 | b51);
00325 
00326           ACE_UINT32 c1 = ACE_static_cast(ACE_UINT32, (a >> 32));
00327           ACE_UINT32 c2 = ACE_static_cast(ACE_UINT32, (a & 0xffffffff));
00328           ACE_UINT32 c3 = ACE_static_cast(ACE_UINT32, (b >> 32));
00329           ACE_UINT32 c4 = ACE_static_cast(ACE_UINT32, (b & 0xffffffff));
00330 
00331 #if defined(ACE_LITTLE_ENDIAN)
00332           * ACE_reinterpret_cast(ACE_UINT32*, target + 0) = c2;
00333           * ACE_reinterpret_cast(ACE_UINT32*, target + 4) = c1;
00334           * ACE_reinterpret_cast(ACE_UINT32*, target + 8) = c4;
00335           * ACE_reinterpret_cast(ACE_UINT32*, target + 12) = c3;
00336 #else
00337           * ACE_reinterpret_cast(ACE_UINT32*, target + 0) = c1;
00338           * ACE_reinterpret_cast(ACE_UINT32*, target + 4) = c2;
00339           * ACE_reinterpret_cast(ACE_UINT32*, target + 8) = c3;
00340           * ACE_reinterpret_cast(ACE_UINT32*, target + 12) = c4;
00341 #endif
00342           orig += 16;
00343           target += 16;
00344         }
00345     }
00346 
00347 #else /* ACE_LONG_SIZE != 8 */
00348 
00349   while (orig < end)
00350     {
00351 #if defined(ACE_HAS_PENTIUM) && defined(__GNUG__)
00352       register unsigned int a =
00353         *ACE_reinterpret_cast(const unsigned int*, orig);
00354       register unsigned int b =
00355         *ACE_reinterpret_cast(const unsigned int*, orig + 4);
00356       register unsigned int c =
00357         *ACE_reinterpret_cast(const unsigned int*, orig + 8);
00358       register unsigned int d =
00359         *ACE_reinterpret_cast(const unsigned int*, orig + 12);
00360 
00361       asm ("bswap %1" : "=r" (a) : "0" (a));
00362       asm ("bswap %1" : "=r" (b) : "0" (b));
00363       asm ("bswap %1" : "=r" (c) : "0" (c));
00364       asm ("bswap %1" : "=r" (d) : "0" (d));
00365 
00366       *ACE_reinterpret_cast(unsigned int*, target) = a;
00367       *ACE_reinterpret_cast(unsigned int*, target + 4) = b;
00368       *ACE_reinterpret_cast(unsigned int*, target + 8) = c;
00369       *ACE_reinterpret_cast(unsigned int*, target + 12) = d;
00370 #elif defined(ACE_HAS_PENTIUM) \
00371       && (defined(_MSC_VER) || defined(__BORLANDC__)) \
00372       && !defined(ACE_LACKS_INLINE_ASSEMBLY)
00373       __asm mov eax, orig
00374       __asm mov esi, target
00375       __asm mov edx, [eax]
00376       __asm mov ecx, 4[eax]
00377       __asm mov ebx, 8[eax]
00378       __asm mov eax, 12[eax]
00379       __asm bswap edx
00380       __asm bswap ecx
00381       __asm bswap ebx
00382       __asm bswap eax
00383       __asm mov [esi], edx
00384       __asm mov 4[esi], ecx
00385       __asm mov 8[esi], ebx
00386       __asm mov 12[esi], eax
00387 #else
00388       register ACE_UINT32 a =
00389         * ACE_reinterpret_cast(const ACE_UINT32*, orig);
00390       register ACE_UINT32 b =
00391         * ACE_reinterpret_cast(const ACE_UINT32*, orig + 4);
00392       register ACE_UINT32 c =
00393         * ACE_reinterpret_cast(const ACE_UINT32*, orig + 8);
00394       register ACE_UINT32 d =
00395         * ACE_reinterpret_cast(const ACE_UINT32*, orig + 12);
00396 
00397       // Expect the optimizer reordering this A LOT.
00398       // We leave it this way for clarity.
00399       a = (a << 24) | ((a & 0xff00) << 8) | ((a & 0xff0000) >> 8) | (a >> 24);
00400       b = (b << 24) | ((b & 0xff00) << 8) | ((b & 0xff0000) >> 8) | (b >> 24);
00401       c = (c << 24) | ((c & 0xff00) << 8) | ((c & 0xff0000) >> 8) | (c >> 24);
00402       d = (d << 24) | ((d & 0xff00) << 8) | ((d & 0xff0000) >> 8) | (d >> 24);
00403 
00404       * ACE_reinterpret_cast(ACE_UINT32*, target) = a;
00405       * ACE_reinterpret_cast(ACE_UINT32*, target + 4) = b;
00406       * ACE_reinterpret_cast(ACE_UINT32*, target + 8) = c;
00407       * ACE_reinterpret_cast(ACE_UINT32*, target + 12) = d;
00408 #endif
00409 
00410       orig += 16;
00411       target += 16;
00412     }
00413 
00414 #endif /* ACE_LONG_SIZE == 8 */
00415 
00416   // (n & 3) == (n % 4).
00417   switch (n&3) {
00418   case 3:
00419     ACE_CDR::swap_4 (orig, target);
00420     orig += 4;
00421     target += 4;
00422   case 2:
00423     ACE_CDR::swap_4 (orig, target);
00424     orig += 4;
00425     target += 4;
00426   case 1:
00427     ACE_CDR::swap_4 (orig, target);
00428   }
00429 }

ACE_INLINE void ACE_CDR::swap_8 const char *    orig,
char *    target
[static]
 

Definition at line 100 of file CDR_Base.inl.

Referenced by ACE_InputCDR::read_8, swap_16, swap_8_array, and ACE_OutputCDR::write_8.

00101 {
00102 #if defined(ACE_HAS_PENTIUM) && defined(__GNUG__)
00103   register unsigned int i =
00104     *ACE_reinterpret_cast(const unsigned int*, orig);
00105   register unsigned int j =
00106     *ACE_reinterpret_cast(const unsigned int*, orig + 4);
00107   asm ("bswap %1" : "=r" (i) : "0" (i));
00108   asm ("bswap %1" : "=r" (j) : "0" (j));
00109   *ACE_reinterpret_cast(unsigned int*, target + 4) = i;
00110   *ACE_reinterpret_cast(unsigned int*, target) = j;
00111 #elif defined(ACE_HAS_PENTIUM) \
00112       && (defined(_MSC_VER) || defined(__BORLANDC__)) \
00113       && !defined(ACE_LACKS_INLINE_ASSEMBLY)
00114   __asm mov ecx, orig;
00115   __asm mov edx, target;
00116   __asm mov eax, [ecx];
00117   __asm mov ebx, 4[ecx];
00118   __asm bswap eax;
00119   __asm bswap ebx;
00120   __asm mov 4[edx], eax;
00121   __asm mov [edx], ebx;
00122 #elif ACE_SIZEOF_LONG == 8
00123   // 64 bit architecture.
00124   register unsigned long x =
00125     * ACE_reinterpret_cast(const unsigned long*, orig);
00126   register unsigned long x84 = (x & 0x000000ff000000ffUL) << 24;
00127   register unsigned long x73 = (x & 0x0000ff000000ff00UL) << 8;
00128   register unsigned long x62 = (x & 0x00ff000000ff0000UL) >> 8;
00129   register unsigned long x51 = (x & 0xff000000ff000000UL) >> 24;
00130   x = (x84 | x73 | x62 | x51);
00131   x = (x << 32) | (x >> 32);
00132   *ACE_reinterpret_cast(unsigned long*, target) = x;
00133 #else
00134   register ACE_UINT32 x =
00135     * ACE_reinterpret_cast(const ACE_UINT32*, orig);
00136   register ACE_UINT32 y =
00137     * ACE_reinterpret_cast(const ACE_UINT32*, orig + 4);
00138   x = (x << 24) | ((x & 0xff00) << 8) | ((x & 0xff0000) >> 8) | (x >> 24);
00139   y = (y << 24) | ((y & 0xff00) << 8) | ((y & 0xff0000) >> 8) | (y >> 24);
00140   * ACE_reinterpret_cast(ACE_UINT32*, target) = y;
00141   * ACE_reinterpret_cast(ACE_UINT32*, target + 4) = x;
00142 #endif
00143 }

void ACE_CDR::swap_8_array const char *    orig,
char *    target,
size_t    length
[static]
 

Definition at line 436 of file CDR_Base.cpp.

References swap_8.

Referenced by ACE_InputCDR::read_array, and ACE_OutputCDR::write_array.

00437 {
00438   // ACE_ASSERT(n > 0); The caller checks that n > 0
00439 
00440   const char* const end = orig + 8*n;
00441   while (orig < end)
00442     {
00443       swap_8(orig, target);
00444       orig += 8;
00445       target += 8;
00446     }
00447 }

size_t ACE_CDR::total_length const ACE_Message_Block   begin,
const ACE_Message_Block   end
[static]
 

Definition at line 493 of file CDR_Base.cpp.

References ACE_Message_Block::cont, and ACE_Message_Block::length.

Referenced by consolidate, and ACE_OutputCDR::total_length.

00495 {
00496   size_t l = 0;
00497   // Compute the total size.
00498   for (const ACE_Message_Block *i = begin;
00499        i != end;
00500        i = i->cont ())
00501     l += i->length ();
00502   return l;
00503 }


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 12:46:33 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002