NAME

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

SYNOPSIS

#include <ace/CDR_Stream.h>

class ACE_CDR { public: 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 void swap_2 (const char *orig, char *target); static void swap_4 (const char *orig, char *target); static void swap_8 (const char *orig, char *target); static void swap_16 (const char *orig, char *target); static void mb_align (ACE_Message_Block *mb); static int grow (ACE_Message_Block *mb, size_t minsize); static size_t total_length ( const ACE_Message_Block *begin, const ACE_Message_Block *end ); typedef unsigned long Boolean; 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; inline || (defined (__BORLANDC__) && (__BORLANDC__ >= 0x530)); typedef longlong_t LongLong; typedef long long LongLong; typedef float Float;

struct Float { public: u_int f; char f[4]; Float (void); Float (const float &init); Float & operator= (const float &rhs); int operator!= (const Float &rhs) const; };

typedef double Double; typedef long double LongDouble; };

DESCRIPTION

ACE Common Data Representation (CDR) marshaling and demarshaling classes.

This implementation was inspired in the CDR class in SunSoft's IIOP engine, but has a completely different implementation and a different interface too.

The current implementation assumes that the host has 1-byte, 2-byte and 4-byte integral types, and that it has single precision and double precision IEEE floats. Those assumptions are pretty good these days, with Crays beign the only known exception.

Constants defined by the CDR protocol.

By defining as many of these constants as possible as enums we ensure they get inlined and avoid pointless static memory allocations.
static void swap_2 (const char *orig, char *target);

static void swap_4 (const char *orig, char *target);

static void swap_8 (const char *orig, char *target);

static void swap_16 (const char *orig, char *target);

static void mb_align (ACE_Message_Block *mb);

static int grow (ACE_Message_Block *mb, size_t minsize);

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

Definitions of the IDL basic types, for use in the CDR classes. The cleanest way to avoid complaints from all compilers is to define them all. This is non-compliant, but a nasty bout with Green Hills C++68000 1.8.8 forces us into it.

typedef unsigned long Boolean;

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;

inline || (defined (__BORLANDC__) && (__BORLANDC__ >= 0x530));

typedef longlong_t LongLong;

LynxOS 2.5.0 and Linux don't have u_longlong_t.

typedef long long LongLong;

If "long long" isn't native, programs can't use these data types in normal arithmetic expressions. If any particular application can cope with the loss of range, it can define conversion operators itself.

typedef float Float;

typedef double Double;

94-9-32 Appendix A defines a 128 bit floating point "long double" data type, with greatly extended precision and four more bits of exponent (compared to "double"). This is an IDL extension, not yet standard.

typedef long double LongDouble;

AUTHORS

Aniruddha Gokhale gokhale@cs.wustl.edu and Carlos O'Ryan coryan@cs.wustl.edu for the original implementation in TAO. ACE version by Jeff Parsons parsons@cs.wustl.edu and Istvan Buki istvan.buki@euronet.be. Codeset translation by Jim Rogers (jrogers@viasoft.com) and Carlos O'Ryan coryan@cs.wustl.edu

LIBRARY

ace