OnSubscriptionEventSource.h

Go to the documentation of this file.
00001 // Copyright CERN 2012 - Developed in collaboration with GSI
00002 
00003 #ifndef ON_SUBSCRIPTION_EVENT_SOURCE_H
00004 #define ON_SUBSCRIPTION_EVENT_SOURCE_H
00005 
00006 #include <fesa-core/RealTime/AbstractEventSource.h>
00007 #include <fesa-core/Proxy/ProxyInterface.h>
00008 
00009 #include <string>
00010 #include <set>
00011 
00012 namespace fesa
00013 {
00014 
00015 class EventElement;
00016 
00022 class OnSubscriptionEventSource : public AbstractEventSource
00023 {
00024   public:
00025 
00029     OnSubscriptionEventSource();
00030 
00031   private:
00032 
00033     friend class AbstractRealTimeLabObjectFactory;
00034     friend class AbstractEventSourceFactory;
00035 
00039     ~OnSubscriptionEventSource();
00040 
00047     void connect(boost::shared_ptr<fesa::EventElement>& eventElement);
00048 
00053     RTEvent* wait();
00054 
00059     bool startSubscriptions();
00060 
00065     struct EventInfo
00066     {
00067         std::string deviceName;
00068         std::string propertyName;
00069         std::string cycleSelectorName;
00070         rdaData data;
00071     };
00072     EventInfo eventInfo_;
00073     ProxyInterface proxy_;
00074 
00078     typedef std::multimap<std::pair<std::string, std::string>, std::string> OnSubscriptionEventMapping;
00079 
00080     OnSubscriptionEventMapping onSubscriptionEventMapping_;
00081 
00082     typedef std::set<std::pair<std::string, std::string> > PendingSubscriptions;
00083     PendingSubscriptions pendingSubscriptions_;
00084 
00089     OnSubscriptionEventMapping::iterator itr1_;
00090 
00095     OnSubscriptionEventMapping::iterator itr2_;
00096 
00101     bool IsSubscriptionStarted_;
00102 
00108     class SubscriptionThread : public Thread
00109     {
00110       public:
00111         SubscriptionThread(OnSubscriptionEventSource*);
00112         ~SubscriptionThread();
00113       private:
00114         void run();
00119         OnSubscriptionEventSource* evtSrc_;
00120     };
00121 
00126     SubscriptionThread* subscriptionThread_;
00127 
00128     void createSubscriptionThread();
00129     void deleteSubscriptionThread();
00130 
00131 };
00132 
00133 } // fesa
00134 
00135 #endif // ON_SUBSCRIPTION_EVENT_SOURCE_H

Generated on 18 Jan 2013 for Fesa by  doxygen 1.6.1