1 #ifndef artdaq_Application_Commandable_hh
2 #define artdaq_Application_Commandable_hh
8 #include "canvas/Persistency/Provenance/RunID.h"
9 #include "fhiclcpp/ParameterSet.h"
11 #include "artdaq/Application/Commandable_sm.h"
51 bool initialize(fhicl::ParameterSet
const& pset, uint64_t timeout, uint64_t timestamp);
60 bool start(art::RunID
id, uint64_t timeout, uint64_t timestamp);
68 bool stop(uint64_t timeout, uint64_t timestamp);
76 bool pause(uint64_t timeout, uint64_t timestamp);
84 bool resume(uint64_t timeout, uint64_t timestamp);
100 bool soft_initialize(fhicl::ParameterSet
const& pset, uint64_t timeout, uint64_t timestamp);
109 bool reinitialize(fhicl::ParameterSet
const& pset, uint64_t timeout, uint64_t timestamp);
121 virtual std::string
report(std::string
const&)
const
123 std::lock_guard<std::mutex> lk(primary_mutex_);
131 std::string
status()
const;
141 return "This string is returned from Commandable::register_monitor; register_monitor should either be overridden in a derived class or this process should not have been sent the register_monitor call";
152 return "This string is returned from Commandable::unregister_monitor; unregister_monitor should either be overridden in a derived class or this process should not have been sent the unregister_monitor call";
168 virtual bool do_initialize(fhicl::ParameterSet
const&, uint64_t, uint64_t);
176 virtual bool do_start(art::RunID, uint64_t, uint64_t);
184 virtual bool do_stop(uint64_t, uint64_t);
192 virtual bool do_pause(uint64_t, uint64_t);
200 virtual bool do_resume(uint64_t, uint64_t);
216 virtual bool do_reinitialize(fhicl::ParameterSet
const&, uint64_t, uint64_t);
262 virtual std::string
do_trace_get(std::string
const& name);
273 virtual bool do_trace_set(std::string
const& type, std::string
const& name, uint64_t mask);
283 virtual bool do_meta_command(std::string
const& command, std::string
const& args);
323 mutable std::mutex primary_mutex_;
virtual bool do_add_config_archive_entry(std::string const &, std::string const &)
Add the specified key-value pair to the configuration archive list.
bool initialize(fhicl::ParameterSet const &pset, uint64_t timeout, uint64_t timestamp)
Processes the initialize request.
virtual bool do_start(art::RunID, uint64_t, uint64_t)
Perform the start transition.
Commandable & operator=(Commandable const &)=delete
Copy Assignment operator is deleted.
virtual std::string report(std::string const &) const
Default report implementation returns current report_string.
Commandable is the base class for all artdaq components which implement the artdaq state machine...
virtual bool do_clear_config_archive()
Clears the configuration archive list.
virtual void badTransition(const std::string &trans)
This function is called when an attempt is made to call an illegal transition.
virtual void InRunExit()
Perform actions upon leaving the InRun state.
virtual std::string unregister_monitor(std::string const &)
Perform the unregister_monitor action.
bool external_request_status_
Whether the last command succeeded.
virtual bool do_pause(uint64_t, uint64_t)
Perform the pause transition.
bool reinitialize(fhicl::ParameterSet const &pset, uint64_t timeout, uint64_t timestamp)
Processes the reinitialize request.
std::string current_state() const
Return the name of the current state.
virtual void BootedEnter()
Perform actions upon entering the Booted state.
std::string status() const
Returns the current state of the Commandable.
virtual bool do_shutdown(uint64_t)
Perform the shutdown transition.
virtual ~Commandable()=default
Default Destructor.
virtual bool do_soft_initialize(fhicl::ParameterSet const &, uint64_t, uint64_t)
Perform the soft_initialize transition.
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.
virtual std::string register_monitor(fhicl::ParameterSet const &)
Perform the register_monitor action.
virtual bool do_meta_command(std::string const &command, std::string const &args)
Run a module-defined command with the given parameter string.
bool resume(uint64_t timeout, uint64_t timestamp)
Processes the resume transition.
CommandableContext fsm_
The generated State Machine (using smc_compiler)
bool pause(uint64_t timeout, uint64_t timestamp)
Processes the pause transition.
std::string report_string_
Status information about the last command.
virtual bool do_stop(uint64_t, uint64_t)
Perform the stop transition.
bool in_run_failure()
Actions taken when the in_run_failure state is set.
std::vector< std::string > legal_commands() const
Get the legal transition commands from the current state.
bool soft_initialize(fhicl::ParameterSet const &pset, uint64_t timeout, uint64_t timestamp)
Processes the soft-initialize request.
virtual bool do_resume(uint64_t, uint64_t)
Perform the resume transition.
bool start(art::RunID id, uint64_t timeout, uint64_t timestamp)
Processes the start transition.
virtual bool do_reinitialize(fhicl::ParameterSet const &, uint64_t, uint64_t)
Perform the reinitialize transition.
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...
bool stop(uint64_t timeout, uint64_t timestamp)
Processes the stop transition.
virtual bool do_rollover_subrun(uint64_t eventNum, uint32_t subrunNum)
Perform the rollover_subrun transition.
virtual bool do_initialize(fhicl::ParameterSet const &, uint64_t, uint64_t)
Perform the initialize transition.
bool shutdown(uint64_t timeout)
Processes the shutdown transition.