tdaq-develop-2025-02-12
ots::FEVInterface Class Referenceabstract

#include <otsdaq/FECore/FEVInterface.h>

Inheritance diagram for ots::FEVInterface:
ots::WorkLoop ots::Configurable ots::VStateMachine ots::FEProducerVInterface

Classes

struct  frontEndMacroStruct_t
 < members fully define a front-end macro function More...
 
struct  macroStruct_t
 end FE Macros More...
 

Public Types

using frontEndMacroArg_t = std::pair< const std::string, std::string >
 end Slow Controls More...
 
using frontEndMacroArgs_t = std::vector< frontEndMacroArg_t > &
 
using frontEndMacroConstArgs_t = const std::vector< frontEndMacroArg_t > &
 
using frontEndMacroFunction_t = void(ots::FEVInterface::*)(const frontEndMacroStruct_t &feMacroStruct, FEVInterface::frontEndMacroConstArgs_t argsIn, FEVInterface::frontEndMacroArgs_t argsOut)
 void function (vector-of-inputs, vector-of-outputs)
 

Public Member Functions

 FEVInterface (const std::string &interfaceUID, const ConfigurationTree &theXDAQContextConfigTree, const std::string &configurationPath)
 
const std::string & getInterfaceUID (void) const
 
const std::string & getInterfaceType (void) const
 
virtual void universalRead (char *address, char *returnValue)=0
 throw std::runtime_error exception on error/timeout
 
virtual void universalWrite (char *address, char *writeValue)=0
 
const unsigned int & getUniversalAddressSize (void)
 
const unsigned int & getUniversalDataSize (void)
 
virtual void universalBlockRead (char *address, char *returnValue, unsigned int numberOfBytes)
 
virtual void universalBlockWrite (char *address, char *writeValue, unsigned int numberOfBytes)
 
void runSequenceOfCommands (const std::string &treeLinkName)
 
virtual void configure (void)
 
virtual void start (std::string)
 
virtual void stop (void)
 
virtual void halt (void)
 
virtual void pause (void)
 
virtual void resume (void)
 
virtual bool running (void)
 
virtual void configureSlowControls (void)
 end State Machine handlers More...
 
void addSlowControlsChannels (ConfigurationTree slowControlsGroupLink, std::map< std::string, FESlowControlsChannel > *mapOfSlowControlsChannels)
 
virtual void resetSlowControlsChannelIterator (void)
 virtual in case channels are handled in multiple maps, for example
 
virtual FESlowControlsChannelgetNextSlowControlsChannel (void)
 virtual in case channels are handled in multiple maps, for example
 
virtual unsigned int getSlowControlsChannelCount (void)
 virtual in case channels are handled in multiple maps, for example
 
bool slowControlsRunning (void)
 slow controls workloop calls this
 
void startSlowControlsWorkLoop (void)
 
void stopSlowControlsWorkLoop (void)
 
const std::map< std::string, frontEndMacroStruct_t > & getMapOfFEMacroFunctions (void)
 
void runSelfFrontEndMacro (const std::string &feMacroName, const std::vector< FEVInterface::frontEndMacroArg_t > &inputArgs, std::vector< FEVInterface::frontEndMacroArg_t > &outputArgs)
 
template<class T >
void sendToFrontEnd (const std::string &targetInterfaceID, const T &value) const
 end FE Macros More...
 
void runFrontEndMacro (const std::string &targetInterfaceID, const std::string &feMacroName, const std::vector< FEVInterface::frontEndMacroArg_t > &inputArgs, std::vector< FEVInterface::frontEndMacroArg_t > &outputArgs) const
 
template<class T >
void receiveFromFrontEnd (const std::string &requester, T &retValue, unsigned int timeoutInSeconds=1) const
 
void receiveFromFrontEnd (const std::string &requester, std::string &retValue, unsigned int timeoutInSeconds=1) const
 specialized template function for T=std::string More...
 
template<class T >
receiveFromFrontEnd (const std::string &requester="*", unsigned int timeoutInSeconds=1) const
 
std::string receiveFromFrontEnd (const std::string &requester="*", unsigned int timeoutInSeconds=1) const
 specialized template function for T=std::string More...
 
