artdaq  v3_06_00
artdaq::Commandable Class Reference

Commandable is the base class for all artdaq components which implement the artdaq state machine. More...

#include <artdaq/Application/Commandable.hh>

Inheritance diagram for artdaq::Commandable:
artdaq::BoardReaderApp artdaq::DataLoggerApp artdaq::DispatcherApp artdaq::EventBuilderApp artdaq::RoutingMasterApp

Public Member Functions

 Commandable ()
 
 Commandable (Commandable const &)=delete
 Copy Constructor is deleted.
 
virtual ~Commandable ()=default
 Default Destructor.
 
Commandableoperator= (Commandable const &)=delete
 Copy Assignment operator is deleted. More...
 
bool initialize (fhicl::ParameterSet const &pset, uint64_t timeout, uint64_t timestamp)
 Processes the initialize request. More...
 
bool start (art::RunID id, uint64_t timeout, uint64_t timestamp)
 Processes the start transition. More...
 
bool stop (uint64_t timeout, uint64_t timestamp)
 Processes the stop transition. More...
 
bool pause (uint64_t timeout, uint64_t timestamp)
 Processes the pause transition. More...
 
bool resume (uint64_t timeout, uint64_t timestamp)
 Processes the resume transition. More...
 
bool shutdown (uint64_t timeout)
 Processes the shutdown transition. More...
 
bool soft_initialize (fhicl::ParameterSet const &pset, uint64_t timeout, uint64_t timestamp)
 Processes the soft-initialize request. More...
 
bool reinitialize (fhicl::ParameterSet const &pset, uint64_t timeout, uint64_t timestamp)
 Processes the reinitialize request. More...
 
bool in_run_failure ()
 Actions taken when the in_run_failure state is set. More...
 
virtual std::string report (std::string const &) const
 Default report implementation returns current report_string. More...
 
std::string status () const
 Returns the current state of the Commandable. More...
 
virtual std::string register_monitor (fhicl::ParameterSet const &)
 Perform the register_monitor action. More...
 
virtual std::string unregister_monitor (std::string const &)
 Perform the unregister_monitor action. More...
 
std::vector< std::string > legal_commands () const
 Get the legal transition commands from the current state. More...
 
virtual bool do_initialize (fhicl::ParameterSet const &, uint64_t, uint64_t)
 Perform the initialize transition. More...
 
virtual bool do_start (art::RunID, uint64_t, uint64_t)
 Perform the start transition. More...
 
virtual bool do_stop (uint64_t, uint64_t)
 Perform the stop transition. More...
 
virtual bool do_pause (uint64_t, uint64_t)
 Perform the pause transition. More...
 
virtual bool do_resume (uint64_t, uint64_t)
 Perform the resume transition. More...
 
virtual bool do_shutdown (uint64_t)
 Perform the shutdown transition. More...
 
virtual bool do_reinitialize (fhicl::ParameterSet const &, uint64_t, uint64_t)
 Perform the reinitialize transition. More...
 
virtual bool do_soft_initialize (fhicl::ParameterSet const &, uint64_t, uint64_t)
 Perform the soft_initialize transition. More...
 
virtual bool do_rollover_subrun (uint64_t eventNum, uint32_t subrunNum)
 Perform the rollover_subrun transition. More...
 
virtual void badTransition (const std::string &trans)
 This function is called when an attempt is made to call an illegal transition. More...
 
virtual void BootedEnter ()
 Perform actions upon entering the Booted state. More...
 
virtual void InRunExit ()
 Perform actions upon leaving the InRun state. More...
 
virtual std::string do_trace_get (std::string const &name)
 Get the TRACE mask for the given TRACE name If name is "ALL", then all TRACE masks will be printed. More...
 
virtual bool do_trace_set (std::string const &type, std::string const &name, uint64_t mask)
 Set the given TRACE mask for the given TRACE name. More...
 
virtual bool do_meta_command (std::string const &command, std::string const &args)
 Run a module-defined command with the given parameter string. More...
 
virtual bool do_add_config_archive_entry (std::string const &, std::string const &)
 Add the specified key-value pair to the configuration archive list. More...
 
virtual bool do_clear_config_archive ()
 Clears the configuration archive list. More...
 

Protected Member Functions

std::string current_state () const
 Return the name of the current state. More...
 

Protected Attributes

CommandableContext fsm_
 The generated State Machine (using smc_compiler)
 
bool external_request_status_
 Whether the last command succeeded.
 
std::string report_string_
 Status information about the last command.
 

Detailed Description

Commandable is the base class for all artdaq components which implement the artdaq state machine.

Definition at line 20 of file Commandable.hh.

Constructor & Destructor Documentation

artdaq::Commandable::Commandable ( )

Default constructor.

Definition at line 23 of file Commandable.cc.

Member Function Documentation

void artdaq::Commandable::badTransition ( const std::string &  trans)
virtual

This function is called when an attempt is made to call an illegal transition.

Parameters
transThe transition that was attempted

Definition at line 375 of file Commandable.cc.

void artdaq::Commandable::BootedEnter ( )
virtual

Perform actions upon entering the Booted state.

This function is a No-Op. Derived classes should override it.

Reimplemented in artdaq::BoardReaderApp, artdaq::RoutingMasterApp, and artdaq::EventBuilderApp.

Definition at line 394 of file Commandable.cc.

std::string artdaq::Commandable::current_state ( ) const
protected

Return the name of the current state.

Returns
The name of the current state

Definition at line 514 of file Commandable.cc.

bool artdaq::Commandable::do_add_config_archive_entry ( std::string const &  key,
std::string const &  value 
)
virtual

Add the specified key-value pair to the configuration archive list.

Returns
Whether the command succeeded (always true)

This function is a No-Op. Derived classes should override it.

Reimplemented in artdaq::EventBuilderApp, and artdaq::DataLoggerApp.

Definition at line 497 of file Commandable.cc.

bool artdaq::Commandable::do_clear_config_archive ( )
virtual

Clears the configuration archive list.

Returns
Whether the command succeeded (always true)

This function is a No-Op. Derived classes should override it.

Reimplemented in artdaq::EventBuilderApp, and artdaq::DataLoggerApp.

Definition at line 503 of file Commandable.cc.

bool artdaq::Commandable::do_initialize ( fhicl::ParameterSet const &  ,
uint64_t  ,
uint64_t   
)
virtual

Perform the initialize transition.

Returns
Whether the transition succeeded

This function is a No-Op. Derived classes should override it.

Reimplemented in artdaq::BoardReaderApp, artdaq::DataLoggerApp, artdaq::DispatcherApp, artdaq::EventBuilderApp, and artdaq::RoutingMasterApp.

Definition at line 319 of file Commandable.cc.

bool artdaq::Commandable::do_meta_command ( std::string const &  command,
std::string const &  args 
)
virtual

Run a module-defined command with the given parameter string.

This function is a No-Op. Derived classes should override it.

Parameters
commandName of the command to run (implementation-defined)
argsAny arguments for the command (implementation-defined)
Returns
Whether the command succeeded (always true)

Reimplemented in artdaq::BoardReaderApp.

Definition at line 484 of file Commandable.cc.

bool artdaq::Commandable::do_pause ( uint64_t  ,
uint64_t   
)
virtual

Perform the pause transition.

Returns
Whether the transition succeeded

This function is a No-Op. Derived classes should override it.

Reimplemented in artdaq::BoardReaderApp, artdaq::RoutingMasterApp, artdaq::DataLoggerApp, artdaq::DispatcherApp, and artdaq::EventBuilderApp.

Definition at line 340 of file Commandable.cc.

bool artdaq::Commandable::do_reinitialize ( fhicl::ParameterSet const &  ,
uint64_t  ,
uint64_t   
)
virtual

Perform the reinitialize transition.

Returns
Whether the transition succeeded

This function is a No-Op. Derived classes should override it.

Reimplemented in artdaq::BoardReaderApp, artdaq::RoutingMasterApp, artdaq::EventBuilderApp, artdaq::DataLoggerApp, and artdaq::DispatcherApp.

Definition at line 361 of file Commandable.cc.

