aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/daemon_messages.h
diff options
context:
space:
mode:
authorLee Clagett <code@leeclagett.com>2019-11-07 05:45:06 +0000
committerLee Clagett <code@leeclagett.com>2020-03-05 14:20:56 +0000
commit0f78b06e8c578819f831a513490278a5f70b01af (patch)
tree2f940ff50b1676b92887a4a755b7eb1ba462c04c /src/rpc/daemon_messages.h
parentMerge pull request #6057 (diff)
downloadmonero-0f78b06e8c578819f831a513490278a5f70b01af.tar.xz
Various improvements to the ZMQ JSON-RPC handling:
- Finding handling function in ZMQ JSON-RPC now uses binary search - Temporary `std::vector`s in JSON output now use `epee::span` to prevent allocations. - Binary -> hex in JSON output no longer allocates temporary buffer - C++ structs -> JSON skips intermediate DOM creation, and instead write directly to an output stream.
Diffstat (limited to 'src/rpc/daemon_messages.h')
-rw-r--r--src/rpc/daemon_messages.h17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/rpc/daemon_messages.h b/src/rpc/daemon_messages.h
index c0d9aed0a..bb5059cdc 100644
--- a/src/rpc/daemon_messages.h
+++ b/src/rpc/daemon_messages.h
@@ -28,6 +28,8 @@
#pragma once
+#include <rapidjson/stringbuffer.h>
+#include <rapidjson/writer.h>
#include <unordered_map>
#include <vector>
@@ -40,26 +42,25 @@
#define BEGIN_RPC_MESSAGE_CLASS(classname) \
class classname \
{ \
- public: \
- static const char* const name;
+ public:
#define BEGIN_RPC_MESSAGE_REQUEST \
- class Request : public Message \
+ class Request final : public Message \
{ \
public: \
Request() { } \
~Request() { } \
- rapidjson::Value toJson(rapidjson::Document& doc) const; \
- void fromJson(rapidjson::Value& val);
+ void doToJson(rapidjson::Writer<rapidjson::StringBuffer>& dest) const override final; \
+ void fromJson(const rapidjson::Value& val) override final;
#define BEGIN_RPC_MESSAGE_RESPONSE \
- class Response : public Message \
+ class Response final : public Message \
{ \
public: \
Response() { } \
~Response() { } \
- rapidjson::Value toJson(rapidjson::Document& doc) const; \
- void fromJson(rapidjson::Value& val);
+ void doToJson(rapidjson::Writer<rapidjson::StringBuffer>& dest) const override final; \
+ void fromJson(const rapidjson::Value& val) override final;
#define END_RPC_MESSAGE_REQUEST };
#define END_RPC_MESSAGE_RESPONSE };