fesa::OnSubscriptionEventSource Class Reference

OnSubscriptionEventSource is dedicated to establish subscriptions using the ProxyInterface and then trigger a rtEvent per notification received. More...

#include <OnSubscriptionEventSource.h>

Inheritance diagram for fesa::OnSubscriptionEventSource:
fesa::AbstractEventSource fesa::Thread

List of all members.

Classes

struct  EventInfo
 stores information about an event More...
class  SubscriptionThread
 This class creates a thread that keeps the reconnection of pending subscriptions. More...

Public Member Functions

 OnSubscriptionEventSource ()
 constructor

Private Types

typedef std::multimap
< std::pair< std::string,
std::string >, std::string > 
OnSubscriptionEventMapping
typedef std::set< std::pair
< std::string, std::string > > 
PendingSubscriptions

Private Member Functions

 ~OnSubscriptionEventSource ()
 destructor
void connect (boost::shared_ptr< fesa::EventElement > &eventElement)
 Connect method is used to register a new subscription.
RTEventwait ()
 calling this method the current thread is suspended until a new notification is received.
bool startSubscriptions ()
 This method is in charge of starting all the subscriptions already registered by the connect method.
void createSubscriptionThread ()
void deleteSubscriptionThread ()

Private Attributes

EventInfo eventInfo_
ProxyInterface proxy_
OnSubscriptionEventMapping onSubscriptionEventMapping_
PendingSubscriptions pendingSubscriptions_
OnSubscriptionEventMapping::iterator itr1_
 pointer to the first element in the map
OnSubscriptionEventMapping::iterator itr2_
 pointer to the last element in the map
bool IsSubscriptionStarted_
 Flag to know if the subscriptions have been already started or not.
SubscriptionThreadsubscriptionThread_
 Pointer to the thread in charge to establish the remaining subscriptions.

Friends

class AbstractRealTimeLabObjectFactory
class AbstractEventSourceFactory

Detailed Description

OnSubscriptionEventSource is dedicated to establish subscriptions using the ProxyInterface and then trigger a rtEvent per notification received.

Definition at line 22 of file OnSubscriptionEventSource.h.


Member Typedef Documentation

typedef std::multimap<std::pair<std::string, std::string>, std::string> fesa::OnSubscriptionEventSource::OnSubscriptionEventMapping [private]

multimap<<deviceName, propertyname> fesaEventName>

Definition at line 78 of file OnSubscriptionEventSource.h.

typedef std::set<std::pair<std::string, std::string> > fesa::OnSubscriptionEventSource::PendingSubscriptions [private]

Definition at line 82 of file OnSubscriptionEventSource.h.


Constructor & Destructor Documentation

fesa::OnSubscriptionEventSource::OnSubscriptionEventSource (  ) 
fesa::OnSubscriptionEventSource::~OnSubscriptionEventSource (  )  [private]

destructor

Definition at line 35 of file OnSubscriptionEventSource.cpp.

References deleteSubscriptionThread(), and subscriptionThread_.


Member Function Documentation

void fesa::OnSubscriptionEventSource::connect ( boost::shared_ptr< fesa::EventElement > &  eventElement  )  [private, virtual]

Connect method is used to register a new subscription.

Parameters:
eventName coming from instantiation. The subscription is identified by the set of device name, property name and cycle selector name with the format: "deviceName:propertyName#logicalEventName"

Implements fesa::AbstractEventSource.

Definition at line 41 of file OnSubscriptionEventSource.cpp.

References fesa::ON_SUBSCRIPTION_TAG_DEVICE, fesa::ON_SUBSCRIPTION_TAG_PROPERTY, onSubscriptionEventMapping_, and pendingSubscriptions_.

void fesa::OnSubscriptionEventSource::createSubscriptionThread (  )  [private]
void fesa::OnSubscriptionEventSource::deleteSubscriptionThread (  )  [private]
bool fesa::OnSubscriptionEventSource::startSubscriptions (  )  [private]

This method is in charge of starting all the subscriptions already registered by the connect method.

Returns:
Returns true if all subscription were established, false otherwise.

Definition at line 113 of file OnSubscriptionEventSource.cpp.

References fesa::FesaException::getMessage(), IsSubscriptionStarted_, onSubscriptionEventMapping_, pendingSubscriptions_, proxy_, and fesa::ProxyInterface::subscribe().

Referenced by wait().

RTEvent * fesa::OnSubscriptionEventSource::wait (  )  [private, virtual]

Friends And Related Function Documentation

friend class AbstractEventSourceFactory [friend]

Reimplemented from fesa::AbstractEventSource.

Definition at line 34 of file OnSubscriptionEventSource.h.

friend class AbstractRealTimeLabObjectFactory [friend]

Definition at line 33 of file OnSubscriptionEventSource.h.


Member Data Documentation

Definition at line 72 of file OnSubscriptionEventSource.h.

Referenced by wait().

Flag to know if the subscriptions have been already started or not.

Definition at line 101 of file OnSubscriptionEventSource.h.

Referenced by OnSubscriptionEventSource(), startSubscriptions(), and wait().

pointer to the first element in the map

Definition at line 89 of file OnSubscriptionEventSource.h.

Referenced by OnSubscriptionEventSource(), and wait().

pointer to the last element in the map

Definition at line 95 of file OnSubscriptionEventSource.h.

Referenced by OnSubscriptionEventSource(), and wait().

Pointer to the thread in charge to establish the remaining subscriptions.

Definition at line 126 of file OnSubscriptionEventSource.h.

Referenced by createSubscriptionThread(), deleteSubscriptionThread(), OnSubscriptionEventSource(), and ~OnSubscriptionEventSource().


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

Generated on 18 Jan 2013 for Fesa by  doxygen 1.6.1