artdaq  v3_02_00
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:
18  struct Config
19  {
20  fhicl::Atom<int> id{ fhicl::Name{"id"}, fhicl::Comment{"The unique ID associated with this Commander plugin. (ex. XMLRPC Port number)"}, 0 };
21  fhicl::Atom<std::string> commanderPluginType{ fhicl::Name{"commanderPluginType"}, fhicl::Comment{"String identifying the name of the CommanderInterface plugin to load"} };
22  };
23 #if MESSAGEFACILITY_HEX_VERSION >= 0x20103
24  using Parameters = fhicl::WrappedTable<Config>;
25 #endif
26 
38  CommanderInterface(const fhicl::ParameterSet& ps, artdaq::Commandable& commandable)
39  : _commandable(commandable)
40  , _id(ps.get<int>("id", 0))
41  {}
42 
46  CommanderInterface(const CommanderInterface&) = delete;
47 
53 
57  virtual ~CommanderInterface();
58 
85  virtual void run_server() = 0;
86 
94  virtual std::string send_init(fhicl::ParameterSet, uint64_t, uint64_t);
95 
103  virtual std::string send_soft_init(fhicl::ParameterSet, uint64_t, uint64_t);
104 
112  virtual std::string send_reinit(fhicl::ParameterSet, uint64_t, uint64_t);
113 
121  virtual std::string send_start(art::RunID, uint64_t, uint64_t);
122 
130  virtual std::string send_pause(uint64_t, uint64_t);
131 
139  virtual std::string send_resume(uint64_t, uint64_t);
140 
148  virtual std::string send_stop(uint64_t, uint64_t);
149 
157  virtual std::string send_shutdown(uint64_t);
158 
165  virtual std::string send_status();
166 
173  virtual std::string send_report(std::string);
174 
181  virtual std::string send_legal_commands();
182 
189  virtual std::string send_register_monitor(std::string);
190 
197  virtual std::string send_unregister_monitor(std::string);
198 
206  virtual std::string send_trace_get(std::string);
207 
218  virtual std::string send_trace_set(std::string, std::string, uint64_t);
219 
226  virtual std::string send_meta_command(std::string, std::string);
227 
235  virtual std::string send_rollover_subrun(uint64_t);
236 
237  private:
238 
239  public:
244 
245  protected:
246  int _id;
247  };
248 }
249 
250 #ifndef EXTERN_C_FUNC_DECLARE_START
251 #define EXTERN_C_FUNC_DECLARE_START extern "C" {
252 #endif
253 
254 #define DEFINE_ARTDAQ_COMMANDER(klass) \
255  EXTERN_C_FUNC_DECLARE_START \
256  std::unique_ptr<artdaq::CommanderInterface> make(fhicl::ParameterSet const & ps, \
257  artdaq::Commandable& commandable) { \
258  return std::unique_ptr<artdaq::CommanderInterface>(new klass(ps, commandable)); \
259 }}
260 
261 
262 #endif /* artdaq_ExternalComms_CommanderInterface.hh */
263 
264 // Local Variables:
265 // mode: c++
266 // 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
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
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