- Public Member Functions inherited from ots::WorkLoop
 WorkLoop (const std::string &name)
 
void startWorkLoop (void)
 
bool stopWorkLoop (void)
 
bool isActive (void) const
 
- Public Member Functions inherited from ots::Configurable
 Configurable (const ConfigurationTree &theXDAQContextConfigTree, const std::string &theConfigurationPath)
 
ConfigurationTree getSelfNode () const
 
const ConfigurationManagergetConfigurationManager () const
 
const std::string & getContextUID () const
 
const std::string & getApplicationUID () const
 
unsigned int getApplicationLID () const
 
std::string getContextAddress () const
 
unsigned int getContextPort () const
 
- Public Member Functions inherited from ots::VStateMachine
 VStateMachine (const std::string &name)
 
virtual void paused (void)
 
virtual void halted (void)
 
virtual void configured (void)
 
virtual void initial (void)
 
virtual void inError (void)
 
virtual std::string getStatusProgressDetail (void)
 Status. More...
 
void setTransitionName (const std::string &transitionName)
 
const std::string & getTransitionName (void)
 
void setIterationIndex (unsigned int i)
 
void setSubIterationIndex (unsigned int i)
 
unsigned int getIterationIndex (void)
 
unsigned int getSubIterationIndex (void)
 
void indicateIterationWork (void)
 
void clearIterationWork (void)
 
bool getIterationWork (void)
 
void indicateSubIterationWork (void)
 
void clearSubIterationWork (void)
 
bool getSubIterationWork (void)
 

Static Public Member Functions

static void sendAsyncExceptionToGateway (FEVInterface *fe, const std::string &errMsg, bool isPauseException, bool isStopException)
 
static const std::string & getFEMacroConstArgument (frontEndMacroConstArgs_t args, const std::string &argName)
 < for external specialized template access More...
 
static std::string & getFEMacroArgument (frontEndMacroArgs_t args, const std::string &argName)
 

Public Attributes

FEVInterfacesManagerparentInterfaceManager_
 
bool universalBlockReadImplementationConfirmed = false
 is confirmed by slow controls handling (for example) that universalBlockRead is implemented by the FE plugin
 
- Public Attributes inherited from ots::VStateMachine
CoreSupervisorBaseparentSupervisor_
 

Static Public Attributes

static const std::string UNKNOWN_TYPE = "UNKNOWN"
 

Protected Member Functions

void runMacro (FEVInterface::macroStruct_t &macro, std::map< std::string, uint64_t > &variableMap)
 runMacro
 
bool workLoopThread (toolbox::task::WorkLoop *workLoop)
 end FE Communication helpers ////// More...
 
void registerFEMacroFunction (const std::string &feMacroName, frontEndMacroFunction_t feMacroFunction, const std::vector< std::string > &namesOfInputArgs, const std::vector< std::string > &namesOfOutputArgs, uint8_t requiredUserPermissions=1, const std::string &allowedCallingFEs="*", const std::string &feMacroTooltip="")
 
void registerFEMacroFunction (const std::string &feMacroName, frontEndMacroFunction_t feMacroFunction, const std::vector< std::string > &namesOfInputArgs, const std::vector< std::string > &namesOfOutputArgs, const std::string &requiredUserPermissions=WebUsers::DEFAULT_USER_GROUP+":1", const std::string &allowedCallingFEs="*", const std::string &feMacroTooltip="")
 
template<class T >
std::string & setFEMacroArgumentValue (frontEndMacroArgs_t args, const std::string &argName, const T &value) const
 
template<class T >
std::string & emplaceFEMacroArgumentValue (frontEndMacroArgs_t args, const std::string &argName, const T &value) const
 
- Protected Member Functions inherited from ots::WorkLoop
const std::string & getWorkLoopName (void) const
 Getters.
 

Protected Attributes

std::map< std::string, FESlowControlsChannelmapOfSlowControlsChannels_
 Slow Controls members.
 
std::map< std::string, FESlowControlsChannel >::iterator slowControlsChannelsIterator_
 
FESlowControlsWorkLoop slowControlsWorkLoop_
 
std::string interfaceUID_
 
std::string interfaceType_
 
std::string mfSubject_
 for GEN_COUT decorations which would be safe in destructors, e.g. mirror interfaceUID_
 
