Apama 10.15.0 | Connecting Apama Applications to External Components | Working with IAF Plug-ins | C/C++ Transport Plug-in Development | The C/C++ transport plug-in development specification | Defining the transport function table
 
Defining the transport function table
The EventTransport.h header file provides a definition for an AP_EventTransport_Functions structure. This defines a function table whose elements must be set to point to the implementations of the above functions. See the AP_EventTransport_Functions structure in the API Reference for C++ (Doxygen) for more information.
Note that the order of the function pointers within the function table is critical to the reliable operation of the IAF. However, the order that the function definitions appear within the plug-in source code, and indeed the names of the functions, are not important. Apama recommends that the functions be declared static, so that they are not globally visible and can only be accessed via the function table.
It is therefore not obligatory to implement the functions with the same names as per the definitions, as long as the mapping is performed correctly in an instantiation of AP_EventTransport_Functions. A definition in an event transport implementation would look as follows:
static struct AP_EventTransport_Functions EventTransport_Functions
  = {
  updateProperties,
  sendTransportEvent,
  addEventDecoder,
  removeEventDecoder,
  flushUpstream,
  flushDownstream,
  start,
  stop,
  getLastError,
  getStatus
};
The function table created above needs to be placed in an AP_EventTransport object, and one such object needs to be created for every plug-in within its constructor function. See the AP_EventTransport_Functions structure in the API Reference for C++ (Doxygen) for more information.