hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
interactive_status_cli.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_INTERACTIVE_STATUS_CLI_HPP
7 #define IROHA_INTERACTIVE_STATUS_CLI_HPP
8 
9 #include <endpoint.pb.h>
10 #include <string>
11 
13 #include "logger/logger_fwd.hpp"
14 
15 namespace iroha_cli {
16  namespace interactive {
23  public:
24  InteractiveStatusCli(const std::string &default_peer_ip,
25  int default_port,
26  logger::LoggerPtr pb_qry_factory_log);
27  void run();
28 
29  private:
30  using ActionName = std::string;
31  using ActionParams = std::vector<std::string>;
32  using ActionHandler = std::string (InteractiveStatusCli::*)(ActionParams);
33  using ResultHandler = bool (InteractiveStatusCli::*)(ActionParams);
34  std::unordered_map<ActionName, ActionHandler> actionHandlers_;
35 
36  bool parseAction(std::string &line);
37  bool parseResult(std::string &line);
38 
39  bool parseSendToIroha(ActionParams line);
40  bool parseSaveFile(ActionParams line);
41 
42  void createActionsMenu();
43  void createResultMenu();
44 
45  std::string parseGetHash(ActionParams params);
46 
47  const std::string GET_TX_INFO = "get_tx_info";
48 
49  std::string default_peer_ip_;
50  int default_port_;
51 
52  std::unordered_map<ActionName, ResultHandler> resultHandlers_;
53  ParamsMap resultParamsDescriptions_;
54 
55  DescriptionMap descriptionMap_;
56  ParamsMap requestParamsDescriptions_;
57  MenuPoints menuPoints_;
58  MenuPoints resultPoints_;
59 
60  MenuContext currentContext_;
61  std::string txHash_;
62 
63  logger::LoggerPtr pb_qry_factory_log_;
64  };
65  } // namespace interactive
66 } // namespace iroha_cli
67 
68 #endif // IROHA_INTERACTIVE_STATUS_CLI_HPP
Definition: client.cpp:16
MenuContext
Definition: interactive_common_cli.hpp:29
std::vector< std::string > MenuPoints
Definition: interactive_common_cli.hpp:60
std::shared_ptr< Logger > LoggerPtr
Definition: logger_fwd.hpp:22
InteractiveStatusCli(const std::string &default_peer_ip, int default_port, logger::LoggerPtr pb_qry_factory_log)
Definition: interactive_status_cli.cpp:38
void run()
Definition: interactive_status_cli.cpp:74
std::unordered_map< std::string, ParamsDescription > ParamsMap
Definition: interactive_common_cli.hpp:62
std::unordered_map< std::string, std::string > DescriptionMap
Definition: interactive_common_cli.hpp:58
Definition: interactive_status_cli.hpp:22