Apama  10.2.0.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AP_CorrelatorInterface Class Referenceabstract

#include <correlator_plugin.hpp>

Public Member Functions

virtual ~AP_CorrelatorInterface ()=0
 
virtual void pluginNowBlocking () const =0
 
virtual void sendEvent (const char *event)=0
 
virtual void sendEventTo (const char *event, AP_uint64 targetContext, AP_uint64 sourceContext)=0
 
virtual void sendEventTo (const char *event, AP_uint64 targetContext, const AP_Context &source)=0
 
virtual void sendEventTo (const char *event, const char *targetChannel, const AP_Context &source)=0
 
void subscribe (const AP_EventHandlerInterface::ptr_t &handler, std::initializer_list< const char * > channels)
 
template<typename ITER >
void subscribe (const AP_EventHandlerInterface::ptr_t &handler, const ITER &start, const ITER &end)
 
template<typename T >
void subscribe (const AP_EventHandlerInterface::ptr_t &handler, const T &channel)
 
void unsubscribe (const AP_EventHandlerInterface::ptr_t &handler, std::initializer_list< const char * > channels)
 
template<typename ITER >
void unsubscribe (const AP_EventHandlerInterface::ptr_t &handler, const ITER &start, const ITER &end)
 
template<typename T >
void unsubscribe (const AP_EventHandlerInterface::ptr_t &handler, const T &channel)
 
virtual void unsubscribe (const AP_EventHandlerInterface::ptr_t &handler)=0
 

Protected Member Functions

virtual void subscribe_impl (const AP_EventHandlerInterface::ptr_t &handler, char const *const *start, char const *const *end)=0
 
virtual void unsubscribe_impl (const AP_EventHandlerInterface::ptr_t &handler, char const *const *start, char const *const *end)=0
 
template<typename ITER >
void subscribe_impl (const AP_EventHandlerInterface::ptr_t &handler, const ITER &start, const ITER &end)
 
template<typename ITER >
void unsubscribe_impl (const AP_EventHandlerInterface::ptr_t &handler, const ITER &start, const ITER &end)
 

Detailed Description

Deprecated:
Asynchronous interface to the correlator.

A per-plugin instance of this class can be obtained by calling AP_Context::getCorrelator(). Methods of this class may be invoked from background threads.

Constructor & Destructor Documentation

virtual AP_CorrelatorInterface::~AP_CorrelatorInterface ( )
pure virtual
Deprecated:
Destructor

Member Function Documentation

virtual void AP_CorrelatorInterface::pluginNowBlocking ( ) const
pure virtual
Deprecated:
Called by the plugin when it performs a potentially blocking operation.

A no-op if the plugin doesn't also declare itself as non-blocking via the AP_PLUGIN_GET_CAPABILITIES_FUNCTION_NAME. Potentially blocking operations include sendEventTo.

This form should be called if there is no AP_Context object supplied, such as in a destructor. It should only be called on the thread calling into the plugin from the correlator.

virtual void AP_CorrelatorInterface::sendEvent ( const char *  event)
pure virtual
Deprecated:
Send an event to the correlator
Parameters
eventthe event to send. The event is represented as a string using the format described in the manual. See AP_EventWriter.h for utility code to help build valid event strings.
virtual void AP_CorrelatorInterface::sendEventTo ( const char *  event,
AP_uint64  targetContext,
AP_uint64  sourceContext 
)
pure virtual
Deprecated:
Send an event to a specific context in the correlator
Parameters
eventthe event to send. The event is represented as a string using the format described in the manual. See AP_EventWriter.h for utility code to help build valid event strings.
targetContextthe target context.
sourceContextthe source context. Must be as returned from AP_Context.getContextId(), or 0 if called from a plugin thread.
Deprecated:
 This function is deprecated in favour of calling sendEventTo that takes a const AP_Context&.
In particular, you may not call this function from a plugin event handler and must pass in an AP_Context& to avoid deadlocks.
virtual void AP_CorrelatorInterface::sendEventTo ( const char *  event,
AP_uint64  targetContext,
const AP_Context source 
)
pure virtual
Deprecated:
Send an event to a specific context in the correlator
Parameters
eventthe event to send. The event is represented as a string using the format described in the manual. See AP_EventWriter.h for utility code to help build valid event strings.
targetContextthe target context.
sourcethe source context or handler. Must be the AP_Context passed to your function, or AP_Context::NoContext() if called from a plugin thread.
virtual void AP_CorrelatorInterface::sendEventTo ( const char *  event,
const char *  targetChannel,
const AP_Context source 
)
pure virtual
Deprecated:
Send an event to a specific channel in/out of the correlator
Parameters
eventthe event to send. The event is represented as a string using the format described in the manual. See AP_EventWriter.h for utility code to help build valid event strings.
targetChannelthe target channel name.
sourcethe source context or handler. Must be the AP_Context passed to your function, or AP_Context::NoContext() if called from a plugin thread.
void AP_CorrelatorInterface::subscribe ( const AP_EventHandlerInterface::ptr_t handler,
std::initializer_list< const char * >  channels 
)
inline
Deprecated:
Subscribe an event handler to a list of channels.

