#include <acsncSimpleConsumer.h>
Public Types | |
typedef void(* | eventHandlerFunction )(T eventData, void *handlerParam) |
Public Member Functions | |
SimpleConsumer (const char *channelName) | |
template<class J > | |
void | addSubscription (eventHandlerFunction templateFunction, void *handlerParam=0) |
virtual void | push_structured_event (const CosNotification::StructuredEvent ¬ification) |
Protected Member Functions | |
virtual | ~SimpleConsumer () |
Protected Attributes | |
eventHandlerFunction | templateFunction_mp |
void * | handlerParam_mp |
Private Member Functions | |
void | operator= (const SimpleConsumer &) |
SimpleConsumer (const SimpleConsumer &) | |
void | addSubscription (const char *type_name, eventHandlerFunction templateFunction, void *handlerParam=0) |
SimpleConsumer is used to consume data from a notification channel defined by the string passed to SimpleConsumer's constructor. In a nutshell, this class has been provided so that developers do not have to subclass Consumer and can instead use a generic function to process events.
To begin consuming data, simply invoke the consumerReady method. After that, the eventHandlerFunction will be invoked asynchronously each time an event is received.
TODO:
typedef void(* nc::SimpleConsumer< T >::eventHandlerFunction)(T eventData, void *handlerParam) |
nc::SimpleConsumer< T >::SimpleConsumer | ( | const char * | channelName | ) |
Constructor to be used within components.
channelName | The channel's name |
virtual nc::SimpleConsumer< T >::~SimpleConsumer | ( | ) | [protected, virtual] |
Destructor is protected.
nc::SimpleConsumer< T >::SimpleConsumer | ( | const SimpleConsumer< T > & | ) | [private] |
ALMA C++ coding standards state copy constructors should be disabled.
void nc::SimpleConsumer< T >::addSubscription | ( | eventHandlerFunction | templateFunction, | |
void * | handlerParam = 0 | |||
) | [inline] |
A special version of the addSubscription method. Not only subscribes to an event_type, but it also saves a function pointer and an extra paremter to the function to be utilized when an event of type_name is received. Currently the implementation only allows this method to be invoked once (and that is done from the ACSNC_NEW_SIMPLE_CONSUMER macro). The template paramter is the type_name of the event to be received.
templateFunction | A (static) method which will be invoked each time a type_name event is received. The method must accept a <T> structure as it's first parameter. | |
handlerParam | A void pointer that will be passed to templateFunction (in addition to the actual ICD <T> event) each time a type_name event is received. |
ACSErrTypeCommon::CouldntPerformActionEx |
void nc::SimpleConsumer< T >::addSubscription | ( | const char * | type_name, | |
eventHandlerFunction | templateFunction, | |||
void * | handlerParam = 0 | |||
) | [private] |
A special version of the addSubscription method. Not only subscribes to an event_type, but it also saves a function pointer and an extra paremter to the function to be utilized when an event of type_name is received. Currently the implementation only allows this method to be invoked once (and that is done from the ACSNC_NEW_SIMPLE_CONSUMER macro).
type_name | Type of the event to be received | |
templateFunction | A (static) method which will be invoked each time a type_name event is received. The method must accept a <T> structure as it's first parameter. | |
handlerParam | A void pointer that will be passed to templateFunction (in addition to the actual ICD <T> event) each time a type_name event is received. |
void nc::SimpleConsumer< T >::operator= | ( | const SimpleConsumer< T > & | ) | [private] |
ALMA C++ coding standards state assignment operators should be disabled.
virtual void nc::SimpleConsumer< T >::push_structured_event | ( | const CosNotification::StructuredEvent & | notification | ) | [virtual] |
This is the abstract method inherited Consumer which must be overridden. In the SimpleConsumer class, it just invokes some function registered via the addSubscription method. In doing this, one does not have to override SimpleConsumer. Note that this method must not be invoked by your code!
CosEventComm::Disconnected |
Implements nc::Consumer.
void* nc::SimpleConsumer< T >::handlerParam_mp [protected] |
This is a single parameter that will be passed to the handler function in addition to the ICD <T> event.
Referenced by nc::SimpleConsumer< COUNTER::statusBlockEvent >::addSubscription().
eventHandlerFunction nc::SimpleConsumer< T >::templateFunction_mp [protected] |
This function does something with T events.
Referenced by nc::SimpleConsumer< COUNTER::statusBlockEvent >::addSubscription().