21 #ifndef CORRELATOR_PLUGIN_HPP
22 #define CORRELATOR_PLUGIN_HPP
24 #ifndef _AP_NO_DEPRECATED_PLUGINAPI_WARNING
26 #warning This API for writing EPL plugins is deprecated. Please use the API located in epl_plugin.hpp instead
28 #pragma message("correlator_plugin.hpp(0) Warning: This API for writing EPL plugins is deprecated. Please use the API located in epl_plugin.hpp instead")
32 #include <ApamaTypes.h>
33 #include <AP_Platform.h>
77 #define AP_PLUGIN_VERSION 0x00090000
80 #if (__GNUC__ > 4 || __GNUC_MINOR__ > 3 || !defined(__linux__))
81 #define _has_std_initializer_list
218 virtual uint32 version()
const = 0;
234 virtual char8* char8alloc(
size_t len)
const = 0;
247 virtual char8* char8dup(
const char8* s)
const = 0;
257 virtual void char8free(char8* s)
const = 0;
268 virtual AP_uint64 getContextId()
const = 0;
277 virtual void pluginNowBlocking()
const = 0;
297 virtual ~NoContext() {}
298 virtual uint32
version()
const {
return 0; }
299 virtual char8*
char8alloc(
size_t len)
const {
return 0; }
300 virtual char8*
char8dup(
const char8* s)
const {
return 0; }
301 virtual void char8free(char8* s)
const { }
324 typedef std::shared_ptr<AP_EventHandlerInterface>
ptr_t;
378 virtual void sendEvent(
const char* event) = 0;
394 virtual void sendEventTo(
const char* event, AP_uint64 targetContext, AP_uint64 sourceContext) = 0;
418 virtual void sendEventTo(
const char *event,
const char *targetChannel,
const AP_Context &source) = 0;
419 #ifdef _has_std_initializer_list
467 template<
typename ITER>
493 #ifdef _has_std_initializer_list
537 template<
typename ITER>
581 template<
typename ITER>
584 for (ITER it = start; it != end; ++it) {
585 subscribe_impl(handler, (
char const *
const *) &(*it), (
char const *
const *) &(*it) + 1);
593 template<
typename ITER>
596 for (ITER it = start; it != end; ++it) {
597 unsubscribe_impl(handler, (
char const *
const *) &(*it), (
char const *
const *) &(*it) + 1);
792 template <
typename FN>
953 operator int64()
const {
966 operator float64()
const {
979 operator AP_decimal()
const {
992 operator bool()
const {
1005 operator const char8*()
const {
1040 virtual void operator()(
AP_Type &)
const =0;
1050 template <
typename FN>
1053 explicit Wrap(
const FN &fn) : fn(fn) {}
1054 void operator()(
AP_Type &arg)
const { fn(arg); }
1076 : ptr(reinterpret_cast<const char *>(static_cast<const
AP_Type *>(array))),
1092 return *
reinterpret_cast<const AP_Type *
>(ptr + i*stride);
1257 #endif // CORRELATOR_PLUGIN_HPP
virtual void pluginNowBlocking() const =0
virtual const char8 ** stringSequenceElements(size_t start=0, size_t length=size_t(-1)) const =0
[DEPRECATED] Execution context for a library function call.
Definition: correlator_plugin.hpp:209
AP_UnimplementedException(const std::string &what)
Definition: correlator_plugin.hpp:132
AP_PLUGIN_DLL_SYM AP_ErrorCode(AP_PLUGIN_CALL *AP_ThreadEndedFunctionPtr)(const AP_Context &ctx)
Definition: correlator_plugin.hpp:1255
size_t nParams
Definition: correlator_plugin.hpp:1145
virtual size_t sequenceLength() const =0
[DEPRECATED] Type-safe encapsulation of an EPL object, for passing arguments and return values into a...
Definition: correlator_plugin.hpp:674
const char8 * returnType
Definition: correlator_plugin.hpp:1153
void subscribe(const AP_EventHandlerInterface::ptr_t &handler, std::initializer_list< const char * > channels)
Definition: correlator_plugin.hpp:435
virtual void releaseDecimalSequenceElements() const =0
virtual bool * booleanSequenceElements(size_t start=0, size_t length=size_t(-1)) const =0
virtual void subscribe_impl(const AP_EventHandlerInterface::ptr_t &handler, char const *const *start, char const *const *end)=0
std::shared_ptr< AP_EventHandlerInterface > ptr_t
Definition: correlator_plugin.hpp:324
virtual void pluginNowBlocking() const =0
void unsubscribe(const AP_EventHandlerInterface::ptr_t &handler, const T &channel)
Definition: correlator_plugin.hpp:555
virtual AP_Chunk *const * chunkSequenceElements(size_t start=0, size_t length=size_t(-1)) const =0
AP_FunctionPtr fptr
Definition: correlator_plugin.hpp:1141
AP_Capabilities
Definition: AP_PluginCommon.h:108
AP_PLUGIN_DLL_SYM AP_ErrorCode(AP_PLUGIN_CALL * AP_InitFunctionPtr)(const AP_Context &ctx, uint32 &version, uint32 &nFunctions, AP_Function *&functions)
Definition: correlator_plugin.hpp:1182
virtual ~AP_Context()
Definition: correlator_plugin.hpp:214
virtual AP_uint64 getContextId() const =0
virtual AP_Type & sequenceElement(size_t index) const =0
AP_Type & operator=(AP_Chunk *val)
Definition: correlator_plugin.hpp:946
void subscribe_impl(const AP_EventHandlerInterface::ptr_t &handler, const ITER &start, const ITER &end)
Definition: correlator_plugin.hpp:582
virtual bool booleanValue() const =0
virtual void sendEvent(const char *event)=0
[DEPRECATED] Thrown by plugin authors to signal an error to any EPL calling this plugin.
Definition: correlator_plugin.hpp:159
virtual void releaseFloatSequenceElements() const =0
[DEPRECATED]
Definition: correlator_plugin.hpp:1037
virtual AP_TypeDiscriminator sequenceType() const =0
virtual void releaseBooleanSequenceElements() const =0
AP_Chunk()
Definition: correlator_plugin.hpp:655
virtual void setSequenceLength(size_t length) const =0
const AP_Type & operator[](size_t i) const
Definition: correlator_plugin.hpp:1091
virtual void releaseIntegerSequenceElements() const =0
virtual void copyFrom(const AP_Type &other)=0
void(AP_PLUGIN_CALL * AP_FunctionPtr)(const AP_Context &ctx, const AP_TypeList &args, AP_Type &rval, AP_TypeDiscriminator rtype)
Definition: correlator_plugin.hpp:1119
AP_TypeDiscriminator
Definition: AP_PluginCommon.h:56
virtual ~AP_EventHandlerInterface()
Definition: correlator_plugin.hpp:329
virtual ~AP_CorrelatorInterface()=0
virtual void releaseStringSequenceElements() const =0
virtual int64 * integerSequenceElements(size_t start=0, size_t length=size_t(-1)) const =0
AP_Type & operator[](size_t index) const
Definition: correlator_plugin.hpp:1018
virtual AP_decimal * decimalSequenceElements(size_t start=0, size_t length=size_t(-1)) const =0
AP_BoundsException(const std::string &what)
Definition: correlator_plugin.hpp:147
[DEPRECATED] An interface class that should be implemented by event handlers which are registered via...
Definition: correlator_plugin.hpp:314
AP_PLUGIN_DLL_SYM AP_ErrorCode(AP_PLUGIN_CALL * AP_ShutdownFunctionPtr)(const AP_Context &ctx)
Definition: correlator_plugin.hpp:1198
[DEPRECATED] Type error.
Definition: correlator_plugin.hpp:110
virtual char8 * char8dup(const char8 *s) const =0
AP_Type & operator=(const AP_Type &other)
Definition: correlator_plugin.hpp:1024
AP_TypeException(const std::string &what)
Definition: correlator_plugin.hpp:115
[DEPRECATED] Thrown by an attempt to use a function that is defined but not implemented in this versi...
Definition: correlator_plugin.hpp:127
[DEPRECATED] Asynchronous interface to the correlator.
Definition: correlator_plugin.hpp:350
void visitSequenceElements(const FN &fn, size_t start=0, size_t length=size_t(-1)) const
Definition: correlator_plugin.hpp:793
virtual char8 * char8alloc(size_t len) const =0
virtual void sendEventTo(const char *event, AP_uint64 targetContext, AP_uint64 sourceContext)=0
virtual AP_CorrelatorInterface * getCorrelator() const =0
virtual void releaseSequenceElements() const =0
virtual void unsubscribe_impl(const AP_EventHandlerInterface::ptr_t &handler, char const *const *start, char const *const *end)=0
[DEPRECATED] Container class for an ordered list of AP_Type objects, typically used to hold the argum...
Definition: correlator_plugin.hpp:1069
void unsubscribe_impl(const AP_EventHandlerInterface::ptr_t &handler, const ITER &start, const ITER &end)
Definition: correlator_plugin.hpp:594
void subscribe(const AP_EventHandlerInterface::ptr_t &handler, const T &channel)
Definition: correlator_plugin.hpp:489
void subscribe(const AP_EventHandlerInterface::ptr_t &handler, const ITER &start, const ITER &end)
Definition: correlator_plugin.hpp:468
virtual AP_Type *const * sequenceElements(size_t start=0, size_t length=size_t(-1)) const =0
bool empty() const
Definition: correlator_plugin.hpp:1087
virtual void releaseChunkSequenceElements() const =0
AP_UserPluginException(const std::string &type, const std::string &what)
Definition: correlator_plugin.hpp:169
virtual float64 floatValue() const =0
[DEPRRECATED] Base class for all 'chunk' classes.
Definition: correlator_plugin.hpp:613
virtual AP_Chunk * chunkValue() const =0
[DEPRRECATED] Boundary checking error.
Definition: correlator_plugin.hpp:142
const std::string & getType() const
Definition: correlator_plugin.hpp:175
const char8 ** paramTypes
Definition: correlator_plugin.hpp:1149
virtual int64 integerValue() const =0
AP_PLUGIN_DLL_SYM AP_ErrorCode(AP_PLUGIN_CALL * AP_LibraryVersionFunctionPtr)(const AP_Context &ctx, uint32 &version)
Definition: correlator_plugin.hpp:1219
void unsubscribe(const AP_EventHandlerInterface::ptr_t &handler, std::initializer_list< const char * > channels)
Definition: correlator_plugin.hpp:507
[DEPRECATED] Plugin function descriptor.
Definition: correlator_plugin.hpp:1133
virtual AP_TypeDiscriminator discriminator() const =0
AP_PLUGIN_DLL_SYM AP_Capabilities(AP_PLUGIN_CALL * AP_GetCapabilitiesFunctionPtr)(const AP_Context &ctx)
Definition: correlator_plugin.hpp:1237
[DEPRECATED] Base class of all exceptions thrown across the correlator/plugin boundary.
Definition: correlator_plugin.hpp:94
virtual void createSequence(AP_TypeDiscriminator inner)=0
virtual void visitSequenceElementsImpl(const ElementFn &, size_t start, size_t length) const =0
size_t size() const
Definition: correlator_plugin.hpp:1083
AP_ENGINE_CLIENT_API void char8free(char *string)
Free any char* string returned from the client API.
AP_PluginException(const std::string &what)
Definition: correlator_plugin.hpp:99
const char8 * name
Definition: correlator_plugin.hpp:1137
virtual float64 * floatSequenceElements(size_t start=0, size_t length=size_t(-1)) const =0
virtual AP_decimal decimalValue() const =0
AP_Chunk(const AP_Context &)
Definition: correlator_plugin.hpp:649
virtual void char8free(char8 *s) const =0
AP_TypeList(const T *array, size_t n)
Definition: correlator_plugin.hpp:1075
virtual uint32 version() const =0
virtual ~AP_Chunk()
Definition: correlator_plugin.hpp:630
void unsubscribe(const AP_EventHandlerInterface::ptr_t &handler, const ITER &start, const ITER &end)
Definition: correlator_plugin.hpp:538
virtual const char8 * stringValue() const =0
virtual void handleEvent(const AP_Context &ctx, const char *event, const char *channel)=0