00001 // Copyright CERN 2012 - Developed in collaboration with GSI 00002 00003 #ifndef RT_EVENT_H_ 00004 #define RT_EVENT_H_ 00005 00006 #include <fesa-core/Core/AbstractEvent.h> 00007 #include <fesa-core/Exception/FesaException.h> 00008 00009 namespace fesa 00010 { 00011 00012 class AbstractEventSource; 00013 class RTEventPayload; 00014 00020 class RTEvent : public AbstractEvent 00021 { 00022 public: 00023 00029 RTEvent(const std::string& concreteEventName, MultiplexingContext* context, AbstractEventSource* pEvtSrc); 00030 00040 RTEvent(const std::string& concreteEventName, MultiplexingContext* context, AbstractEventSource* pEvtSrc, RTEventPayload* pPayload); 00041 00042 virtual ~RTEvent(); 00043 00051 RTEventPayload* getPayload(); 00052 00057 AbstractEventSource* getEventSource(); 00058 00059 const std::string& getName() const; 00060 00061 protected: 00062 00066 RTEventPayload* payload_; 00067 00068 std::string concreteEventName_; 00069 00070 private: 00071 00072 AbstractEventSource* pEvtSrc_; 00073 00074 friend class AbstractRTAction; 00075 }; 00076 00077 /************************************************************************/ 00078 00079 inline RTEventPayload* RTEvent::getPayload() 00080 { 00081 if (payload_ == 0) 00082 { 00083 throw FesaException(__FILE__, __LINE__, FesaErrorGettingPayload.c_str(), concreteEventName_.c_str()); 00084 } 00085 return payload_; 00086 } 00087 00088 inline const std::string& RTEvent::getName() const 00089 { 00090 return concreteEventName_; 00091 } 00092 00093 } // fesa 00094 00095 #endif // RT_EVENT_H_