Jpp 19.3.0-rc.3
the software that should make you happy
|
Simple driver for run control clients. More...
#include <JDAQDriver.hh>
Public Member Functions | |
JDAQDriver (const std::string &name, const std::string &server, JLogger *logger, const int level, const int timeout_s) | |
Constructor. | |
virtual bool | enter () override |
Enter the state machine. | |
virtual void | actionExit () override |
Exit the state machine. | |
virtual void | enterState (const CHSM::state &state, const CHSM::event &event) override |
Action when entering state. | |
bool | update (const bool no_wait) |
Update client list with incoming ControlHost message. | |
virtual void | actionStart (int, const char *) override |
virtual void | actionStop (int, const char *) override |
void | run () |
Run driver with user input. | |
void | run (std::istream &in) |
Run driver. | |
void | update () |
Update client list with incoming ControlHost messages until the client list is synchronised with the current state or until the timeout. | |
void | synchronise () |
Synchronise clients. | |
void | filter (const std::string &target="") |
Filter client list by putting failing clients to sleep. | |
virtual bool | filter (const JTag &tag, int length, const char *buffer) |
Filter message. | |
virtual bool | enter (const JArgs &args) |
Enter the state machine. | |
virtual bool | exit () override |
Exit the state machine. | |
bool | isRunning () const |
Check if this client is in runnig state. | |
void | replaceEvent (const JTag &oldTag, const JTag &newTag, JDAQEvent_t &event) |
Replace tag of given event in event table. | |
JDAQEvent_t * | findEvent (const JTag &tag, const std::string &event_name) |
Find event in event table. | |
void | addSubscription (const JSubscription &subscription) |
Add custom subscription. | |
template<class T > | |
void | addParameter (const char option, T ¶meter) |
Add parameter to parser used in method enter(). | |
template<class T > | |
void | addParameter (const char option, T ¶meter, const T &value) |
Add parameter to parser used in method enter(). | |
void | setSelect () |
Set the file descriptor mask for the select call. | |
virtual void | setSelect (JFileDescriptorMask &mask) const |
Set the file descriptor mask for the select call. | |
virtual void | actionSelect (const JFileDescriptorMask &mask) |
Action method following last select call. | |
virtual void | actionRunning () |
This method is repeatedly called when this client machine is in state Running and the clock interval time is non-zero. | |
virtual void | actionInput (int length, const char *buffer) override |
This method is called at ev_input . | |
virtual void | actionTagged (const JTag &tag, int length, const char *buffer) |
This method is called when a custom tag is encountered. | |
void | run (const int port) |
Run for ever. | |
void | A1 (CHSM_ns_alias::event const &) |
void | A2 (CHSM_ns_alias::event const &) |
void | A3 (CHSM_ns_alias::event const &) |
void | A4 (CHSM_ns_alias::event const &) |
void | A5 (CHSM_ns_alias::event const &) |
void | A6 (CHSM_ns_alias::event const &) |
void | A7 (CHSM_ns_alias::event const &) |
void | A8 (CHSM_ns_alias::event const &) |
void | A9 (CHSM_ns_alias::event const &) |
void | A10 (CHSM_ns_alias::event const &) |
void | A11 (CHSM_ns_alias::event const &) |
void | A12 (CHSM_ns_alias::event const &) |
void | A13 (CHSM_ns_alias::event const &) |
void | A14 (CHSM_ns_alias::event const &) |
void | EAM4root (CHSM_ns_alias::state const &, CHSM_ns_alias::event const &) |
void | XAM4root (CHSM_ns_alias::state const &, CHSM_ns_alias::event const &) |
const std::string & | getName () const |
Get name of state machine. | |
int | getDetectorID () const |
Get detector identifier. | |
int | getRunNumber () const |
Get run number. | |
virtual void | actionEnter () |
Interface methods for actions corresponding to state transitions. | |
virtual void | actionInit (int, const char *) |
virtual void | actionConfigure (int, const char *) |
virtual void | actionPause (int, const char *) |
virtual void | actionContinue (int, const char *) |
virtual void | actionReset (int, const char *) |
virtual void | actionQuit (int, const char *) |
virtual void | actionError () |
virtual void | actionRecover (int, const char *) |
const std::string & | getHostname () const |
Get hostname. | |
const std::string & | getFullName () const |
Get full name of this run control client. | |
const JTag & | getUniqueTag () const |
Get unique tag of this run control client. | |
long long int | getClockDelay () const |
Get total delay time. | |
long long int | getClockInterval () const |
Get interval time. | |
void | setClockInterval (const long long int interval_us) |
Set interval time. | |
void | resetClock () |
Reset clock. | |
const std::string & | getEventInfo () const |
Get last event information. | |
void | setEventInfo (const std::string &info) |
Set last event information. | |
Static Public Attributes | |
static const int | SLEEP_TIME_US = 500000 |
static const int | TIMEOUT_S = 1 |
time out of update [s] | |
Protected Types | |
typedef void(JDAQCHSM::*) | action(int, const char *) |
Type definition of action method. | |
Static Protected Member Functions | |
static void | copy (std::istream &in, std::ostream &out, const char eol='\n') |
Copy data from input to output stream. | |
Protected Attributes | |
JClientList | clientList |
bool | is_alive |
std::string | rc_log |
JSharedPointer< JControlHost > | server |
message server | |
JMessageLogger | logger |
message logger | |
std::string | name |
int | detector_id |
int | run_number |
JEventTable | eventTable |
event table | |
std::string | hostname |
std::string | fullname |
JTag | unique_tag |
JTimekeeper | clock |
central clock | |
std::string | event_info |
event information | |
Private Member Functions | |
void | configure () |
Configure client. | |
std::string | getMessage (const CHSM::state &state, const CHSM::event &event) const |
Get event message. | |
virtual void | actionCheck (int length, const char *buffer) override |
This method is called at ev_check and reports a system check by mimicing an enter state action. | |
void | execute (action __action, const CHSM::event &__event) override |
The method to execute the action. | |
const CHSM::state * | getState () const |
Get current state. | |
Private Attributes | |
JSelectReader | select |
select call | |
JParser | parser |
parser method enter() | |
JSubscriptionList | subscription |
custom subscription | |
CHSM_ns_alias::state * | state_ [11] |
CHSM_ns_alias::event const * | taken_ [14] |
CHSM_ns_alias::state * | target_ [14] |
Static Private Attributes | |
static int const | ev_daq_transitions [] |
static int const | ev_init_transitions [] |
static int const | ev_configure_transitions [] |
static int const | ev_start_transitions [] |
static int const | ev_pause_transitions [] |
static int const | ev_continue_transitions [] |
static int const | ev_stop_transitions [] |
static int const | ev_reset_transitions [] |
static int const | ev_quit_transitions [] |
static int const | ev_off_transitions [] |
static int const | ev_check_transitions [] |
static int const | ev_input_transitions [] |
static int const | ev_recover_transitions [] |
static int const | ev_error_transitions [] |
static CHSM_ns_alias::transition const | transition_ [] |
Simple driver for run control clients.
This class can be used to start a set of run control clients, trigger events and eventually stop the clients.
Definition at line 36 of file JDAQDriver.hh.
|
protectedinherited |
Type definition of action method.
Definition at line 152 of file JDAQCHSM.hh.
|
inline |
Constructor.
name | name of driver |
server | name of command message server |
logger | logger |
level | debug level |
timeout_s | timeout_s [s] |
Definition at line 54 of file JDAQDriver.hh.
|
inlineoverridevirtual |
Enter the state machine.
The driver will subscribe to the ControlHost tags corresponding to born, died and reply messages of the clients instead of the standard tags for run control commands. The clients are started after the driver is ready to receive ControlHost messages. In case of an error, a message is printed on the terminal and the state machine is not entered.
Reimplemented from KM3NETDAQ::JDAQClient.
Definition at line 73 of file JDAQDriver.hh.
|
inlineoverridevirtual |
Exit the state machine.
This method waits for the clients to terminate using the died message generated by ControlHost. In case of a timeout, the process is terminated by calling the method stop() of the corresponding client.
Reimplemented from JDAQCHSM.
Definition at line 156 of file JDAQDriver.hh.
|
inlineoverridevirtual |
Action when entering state.
This method waits for all clients to produce the enter state message. In case of a timeout, no specific action is taken but an error message is logged.
state | entered state |
event | event that triggered transition |
Reimplemented from KM3NETDAQ::JDAQClient.
Definition at line 187 of file JDAQDriver.hh.
|
inline |
Update client list with incoming ControlHost message.
This method receives and processes a message. The client list is updated accordingly. If the no-wait option is set to true, it returns in the absence of a pending message immediately. The return value is then false. If the no-wait option is set to false, it waits until the next message is received.
no_wait | wait option |
Definition at line 213 of file JDAQDriver.hh.
|
inlineoverridevirtual |
Reimplemented from JDAQCHSM.
Definition at line 305 of file JDAQDriver.hh.
|
inlineoverridevirtual |
|
inline |
Run driver with user input.
Definition at line 321 of file JDAQDriver.hh.
|
inline |
Run driver.
Example input format:
# comment line. process <process name> <host name> [<start command>]; # The following tokens in <start command> will be substituted: # $HOST$ by <host name>; # $NAME$ by <process name>; # $SERVER$ by JClient::SERVER; # $LOGGER$ by JClient::LOGGER; # $ARGS$ by part following '/' in <process name>; # enter state machine. enter # trigger event # data can be provided online and mixed with data from a separate file (optional). # multiple tags should be separated by a new line. event <event name> { [<tag 1> [data]] [<tag 2> [data][%<file name>%][data]] } # optionally quit before end of input [quit] # optionally kill processes that did not properly terminate. [exit]
in | input stream |
Definition at line 365 of file JDAQDriver.hh.
|
inline |
Update client list with incoming ControlHost messages until the client list is synchronised with the current state or until the timeout.
Definition at line 523 of file JDAQDriver.hh.
|
inline |
Synchronise clients.
Definition at line 546 of file JDAQDriver.hh.
|
inline |
Filter client list by putting failing clients to sleep.
In this, only clients with names that contain the given character sequence are considered.
target | target name of client(s) |
Definition at line 613 of file JDAQDriver.hh.
|
inlinestaticprotected |
Copy data from input to output stream.
Tagged file names are recursively expanded.
in | input stream |
out | output stream |
eol | end of line |
Definition at line 653 of file JDAQDriver.hh.
|
inlinevirtual |
Filter message.
The filter method can be overwritten so that a specific action is made before the corresponding message is processed by the state machine. The message is ignored if true is returned, else it is normally processed.
tag | tag |
length | number of characters |
buffer | message |
Reimplemented from KM3NETDAQ::JDAQClient.
Definition at line 662 of file JDAQClient.hh.
|
inlinevirtualinherited |
Enter the state machine.
This overloaded method enter reproduces the constructor. All necessary input is parsed from the list of arguments. In case of an error, the state machine is not entered.
args | array of command line arguments |
Definition at line 392 of file JDAQClient.hh.
|
inlineoverridevirtualinherited |
Exit the state machine.
This method releases the various resources.
Definition at line 485 of file JDAQClient.hh.
|
inlineinherited |
Check if this client is in runnig state.
Definition at line 508 of file JDAQClient.hh.
|
inlineinherited |
Replace tag of given event in event table.
oldTag | old tag |
newTag | new tag |
event | event |
Definition at line 521 of file JDAQClient.hh.
|
inlineinherited |
Find event in event table.
tag | tag |
event_name | event name |
Definition at line 536 of file JDAQClient.hh.
|
inlineinherited |
Add custom subscription.
subscription | subscription |
Definition at line 552 of file JDAQClient.hh.
|
inlineinherited |
Add parameter to parser used in method enter().
option | option |
parameter | parameter |
Definition at line 565 of file JDAQClient.hh.
|
inlineinherited |
Add parameter to parser used in method enter().
option | option |
parameter | parameter |
value | default value |
Definition at line 579 of file JDAQClient.hh.
|
inlineinherited |
Set the file descriptor mask for the select call.
Definition at line 588 of file JDAQClient.hh.
|
inlinevirtualinherited |
Set the file descriptor mask for the select call.
This implementation does nothing but may be redefined by the derived class.
mask | file descriptor mask |
Reimplemented in KM3NETDAQ::JDataFilter, KM3NETDAQ::JDataWriter, and KM3NETDAQ::MonitorRouter.
Definition at line 604 of file JDAQClient.hh.
|
inlinevirtualinherited |
Action method following last select call.
This implementation does nothing but may be redefined by the derived class.
mask | file descriptor mask |
Reimplemented in KM3NETDAQ::DataQueue, KM3NETDAQ::JDataFilter, KM3NETDAQ::JDataWriter, and KM3NETDAQ::MonitorRouter.
Definition at line 614 of file JDAQClient.hh.
|
inlinevirtualinherited |
This method is repeatedly called when this client machine is in state Running and the clock interval time is non-zero.
This implementation does nothing but may be redefined by the derived class. Care has to be taken so that the time needed to execute this method should be less than the specified clock interval time (see method setClockInterval()).
Reimplemented in AcousticDataFilter, KM3NETDAQ::DataQueue, KM3NETDAQ::JDataFilter, KM3NETDAQ::JDataWriter, KM3NETDAQ::JDQSimulator, KM3NETDAQ::JEventGenerator, and KM3NETDAQ::MonitorRouter.
Definition at line 625 of file JDAQClient.hh.
|
inlineoverridevirtualinherited |
This method is called at ev_input
.
length | length of data |
buffer | pointer to data |
Reimplemented from JDAQCHSM.
Reimplemented in KM3NETDAQ::DataQueue.
Definition at line 635 of file JDAQClient.hh.
|
inlinevirtualinherited |
This method is called when a custom tag is encountered.
tag | tag |
length | length of data |
buffer | pointer to data |
Reimplemented in KM3NETDAQ::JDataFilter.
Definition at line 675 of file JDAQClient.hh.
|
inlineinherited |
Run for ever.
This method can be used when the run control client is started before the run control (e.g. at boot time of the host processor). This method should be called before the state machine is entered. It launches a server which accepts a JNET::JControlHost connection from a designated application e.g. the JDAQClientStarter.cc program. The state machine is entered using the available data in the JNET::JControlHost message. After the state machine is exited, it accepts a new a JNET::JControlHost connection.
port | port number |
Definition at line 775 of file JDAQClient.hh.
|
inlineprivateinherited |
Configure client.
This method is used to setup the event table.
Definition at line 952 of file JDAQClient.hh.
|
inlineprivateinherited |
Get event message.
state | state |
event | event |
Definition at line 964 of file JDAQClient.hh.
|
inlineoverrideprivatevirtualinherited |
This method is called at ev_check
and reports a system check by mimicing an enter state action.
length | number of characters |
buffer | message |
Reimplemented from JDAQCHSM.
Definition at line 1001 of file JDAQClient.hh.
|
inlineoverrideprivatevirtualinherited |
The method to execute the action.
__action | pointer to action method |
__event | event that triggered the action |
Implements JDAQCHSM.
Definition at line 1028 of file JDAQClient.hh.
|
inlineprivateinherited |
Get current state.
Definition at line 1048 of file JDAQClient.hh.
|
inherited |
Definition at line 344 of file JDAQCHSM.cc.
|
inherited |
Definition at line 346 of file JDAQCHSM.cc.
|
inherited |
Definition at line 348 of file JDAQCHSM.cc.
|
inherited |
Definition at line 350 of file JDAQCHSM.cc.
|
inherited |
Definition at line 352 of file JDAQCHSM.cc.
|
inherited |
Definition at line 354 of file JDAQCHSM.cc.
|
inherited |
Definition at line 364 of file JDAQCHSM.cc.
|
inherited |
Definition at line 366 of file JDAQCHSM.cc.
|
inherited |
Definition at line 368 of file JDAQCHSM.cc.
|
inherited |
Definition at line 370 of file JDAQCHSM.cc.
|
inherited |
Definition at line 372 of file JDAQCHSM.cc.
|
inherited |
Definition at line 374 of file JDAQCHSM.cc.
|
inherited |
Definition at line 376 of file JDAQCHSM.cc.
|
inherited |
Definition at line 378 of file JDAQCHSM.cc.
|
inherited |
Definition at line 337 of file JDAQCHSM.cc.
|
inherited |
Definition at line 340 of file JDAQCHSM.cc.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlinevirtualinherited |
Interface methods for actions corresponding to state transitions.
Reimplemented in AcousticDataFilter, JDAQDemoClient, KM3NETDAQ::DataQueue, KM3NETDAQ::JDataFilter, and KM3NETDAQ::MonitorRouter.
Definition at line 120 of file JDAQCHSM.hh.
|
inlinevirtualinherited |
Reimplemented in AcousticDataFilter, JDAQDemoClient, KM3NETDAQ::DataQueue, KM3NETDAQ::JDataFilter, KM3NETDAQ::JDataWriter, and KM3NETDAQ::MonitorRouter.
Definition at line 123 of file JDAQCHSM.hh.
|
inlinevirtualinherited |
Reimplemented in AcousticDataFilter, JDAQDemoClient, KM3NETDAQ::DataQueue, KM3NETDAQ::JDataFilter, KM3NETDAQ::JDataWriter, KM3NETDAQ::JDQSimulator, KM3NETDAQ::JEventGenerator, and KM3NETDAQ::MonitorRouter.
Definition at line 124 of file JDAQCHSM.hh.
|
inlinevirtualinherited |
Reimplemented in AcousticDataFilter, JDAQDemoClient, KM3NETDAQ::DataQueue, KM3NETDAQ::JDataFilter, and KM3NETDAQ::MonitorRouter.
Definition at line 126 of file JDAQCHSM.hh.
|
inlinevirtualinherited |
Reimplemented in AcousticDataFilter, JDAQDemoClient, KM3NETDAQ::DataQueue, KM3NETDAQ::JDataFilter, and KM3NETDAQ::MonitorRouter.
Definition at line 127 of file JDAQCHSM.hh.
|
inlinevirtualinherited |
Reimplemented in AcousticDataFilter, JDAQDemoClient, KM3NETDAQ::DataQueue, KM3NETDAQ::JDataFilter, KM3NETDAQ::JDataWriter, KM3NETDAQ::JDQSimulator, KM3NETDAQ::JEventGenerator, and KM3NETDAQ::MonitorRouter.
Definition at line 129 of file JDAQCHSM.hh.
|
inlinevirtualinherited |
Reimplemented in AcousticDataFilter, JDAQDemoClient, KM3NETDAQ::DataQueue, KM3NETDAQ::JDataFilter, KM3NETDAQ::JDataWriter, KM3NETDAQ::JDQSimulator, KM3NETDAQ::JEventGenerator, and KM3NETDAQ::MonitorRouter.
Definition at line 130 of file JDAQCHSM.hh.
|
inlinevirtualinherited |
Definition at line 135 of file JDAQCHSM.hh.
|
inlinevirtualinherited |
Definition at line 136 of file JDAQCHSM.hh.
|
inlineinherited |
|
inlineinherited |
Get full name of this run control client.
Definition at line 120 of file JDAQClient.hh.
|
inlineinherited |
Get unique tag of this run control client.
Definition at line 131 of file JDAQClient.hh.
|
inlineinherited |
Get total delay time.
Definition at line 142 of file JDAQClient.hh.
|
inlineinherited |
Get interval time.
Definition at line 154 of file JDAQClient.hh.
|
inlineinherited |
Set interval time.
interval_us | interval time [us] |
Definition at line 165 of file JDAQClient.hh.
|
inlineinherited |
|
inlineinherited |
Get last event information.
Definition at line 185 of file JDAQClient.hh.
|
inlineinherited |
Set last event information.
info | event information |
Definition at line 196 of file JDAQClient.hh.
|
static |
Definition at line 43 of file JDAQDriver.hh.
int KM3NETDAQ::JDAQDriver::timeout_us |
timeout of state transitions [us]
Definition at line 637 of file JDAQDriver.hh.
|
protected |
Definition at line 641 of file JDAQDriver.hh.
|
protected |
Definition at line 642 of file JDAQDriver.hh.
|
protected |
Definition at line 643 of file JDAQDriver.hh.
|
protectedinherited |
message server
Definition at line 834 of file JDAQClient.hh.
|
protectedinherited |
message logger
Definition at line 835 of file JDAQClient.hh.
|
privateinherited |
select call
Definition at line 1064 of file JDAQClient.hh.
|
privateinherited |
parser method enter()
Definition at line 1065 of file JDAQClient.hh.
|
privateinherited |
custom subscription
Definition at line 1066 of file JDAQClient.hh.
|
inherited |
|
inherited |
|
staticprivateinherited |
Definition at line 52 of file JDAQCHSM.hh.
|
inherited |
|
inherited |
Definition at line 238 of file JDAQCHSM.hh.
|
staticprivateinherited |
Definition at line 69 of file JDAQCHSM.hh.
|
inherited |
|
inherited |
Definition at line 258 of file JDAQCHSM.hh.
|
staticprivateinherited |
Definition at line 86 of file JDAQCHSM.hh.
|
inherited |
|
inherited |
Definition at line 278 of file JDAQCHSM.hh.
|
staticprivateinherited |
Definition at line 103 of file JDAQCHSM.hh.
|
inherited |
|
inherited |
Definition at line 298 of file JDAQCHSM.hh.
|
staticprivateinherited |
Definition at line 120 of file JDAQCHSM.hh.
|
inherited |
|
inherited |
Definition at line 318 of file JDAQCHSM.hh.
|
staticprivateinherited |
|
inherited |
|
inherited |
Definition at line 338 of file JDAQCHSM.hh.
|
staticprivateinherited |
Definition at line 154 of file JDAQCHSM.hh.
|
inherited |
|
inherited |
Definition at line 358 of file JDAQCHSM.hh.
|
staticprivateinherited |
|
inherited |
|
inherited |
Definition at line 378 of file JDAQCHSM.hh.
|
staticprivateinherited |
Definition at line 188 of file JDAQCHSM.hh.
|
inherited |
|
inherited |
Definition at line 398 of file JDAQCHSM.hh.
|
staticprivateinherited |
Definition at line 205 of file JDAQCHSM.hh.
|
inherited |
|
inherited |
Definition at line 418 of file JDAQCHSM.hh.
|
staticprivateinherited |
Definition at line 222 of file JDAQCHSM.hh.
|
inherited |
|
inherited |
Definition at line 438 of file JDAQCHSM.hh.
|
staticprivateinherited |
Definition at line 239 of file JDAQCHSM.hh.
|
inherited |
|
inherited |
Definition at line 458 of file JDAQCHSM.hh.
|
staticprivateinherited |
Definition at line 256 of file JDAQCHSM.hh.
|
inherited |
|
inherited |
Definition at line 478 of file JDAQCHSM.hh.
|
staticprivateinherited |
Definition at line 273 of file JDAQCHSM.hh.
|
inherited |
|
inherited |
Definition at line 495 of file JDAQCHSM.hh.
|
privateinherited |
Definition at line 522 of file JDAQCHSM.hh.
|
staticprivateinherited |
Definition at line 280 of file JDAQCHSM.hh.
|
privateinherited |
Definition at line 524 of file JDAQCHSM.hh.
|
privateinherited |
Definition at line 525 of file JDAQCHSM.hh.
|
protectedinherited |
Definition at line 165 of file JDAQCHSM.hh.
|
protectedinherited |
Definition at line 166 of file JDAQCHSM.hh.
|
protectedinherited |
Definition at line 167 of file JDAQCHSM.hh.
|
staticinherited |
time out of update [s]
Definition at line 63 of file JDAQClient.hh.
|
protectedinherited |
event table
Definition at line 203 of file JDAQClient.hh.
|
protectedinherited |
Definition at line 204 of file JDAQClient.hh.
|
protectedinherited |
Definition at line 205 of file JDAQClient.hh.
|
protectedinherited |
Definition at line 206 of file JDAQClient.hh.
|
protectedinherited |
central clock
Definition at line 207 of file JDAQClient.hh.
|
protectedinherited |
event information
Definition at line 208 of file JDAQClient.hh.