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:
00018 struct Config
00019 {
00020 fhicl::Atom<int> id{ fhicl::Name{"id"}, fhicl::Comment{"The unique ID associated with this Commander plugin. (ex. XMLRPC Port number)"}, 0 };
00021 fhicl::Atom<std::string> commanderPluginType{ fhicl::Name{"commanderPluginType"}, fhicl::Comment{"String identifying the name of the CommanderInterface plugin to load"} };
00022 };
00023 #if MESSAGEFACILITY_HEX_VERSION >= 0x20103
00024 using Parameters = fhicl::WrappedTable<Config>;
00025 #endif
00026
00038 CommanderInterface(const fhicl::ParameterSet& ps, artdaq::Commandable& commandable)
00039 : _commandable(commandable)
00040 , _id(ps.get<int>("id", 0))
00041 {}
00042
00046 CommanderInterface(const CommanderInterface&) = delete;
00047
00052 CommanderInterface& operator=(const CommanderInterface&) = delete;
00053
00057 virtual ~CommanderInterface();
00058
00085 virtual void run_server() = 0;
00086
00094 virtual std::string send_init(fhicl::ParameterSet, uint64_t, uint64_t);
00095
00103 virtual std::string send_soft_init(fhicl::ParameterSet, uint64_t, uint64_t);
00104
00112 virtual std::string send_reinit(fhicl::ParameterSet, uint64_t, uint64_t);
00113
00121 virtual std::string send_start(art::RunID, uint64_t, uint64_t);
00122
00130 virtual std::string send_pause(uint64_t, uint64_t);
00131
00139 virtual std::string send_resume(uint64_t, uint64_t);
00140
00148 virtual std::string send_stop(uint64_t, uint64_t);
00149
00157 virtual std::string send_shutdown(uint64_t);
00158
00165 virtual std::string send_status();
00166
00173 virtual std::string send_report(std::string);
00174
00181 virtual std::string send_legal_commands();
00182
00189 virtual std::string send_register_monitor(std::string);
00190
00197 virtual std::string send_unregister_monitor(std::string);
00198
00206 virtual std::string send_trace_get(std::string);
00207
00218 virtual std::string send_trace_set(std::string, std::string, uint64_t);
00219
00226 virtual std::string send_meta_command(std::string, std::string);
00227
00235 virtual std::string send_rollover_subrun(uint64_t);
00236
00237 private:
00238
00239 public:
00243 artdaq::Commandable& _commandable;
00244
00245 protected:
00246 int _id;
00247 };
00248 }
00249
00250 #ifndef EXTERN_C_FUNC_DECLARE_START
00251 #define EXTERN_C_FUNC_DECLARE_START extern "C" {
00252 #endif
00253
00254 #define DEFINE_ARTDAQ_COMMANDER(klass) \
00255 EXTERN_C_FUNC_DECLARE_START \
00256 std::unique_ptr<artdaq::CommanderInterface> make(fhicl::ParameterSet const & ps, \
00257 artdaq::Commandable& commandable) { \
00258 return std::unique_ptr<artdaq::CommanderInterface>(new klass(ps, commandable)); \
00259 }}
00260
00261
00262 #endif
00263
00264
00265
00266