Connecting Apama Applications to External Components > Developing Custom Adapters > C/C++ Codec Plug-in Development > The C/C++ codec Plug-in Development Specification > Codec functions to implement > Codec decoder functions
Codec decoder functions
If the codec is to provide a decoder, implementations need to be provided for the following functions:
sendTransportEvent
 
/**
  * Called by the event transport to decode an event and send it on to the
  * Semantic Mapper. Ownership of the message is transferred to the
  * decoder when this function is called. It is assumed that the encoder
  * and transport share the same definition of the content of the event, so
  * that the transport can effectively interpret the event and free any
  * dynamically-allocated memory.
  *
  * @param decoder The event decoder instance
  * @param event The event to be decoded
  * @param timeStamp Timestamps associated with this event
  * @return Event codec error code. If this is not AP_EventCodec_OK, the
  * getLastError() function of the decoder should be called to get a more
  * detailed description of what went wrong.
  */
AP_EventCodecError (*sendTransportEvent)(struct AP_EventDecoder* decoder,
    AP_TransportEvent event, AP_TimestampSet* timeStamp);
 
setSemanticMapper
/**
 * Set the Semantic Mapper object to be used by the decoder. Currently
  * only a single Semantic Mapper is supported in each adapter instance.
  *
  * @param decoder The event decoder instance
  * @param mapper The Semantic Mapper to be used
  */
void (*setSemanticMapper)(struct AP_EventDecoder* decoder,
    AP_SemanticMapper* mapper);
 
flushDownstream
/**
  * Flush any pending transport events into the attached Semantic Mapper.
  * If event processing in the decoder is synchronous (as it usually will
  * be) this function need not do anything except return AP_EventCodec_OK.
  *
  * @param decoder The event decoder instance
  * @return Event codec error code. If this is not AP_EventCodec_OK, the
  * getLastError() function of the decoder should be called to get a more
  * detailed description of what went wrong.
  */
AP_EventCodecError (*flushDownstream)(struct AP_EventDecoder* decoder);
 
getLastError
/**
  * Return the decoder's stored error message, if any. The message string
  * is owned by the decoder so should not be modified or freed by the
  * caller.
  *
  * @param decoder The event decoder instance
  * @return The last error message generated by the decoder
  */
const AP_char8* (*getLastError)(struct AP_EventDecoder* decoder);
Copyright © 2013-2015 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.
Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG.