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 
14 namespace iroha_cli {
15  namespace interactive {
22  public:
23  InteractiveStatusCli(const std::string &default_peer_ip,
24  int default_port);
25  void run();
26 
27  private:
28  using ActionName = std::string;
29  using ActionParams = std::vector<std::string>;
30  using ActionHandler = std::string (InteractiveStatusCli::*)(ActionParams);
31  using ResultHandler = bool (InteractiveStatusCli::*)(ActionParams);
32  std::unordered_map<ActionName, ActionHandler> actionHandlers_;
33 
34  bool parseAction(std::string &line);
35  bool parseResult(std::string &line);
36 
37  bool parseSendToIroha(ActionParams line);
38  bool parseSaveFile(ActionParams line);
39 
40  void createActionsMenu();
41  void createResultMenu();
42 
43  std::string parseGetHash(ActionParams params);
44 
45  const std::string GET_TX_INFO = "get_tx_info";
46 
47  std::string default_peer_ip_;
48  int default_port_;
49 
50  std::unordered_map<ActionName, ResultHandler> resultHandlers_;
51  ParamsMap resultParamsDescriptions_;
52 
53  DescriptionMap descriptionMap_;
54  ParamsMap requestParamsDescriptions_;
55  MenuPoints menuPoints_;
56  MenuPoints resultPoints_;
57 
58  MenuContext currentContext_;
59  std::string txHash_;
60  };
61  } // namespace interactive
62 } // namespace iroha_cli
63 
64 #endif // IROHA_INTERACTIVE_STATUS_CLI_HPP
Definition: client.cpp:16
MenuContext
Definition: interactive_common_cli.hpp:29
string(REPLACE".""/"CMAKE_SWIG_OUTDIR ${SWIG_JAVA_PKG}) else() set(CMAKE_SWIG_FLAGS"") endif() myswig_add_library(irohajava LANGUAGE java SOURCES bindings.i) unset(CMAKE_SWIG_FLAGS) swig_link_libraries(irohajava $
Definition: CMakeLists.txt:54
std::vector< std::string > MenuPoints
Definition: interactive_common_cli.hpp:60
void run()
Definition: interactive_status_cli.cpp:70
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:21
InteractiveStatusCli(const std::string &default_peer_ip, int default_port)
Definition: interactive_status_cli.cpp:38