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 | Using complex_plugin from the correlator
Using complex_plugin from the correlator
Example EPL code that imports this plug-in and uses its functionality is provided in the file complex_plugin.mon, which is located in the samples\correlator_plugin\cpp folder of your Apama installation.
Once more the monitor starts by importing complex_plugin, this time mapping it to the alias complex.
After defining a number of variables, it calls complex.test1. This function displays the number of arguments and then displays them. It also returns the string value "Hello, World", which is then stored in ret1.
The call to complex.test2 requires setting up the sequences it takes as parameters. As the implementation of test2 within complex_plugin is effectively the same as test1, this does the same; it displays the number of arguments and then displays each one, in this case printing out the contents of every sequence. The float value 2.71828 is returned instead.
For complex.test3 the monitor is creating a chunk. The test3 method will create a chunk with a numeric array of the specified size 20, which it initializes with the numbers 1 to 20. It then prints the contents out and returns the chunk to the correlator for retaining in myChunk.
The correlator cannot examine or manipulate myChunk, but myChunk can be passed in to other plug-in methods that expect a chunk of the same type. Note that the type of a chunk, in this case the C++ class ExampleChunk, is not visible in EPL, so it is up to the developer to ensure the chunks are compatible across plug-in methods. This broadly applies to all plug-in methods irrespective of parameter and return types. The developer must ensure that the parameters passed are of the correct types as otherwise failure might occur.
The complex.test4 method is called with myChunk. This traverses the array of floating point numbers contained within and takes the square root of each one. It then prints out the revised numbers. It does not return anything.

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.