fesa::NotificationThread Class Reference

this class is used to notify a subscriber with adjustable priority (always lower, than usual). Each property has a priority level. If that level is lower than the priority's of the server thread, notifications from that property are executed in a NotificationThread. The different NotificationThreads are kept in a Threadpool inside the NotificationThreadFactory. The Notifications of one NotificationThread are stored inside a queue. When the "startConsumption" conditional variable is triggered, the queue will be processed. More...

#include <NotificationThread.h>

Inheritance diagram for fesa::NotificationThread:
fesa::Thread

List of all members.

Classes

class  NotificationQueueElement
 this class stores the triple context, request type, and subcycle. More...

Public Member Functions

 NotificationThread (const std::string &className, const std::string &notificationThreadKey)
 constructor notificationThreadKey string
virtual ~NotificationThread ()
 destructor
void addNotificationEvent (MultiplexingContext &muxContext, RequestType &reqType, std::vector< std::string > &validCS, SubscriptionFilter *subFilter)
 this method adds a new notification event to the queue
bool removeNotificationEvent (SubscriptionFilter *subFilter)
 On an "unsubscribe" the queue has to be cleaned from all instances of the subscriber, before the subscriber can be removed from the subscription tree.
MutexgetMutex ()
 Returns the mutex associated to this NotificationThread instance.

Private Member Functions

void run ()
 As soon, as the Thread is started, it will wait for the ConditionVariable to trigger. As soon as a trigger is recieved, the class will empty the queue and notify all NotificationDevices on it.

Private Attributes

std::deque< boost::shared_ptr
< NotificationQueueElement > > 
queue_
 queue used to store the "Notification Events"
SubscriptionFilterinUseSubFilter_
Mutex mutexQueue_
 mutex protecting the access to the queue (The stl-message queue is not thread-save!!)
Mutex mutexBackThread_
 mutex dedicated to this specific instance of notification and used to protect rdaListener notified from a notificationThread
ConditionalVariable startConsumption_
 The startConsumption is triggered as soon as all Notifications are put into the queue.

Detailed Description

this class is used to notify a subscriber with adjustable priority (always lower, than usual). Each property has a priority level. If that level is lower than the priority's of the server thread, notifications from that property are executed in a NotificationThread. The different NotificationThreads are kept in a Threadpool inside the NotificationThreadFactory. The Notifications of one NotificationThread are stored inside a queue. When the "startConsumption" conditional variable is triggered, the queue will be processed.

Definition at line 28 of file NotificationThread.h.


Constructor & Destructor Documentation

fesa::NotificationThread::NotificationThread ( const std::string &  className,
const std::string &  notificationThreadKey 
)
fesa::NotificationThread::~NotificationThread (  )  [virtual]

destructor

Definition at line 60 of file NotificationThread.cpp.


Member Function Documentation

void fesa::NotificationThread::addNotificationEvent ( MultiplexingContext muxContext,
RequestType reqType,
std::vector< std::string > &  validCS,
SubscriptionFilter subFilter 
)

this method adds a new notification event to the queue

Parameters:
muxContext the corresponding Multiplexing Context
reqType indicates whether the notification is due to a get, set or immediate update
subscriber the Subscriber that is notified

Definition at line 64 of file NotificationThread.cpp.

References mutexQueue_, queue_, fesa::ConditionalVariable::signal(), and startConsumption_.

Referenced by fesa::SubscriptionFilter::notify().

Mutex & fesa::NotificationThread::getMutex (  )  [inline]
bool fesa::NotificationThread::removeNotificationEvent ( SubscriptionFilter subFilter  ) 

On an "unsubscribe" the queue has to be cleaned from all instances of the subscriber, before the subscriber can be removed from the subscription tree.

Parameters:
subscriber the Subscriber that is removed
Returns:
bool that is true if the subscriptionFilter is in use and therefore cannot be deleted

Definition at line 76 of file NotificationThread.cpp.

References inUseSubFilter_, mutexQueue_, and queue_.

Referenced by fesa::SubscriptionFilter::removeSubscriber().

void fesa::NotificationThread::run (  )  [private, virtual]

As soon, as the Thread is started, it will wait for the ConditionVariable to trigger. As soon as a trigger is recieved, the class will empty the queue and notify all NotificationDevices on it.

Implements fesa::Thread.

Definition at line 98 of file NotificationThread.cpp.

References fesa::SubscriptionFilter::doUpdate(), fesa::Thread::hasFinished_, inUseSubFilter_, fesa::Thread::isRunning_, mutexQueue_, queue_, startConsumption_, and fesa::ConditionalVariable::wait().


Member Data Documentation

Definition at line 119 of file NotificationThread.h.

Referenced by removeNotificationEvent(), and run().

mutex dedicated to this specific instance of notification and used to protect rdaListener notified from a notificationThread

Definition at line 130 of file NotificationThread.h.

Referenced by getMutex().

mutex protecting the access to the queue (The stl-message queue is not thread-save!!)

Definition at line 124 of file NotificationThread.h.

Referenced by addNotificationEvent(), removeNotificationEvent(), and run().

std::deque<boost::shared_ptr<NotificationQueueElement> > fesa::NotificationThread::queue_ [private]

queue used to store the "Notification Events"

Definition at line 117 of file NotificationThread.h.

Referenced by addNotificationEvent(), removeNotificationEvent(), and run().

The startConsumption is triggered as soon as all Notifications are put into the queue.

Definition at line 135 of file NotificationThread.h.

Referenced by addNotificationEvent(), and run().


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

Generated on 18 Jan 2013 for Fesa by  doxygen 1.6.1