SubscriptionTreeManager.h

Go to the documentation of this file.
00001 // Copyright CERN 2012 - Developed in collaboration with GSI
00002 
00003 #ifndef SUBSCRIPTION_TREE_MANAGER_H_
00004 #define SUBSCRIPTION_TREE_MANAGER_H_
00005 
00006 #include <fesa-core/RDADeviceServer/SubscriptionCycle.h>
00007 #include <fesa-core/RDADeviceServer/NotificationThreadFactory.h>
00008 #include <fesa-core/Core/FesaDefs.h>
00009 #include <fesa-core/Utilities/Mutex.h>
00010 
00011 #include <string>
00012 #include <map>
00013 #include <boost/shared_ptr.hpp>
00014 
00015 class rdaData;
00016 class rdaValueChangeListener;
00017 
00018 namespace fesa
00019 {
00020 
00021 class AbstractDevice;
00022 class Property;
00023 class MultiplexingContext;
00024 class ManualNotificationMessage;
00025 class SubscriptionParameter;
00026 class Notification;
00027 
00033 class SubscriptionTreeManager
00034 {
00035   public:
00036 
00042     SubscriptionTreeManager(bool useFastUpdate);
00043     SubscriptionTreeManager(const SubscriptionTreeManager& other);
00044     SubscriptionTreeManager& operator=(const SubscriptionTreeManager& other);
00045 
00046 
00051     bool initialize();
00052 
00061     void addSubscriber(const std::string& className, AbstractDevice& device, Property& property,
00062                        const std::string& cycleSelector, const rdaData& filter, rdaValueChangeListener* subscriber);
00063 
00071     void removeSubscriber( AbstractDevice& device, Property& property, const std::string& cycleSelector,
00072                            rdaValueChangeListener* subscriber);
00073 
00080     void notify(uint32_t IDKey, MultiplexingContext& muxContext,
00081                 RequestType& reqType);
00082 
00088     void notify(ManualNotificationMessage* msg, RequestType& reqType);
00089 
00090 
00097     void reportInternalError(const std::string& errorCategory, int32_t errorCode, const std::string&  message);
00098 
00102     ~SubscriptionTreeManager();
00103 
00104   private:
00105 
00110     boost::shared_ptr<SubscriptionParameter> addSubscriptionParam(const std::string& paramName, AbstractDevice& device, Property& property, const std::string& cycleSelector,
00111                                                                   const rdaData& filter, rdaValueChangeListener* subscriber);
00112 
00116     void initNotifications();
00117 
00122     //            void addGlobalDevicesToNotificationIDCollection();
00123 
00127     Mutex treeMutex_;
00128 
00133     typedef std::map<uint32_t, boost::shared_ptr<Notification> > NotificationMap;
00134     typedef NotificationMap::iterator NotificationItr;
00135     NotificationMap notifications_;
00136 
00140     typedef std::map<std::string, boost::shared_ptr<SubscriptionParameter> > SubscriptionMap;
00141     typedef SubscriptionMap::iterator SubscriptionItr;
00142     SubscriptionMap subscriptions_;
00143 
00148     SubscriptionCycle subscriptionCycle_;
00149 
00153     bool initializationSucessfull_;
00154 
00158     //            std::vector<SubscriptionParameter*> waitingSubscriberCol_;
00159 
00160 
00164     int32_t lastErrorCode_;
00165 
00171     bool useFastUpdate_;
00172 
00176     NotificationThreadFactory notificationThreadFactory_;
00177 
00178     void printState(std::string& header);
00179 
00180 };
00181 
00182 } // fesa
00183 
00184 #endif // SUBSCRIPTION_TREE_MANAGER_H_

Generated on 18 Jan 2013 for Fesa by  doxygen 1.6.1