#include <acsncRTSupplier.h>
Classes | |
class | EventProcessingCallback |
struct | unpublishedEventData |
Public Member Functions | |
RTSupplier (const char *channelName, acscomponent::ACSComponentImpl *component) | |
virtual void | disconnect () |
template<class T > | |
void | publishData (T data, EventProcessingCallback *evProcCallback=NULL) |
unsigned int | getQueueSize () |
Protected Member Functions | |
virtual | ~RTSupplier () |
Static Protected Member Functions | |
static void | worker (void *param_p) |
Protected Attributes | |
baci::BACIThreadManager * | threadManager_mp |
std::queue< unpublishedEventData > | unpublishedEvents_m |
CORBA::Any | any_m |
ACE_Thread_Mutex | eventQueueMutex_m |
Logging::RepeatGuardLogger < Logging::BaseLog > * | rtSupGuardb |
Logging::RepeatGuardLogger < ACSErr::ACSbaseExImpl > * | rtSupGuardex |
Private Member Functions | |
void | operator= (const RTSupplier &) |
RTSupplier (const RTSupplier &) |
RTSupplier is used to publish data onto a notification channel defined by the string passed to RTSupplier's constructor. Please do not let the name confuse you as this class does not publish structured events in real-time. Instead, invocations of the publishData method merely save the structured event to an internal queue and the event will be sent across the network by a low-priority thread sometime later. In summary, it's safe to call publishData from real-time code as it does not block until the event has been received on manager's host.
TODO:
nc::RTSupplier::RTSupplier | ( | const char * | channelName, | |
acscomponent::ACSComponentImpl * | component | |||
) |
Constructor
channlName | The name of the channel events will be published to. | |
component | A reference to a component is needed for the Event Description (which is normally hidden from Consumers). |
virtual nc::RTSupplier::~RTSupplier | ( | ) | [protected, virtual] |
Destructor is protected.
nc::RTSupplier::RTSupplier | ( | const RTSupplier & | ) | [private] |
ALMA C++ coding standards state copy constructors should be disabled.
virtual void nc::RTSupplier::disconnect | ( | ) | [virtual] |
Overriden from Supplier class. Ensures all events in the queue are published before exiting.
Reimplemented from nc::Supplier.
unsigned int nc::RTSupplier::getQueueSize | ( | ) |
Returns the size of the queue with events waiting to be sent by the worker thread.
void nc::RTSupplier::operator= | ( | const RTSupplier & | ) | [private] |
ALMA C++ coding standards state assignment operators should be disabled.
void nc::RTSupplier::publishData | ( | T | data, | |
EventProcessingCallback * | evProcCallback = NULL | |||
) |
Templated method called by the developer to send ICD events to consumers. publishData saves the ICD event to an internal queue and returns control immediately. Please note that any exceptions associated with actual CORBA calls involved with pushing events are only logged as this functionality is really performed by the worker method/thread.
ACSErrTypeCommon::CORBAProblemEx |
data | A user-defined IDL struct. FRIDGE::temperatureDataBlockEvent for example
|
static void nc::RTSupplier::worker | ( | void * | param_p | ) | [static, protected] |
Low priority thread method which is actually responsible for sending events across the network. Any exceptions generated by the CORBA calls are only logged here. This thread just sleeps for awhile if there are no events to publish. If the queue is non-empty, it publishes all events before sleeping again.
parmam_p | A pointer to this instance. |
CORBA::Any nc::RTSupplier::any_m [protected] |
A CORBA any which is used to encode/store ICD style events. This has been made a member variable to improve performance of the publishData method.
ACE_Thread_Mutex nc::RTSupplier::eventQueueMutex_m [protected] |
Mutex prevents real-time code from saving half an event with the low priority thread trying to publish it.
Repeat guard for the logger, to be used in static methods
Repeat guard for the exceptions, to be used in static methods
baci::BACIThreadManager* nc::RTSupplier::threadManager_mp [protected] |
BACI thread manager used to control the worker thread.
std::queue<unpublishedEventData> nc::RTSupplier::unpublishedEvents_m [protected] |
A queque of structured events.