00001 // Copyright CERN 2012 - Developed in collaboration with GSI 00002 00003 #ifndef NOTIFICATION_PRODUCER_H_ 00004 #define NOTIFICATION_PRODUCER_H_ 00005 00006 #include <fesa-core/Core/FesaDefs.h> 00007 #include <fesa-core/Core/AbstractMsgQueue.h> 00008 00009 #include <string> 00010 00011 namespace fesa 00012 { 00013 00014 class ManualNotificationMessage; 00015 class MultiplexingContext; 00016 00022 class NotificationProducer 00023 { 00024 public: 00025 00032 void sendAutomaticNotification(const uint32_t& notificationID, 00033 MultiplexingContext& muxContext, uint32_t msgPrio = DEFAULT_MQ_PRIO); 00034 00041 void sendManualNotification(ManualNotificationMessage& manMsg); 00042 00050 void sendCommandMessage(const std::string &command, const std::string ¶meter1, 00051 const std::string ¶meter2, uint32_t msgPrio = DEFAULT_MQ_PRIO); 00052 00057 uint32_t getCurrentMsgCount(); 00058 00062 static NotificationProducer* getInstance(); 00063 00064 private: 00065 00069 static void releaseInstance(); 00070 00074 AbstractMsgQueue* msgQueuePtr_; 00075 00079 static NotificationProducer* theInstance_; 00080 00085 NotificationProducer(const std::string& queueName); 00086 00090 NotificationProducer(const NotificationProducer& other); 00091 00092 NotificationProducer& operator=(const NotificationProducer& other); 00093 00097 ~NotificationProducer(); 00098 00099 //for releaseInstance() at the cleanup 00100 friend class AbstractEquipment; 00101 }; 00102 00103 inline uint32_t NotificationProducer::getCurrentMsgCount() 00104 { 00105 return msgQueuePtr_->getCurrentMsgCount(); 00106 } 00107 00108 } // fesa 00109 00110 #endif // NOTIFICATION_PRODUCER_H_