8#ifndef OCF_OCM_SERVERCTL_REQUESTOR_HPP_
9#define OCF_OCM_SERVERCTL_REQUESTOR_HPP_
13#include <unordered_map>
17#include <boost/asio/io_service.hpp>
21#include <rad/logger.hpp>
23std::ostream&
operator<<(std::ostream& os, std::shared_ptr<daqif::DaqStatus>
const& s);
24std::ostream&
operator<<(std::ostream& os, std::shared_ptr<daqif::DaqReply>
const& s);
25std::ostream&
operator<<(std::ostream& os, std::vector<std::shared_ptr<daqif::DaqStatus>>
const& s);
27operator<<(std::ostream& os, std::vector<std::shared_ptr<daqif::AwaitDaqReply>>
const& s);
36std::ostream&
operator<<(std::ostream& os,
JsonPrint<std::shared_ptr<daqif::DaqStatus>>
const& s);
37std::ostream&
operator<<(std::ostream& os,
JsonPrint<std::shared_ptr<daqif::DaqReply>>
const& s);
42operator<<(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 << 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 << std::endl;
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 << std::endl;
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 << std::endl;
181 void Handle(::stdif::StdCmdsSync& std_cmds,
182 ::daqif::OcmDaqControlSync& daq_cmds,
183 CLI::App* arg)
override;
194 void Handle(::stdif::StdCmdsSync& std_cmds,
195 ::daqif::OcmDaqControlSync& daq_cmds,
196 CLI::App* arg)
override;
205 void Handle(::stdif::StdCmdsSync& std_cmds,
206 ::daqif::OcmDaqControlSync& daq_cmds,
207 CLI::App* arg)
override;
211 std::string m_keywords;
218 void Handle(::stdif::StdCmdsSync& std_cmds,
219 ::daqif::OcmDaqControlSync& daq_cmds,
220 CLI::App* arg)
override;
225 std::string m_substate;
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.
void AddOptions(CLI::App *app) override
Add arguments to command.
CommonArgs & operator=(CommonArgs const &)=delete
CommonArgs(CommonArgs const &)=delete
JsonPrint(T const &t_arg)
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.
NoArgRequestor(Func func, CommonArgs &args)
virtual void AddOptions(CLI::App *app)
Add arguments to command.
Requestor(CommonArgs &args)
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 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.
virtual void AddOptions(CLI::App *app) override
Add arguments to command.
Simple Daq commands that accepts a single argument id and returns a shared_ptr type that can be forma...
void AddOptions(CLI::App *sub) 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.
SimpleDaqRequestor(Func func, CommonArgs &args)
Simple requestor for commands without argument.
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.
SimpleRequestor(Func func, CommonArgs &args)
std::string m_primary_sources
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.
std::string m_metadata_sources
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.
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.