$treeview $search $mathjax $extrastylesheet
otsdaq
v2_03_00
$projectbrief
|
$projectbrief
|
$searchbox |
00001 #ifndef _ots_FEVInterfacesManager_h_ 00002 #define _ots_FEVInterfacesManager_h_ 00003 00004 #include <map> 00005 #include <memory> 00006 #include <mutex> 00007 #include <queue> 00008 #include <string> 00009 #include "otsdaq-core/Configurable/Configurable.h" 00010 #include "otsdaq-core/FECore/FEVInterface.h" 00011 #include "otsdaq-core/FiniteStateMachine/VStateMachine.h" 00012 00013 namespace ots 00014 { 00015 // FEVInterfacesManager 00016 // This class is a virtual class that handles a collection of front-end interface 00017 // plugins. 00018 class FEVInterfacesManager : public VStateMachine, public Configurable 00019 { 00020 public: 00021 FEVInterfacesManager(const ConfigurationTree& theXDAQContextConfigTree, 00022 const std::string& supervisorConfigurationPath); 00023 virtual ~FEVInterfacesManager(void); 00024 00025 // Methods 00026 void init(void); 00027 void destroy(void); 00028 void createInterfaces(void); 00029 00030 // State Machine Methods 00031 void configure(void); 00032 void halt(void); 00033 void initialize(void); 00034 void pause(void); 00035 void resume(void); 00036 void start(std::string runNumber); 00037 void stop(void); 00038 00039 void universalRead(const std::string& interfaceID, 00040 char* address, 00041 char* returnValue); // used by MacroMaker 00042 void universalWrite(const std::string& interfaceID, 00043 char* address, 00044 char* writeValue); // used by MacroMaker 00045 std::string getFEListString(const std::string& supervisorLid); // used by MacroMaker 00046 std::string getFEMacrosString( 00047 const std::string& supervisorName, 00048 const std::string& supervisorLid); // used by MacroMaker 00049 void runFEMacro( 00050 const std::string& interfaceID, 00051 const FEVInterface::frontEndMacroStruct_t& feMacro, 00052 const std::string& inputArgs, 00053 std::string& outputArgs); // used by MacroMaker and FE calling indirectly 00054 void runFEMacro(const std::string& interfaceID, 00055 const std::string& feMacroName, 00056 const std::string& inputArgs, 00057 std::string& outputArgs); // used by MacroMaker 00058 void runMacro(const std::string& interfaceID, 00059 const std::string& macroObjectString, 00060 const std::string& inputArgs, 00061 std::string& outputArgs); // used by MacroMaker 00062 void runFEMacroByFE( 00063 const std::string& callingInterfaceID, 00064 const std::string& interfaceID, 00065 const std::string& feMacroName, 00066 const std::string& inputArgs, 00067 std::string& outputArgs); // used by FE calling (i.e. FESupervisor) 00068 void startFEMacroMultiDimensional( 00069 const std::string& requester, 00070 const std::string& interfaceID, 00071 const std::string& feMacroName, 00072 const bool enableSavingOutput, 00073 const std::string& outputFilePath, 00074 const std::string& outputFileRadix, 00075 const std::string& inputArgs); // used by iterator calling (i.e. FESupervisor) 00076 void startMacroMultiDimensional( 00077 const std::string& requester, 00078 const std::string& interfaceID, 00079 const std::string& macroName, 00080 const std::string& macroString, 00081 const bool enableSavingOutput, 00082 const std::string& outputFilePath, 00083 const std::string& outputFileRadix, 00084 const std::string& inputArgs); // used by iterator calling (i.e. FESupervisor) 00085 bool checkMacroMultiDimensional( 00086 const std::string& interfaceID, 00087 const std::string& macroName); // used by iterator calling (i.e. FESupervisor) 00088 00089 unsigned int getInterfaceUniversalAddressSize( 00090 const std::string& interfaceID); // used by MacroMaker 00091 unsigned int getInterfaceUniversalDataSize( 00092 const std::string& interfaceID); // used by MacroMaker 00093 bool allFEWorkloopsAreDone(void); // used by Iterator, e.g. 00094 const FEVInterface& getFEInterface(const std::string& interfaceID) const; 00095 00096 const std::map<std::string /*name*/, std::unique_ptr<FEVInterface> >& getFEInterfaces( 00097 void) const 00098 { 00099 return theFEInterfaces_; 00100 } 00101 FEVInterface* getFEInterfaceP(const std::string& interfaceID); 00102 00103 // FE communication helpers 00104 std::mutex frontEndCommunicationReceiveMutex_; 00105 std::map<std::string /*targetInterfaceID*/, // map of target to buffers organized by 00106 // source 00107 std::map<std::string /*requester*/, std::queue<std::string /*value*/> > > 00108 frontEndCommunicationReceiveBuffer_; 00109 00110 // multi-dimensional FE Macro helpers 00111 std::mutex macroMultiDimensionalDoneMutex_; 00112 std::map<std::string /*targetInterfaceID*/, // set of active multi-dimensional Macro 00113 // launches 00114 std::string /*status := Active, Done, Error: <message> */> 00115 macroMultiDimensionalStatusMap_; 00116 00117 private: 00118 std::map<std::string /*name*/, std::unique_ptr<FEVInterface> > theFEInterfaces_; 00119 std::vector<std::string /*name*/> theFENamesByPriority_; 00120 00121 // for managing transition iterations 00122 std::map<std::string /*name*/, bool /*isDone*/> stateMachinesIterationDone_; 00123 unsigned int stateMachinesIterationWorkCount_; 00124 unsigned int subIterationWorkStateMachineIndex_; 00125 void preStateMachineExecution(unsigned int i); 00126 bool postStateMachineExecution(unsigned int i); 00127 void preStateMachineExecutionLoop(void); 00128 void postStateMachineExecutionLoop(void); 00129 }; 00130 00131 } // namespace ots 00132 00133 #endif