CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/EventFilter/ResourceBroker/interface/FUResourceBroker.h

Go to the documentation of this file.
00001 
00002 //
00003 // FUResourceBroker
00004 // ----------------
00005 //
00006 //            10/20/2006 Philipp Schieferdecker <philipp.schieferdecker@cern.ch>
00007 //            20/01/2012 Andrei Spataru <aspataru@cern.ch>
00009 
00010 #ifndef FURESOURCEBROKER_H
00011 #define FURESOURCEBROKER_H 1
00012 
00013 #include "EventFilter/ResourceBroker/interface/FUTypes.h"
00014 #include "EventFilter/ResourceBroker/interface/IPCManager.h"
00015 #include "EventFilter/ResourceBroker/interface/RBStateMachine.h"
00016 #include "EventFilter/ResourceBroker/interface/SharedResources.h"
00017 #include "EventFilter/ResourceBroker/interface/SMEventScheduler.h"
00018 
00019 #include "xdaq/Application.h"
00020 #include "xdaq/NamespaceURI.h"
00021 #include "xdata/InfoSpace.h"
00022 #include "xdata/String.h"
00023 #include "xdata/Boolean.h"
00024 #include "xdata/UnsignedInteger32.h"
00025 #include "xdata/Double.h"
00026 #include "i2o/exception/Exception.h"
00027 
00028 #include "interface/shared/frl_header.h"
00029 #include "interface/shared/fed_header.h"
00030 #include "interface/shared/fed_trailer.h"
00031 
00032 #include <vector>
00033 #include <string>
00034 #include <semaphore.h>
00035 #include <sys/time.h>
00036 
00037 namespace evf {
00038 
00039 class BUProxy;
00040 class SMProxy;
00041 class EvffedFillerRB;
00042 
00050 class FUResourceBroker: public xdaq::Application, public xdata::ActionListener {
00051 
00052 public:
00053         //
00054         // xdaq instantiator macro
00055         //
00056         XDAQ_INSTANTIATOR();
00057 
00058         //
00059         // construction/destruction
00060         //
00061         FUResourceBroker(xdaq::ApplicationStub *s);
00062         virtual ~FUResourceBroker();
00063 
00064         //
00065         // public member functions
00066         //
00067 
00071         xoap::MessageReference handleFSMSoapMessage(xoap::MessageReference msg)
00072                         throw (xoap::exception::Exception);
00073 
00077         void I2O_FU_TAKE_Callback(toolbox::mem::Reference *bufRef) throw(i2o::exception::Exception);
00078 
00082         void I2O_FU_DATA_DISCARD_Callback(toolbox::mem::Reference *bufRef) throw(i2o::exception::Exception);
00083 
00087         void I2O_FU_DQM_DISCARD_Callback(toolbox::mem::Reference *bufRef) throw(i2o::exception::Exception);
00088 
00092         void I2O_EVM_LUMISECTION_Callback(toolbox::mem::Reference *bufRef) throw(i2o::exception::Exception);
00093 
00094         // Hyper DAQ web page(s) [see Utilities/WebGUI]
00095         void webPageRequest(xgi::Input *in, xgi::Output *out)
00096                         throw (xgi::exception::Exception);
00097         void customWebPage(xgi::Input *in, xgi::Output *out)
00098                         throw (xgi::exception::Exception);
00099 
00103         void actionPerformed(xdata::Event& e);
00104 
00105         unsigned int instanceNumber() const {
00106                 return instance_.value_;
00107         }
00108 
00109 public:
00110         static const int CRC_ERROR_SHIFT = 0x0;
00111         static const int DATA_ERROR_SHIFT = 0x1;
00112         static const int LOST_ERROR_SHIFT = 0x2;
00113         static const int TIMEOUT_NOEVENT_ERROR_SHIFT = 0x3;
00114         static const int TIMEOUT_EVENT_ERROR_SHIFT = 0x4;
00115         static const int SENT_ERREVENT_ERROR_SHIFT = 0x5;
00116 
00117 private:
00118         //
00119         // private member functions
00120         //
00121         void exportParameters();
00122         void bindStateMachineCallbacks();
00123         bool waitForStateChange(std::string name, int timeoutMicroSec);
00124 
00125 private:
00126         //
00127         // member data
00128         //
00129         // Event scheduler, owned by FUResourceBroker
00130         rb_statemachine::SMEventScheduler* eventScheduler_;
00131 
00132         // Shared Resources
00133         rb_statemachine::SharedResourcesPtr_t res_;
00134 
00135         // Finite state machine
00136         rb_statemachine::RBStateMachinePtr fsm_;
00137 
00138         // monitored parameters
00139         xdata::String url_;
00140         xdata::String class_;
00141         xdata::UnsignedInteger32 instance_;
00142 };
00143 
00144 } // namespace evf
00145 
00146 
00147 #endif