bool artdaq::Commandable::do_resume ( uint64_t  ,
uint64_t   
)
virtual

Perform the resume transition.

Returns
Whether the transition succeeded

This function is a No-Op. Derived classes should override it.

Reimplemented in artdaq::BoardReaderApp, artdaq::RoutingMasterApp, artdaq::DataLoggerApp, artdaq::DispatcherApp, and artdaq::EventBuilderApp.

Definition at line 347 of file Commandable.cc.

bool artdaq::Commandable::do_rollover_subrun ( uint64_t  eventNum,
uint32_t  subrunNum 
)
virtual

Perform the rollover_subrun transition.

Parameters
eventNumSequence ID of boundary
subrunNumNew Subrun Number
Returns
Whether the transition succeeded

Reimplemented in artdaq::EventBuilderApp.

Definition at line 490 of file Commandable.cc.

bool artdaq::Commandable::do_shutdown ( uint64_t  )
virtual

Perform the shutdown transition.

Returns
Whether the transition succeeded

This function is a No-Op. Derived classes should override it.

Reimplemented in artdaq::BoardReaderApp, artdaq::RoutingMasterApp, artdaq::DataLoggerApp, artdaq::DispatcherApp, and artdaq::EventBuilderApp.

Definition at line 354 of file Commandable.cc.

bool artdaq::Commandable::do_soft_initialize ( fhicl::ParameterSet const &  ,
uint64_t  ,
uint64_t   
)
virtual

Perform the soft_initialize transition.

Returns
Whether the transition succeeded

This function is a No-Op. Derived classes should override it.

Reimplemented in artdaq::BoardReaderApp, artdaq::RoutingMasterApp, artdaq::EventBuilderApp, artdaq::DataLoggerApp, and artdaq::DispatcherApp.

Definition at line 368 of file Commandable.cc.

bool artdaq::Commandable::do_start ( art::RunID  ,
uint64_t  ,
uint64_t   
)
virtual

Perform the start transition.

Returns
Whether the transition succeeded

This function is a No-Op. Derived classes should override it.

Reimplemented in artdaq::BoardReaderApp, artdaq::RoutingMasterApp, artdaq::DataLoggerApp, artdaq::DispatcherApp, and artdaq::EventBuilderApp.

Definition at line 326 of file Commandable.cc.

bool artdaq::Commandable::do_stop ( uint64_t  ,
uint64_t   
)
virtual

Perform the stop transition.

Returns
Whether the transition succeeded

This function is a No-Op. Derived classes should override it.

Reimplemented in artdaq::BoardReaderApp, artdaq::RoutingMasterApp, artdaq::DataLoggerApp, artdaq::DispatcherApp, and artdaq::EventBuilderApp.

Definition at line 333 of file Commandable.cc.

std::string artdaq::Commandable::do_trace_get ( std::string const &  name)
virtual

Get the TRACE mask for the given TRACE name If name is "ALL", then all TRACE masks will be printed.

This function is implemented in Commandable, derived classes may override if necessary.

Parameters
nameTRACE name to print mask for. "ALL" prints all TRACE masks
Returns
TRACE mask of the given TRACE name

Definition at line 405 of file Commandable.cc.

bool artdaq::Commandable::do_trace_set ( std::string const &  type,
std::string const &  name,
uint64_t  mask 
)
virtual

Set the given TRACE mask for the given TRACE name.

This function is implemented in Commandable, derived classes may override if necessary.

Parameters
typeType of TRACE mask to set (either M, S, or T)
nameName of the TRACE level to set mask for
maskMask to set
Returns
Whether the command succeeded (always true)

Definition at line 434 of file Commandable.cc.

bool artdaq::Commandable::in_run_failure ( )

Actions taken when the in_run_failure state is set.

Returns
Whether the notification was properly processed

Definition at line 245 of file Commandable.cc.

bool artdaq::Commandable::initialize ( fhicl::ParameterSet const &  pset,
uint64_t  timeout,
uint64_t  timestamp 
)

Processes the initialize request.

Parameters
psetParameterSet used to configure the Commandable
timeoutTimeout for init step
timestampTimestamp of init step
Returns
Whether the transition was successful

