Apama 10.3 | Apama Documentation | Connecting Apama Applications to External Components | Working with IAF Plug-ins | C/C++ Codec Plug-in Development | The C/C++ codec plug-in development specification | Defining the codec function tables | The codec function table
The codec function table
Every codec needs to define a generic codec function table. The header file provides a definition for this as an AP_EventCodec_Functions structure. Its definition is as follows:
* AP_EventCodec_Functions
* Table of client visible functions exported by a codec library instance.
* These functions declare the only operations that may be performed by users
* of a codec (but note that separate function tables exist for encoding-
* and decoding-specific functions).
* Note that all of these functions take an initial AP_EventCodec*
* argument; this is analogous to the (hidden) 'this' pointer passed to a
* C++ object when a member function is invoked on it.
struct AP_EventCodec_Functions {
  * updateProperties
* Update the configuration of the codec. The codec may assume that
* flushUpstream() and flushDownstream() have been called before this
* function is invoked. The recommended procedure for updating properties
* is to first compare the new property set with the existing stored
* properties -- if there are no changes, no action should be taken. Any
* pointer to the old property set becomes invalid as soon as this
* function returns; any such pointers should therefore be discarded in
* favour of the supplied new properties.
* @param codec The event codec instance
* @param properties The new codec property set derived from the IAF
* configuration file
* @param timestampConfig Timestamp recording/logging settings
* @return Event codec error code. If this is not AP_EventCodec_OK, the
* getLastError() function of the codec should be called to get a more
* detailed description of what went wrong.
  AP_EventCodecError (*updateProperties)(struct AP_EventCodec* codec,
    AP_EventCodecProperties* properties,
    IAF_TimestampConfig* timestampConfig);
  * getLastError
* Return the codec's stored error message, if any. The message string is
* owned by the codec so should not be modified or freed by the caller.
* @param codec The event codec instance
* @return The last error message generated by the codec
  const AP_char8* (*getLastError)(struct AP_EventCodec* codec);
  * getStatus
* Fill in the supplied AP_EventCodecStatus structure with up-to-date
* status information for the codec. Note that any data pointed to by the
* returned structure (such as strings) remains owned by the codec. The
* caller must copy this data if it wishes to modify it.
* @param codec The event codec instance
* @param status The status structure to be filled in
  void (*getStatus)(struct AP_EventCodec* codec,
     AP_EventCodecStatus* status);
where the library functions updateProperties,getLastErrorCodec and getStatus are being defined as being the implementations of the Codec Development Specification's updateProperties,getLastError and getStatus function definitions respectively.

Copyright © 2013-2018 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.