If this event handler is already subscribed to one or more channels, then the channels you specify in this call are added to that subscription (quashing duplicates). Otherwise a new subscription is created for the new channels.

This method uses smart pointers for reference counting and an initializer list (C++11) so should be called like this:

correlator->subscribe(AP_EventHandlerInterface::ptr_t(new MyHandlerType()), { "channel one", "channel two" });

Parameters
handlerThe event handler to subscribe.
channelsA list of the channels to subscribe to.
template<typename ITER >
void AP_CorrelatorInterface::subscribe ( const AP_EventHandlerInterface::ptr_t handler,
const ITER &  start,
const ITER &  end 
)
inline
Deprecated:
Subscribe an event handler to a list of channels.

If this event handler is already subscribed to one or more channels, then the channels you specify in this call are added to that subscription (quashing duplicates). Otherwise a new subscription is created for the new channels.

This method uses smart pointers for reference counting and an iterator pair, so should be called like this:

correlator->subscribe(AP_EventHandlerInterface::ptr_t(new MyHandlerType()), channels.begin(), channels.end());

or (with an array of char*s):

correlator->subscribe(AP_EventHandlerInterface::ptr_t(new MyHandlerType()), channels+0, channels+n);

equivalent to: for (auto it = start; it != end; ++it) { subscribe(my_handle, *it); }

The iterators must dereference to something which can be cast to a const char*

Parameters
handlerThe event handler to subscribe.
startThe iterator to start from
endThe iterator to end at
template<typename T >
void AP_CorrelatorInterface::subscribe ( const AP_EventHandlerInterface::ptr_t handler,
const T &  channel 
)
inline
Deprecated:
Subscribe an event handler to a list of channels.

If this event handler is already subscribed to one or more channels, then the channels you specify in this call are added to that subscription (quashing duplicates). Otherwise a new subscription is created for the new channels.

This method uses smart pointers for reference counting so should be called like this:

correlator->subscribe(AP_EventHandlerInterface::ptr_t(new MyHandlerType()), "channel one");

Parameters
handlerThe event handler to subscribe.
channelThe channel to subscribe to (must be castable to char*).
virtual void AP_CorrelatorInterface::subscribe_impl ( const AP_EventHandlerInterface::ptr_t handler,
char const *const *  start,
char const *const *  end 
)
protectedpure virtual
template<typename ITER >
void AP_CorrelatorInterface::subscribe_impl ( const AP_EventHandlerInterface::ptr_t handler,
const ITER &  start,
const ITER &  end 
)
inlineprotected
void AP_CorrelatorInterface::unsubscribe ( const AP_EventHandlerInterface::ptr_t handler,
std::initializer_list< const char * >  channels 
)
inline
Deprecated:
Unsubscribe an event handler from a list of channels.

If this results in the handler being subscribed to no channels, then removes that subscription entirely (which may result in deleting the handler if it has no other references).

This method uses smart pointers for reference counting and an initializer list (C++11) so should be called like this:

correlator->unsubscribe(my_handler, { "channel one", "channel two" });

Parameters
handlerThe event handler to unsubscribe.
channelsA list of the channels to unsubscribe from.
template<typename ITER >
void AP_CorrelatorInterface::unsubscribe ( const AP_EventHandlerInterface::ptr_t handler,
const ITER &  start,
const ITER &  end 
)
inline
Deprecated:
Unsubscribe an event handler from a list of channels.

If this results in the handler being subscribed to no channels, then removes that subscription entirely (which may result in deleting the handler if it has no other references).

This method uses smart pointers for reference counting and an iterator pair so should be called like this:

correlator->unsubscribe(my_handler, channels.begin(), channels.end());

or (with an array of char*s):

correlator->unsubscribe(my_handler, channels+0, channels+n);

equivalent to: for (auto it = start; it != end; ++it) { unsubscribe(my_handle, *it); }

The iterators must dereference to something which can be cast to a const char*

Parameters
handlerThe event handler to unsubscribe.
startThe iterator to start from
endThe iterator to end at
template<typename T >
void AP_CorrelatorInterface::unsubscribe ( const AP_EventHandlerInterface::ptr_t handler,
const T &  channel 
)
inline
Deprecated:
Unsubscribe an event handler from a channel.

If this results in the handler being subscribed to no channels, then removes that subscription entirely (which may result in deleting the handler if it has no other references).

This method uses smart pointers for reference counting.

Parameters
handlerThe event handler to unsubscribe.
channelThe channel to unsubscribe from (must be castable to a char*)
virtual void AP_CorrelatorInterface::unsubscribe ( const AP_EventHandlerInterface::ptr_t handler)
pure virtual
Deprecated:
Unsubscribe an event handler from all channels.

This may result in deleting the handler if it has no other references.

Parameters
handlerThe event handler to unsubscribe.
virtual void AP_CorrelatorInterface::unsubscribe_impl ( const AP_EventHandlerInterface::ptr_t handler,
char const *const *  start,
char const *const *  end 
)
protectedpure virtual
template<typename ITER >
void AP_CorrelatorInterface::unsubscribe_impl ( const AP_EventHandlerInterface::ptr_t handler,
const ITER &  start,
const ITER &  end 
)
inlineprotected

The documentation for this class was generated from the following file: