00001 // Copyright CERN 2012 - Developed in collaboration with GSI 00002 00003 #ifndef THREAD_PRIORITY_CONFIGURATION_H 00004 #define THREAD_PRIORITY_CONFIGURATION_H 00005 00006 #include <string> 00007 00008 #include <stdint.h> 00009 00010 namespace fesa 00011 { 00012 00013 class ProcessConfiguration; 00014 class XMLParser; 00015 00016 const std::string threadCmwXMLElementName = "rda-server-thread"; 00017 const std::string threadPersistenceXMLElementName = "persistence-thread"; 00018 const std::string threadNotificationConsumerXMLElementName = "server-notif-thread"; 00019 const std::string threadClientNotificationXMLElementName = "/client-notification-threads/"; 00020 const std::string threadRTSchedulerXMLElementName = "-concurrency-layer"; 00021 const std::string threadEventSourceXMLElementName = "-event-source"; 00022 const std::string priorityAttributeName = "prio"; 00023 00024 class ThreadPriorityConfiguration 00025 { 00026 public: 00027 virtual int32_t getPrioCMW() const = 0; 00028 virtual int32_t getPrioPersistence() const = 0; 00029 virtual int32_t getPrioNotificationConsumer() const = 0; 00030 virtual int32_t getPrioRTScheduler(const std::string& name) const = 0; 00031 virtual int32_t getPrioEventSource(const std::string& name) const = 0; 00032 virtual int32_t getPrioNotificationthread(const std::string& className, const std::string& notificationThreadKey) const = 0; 00033 virtual bool getMaximumPrio(int32_t &maxPrio) const = 0; 00034 virtual ~ThreadPriorityConfiguration(); 00035 }; 00036 00037 00038 class ThreadPriorityConfigurationFromFile : public ThreadPriorityConfiguration 00039 { 00040 public: 00041 int32_t getPrioCMW() const; 00042 int32_t getPrioPersistence() const; 00043 int32_t getPrioNotificationConsumer() const; 00044 int32_t getPrioRTScheduler(const std::string& name) const; 00045 int32_t getPrioEventSource(const std::string& name) const; 00046 int32_t getPrioNotificationthread(const std::string& className, const std::string& notificationThreadKey) const; 00047 00054 bool getMaximumPrio(int32_t &maxPrio) const; 00055 ThreadPriorityConfigurationFromFile(XMLParser& xmlParser, const ProcessConfiguration* processConfiguration); 00056 ~ThreadPriorityConfigurationFromFile(); 00057 private: 00058 00059 //The xml which will be used to read out the instantiation file 00060 XMLParser& xmlParser_; 00061 00065 const ProcessConfiguration* processConfiguration_; 00066 00067 //true, if nice-priorities should be used instead of rt-priorities 00068 bool use_nice_priorities_; 00069 }; 00070 00071 00072 class ThreadPriorityConfigurationFromCCDB : public ThreadPriorityConfiguration 00073 { 00074 int32_t getPrioCMW() const; 00075 int32_t getPrioPersistence() const; 00076 int32_t getPrioNotificationConsumer() const; 00077 int32_t getPrioRTScheduler(const std::string& name) const; 00078 int32_t getPrioEventSource(const std::string& name) const; 00079 int32_t getPrioNotificationthread(const std::string& className, const std::string& notificationThreadKey) const; 00080 bool getMaximumPrio(int32_t &maxPrio) const; 00081 }; 00082 00083 } // fesa 00084 00085 #endif // THREAD_PRIORITY_CONFIGURATION_H