Developing Apama Applications > Writing Correlator Plug-ins > Writing a Plug-in in C and C++ > Parameter-less plug-in functions
Parameter-less plug-in functions
Occasionally it is useful to invoke a function or method within a plug-in which requires, and returns, no parameters. This is simply achieved by having the function/method ignore the function/method parameters and defining a function which takes no parameters and returns void in the function table. For example:
C++
In C++ the method is defined as:
void AP_PLUGIN_CALL Analytic::SilentInitialisation (
  const AP_Context& ctx,
  const AP_TypeList& args,
  AP_Type& rval,
  AP_TypeDiscriminator rtype) {

  // Custom Code Here
  // Ignoring the args, rval and rtype parameters
}
C
And, in C as:
static void AP_PLUGIN_CALL SilentInitialisation (
  const AP_PluginContext* ctx,
  const AP_PluginTypeList* args,
  AP_PluginType* rval,
  AP_TypeDiscriminator rtype) {

    // Custom Code Here
    // Ignoring the args, rval and rtype parameters
}
Then the function table would appear thus, in C++:
Static AP_Function Functions[1] = {
  {
    "SilentInit", &Analytics:: SilentInitialisation, 0, NULL,
    "void" },
};
And as below in C:
Static AP_Function Functions[1] = {
  { "SilentInit", &SilentInitialisation, 0, NULL, "void" },
};
EPL
In EPL, the plug-in function/method is then invoked as:

import "analytics" as a;
action onload {
  a.SilentInit();
  // Custom Code Here
}
Returning multiple values
Each call to a plug-in function returns a single value. Occasionally it is necessary for an operation to return multiple values; there are various techniques that can be used to achieve this:
*Provide multiple functions which are called in turn, each of which returns one of the values.
*Return a chunk expressing the composite value, and provide functions that interrogate the chunk to extract each individual value.
*Return a string that can be parsed as an event that expresses the composite value.
*Enqueue an event that expresses the composite value.
*Pass the function a string and modify the elements.
See The chunk data type for details of how chunks are used and Asynchronous plug-ins for how to enqueue an event from a plug-in.
Copyright © 2013 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or Terracotta Inc., San Francisco, CA, USA, and/or Software AG (Canada) Inc., Cambridge, Ontario, Canada, and/or, Software AG (UK) Ltd., Derby, United Kingdom, and/or Software A.G. (Israel) Ltd., Or-Yehuda, Israel and/or their licensors.