unsigned int universalAddressSize_ = 0
 
unsigned int universalDataSize_ = 0
 
std::map< std::string, frontEndMacroStruct_tmapOfFEMacroFunctions_
 Map of FE Macro functions members. More...
 
- Protected Attributes inherited from ots::WorkLoop
volatile bool continueWorkLoop_
 
- Protected Attributes inherited from ots::Configurable
const ConfigurationTree theXDAQContextConfigTree_
 
const std::string theConfigurationPath_
 
const std::string theConfigurationRecordName_
 
- Protected Attributes inherited from ots::VStateMachine
std::map< std::string, std::map< unsigned int, std::string > > iterationAliasMap_
 
std::map< std::string, std::map< unsigned int, std::string > > subIterationAliasMap_
 

Friends

class FEVInterfacesManager
 

Detailed Description

FEVInterface This class is a virtual class defining the features of front-end interface plugin class. The features include configuration hooks, finite state machine handlers, Front-end Macros for web accessible C++ handlers, slow controls hooks, as well as universal write and read for Macro Maker compatibility.

It inherits workloop as 'public virtual' for the case that other classes like DataProducer will also be inherited by child class and only one workloop is desired.

Definition at line 55 of file FEVInterface.h.

Member Typedef Documentation

◆ frontEndMacroArg_t

using ots::FEVInterface::frontEndMacroArg_t = std::pair<const std::string , std::string >

end Slow Controls

=========================== start FE Macros public types and functions for map of FE macros

Definition at line 140 of file FEVInterface.h.

Member Function Documentation

◆ addSlowControlsChannels()

void FEVInterface::addSlowControlsChannels ( ConfigurationTree  slowControlsGroupLink,
std::map< std::string, FESlowControlsChannel > *  mapOfSlowControlsChannels 
)

addSlowControlsChannels Usually subInterfaceID = "" and mapOfSlowControlsChannels = &mapOfSlowControlsChannels_

Definition at line 154 of file FEVInterface.cc.

◆ configure()

virtual void ots::FEVInterface::configure ( void  )
inlinevirtual

=========================== start State Machine handlers

Implements ots::VStateMachine.

Definition at line 89 of file FEVInterface.h.

◆ configureSlowControls()

void FEVInterface::configureSlowControls ( void  )
virtual

end State Machine handlers

=========================== start Slow Controls

Definition at line 65 of file FEVInterface.cc.

◆ getFEMacroArgument()

std::string & FEVInterface::getFEMacroArgument ( frontEndMacroArgs_t  args,
const std::string &  argName 
)
static

getFEMacroOutputArgument helper function for getting the value of an argument

Note: static function

Definition at line 943 of file FEVInterface.cc.

◆ getFEMacroConstArgument()

const std::string & FEVInterface::getFEMacroConstArgument ( frontEndMacroConstArgs_t  args,
const std::string &  argName 
)
static

< for external specialized template access

getFEMacroConstArgument helper function for getting the value of an argument

Note: static function

Definition at line 896 of file FEVInterface.cc.

◆ receiveFromFrontEnd() [1/4]

void FEVInterface::receiveFromFrontEnd ( const std::string &  requester,
std::string &  retValue,
unsigned int  timeoutInSeconds = 1 
) const

specialized template function for T=std::string

receiveFromFrontEnd specialized template function for T=std::string

Note: requester can be a wildcard string as defined in StringMacros

Definition at line 1199 of file FEVInterface.cc.

◆ receiveFromFrontEnd() [2/4]

template<class T >
void ots::FEVInterface::receiveFromFrontEnd ( const std::string &  requester,
T &  retValue,
unsigned int  timeoutInSeconds = 1 
) const

receiveFromFrontEnd

  • can be used for source interface ID to accept a message from any front-end NOTE: can not overload functions based on return type, so T& passed as value

◆ receiveFromFrontEnd() [3/4]

template<class T >
T ots::FEVInterface::receiveFromFrontEnd ( const std::string &  requester = "*",
unsigned int  timeoutInSeconds = 1 
) const

NOTE: can not overload functions based on return type, so calls function with T& passed as value

◆ receiveFromFrontEnd() [4/4]