Definition at line 31 of file Commandable.cc.

void artdaq::Commandable::InRunExit ( )
virtual

Perform actions upon leaving the InRun state.

This function is a No-Op. Derived classes should override it.

Definition at line 399 of file Commandable.cc.

std::vector< std::string > artdaq::Commandable::legal_commands ( ) const

Get the legal transition commands from the current state.

Returns
A list of legal transitions from the current state

Definition at line 285 of file Commandable.cc.

Commandable& artdaq::Commandable::operator= ( Commandable const &  )
delete

Copy Assignment operator is deleted.

Returns
Commandable copy
bool artdaq::Commandable::pause ( uint64_t  timeout,
uint64_t  timestamp 
)

Processes the pause transition.

Parameters
timeoutTimeout for transition
timestampTimestamp of transition
Returns
Whether the transition was successful

Definition at line 113 of file Commandable.cc.

virtual std::string artdaq::Commandable::register_monitor ( fhicl::ParameterSet const &  )
inlinevirtual

Perform the register_monitor action.

Returns
A report on the status of the command

This function is a No-Op. Derived classes should override it.

Reimplemented in artdaq::DispatcherApp.

Definition at line 139 of file Commandable.hh.

bool artdaq::Commandable::reinitialize ( fhicl::ParameterSet const &  pset,
uint64_t  timeout,
uint64_t  timestamp 
)

Processes the reinitialize request.

Parameters
psetParameterSet used to configure the Commandable
timeoutTimeout for init step
timestampTimestamp of init step
Returns
Whether the transition was successful

Definition at line 218 of file Commandable.cc.

virtual std::string artdaq::Commandable::report ( std::string const &  ) const
inlinevirtual

Default report implementation returns current report_string.

Returns
Current report_string (may be set by derived classes)

Reimplemented in artdaq::BoardReaderApp, artdaq::RoutingMasterApp, artdaq::EventBuilderApp, artdaq::DataLoggerApp, and artdaq::DispatcherApp.

Definition at line 121 of file Commandable.hh.

bool artdaq::Commandable::resume ( uint64_t  timeout,
uint64_t  timestamp 
)

Processes the resume transition.

Parameters
timeoutTimeout for transition
timestampTimestamp of transition
Returns
Whether the transition was successful

Definition at line 140 of file Commandable.cc.

bool artdaq::Commandable::shutdown ( uint64_t  timeout)

Processes the shutdown transition.

Parameters
timeoutTimeout for transition
Returns
Whether the transition was successful

Definition at line 166 of file Commandable.cc.

bool artdaq::Commandable::soft_initialize ( fhicl::ParameterSet const &  pset,
uint64_t  timeout,
uint64_t  timestamp 
)

Processes the soft-initialize request.

Parameters
psetParameterSet used to configure the Commandable
timeoutTimeout for init step
timestampTimestamp of init step
Returns
Whether the transition was successful

Definition at line 191 of file Commandable.cc.

bool artdaq::Commandable::start ( art::RunID  id,
uint64_t  timeout,
uint64_t  timestamp 
)

Processes the start transition.

Parameters
idRun number of new run
timeoutTimeout for transition
timestampTimestamp of transition
Returns
Whether the transition was successful

Definition at line 59 of file Commandable.cc.

std::string artdaq::Commandable::status ( ) const

Returns the current state of the Commandable.

Returns
The current state of the Commandable

Definition at line 272 of file Commandable.cc.

bool artdaq::Commandable::stop ( uint64_t  timeout,
uint64_t  timestamp 
)

Processes the stop transition.

Parameters
timeoutTimeout for transition
timestampTimestamp of transition
Returns
Whether the transition was successful

Definition at line 86 of file Commandable.cc.

virtual std::string artdaq::Commandable::unregister_monitor ( std::string const &  )
inlinevirtual

Perform the unregister_monitor action.

Returns
A report on the status of the command

This function is a No-Op. Derived classes should override it.

Reimplemented in artdaq::DispatcherApp.

Definition at line 150 of file Commandable.hh.


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