ifw-ocf  2.0.0-dev
 All Classes Namespaces Files Functions Variables Groups
requestor.hpp
Go to the documentation of this file.
1 
8 #ifndef OCF_OCM_SERVERCTL_REQUESTOR_HPP_
9 #define OCF_OCM_SERVERCTL_REQUESTOR_HPP_
10 
11 #include <iostream>
12 #include <unordered_map>
13 #include <vector>
14 
15 #include <boost/asio/io_service.hpp>
16 #include <boost/program_options.hpp>
17 
18 #include <OcmServerIf.hpp>
19 #include <rad/logger.hpp>
20 
21 struct CommonArgs {
22  unsigned timeout;
23  std::string req_addr;
24  std::string pub_addr;
25 
26  CommonArgs() = default;
27  CommonArgs(CommonArgs const&) = delete;
28  CommonArgs& operator=(CommonArgs const&) = delete;
29 };
30 
31 struct Requestor {
32  explicit Requestor(CommonArgs& args);
33  virtual ~Requestor() {
34  }
35  virtual std::string Synopsis();
39  virtual void AddOptions(boost::program_options::options_description& descr);
43  virtual void Handle(::ocmServerIf::CommandsSync& client,
44  boost::program_options::variables_map& vm,
45  std::vector<std::string>& opts) = 0;
46 
47  protected:
49 };
50 
53  void Handle(::ocmServerIf::CommandsSync& client,
54  boost::program_options::variables_map& vm,
55  std::vector<std::string>& opts) override;
56 };
57 
60  void Handle(::ocmServerIf::CommandsSync& client,
61  boost::program_options::variables_map& vm,
62  std::vector<std::string>& opts) override;
63 };
64 
65 #endif // #ifndef OCF_OCM_SERVERCTL_REQUESTOR_HPP_
CommonArgs & operator=(CommonArgs const &)=delete
Requestor(CommonArgs &args)
Definition: requestor.cpp:12
CommonArgs()=default
virtual void Handle(::ocmServerIf::CommandsSync &client, boost::program_options::variables_map &vm, std::vector< std::string > &opts)=0
Definition: requestor.hpp:51
Definition: requestor.hpp:58
virtual ~Requestor()
Definition: requestor.hpp:33
std::string req_addr
Definition: requestor.hpp:23
std::string pub_addr
Definition: requestor.hpp:24
void Handle(::ocmServerIf::CommandsSync &client, boost::program_options::variables_map &vm, std::vector< std::string > &opts) override
Definition: requestor.cpp:22
CommonArgs & m_args
Definition: requestor.hpp:48
virtual void AddOptions(boost::program_options::options_description &descr)
Definition: requestor.cpp:19
unsigned timeout
Definition: requestor.hpp:22
Definition: requestor.hpp:21
Definition: requestor.hpp:31
virtual std::string Synopsis()
Definition: requestor.cpp:15
void Handle(::ocmServerIf::CommandsSync &client, boost::program_options::variables_map &vm, std::vector< std::string > &opts) override
Definition: requestor.cpp:28