Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

nc::SimpleConsumer< T > Class Template Reference

#include <acsncSimpleConsumer.h>

Inheritance diagram for nc::SimpleConsumer< T >:

Inheritance graph
[legend]
Collaboration diagram for nc::SimpleConsumer< T >:

Collaboration graph
[legend]
List of all members.

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 &notification)

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)

Detailed Description

template<class T>
class nc::SimpleConsumer< T >

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:


Member Typedef Documentation

template<class T>
typedef void(* nc::SimpleConsumer< T >::eventHandlerFunction)(T eventData, void *handlerParam)
 

Pointer to an event handler function.

Parameters:
eventData A templated ICD event structure
handlerParam A void parameter passed to the addSubscription method. This can be anything the developers chooses.
Returns:
void


Constructor & Destructor Documentation

template<class T>
nc::SimpleConsumer< T >::SimpleConsumer const char *  channelName  ) 
 

Constructor to be used within components.

Parameters:
channelName The channel's name

template<class T>
virtual nc::SimpleConsumer< T >::~SimpleConsumer  )  [protected, virtual]
 

Destructor is protected.

template<class T>
nc::SimpleConsumer< T >::SimpleConsumer const SimpleConsumer< T > &   )  [private]
 

ALMA C++ coding standards state copy constructors should be disabled.


Member Function Documentation

template<class T>
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).

Parameters:
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.
Returns:
void

template<class T>
template<class J>
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.

Parameters:
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.
Exceptions:
ACSErrTypeCommon::CouldntPerformActionEx 
Returns:
void

template<class T>
void nc::SimpleConsumer< T >::operator= const SimpleConsumer< T > &   )  [private]
 

ALMA C++ coding standards state assignment operators should be disabled.

template<class T>
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!

Exceptions:
CosEventComm::Disconnected 
Returns:
void

Implements nc::Consumer.


Member Data Documentation

template<class T>
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.

template<class T>
eventHandlerFunction nc::SimpleConsumer< T >::templateFunction_mp [protected]
 

This function does something with T events.


The documentation for this class was generated from the following file:
Generated on Thu Apr 30 02:37:34 2009 for ACS C++ API by doxygen 1.3.8