00001 #ifndef artdaq_ExternalComms_CommanderInterface_hh
00002 #define artdaq_ExternalComms_CommanderInterface_hh
00003
00004 #include "artdaq/DAQdata/Globals.hh"
00005 #include "fhiclcpp/ParameterSet.h"
00006 #include "artdaq/Application/Commandable.hh"
00007 #include "cetlib/compiler_macros.h"
00008
00009
00010 namespace artdaq
00011 {
00015 class CommanderInterface
00016 {
00017 public:
00021 struct Config
00022 {
00024 fhicl::Atom<int> id{ fhicl::Name{"id"}, fhicl::Comment{"The unique ID associated with this Commander plugin. (ex. XMLRPC Port number)"}, 0 };
00026 fhicl::Atom<std::string> commanderPluginType{ fhicl::Name{"commanderPluginType"}, fhicl::Comment{"String identifying the name of the CommanderInterface plugin to load"} };
00027 };
00028 #if MESSAGEFACILITY_HEX_VERSION >= 0x20103
00029 using Parameters = fhicl::WrappedTable<Config>;
00030 #endif
00031
00037 CommanderInterface(const fhicl::ParameterSet& ps, artdaq::Commandable& commandable)
00038 : _commandable(commandable)
00039 , _id(ps.get<int>("id", 0))
00040 {}
00041
00045 CommanderInterface(const CommanderInterface&) = delete;
00046
00051 CommanderInterface& operator=(const CommanderInterface&) = delete;
00052
00056 virtual ~CommanderInterface();
00057
00084 virtual void run_server() = 0;
00085
00093 virtual std::string send_init(fhicl::ParameterSet, uint64_t, uint64_t);
00094
00102 virtual std::string send_soft_init(fhicl::ParameterSet, uint64_t, uint64_t);
00103
00111 virtual std::string send_reinit(fhicl::ParameterSet, uint64_t, uint64_t);
00112
00120 virtual std::string send_start(art::RunID, uint64_t, uint64_t);
00121
00129 virtual std::string send_pause(uint64_t, uint64_t);
00130
00138 virtual std::string send_resume(uint64_t, uint64_t);
00139
00147 virtual std::string send_stop(uint64_t, uint64_t);
00148
00156 virtual std::string send_shutdown(uint64_t);
00157
00164 virtual std::string send_status();
00165
00172 virtual std::string send_report(std::string);
00173
00180 virtual std::string send_legal_commands();
00181
00188 virtual std::string send_register_monitor(std::string);
00189
00196 virtual std::string send_unregister_monitor(std::string);
00197
00205 virtual std::string send_trace_get(std::string);
00206
00217 virtual std::string send_trace_set(std::string, std::string, uint64_t);
00218
00225 virtual std::string send_meta_command(std::string, std::string);
00226
00234 virtual std::string send_rollover_subrun(uint64_t);
00235
00236 private:
00237
00238 public:
00242 artdaq::Commandable& _commandable;
00243
00244 protected:
00245 int _id;
00246 };
00247 }
00248
00249 #ifndef EXTERN_C_FUNC_DECLARE_START
00250 #define EXTERN_C_FUNC_DECLARE_START extern "C" {
00251 #endif
00252
00253 #define DEFINE_ARTDAQ_COMMANDER(klass) \
00254 EXTERN_C_FUNC_DECLARE_START \
00255 std::unique_ptr<artdaq::CommanderInterface> make(fhicl::ParameterSet const & ps, \
00256 artdaq::Commandable& commandable) { \
00257 return std::unique_ptr<artdaq::CommanderInterface>(new klass(ps, commandable)); \
00258 }}
00259
00260
00261 #endif
00262
00263
00264
00265