CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_9_patch3/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 
00027 #include "interface/shared/frl_header.h"
00028 #include "interface/shared/fed_header.h"
00029 #include "interface/shared/fed_trailer.h"
00030 
00031 #include <vector>
00032 #include <string>
00033 #include <semaphore.h>
00034 #include <sys/time.h>
00035 
00036 namespace evf {
00037 
00038 class BUProxy;
00039 class SMProxy;
00040 class EvffedFillerRB;
00041 
00049 class FUResourceBroker: public xdaq::Application, public xdata::ActionListener {
00050 
00051 public:
00052         //
00053         // xdaq instantiator macro
00054         //
00055         XDAQ_INSTANTIATOR();
00056 
00057         //
00058         // construction/destruction
00059         //
00060         FUResourceBroker(xdaq::ApplicationStub *s);
00061         virtual ~FUResourceBroker();
00062 
00063         //
00064         // public member functions
00065         //
00066 
00070         xoap::MessageReference handleFSMSoapMessage(xoap::MessageReference msg)
00071                         throw (xoap::exception::Exception);
00072 
00076         void I2O_FU_TAKE_Callback(toolbox::mem::Reference *bufRef);
00077 
00081         void I2O_FU_DATA_DISCARD_Callback(toolbox::mem::Reference *bufRef);
00082 
00086         void I2O_FU_DQM_DISCARD_Callback(toolbox::mem::Reference *bufRef);
00087 
00091         void I2O_EVM_LUMISECTION_Callback(toolbox::mem::Reference *bufRef);
00092 
00093         // Hyper DAQ web page(s) [see Utilities/WebGUI]
00094         void webPageRequest(xgi::Input *in, xgi::Output *out)
00095                         throw (xgi::exception::Exception);
00096         void customWebPage(xgi::Input *in, xgi::Output *out)
00097                         throw (xgi::exception::Exception);
00098 
00102         void actionPerformed(xdata::Event& e);
00103 
00104         unsigned int instanceNumber() const {
00105                 return instance_.value_;
00106         }
00107 
00108 public:
00109         static const int CRC_ERROR_SHIFT = 0x0;
00110         static const int DATA_ERROR_SHIFT = 0x1;
00111         static const int LOST_ERROR_SHIFT = 0x2;
00112         static const int TIMEOUT_NOEVENT_ERROR_SHIFT = 0x3;
00113         static const int TIMEOUT_EVENT_ERROR_SHIFT = 0x4;
00114         static const int SENT_ERREVENT_ERROR_SHIFT = 0x5;
00115 
00116 private:
00117         //
00118         // private member functions
00119         //
00120         void exportParameters();
00121         void bindStateMachineCallbacks();
00122         bool waitForStateChange(std::string name, int timeoutMicroSec);
00123 
00124 private:
00125         //
00126         // member data
00127         //
00128         // Event scheduler, owned by FUResourceBroker
00129         rb_statemachine::SMEventScheduler* eventScheduler_;
00130 
00131         // Shared Resources
00132         rb_statemachine::SharedResourcesPtr_t res_;
00133 
00134         // Finite state machine
00135         rb_statemachine::RBStateMachinePtr fsm_;
00136 
00137         // monitored parameters
00138         xdata::String url_;
00139         xdata::String class_;
00140         xdata::UnsignedInteger32 instance_;
00141 };
00142 
00143 } // namespace evf
00144 
00145 
00146 #endif