OnSubscriptionEventSource is dedicated to establish subscriptions using the ProxyInterface and then trigger a rtEvent per notification received. More...
#include <OnSubscriptionEventSource.h>
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. | |
RTEvent * | wait () |
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. | |
SubscriptionThread * | subscriptionThread_ |
Pointer to the thread in charge to establish the remaining subscriptions. | |
Friends | |
class | AbstractRealTimeLabObjectFactory |
class | AbstractEventSourceFactory |
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.
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.
fesa::OnSubscriptionEventSource::OnSubscriptionEventSource | ( | ) |
constructor
Definition at line 26 of file OnSubscriptionEventSource.cpp.
References IsSubscriptionStarted_, itr1_, itr2_, onSubscriptionEventMapping_, and subscriptionThread_.
fesa::OnSubscriptionEventSource::~OnSubscriptionEventSource | ( | ) | [private] |
destructor
Definition at line 35 of file OnSubscriptionEventSource.cpp.
References deleteSubscriptionThread(), and subscriptionThread_.
void fesa::OnSubscriptionEventSource::connect | ( | boost::shared_ptr< fesa::EventElement > & | eventElement | ) | [private, virtual] |
Connect method is used to register a new subscription.
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] |
Definition at line 139 of file OnSubscriptionEventSource.cpp.
References fesa::Thread::getPriority(), fesa::Thread::setPriority(), fesa::Thread::start(), and subscriptionThread_.
Referenced by wait().
void fesa::OnSubscriptionEventSource::deleteSubscriptionThread | ( | ) | [private] |
Definition at line 146 of file OnSubscriptionEventSource.cpp.
References fesa::Thread::stop(), and subscriptionThread_.
Referenced by fesa::OnSubscriptionEventSource::SubscriptionThread::run(), and ~OnSubscriptionEventSource().
bool fesa::OnSubscriptionEventSource::startSubscriptions | ( | ) | [private] |
This method is in charge of starting all the subscriptions already registered by the connect method.
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] |
calling this method the current thread is suspended until a new notification is received.
FesaException |
Implements fesa::AbstractEventSource.
Definition at line 51 of file OnSubscriptionEventSource.cpp.
References createSubscriptionThread(), fesa::SynchronizationLabObjectFactory::createTimingContext(), fesa::OnSubscriptionEventSource::EventInfo::cycleSelectorName, fesa::OnSubscriptionEventSource::EventInfo::data, fesa::OnSubscriptionEventSource::EventInfo::deviceName, eventInfo_, fesa::SynchronizationLabObjectFactory::getInstance(), IsSubscriptionStarted_, itr1_, itr2_, onSubscriptionEventMapping_, fesa::OnSubscriptionEventSource::EventInfo::propertyName, proxy_, fesa::OnSubscriptionRTEventPayload::rdaData_, fesa::AbstractEventSource::RTEvent, startSubscriptions(), and fesa::ProxyInterface::waitNotification().
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.
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().
fesa::OnSubscriptionEventSource::itr1_ [private] |
pointer to the first element in the map
Definition at line 89 of file OnSubscriptionEventSource.h.
Referenced by OnSubscriptionEventSource(), and wait().
fesa::OnSubscriptionEventSource::itr2_ [private] |
pointer to the last element in the map
Definition at line 95 of file OnSubscriptionEventSource.h.
Referenced by OnSubscriptionEventSource(), and wait().
Definition at line 80 of file OnSubscriptionEventSource.h.
Referenced by connect(), OnSubscriptionEventSource(), startSubscriptions(), and wait().
Definition at line 83 of file OnSubscriptionEventSource.h.
Referenced by connect(), fesa::OnSubscriptionEventSource::SubscriptionThread::run(), and startSubscriptions().
Definition at line 73 of file OnSubscriptionEventSource.h.
Referenced by fesa::OnSubscriptionEventSource::SubscriptionThread::run(), startSubscriptions(), 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().