| ifw-daq
    2.1.0-pre1
    IFW Data Acquisition modules | 
 
 
 
Go to the documentation of this file.
    8 #ifndef OCF_OCM_SERVERCTL_REQUESTOR_HPP_ 
    9 #define OCF_OCM_SERVERCTL_REQUESTOR_HPP_ 
   12 #include <type_traits> 
   13 #include <unordered_map> 
   16 #include <CLI/App.hpp> 
   17 #include <boost/asio/io_service.hpp> 
   21 #include <rad/logger.hpp> 
   23 std::ostream& 
operator<<(std::ostream& os, std::shared_ptr<daqif::DaqStatus> 
const& s);
 
   24 std::ostream& 
operator<<(std::ostream& os, std::shared_ptr<daqif::DaqReply> 
const& s);
 
   25 std::ostream& 
operator<<(std::ostream& os, std::vector<std::shared_ptr<daqif::DaqStatus>> 
const& s);
 
   27 operator<<(std::ostream& os, std::vector<std::shared_ptr<daqif::AwaitDaqReply>> 
const& s);
 
   36 std::ostream& 
operator<<(std::ostream& os, 
JsonPrint<std::shared_ptr<daqif::DaqStatus>> 
const& s);
 
   37 std::ostream& 
operator<<(std::ostream& os, 
JsonPrint<std::shared_ptr<daqif::DaqReply>> 
const& s);
 
   42 operator<<(std::ostream& os, 
JsonPrint<std::vector<std::shared_ptr<daqif::DaqStatus>>> 
const& s);
 
   70     Handle(::stdif::StdCmdsSync& std_cmds, ::daqif::OcmDaqControlSync& daq_cmds, CLI::App* arg) = 0;
 
   78     virtual void AddOptions(CLI::App* app) 
override;
 
   79     virtual void Handle(::stdif::StdCmdsSync& std_cmds,
 
   80                         ::daqif::OcmDaqControlSync& daq_cmds,
 
   81                         CLI::App* arg) 
override;
 
   99     void Handle(::stdif::StdCmdsSync& std_cmds,
 
  100                 ::daqif::OcmDaqControlSync& daq_cmds,
 
  101                 CLI::App* arg)
 override {
 
  102         if constexpr (std::is_invocable_v<Func, decltype(std_cmds)>) {
 
  103             auto reply = (std_cmds.*
m_func)();
 
  107                 std::cout << 
"Reply: " << reply << std::endl;
 
  109         } 
else if constexpr (std::is_invocable_v<Func, decltype(daq_cmds)>) {
 
  110             auto reply = (daq_cmds.*
m_func)();
 
  114                 std::cout << 
"Reply: " << reply << std::endl;
 
  127 template <
class Func>
 
  133         sub->add_option(
"id", m_id, 
"DAQ ID");
 
  136     void Handle(::stdif::StdCmdsSync& std_cmds,
 
  137                 ::daqif::OcmDaqControlSync& daq_cmds,
 
  138                 CLI::App* arg)
 override {
 
  139         auto reply = (daq_cmds.*m_func)(m_id);
 
  143             std::cout << 
"Reply: " << reply << std::endl;
 
  152 template <
class Func>
 
  157     void Handle(::stdif::StdCmdsSync& std_cmds,
 
  158                 ::daqif::OcmDaqControlSync& daq_cmds,
 
  159                 CLI::App* arg)
 override {
 
  160         auto reply = (daq_cmds.*
m_func)();
 
  164             std::cout << 
"Reply: " << reply << std::endl;
 
  181     void Handle(::stdif::StdCmdsSync& std_cmds,
 
  182                 ::daqif::OcmDaqControlSync& daq_cmds,
 
  183                 CLI::App* arg) 
override;
 
  192     void Handle(::stdif::StdCmdsSync& std_cmds,
 
  193                 ::daqif::OcmDaqControlSync& daq_cmds,
 
  194                 CLI::App* arg) 
override;
 
  198     std::string m_keywords;
 
  205     void Handle(::stdif::StdCmdsSync& std_cmds,
 
  206                 ::daqif::OcmDaqControlSync& daq_cmds,
 
  207                 CLI::App* arg) 
override;
 
  212     std::string m_substate;
 
  216 #endif  // #ifndef OCF_OCM_SERVERCTL_REQUESTOR_HPP_ 
  
void AddOptions(CLI::App *sub)
Add arguments to command.
Requestor(CommonArgs &args)
SimpleDaqRequestor(Func func, CommonArgs &args)
void Handle(::stdif::StdCmdsSync &std_cmds, ::daqif::OcmDaqControlSync &daq_cmds, CLI::App *arg) override
Receives a parsed variables_map that include the options added with AddOptions.
Simple requestor for commands without argument.
virtual void AddOptions(CLI::App *app)
Add arguments to command.
void Handle(::stdif::StdCmdsSync &std_cmds, ::daqif::OcmDaqControlSync &daq_cmds, CLI::App *arg) override
Receives a parsed variables_map that include the options added with AddOptions.
void AddOptions(CLI::App *app) override
Add arguments to command.
std::string m_primary_sources
std::ostream & operator<<(std::ostream &os, std::shared_ptr< daqif::DaqStatus > const &s)
void Handle(::stdif::StdCmdsSync &std_cmds, ::daqif::OcmDaqControlSync &daq_cmds, CLI::App *arg) override
Receives a parsed variables_map that include the options added with AddOptions.
CommonArgs(CommonArgs const &)=delete
Simple Daq commands that accepts a single argument id and returns a shared_ptr type that can be forma...
void Handle(::stdif::StdCmdsSync &std_cmds, ::daqif::OcmDaqControlSync &daq_cmds, CLI::App *arg) override
Receives a parsed variables_map that include the options added with AddOptions.
void Handle(::stdif::StdCmdsSync &std_cmds, ::daqif::OcmDaqControlSync &daq_cmds, CLI::App *arg) override
Receives a parsed variables_map that include the options added with AddOptions.
JsonPrint(T const &t_arg)
void AddOptions(CLI::App *app) override
Add arguments to command.
void Handle(::stdif::StdCmdsSync &std_cmds, ::daqif::OcmDaqControlSync &daq_cmds, CLI::App *arg) override
Receives a parsed variables_map that include the options added with AddOptions.
CommonArgs & operator=(CommonArgs const &)=delete
virtual void Handle(::stdif::StdCmdsSync &std_cmds, ::daqif::OcmDaqControlSync &daq_cmds, CLI::App *arg)=0
Receives a parsed variables_map that include the options added with AddOptions.
virtual void AddOptions(CLI::App *app) override
Add arguments to command.
virtual void Handle(::stdif::StdCmdsSync &std_cmds, ::daqif::OcmDaqControlSync &daq_cmds, CLI::App *arg) override
Receives a parsed variables_map that include the options added with AddOptions.
void AddOptions(CLI::App *app) override
Add arguments to command.
SimpleRequestor(Func func, CommonArgs &args)
NoArgRequestor(Func func, CommonArgs &args)
std::string m_metadata_sources