std::string FEVInterface::receiveFromFrontEnd ( const std::string &  requester = "*",
unsigned int  timeoutInSeconds = 1 
) const

specialized template function for T=std::string

receiveFromFrontEnd specialized template function for T=std::string Note: if called without template <T> syntax, necessary because types of std::basic_string<char> cause compiler problems if no string specific function

Definition at line 1282 of file FEVInterface.cc.

◆ registerFEMacroFunction()

void FEVInterface::registerFEMacroFunction ( const std::string &  feMacroName,
frontEndMacroFunction_t  feMacroFunction,
const std::vector< std::string > &  namesOfInputArgs,
const std::vector< std::string > &  namesOfOutputArgs,
uint8_t  requiredUserPermissions = 1,
const std::string &  allowedCallingFEs = "*",
const std::string &  feMacroTooltip = "" 
)
protected

registerFEMacroFunction used by user-defined front-end interface implementations of this virtual interface class to register their macro functions.

Front-end Macro Functions are then made accessible through the ots Control System web interfaces. The menu consisting of all enabled FEs macros is assembled by the FE Supervisor (and its FE Interface Manager).

Definition at line 846 of file FEVInterface.cc.

◆ runFrontEndMacro()

void FEVInterface::runFrontEndMacro ( const std::string &  targetInterfaceID,
const std::string &  feMacroName,
const std::vector< FEVInterface::frontEndMacroArg_t > &  inputArgs,
std::vector< FEVInterface::frontEndMacroArg_t > &  outputArgs 
) const

runFrontEndMacro run a front-end macro in the target interface plug-in and gets the output arguments back

Definition at line 1122 of file FEVInterface.cc.

◆ running()

virtual bool ots::FEVInterface::running ( void  )
inlinevirtual

return true to have running() called again

Reimplemented from ots::VStateMachine.

Definition at line 108 of file FEVInterface.h.

◆ runSelfFrontEndMacro()

void FEVInterface::runSelfFrontEndMacro ( const std::string &  feMacroName,
const std::vector< FEVInterface::frontEndMacroArg_t > &  argsIn,
std::vector< FEVInterface::frontEndMacroArg_t > &  argsOut 
)

runFrontEndMacro Helper function to run this FEInterface's own front-end macro and gets the output arguments back.

Very similar to FEVInterfacesManager::runFEMacro()

Note: that argsOut are populated for caller, can just pass empty vector.

Definition at line 1052 of file FEVInterface.cc.

◆ runSequenceOfCommands()

void FEVInterface::runSequenceOfCommands ( const std::string &  treeLinkName)

runSequenceOfCommands runs a sequence of write commands from a linked section of the configuration tree based on these fields:

  • WriteAddress, WriteValue, StartingBitPosition, BitFieldSize

Definition at line 961 of file FEVInterface.cc.

◆ sendAsyncExceptionToGateway()

void FEVInterface::sendAsyncExceptionToGateway ( FEVInterface fe,
const std::string &  errorMessage,
bool  isPauseException,
bool  isStopException 
)
static

SendAsyncErrorToGateway Static – thread Send async error or soft error to gateway Call this as thread so that parent calling function (workloop) can end.

Note: be careful not to access fe pointer after HALT has potentially propagated.. because the pointer might be destructed!

Definition at line 681 of file FEVInterface.cc.

◆ sendToFrontEnd()

template<class T >
void ots::FEVInterface::sendToFrontEnd ( const std::string &  targetInterfaceID,
const T &  value 
) const

end FE Macros

=========================== start FE communication helpers

◆ workLoopThread()

bool FEVInterface::workLoopThread ( toolbox::task::WorkLoop *  workLoop)
protectedvirtual

end FE Communication helpers //////

override WorkLoop::workLoopThread return false to stop the workloop from calling the thread again

Implements ots::WorkLoop.

Definition at line 760 of file FEVInterface.cc.

Member Data Documentation

◆ mapOfFEMacroFunctions_

std::map<std::string, frontEndMacroStruct_t> ots::FEVInterface::mapOfFEMacroFunctions_
protected

Map of FE Macro functions members.

FE Macro Function members and helper functions:

Definition at line 277 of file FEVInterface.h.


The documentation for this class was generated from the following files: