RTEvent.cpp

Go to the documentation of this file.
00001 // Copyright CERN 2012 - Developed in collaboration with GSI
00002 
00003 #include <fesa-core/RealTime/RTEvent.h>
00004 
00005 #include <fesa-core/RealTime/RTEventPayload.h>
00006 #include <fesa-core/Synchronization/MultiplexingContext.h>
00007 #include <fesa-core/Core/AbstractEquipment.h>
00008 #include <fesa-core/Diagnostic/Diagnostics.h>
00009 
00010 #include <cmw-log/Logger.h>
00011 
00012 
00013 namespace
00014 {
00015 
00016 const std::string diagTopic = fesa::DiagnosticUtils::eventProfilingStr;
00017 
00018 } // namespace
00019 
00020 
00021 namespace fesa
00022 {
00023 
00024 RTEvent::RTEvent(const std::string& concreteEventName, MultiplexingContext* context, AbstractEventSource* pEvtSrc) :
00025     AbstractEvent(context),
00026     payload_(0),
00027     concreteEventName_(concreteEventName),
00028     pEvtSrc_(pEvtSrc)
00029 {
00030     const boost::shared_ptr<Diagnostics>& diagnostics = AbstractEquipment::getInstance()->getDiagnostics();
00031     DiagnosticUtils::DiagnosticMessage diagMsg;
00032     diagMsg.side = DiagnosticUtils::framework;
00033     diagMsg.source = DiagnosticUtils::event;
00034     diagMsg.name = getName();
00035     diagMsg.action = DiagnosticUtils::start;
00036     diagnostics->log(diagTopic, diagMsg);
00037 }
00038 
00039 RTEvent::RTEvent(const std::string& concreteEventName, MultiplexingContext* context, AbstractEventSource* pEvtSrc,
00040                  RTEventPayload* payload) :
00041     AbstractEvent(context),
00042     payload_(payload),
00043     concreteEventName_(concreteEventName),
00044     pEvtSrc_(pEvtSrc)
00045 {
00046     const boost::shared_ptr<Diagnostics>& diagnostics = AbstractEquipment::getInstance()->getDiagnostics();
00047     DiagnosticUtils::DiagnosticMessage diagMsg;
00048     diagMsg.side = DiagnosticUtils::framework;
00049     diagMsg.source = DiagnosticUtils::event;
00050     diagMsg.name = getName();
00051     diagMsg.action = DiagnosticUtils::start;
00052     diagnostics->log(diagTopic, diagMsg);
00053 }
00054 
00055 RTEvent::~RTEvent()
00056 {
00057     delete muxContext_;
00058     muxContext_ = NULL;
00059     if (payload_ != NULL)
00060     {
00061         delete payload_;
00062     }
00063     const boost::shared_ptr<Diagnostics>& diagnostics = AbstractEquipment::getInstance()->getDiagnostics();
00064     DiagnosticUtils::DiagnosticMessage diagMsg;
00065     diagMsg.side = DiagnosticUtils::framework;
00066     diagMsg.source = DiagnosticUtils::event;
00067     diagMsg.name = getName();
00068     diagMsg.action = DiagnosticUtils::stop;
00069     diagnostics->log(diagTopic, diagMsg);
00070 }
00071 
00072 AbstractEventSource* RTEvent::getEventSource()
00073 {
00074     return pEvtSrc_;
00075 }
00076 
00077 } // fesa

Generated on 18 Jan 2013 for Fesa by  doxygen 1.6.1