artdaq  v3_02_01
CommanderInterface.hh
1 #ifndef artdaq_ExternalComms_CommanderInterface_hh
2 #define artdaq_ExternalComms_CommanderInterface_hh
3 
4 #include "artdaq/DAQdata/Globals.hh"
5 #include "fhiclcpp/ParameterSet.h"
6 #include "artdaq/Application/Commandable.hh"
7 #include "cetlib/compiler_macros.h"
8 
9 
10 namespace artdaq
11 {
16  {
17  public:
21  struct Config
22  {
24  fhicl::Atom<int> id{ fhicl::Name{"id"}, fhicl::Comment{"The unique ID associated with this Commander plugin. (ex. XMLRPC Port number)"}, 0 };
26  fhicl::Atom<std::string> commanderPluginType{ fhicl::Name{"commanderPluginType"}, fhicl::Comment{"String identifying the name of the CommanderInterface plugin to load"} };
27  };
28 #if MESSAGEFACILITY_HEX_VERSION >= 0x20103
29  using Parameters = fhicl::WrappedTable<Config>;
30 #endif
31 
37  CommanderInterface(const fhicl::ParameterSet& ps, artdaq::Commandable& commandable)
38  : _commandable(commandable)
39  , _id(ps.get<int>("id", 0))
40  {}
41 
45  CommanderInterface(const CommanderInterface&) = delete;
46 
52 
56  virtual ~CommanderInterface();
57 
84  virtual void run_server() = 0;
85 
93  virtual std::string send_init(fhicl::ParameterSet, uint64_t, uint64_t);
94 
102  virtual std::string send_soft_init(fhicl::ParameterSet, uint64_t, uint64_t);
103 
111  virtual std::string send_reinit(fhicl::ParameterSet, uint64_t, uint64_t);
112 
120  virtual std::string send_start(art::RunID, uint64_t, uint64_t);
121 
129  virtual std::string send_pause(uint64_t, uint64_t);
130 
138  virtual std::string send_resume(uint64_t, uint64_t);
139 
147  virtual std::string send_stop(uint64_t, uint64_t);
148 
156  virtual std::string send_shutdown(uint64_t);
157 
164  virtual std::string send_status();
165 
172  virtual std::string send_report(std::string);
173 
180  virtual std::string send_legal_commands();
181 
188  virtual std::string send_register_monitor(std::string);
189 
196  virtual std::string send_unregister_monitor(std::string);
197 
205  virtual std::string send_trace_get(std::string);
206 
217  virtual std::string send_trace_set(std::string, std::string, uint64_t);
218 
225  virtual std::string send_meta_command(std::string, std::string);
226 
234  virtual std::string send_rollover_subrun(uint64_t);
235 
236  private:
237 
238  public:
243 
244  protected:
245  int _id;
246  };
247 }
248 
249 #ifndef EXTERN_C_FUNC_DECLARE_START
250 #define EXTERN_C_FUNC_DECLARE_START extern "C" {
251 #endif
252 
253 #define DEFINE_ARTDAQ_COMMANDER(klass) \
254  EXTERN_C_FUNC_DECLARE_START \
255  std::unique_ptr<artdaq::CommanderInterface> make(fhicl::ParameterSet const & ps, \
256  artdaq::Commandable& commandable) { \
257  return std::unique_ptr<artdaq::CommanderInterface>(new klass(ps, commandable)); \
258 }}
259 
260 
261 #endif /* artdaq_ExternalComms_CommanderInterface.hh */
262 
263 // Local Variables:
264 // mode: c++
265 // End:
This interface defines the functions used to transfer data between artdaq applications.
Commandable is the base class for all artdaq components which implement the artdaq state machine...
Definition: Commandable.hh:20
virtual std::string send_report(std::string)
Using the transport mechanism, send a report command
virtual std::string send_soft_init(fhicl::ParameterSet, uint64_t, uint64_t)
Using the transport mechanism, send a soft_init command
virtual std::string send_unregister_monitor(std::string)
Using the transport mechanism, send an unregister_monitor command
fhicl::Atom< std::string > commanderPluginType
&quot;commanderPluginType&quot; (REQUIRED): The type of Commander plugin to load
virtual std::string send_meta_command(std::string, std::string)
Using the transport mechanism, send an send_meta_command command
int _id
ID Number of this Commander.
virtual std::string send_resume(uint64_t, uint64_t)
Using the transport mechanism, send a resume command
virtual std::string send_legal_commands()
Using the transport mechanism, send a legal_commands command
virtual std::string send_trace_set(std::string, std::string, uint64_t)
Using the transport mechanism, send an send_trace_msgfacility_set command
virtual std::string send_start(art::RunID, uint64_t, uint64_t)
Using the transport mechanism, send a start command
virtual ~CommanderInterface()
Default virtual Destructor.
artdaq::Commandable & _commandable
Reference to the Commandable that this Commander Commands.
virtual std::string send_stop(uint64_t, uint64_t)
Using the transport mechanism, send a stop command
virtual std::string send_init(fhicl::ParameterSet, uint64_t, uint64_t)
Using the transport mechanism, send an init command
CommanderInterface(const fhicl::ParameterSet &ps, artdaq::Commandable &commandable)
CommanderInterface Constructor.
virtual std::string send_reinit(fhicl::ParameterSet, uint64_t, uint64_t)
Using the transport mechanism, send a reinit command
CommanderInterface & operator=(const CommanderInterface &)=delete
Copy Assignment operator is deleted.
virtual std::string send_shutdown(uint64_t)
Using the transport mechanism, send a shutdown command
virtual std::string send_register_monitor(std::string)
Using the transport mechanism, send a register_monitor command
Configuration of the CommanderInterface. May be used for parameter validation
virtual void run_server()=0
run_server is the main work loop for the Commander.
virtual std::string send_status()
Using the transport mechanism, send a status command
virtual std::string send_trace_get(std::string)
Using the transport mechanism, send an send_trace_get command
virtual std::string send_rollover_subrun(uint64_t)
Using the transport mechanism, send a send_rollover_subrun command
virtual std::string send_pause(uint64_t, uint64_t)
Using the transport mechanism, send a pause command