Apama Documentation : Connecting Apama Applications to External Components : Developing Custom Adapters : C/C++ Codec Plug-in Development : The C/C++ codec Plug-in Development Specification : Defining the codec function tables : Registering the codec function tables
Registering the codec function tables
The encoding and decoding function tables created above need to be placed in the relevant object, AP_EventEncoder and AP_EventDecoder. These, together with the generic function table, need to be placed in an AP_EventCodec object. The definitions of these structures are as follows:
/**
* AP_EventEncoder
*
* External (client-visible) interface to the encoder part of a codec
* plugin library. The AP_EventEncoder struct contains a table of
* function pointers, declared in the AP_EventEncoder_Functions struct
* above. The implementation of these functions is private. Users of
* the encoder should invokefunctions on it as in the following example
* (encoder is of type AP_EventEncoder*):
*
* i = encoder->functions->sendNormalisedEvent(encoder, event, timestamps);
*/
struct AP_EventEncoder {
/**
* Pointer to private internal data.
*/
  void* reserved;
/**
* Function table of encoder operations. See documentation for
* AP_EventEncoder_Functions for details.
*/
  struct AP_EventEncoder_Functions* functions;
};
/**
* AP_EventDecoder
*
* External (client-visible) interface to the decoder part of a codec
* plugin library. The AP_EventDecoder struct contains a table of
* function pointers, declared in the AP_EventEDecoder_Functions struct
* above. The implementation of these functions is private. Users of the
* decoder should invoke functions on it as in the following example (
* decoder is of type AP_EventDecoder*):
*
* i = decoder->functions->sendTransportEvent(decoder, event, timestamps);
*/
struct AP_EventDecoder {
/**
* Pointer to private internal data.
*/
  void* reserved;
/**
* Function table of decoder operations. See documentation for
* AP_EventDecoder_Functions for details.
*/
  struct AP_EventDecoder_Functions* functions;
};
/**
* AP_EventCodec
*
* External (client-visible) interface to an IAF codec plug-in library. The
* AP_EventCodec struct contains pointers to the encoder and decoder parts
* of the codec (either of these may be NULL if the codec operates in one
* direction only) and a table of function pointers, declared in the
* AP_EventCodec_Functions struct above. The implementation of these
* functions is private. Users of the codec should invoke functions on it
* as in the following example (codec is of type AP_EventCodec*):
*
* i = codec->functions->updateProperties(codec, properties, timestampConfig);
*/
struct AP_EventCodec {
/**
* Pointer to private internal data.
*/
  void* reserved;
/**
* Function table of codec operations. See documentation for
* AP_EventCodec_Functions for details.
*/
  struct AP_EventCodec_Functions* functions;
/**
* Pointer to embedded encoder.
*/
  AP_EventEncoder* encoder;
/**
* Pointer to embedded decoder.
*/
  AP_EventDecoder* decoder;
};
The first element of each structure, reserved, is a placeholder for any private data that the encoder, decoder, or the generic codec code requires.
An AP_EventCodec object needs to be created for every plug-in within its constructor function. As indicated in the descriptive text, the encoder and decoder fields in it may be set to NULL if the codec does not implement the respective functionality, although clearly it is meaningless to have both set to NULL.
Copyright © 2013-2016 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback