Apama 10.3 | Apama Documentation | Developing Apama Applications | Developing EPL Plug-ins | EPL Plug-ins in C and C++ Written Prior to 10.0 | Advanced plug-in functionality in C++ and C | Working with chunk in C
Working with chunk in C
In C, working with chunks is similar. Functions that carry out the functionality that would otherwise be defined within the class methods need to be implemented. There are two specific rules that must be followed.
First a callback function table must be supplied with every user chunk that is created. Here's an example:

const struct AP_PluginChunk_Callbacks exampleChunkCallbacks = {
This specifies the functions that represent the "destroy" and "copy" functions described in the above C++ sections.
The other rule is that the user must implement a chunk "constructor" like method. Its contents or name do not matter, but it must return a specific structure that is obtained through calling the createChunk function. Here's an example constructor:

AP_PluginChunk* exampleChunkConstructor(
  const AP_PluginContext *ctx, unsigned size)
  struct ExampleChunk* data;
  data = (struct ExampleChunk*)malloc(
    sizeof(struct ExampleChunk));
  data->size = size;
  data->data = (double *)malloc(sizeof(double) * size);
    "ExampleChunk constructor called with size = %u\n",size);
  return ctx->functions

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.