## NAME

ACE_WChar_Codeset_Translator - Codeset translation routines common to both Output and Input CDR streams.

## SYNOPSIS

    #include <ace/CDR_Stream.h>

    class ACE_WChar_Codeset_Translator
    {
      public:
        virtual ACE_CDR::Boolean read_wchar (
            ACE_InputCDR&,
            ACE_CDR::WChar&
            ) = 0;
        virtual ACE_CDR::Boolean read_wstring (
            ACE_InputCDR&,
            ACE_CDR::WChar *&
            ) = 0;
        virtual ACE_CDR::Boolean read_wchar_array (
            ACE_InputCDR&,
            ACE_CDR::WChar*,
            ACE_CDR::ULong
            ) = 0;
        virtual ACE_CDR::Boolean write_wchar (
            ACE_OutputCDR&,
            ACE_CDR::WChar
            ) = 0;
        virtual ACE_CDR::Boolean write_wstring (
            ACE_OutputCDR&,
            ACE_CDR::ULong,
            const ACE_CDR::WChar*
            ) = 0;
        virtual ACE_CDR::Boolean write_wchar_array (
            ACE_OutputCDR&,
            const ACE_CDR::WChar*,
            ACE_CDR::ULong
            ) = 0;
      protected:
        ACE_CDR::Boolean read_1 (ACE_InputCDR& input, ACE_CDR::Octet *x);
        ACE_CDR::Boolean read_2 (ACE_InputCDR& input, ACE_CDR::UShort *x);
        ACE_CDR::Boolean read_4 (ACE_InputCDR& input, ACE_CDR::ULong *x);
        ACE_CDR::Boolean write_1 (
            ACE_OutputCDR& output,
            const ACE_CDR::Octet *x
            );
        ACE_CDR::Boolean write_2 (
            ACE_OutputCDR& output,
            const ACE_CDR::UShort *x
            );
        ACE_CDR::Boolean write_4 (
            ACE_OutputCDR& output,
            const ACE_CDR::ULong *x
            );
        ACE_CDR::Boolean read_array (
            ACE_InputCDR& input,
            void* x,
            size_t size,
            size_t align,
            ACE_CDR::ULong length
            );
        ACE_CDR::Boolean write_array (
            ACE_OutputCDR& output,
            const void *x,
            size_t size,
            size_t align,
            ACE_CDR::ULong length
            );
        int adjust (
            ACE_OutputCDR& out,
            size_t size,
            size_t align,
            char *&buf
            );
        void good_bit (ACE_OutputCDR& out, int bit);
    };

## 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.

## PUBLIC MEMBERS

    virtual ACE_CDR::Boolean read_wchar (
        ACE_InputCDR&,
        ACE_CDR::WChar&
        ) = 0;

    virtual ACE_CDR::Boolean read_wstring (
        ACE_InputCDR&,
        ACE_CDR::WChar *&
        ) = 0;

    virtual ACE_CDR::Boolean read_wchar_array (
        ACE_InputCDR&,
        ACE_CDR::WChar*,
        ACE_CDR::ULong
        ) = 0;

    virtual ACE_CDR::Boolean write_wchar (
        ACE_OutputCDR&,
        ACE_CDR::WChar
        ) = 0;

    virtual ACE_CDR::Boolean write_wstring (
        ACE_OutputCDR&,
        ACE_CDR::ULong,
        const ACE_CDR::WChar*
        ) = 0;

    virtual ACE_CDR::Boolean write_wchar_array (
        ACE_OutputCDR&,
        const ACE_CDR::WChar*,
        ACE_CDR::ULong
        ) = 0;

## PROTECTED MEMBERS

    ACE_CDR::Boolean read_1 (ACE_InputCDR& input, ACE_CDR::Octet *x);

    ACE_CDR::Boolean read_2 (ACE_InputCDR& input, ACE_CDR::UShort *x);

    ACE_CDR::Boolean read_4 (ACE_InputCDR& input, ACE_CDR::ULong *x);

    ACE_CDR::Boolean write_1 (
        ACE_OutputCDR& output,
        const ACE_CDR::Octet *x
        );

    ACE_CDR::Boolean write_2 (
        ACE_OutputCDR& output,
        const ACE_CDR::UShort *x
        );

    ACE_CDR::Boolean write_4 (
        ACE_OutputCDR& output,
        const ACE_CDR::ULong *x
        );

Children have access to low-level routines because they cannot use read_char or something similar (it would recurse).

    ACE_CDR::Boolean read_array (
        ACE_InputCDR& input,
        void* x,
        size_t size,
        size_t align,
        ACE_CDR::ULong length
        );

Efficiently read `length` elements of size `size` each from `input` into `x`; the data must be aligned to `align`.

    ACE_CDR::Boolean write_array (
        ACE_OutputCDR& output,
        const void *x,
        size_t size,
        size_t align,
        ACE_CDR::ULong length
        );

Efficiently write `length` elements of size `size` from `x` into `output`. Before inserting the elements enough padding is added to ensure that the elements will be aligned to `align` in the stream.

    int adjust (
        ACE_OutputCDR& out,
        size_t size,
        size_t align,
        char *&buf
        );

Exposes the stream implementation of `adjust`, this is useful in many cases to minimize memory allocations during marshaling. On success `buf` will contain a contiguous area in the CDR stream that can hold `size` bytes aligned to `align`. Results

    void good_bit (ACE_OutputCDR& out, int bit);

Used by derived classes to set errors in the CDR stream.

## 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