Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
variant_connection.hpp
Go to the documentation of this file.
1#pragma once
4#include <fc/thread/future.hpp>
5#include <fc/log/logger.hpp>
6#include <functional>
7
8namespace fc { namespace rpc {
9
10 namespace detail { class variant_connection_impl; }
11
19 {
20 public:
21 typedef std::function<variant(const variants&)> method;
22 typedef std::function<variant(const variant_object&)> named_param_method;
23
24 variant_connection( fc::variant_stream::ptr in, fc::variant_stream::ptr out );
26
30 future<void> exec();
31
33 void set_logger( const logger& l );
34
46
51 void notice( const fc::string& method );
52 void notice( const fc::string& method, const variants& args );
53 void notice( const fc::string& method, const variant_object& named_args );
54
56 future<fc::variant> async_call( const fc::string& method,
57 const variant_object& args );
58
59 future<fc::variant> async_call( const fc::string& method, mutable_variant_object args );
60
62 future<fc::variant> async_call( const fc::string& method,
63 const variants& args );
64
65 future<fc::variant> async_call( const fc::string& method );
66
67 future<fc::variant> async_call( const fc::string& method,
68 const fc::variant& a1 );
69
70 future<fc::variant> async_call( const fc::string& method,
71 const fc::variant& a1,
72 const fc::variant& a2 );
73
74 future<fc::variant> async_call( const fc::string& method,
75 const fc::variant& a1,
76 const fc::variant& a2,
77 const fc::variant& a3 );
78
79 template<typename Result>
80 Result call( const fc::string& method,
81 const fc::variant& a1,
82 const fc::variant& a2,
83 const fc::variant& a3,
85 {
86 return async_call( method, a1, a2, a3 ).wait(timeout).as<Result>();
87 }
88
89 template<typename Result>
90 Result call( const fc::string& method,
91 const fc::variant& a1,
92 const fc::variant& a2,
94 {
95 return async_call( method, a1, a2 ).wait(timeout).as<Result>();
96 }
97
98 template<typename Result>
99 Result call( const fc::string& method,
100 const fc::variant& a1,
102 {
103 return async_call( method, a1 ).wait(timeout).as<Result>();
104 }
105
106 template<typename Result>
107 Result call( const fc::string& method,
108 variant_object a1,
110 {
111 return async_call( method, fc::move(a1) ).wait(timeout).as<Result>();
112 }
113 template<typename Result>
114 Result call( const fc::string& method,
117 {
118 return async_call( method, variant_object( fc::move(a1) ) ).wait(timeout).as<Result>();
119 }
120
121
122 template<typename Result>
124 {
125 return async_call( method ).wait(timeout).as<Result>();
126 }
127
129 variant call( const fc::string& method, const variant_object& named_args );
131
132 private:
133 std::unique_ptr<detail::variant_connection_impl> my;
134 };
135 typedef std::shared_ptr<variant_connection> variant_connection_ptr;
136
137}} // fc::rpc
138
139
140
std::string name
static constexpr microseconds maximum()
Definition time.hpp:14
An order-preserving dictionary of variants.
Implements JSON-RPC 2.0 over a set of io streams.
void add_named_param_method(const fc::string &name, named_param_method)
Result call(const fc::string &method, const fc::variant &a1, const fc::variant &a2, microseconds timeout=microseconds::maximum())
future< fc::variant > async_call(const fc::string &method, const fc::variant &a1, const fc::variant &a2, const fc::variant &a3)
future< fc::variant > async_call(const fc::string &method, const fc::variant &a1)
variant call(const fc::string &method, const variant_object &named_args)
Sending in a variant_object will be issued as named parameters.
future< fc::variant > async_call(const fc::string &method, const variant_object &args)
args will be handled as named params
Result call(const fc::string &method, const fc::variant &a1, microseconds timeout=microseconds::maximum())
future< fc::variant > async_call(const fc::string &method, const variants &args)
Sending in an array of variants will be handled as positional arguments.
future< fc::variant > async_call(const fc::string &method)
void add_method(const fc::string &name, method)
void set_logger(const logger &l)
std::function< variant(const variants &)> method
variant_connection(fc::variant_stream::ptr in, fc::variant_stream::ptr out)
Result call(const fc::string &method, microseconds timeout=microseconds::maximum())
future< fc::variant > async_call(const fc::string &method, const fc::variant &a1, const fc::variant &a2)
void notice(const fc::string &method, const variants &args)
Result call(const fc::string &method, variant_object a1, microseconds timeout=microseconds::maximum())
void remove_method(const fc::string &name)
std::function< variant(const variant_object &)> named_param_method
Result call(const fc::string &method, const fc::variant &a1, const fc::variant &a2, const fc::variant &a3, microseconds timeout=microseconds::maximum())
void notice(const fc::string &method)
future< fc::variant > async_call(const fc::string &method, mutable_variant_object args)
void notice(const fc::string &method, const variant_object &named_args)
Result call(const fc::string &method, mutable_variant_object a1, microseconds timeout=microseconds::maximum())
An order-preserving dictionary of variants.
stores null, int64, uint64, double, bool, string, std::vector<variant>, and variant_object's.
Definition variant.hpp:191
std::shared_ptr< variant_connection > variant_connection_ptr
namespace sysio::chain
Definition authority.cpp:3
std::string string
Definition string.hpp:10
std::vector< fc::variant > variants
Definition variant.hpp:173
int l