Previous Table of Contents Next


13.8.1 Codec Interface


   module IOP {

   local interface Codec { exception InvalidTypeForEncoding {}; exception FormatMismatch {}; exception TypeMismatch {};

   CORBA::OctetSeq encode (in any data) raises (InvalidTypeForEncoding); any decode (in CORBA::OctetSeq data)

   raises (FormatMismatch); CORBA::OctetSeq encode_value (in any data) raises (InvalidTypeForEncoding);

   any decode_value ( in CORBA::OctetSeq data, in CORBA::TypeCode tc) raises (FormatMismatch, TypeMismatch);

   };};

   13.8.1.1 Exceptions

   InvalidTypeForEncoding

   This exception is raised by encode or encode_value when the type is invalid for the encoding. For example, this exception is raised if the encoding is ENCODING_CDR_ENCAPS version 1.0 and a type that does not exist in that version, such as wstring, is passed to the operation.

   FormatMismatch

   This exception is raised by decode or decode_value when the data in the octet sequence cannot be decoded into an any.

   TypeMismatch

   This exception is raised by decode_value when the given TypeCode does not match the given octet sequence.

   13.8.1.2 Operations

   encode

   Convert the given any into an octet sequence based on the encoding format effective for this Codec.

   This operation may raise InvalidTypeForEncoding.

Parameter

data

Return Value

decode

The data, in the form of an any, to be encoded into an octet
sequence.
An octet sequence containing the encoded any. This octet
sequence contains both the TypeCode and the data of the type.

   Decode the given octet sequence into an any based on the encoding format effective for this Codec.

   This operation raises FormatMismatch if the octet sequence cannot be decoded into an any.

   Parameter

   data The data, in the form of an octet sequence, to be decoded into an any.

   Return Value

   An any containing the data from the decoded octet sequence.

   encode_value

   Convert the given any into an octet sequence based on the encoding format effective for this Codec. Only the data from the any is encoded, not the TypeCode.

   This operation may raise InvalidTypeForEncoding.

   Parameter

   data The data, in the form of an any, to be encoded into an octet sequence.

   Return Value

   An octet sequence containing the data from the encoded any.

   decode_value

   Decode the given octet sequence into an any based on the given TypeCode and the encoding format effective for this Codec.

   This operation raises FormatMismatch if the octet sequence cannot be decoded into an any.

   Parameter

   data The data, in the form of an octet sequence, to be decoded into an any.

   tc The TypeCode to be used to decode the data.

   Return Value

   An any containing the data from the decoded octet sequence.