Next: Converters factories, Previous: Adding support for new code sets, Up: Code sets

#### 11.4.4 Character data Converter

Character data converters do direct marshalling/unmarshalling of character data (char or wchar - depending on `Converter`) into/from PolyORB's buffer. This allows to minimize the speed penalty on character data marshalling.

Character data Converters for char data have the following API (from `PolyORB.GIOP_P.Code_Sets.Converters` package:

            type Converter is abstract tagged private;

            procedure Marshall
              (C      : Converter;
               Buffer : access Buffers.Buffer_Type;
               Data   : Types.Char;
               Error  : in out Errors.Error_Container)
               is abstract;

            procedure Marshall
              (C      : Converter;
               Buffer : access Buffers.Buffer_Type;
               Data   : Types.String;
               Error  : in out Errors.Error_Container)
               is abstract;

            procedure Unmarshall
              (C      : Converter;
               Buffer : access Buffers.Buffer_Type;
               Data   :    out Types.Char;
               Error  : in out Errors.Error_Container)
               is abstract;

            procedure Unmarshall
              (C      : Converter;
               Buffer : access Buffers.Buffer_Type;
               Data   :    out Types.String;
               Error  : in out Errors.Error_Container)
               is abstract;

The Marshall subprograms do marshalling of one character or string of characters into the buffer. The Unmarshall subprograms do unmarshalling of one character or string of characters from the buffer.

Note: Depending on the item size of the data (char/wchar) and GIOP version, marshalling/unmarshalling algorithms may vary. In some situations marshalling of string is not equivalent to marshalling its length and marshalling one by one each character. Please refere to GIOP specifications for more details.

If marshalling/unmarshalling fails, subprograms must set the Error parameter to the corresponding error, usually `Data_Conversion_E`.

Note: We recommend to always use the Data_Conversion_E error code with Minor status 1.

All `Converters` (native, fallback and conversion) have similar APIs. Wchar data converters differ only in parameter type.