From fdd0336d33d6c8a6a9a72b17047d225944ca53e9 Mon Sep 17 00:00:00 2001 From: "shadow.zhou" Date: Fri, 3 Jul 2020 19:27:47 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=88=9D=E5=A7=8B=E5=8C=96=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=EF=BC=8C=E5=88=9D=E6=AD=A5=E8=B0=83=E7=A0=94=E5=AE=8C?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E7=AB=AF=E5=92=8C=E6=9C=8D=E5=8A=A1=E7=AB=AF?= =?UTF-8?q?=E9=80=9A=E4=BF=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/launch.json | 18 + .vscode/settings.json | 12 +- .vscode/tasks.json | 16 + Makefile | 8 +- WORKSPACE | 11 +- apis/BUILD | 10 +- apis/cpp/protocol/v1/deduction.grpc.pb.cc | 144 +++ apis/cpp/protocol/v1/deduction.grpc.pb.h | 524 ++++++++ apis/cpp/protocol/v1/deduction.pb.cc | 870 +++++++++++++ apis/cpp/protocol/v1/deduction.pb.h | 874 +++++++++++++ apis/cpp/protocol/v1/fee.grpc.pb.cc | 142 --- apis/cpp/protocol/v1/fee.grpc.pb.h | 522 -------- apis/cpp/protocol/v1/fee.pb.cc | 610 --------- apis/cpp/protocol/v1/fee.pb.h | 653 ---------- apis/protocol/v1/deduction.proto | 23 + apis/protocol/v1/fee.proto | 19 - apps/3rd/sql/mysqlplus.h | 1369 +++++++++++++++++++++ apps/3rd/sql/polyfill/datetime.h | 129 ++ apps/3rd/sql/polyfill/function_traits.h | 57 + apps/3rd/sql/polyfill/optional.hpp | 1052 ++++++++++++++++ apps/BUILD | 19 +- apps/client.cc | 115 +- apps/server.cc | 48 +- bazel-bin | 2 +- bazel-out | 2 +- bazel-pms | 1 + bazel-testlogs | 2 +- mysql.BUILD | 9 + 28 files changed, 5222 insertions(+), 2039 deletions(-) create mode 100644 .vscode/launch.json create mode 100644 .vscode/tasks.json create mode 100644 apis/cpp/protocol/v1/deduction.grpc.pb.cc create mode 100644 apis/cpp/protocol/v1/deduction.grpc.pb.h create mode 100644 apis/cpp/protocol/v1/deduction.pb.cc create mode 100644 apis/cpp/protocol/v1/deduction.pb.h delete mode 100644 apis/cpp/protocol/v1/fee.grpc.pb.cc delete mode 100644 apis/cpp/protocol/v1/fee.grpc.pb.h delete mode 100644 apis/cpp/protocol/v1/fee.pb.cc delete mode 100644 apis/cpp/protocol/v1/fee.pb.h create mode 100644 apis/protocol/v1/deduction.proto delete mode 100644 apis/protocol/v1/fee.proto create mode 100644 apps/3rd/sql/mysqlplus.h create mode 100644 apps/3rd/sql/polyfill/datetime.h create mode 100644 apps/3rd/sql/polyfill/function_traits.h create mode 100644 apps/3rd/sql/polyfill/optional.hpp create mode 120000 bazel-pms create mode 100644 mysql.BUILD diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..1613945 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,18 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "(lldb) Launch", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/bazel-bin/apps/server", + "args": [], + "stopAtEntry": true, + "cwd": "${workspaceFolder}", + "environment": [], + "externalConsole": true, + "MIMode": "lldb", + "preLaunchTask": "Build with Bazel" + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 7b27a18..a01c978 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -16,6 +16,16 @@ "optional": "cpp", "__bit_reference": "cpp", "iostream": "cpp", - "istream": "cpp" + "istream": "cpp", + "ostream": "cpp", + "map": "cpp", + "memory": "cpp", + "unordered_map": "cpp", + "mutex": "cpp", + "__locale": "cpp", + "locale": "cpp", + "thread": "cpp", + "typeindex": "cpp", + "string": "cpp" } } \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..edf8dfd --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,16 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Build with Bazel",//这个任务的名字在launch.json最后一项配置 + "type": "shell", + "command": "make build", + "args": [ + ], + "group": { + "kind": "build", + "isDefault": true + } + } + ] +} \ No newline at end of file diff --git a/Makefile b/Makefile index e8be808..236fd38 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,13 @@ apis: bazel build //apis:all build: - bazel build --cxxopt='-std=c++17' + bazel build -c dbg --spawn_strategy=standalone --cxxopt='-std=c++17' //apps:all + +server: + bazel run --cxxopt='-std=c++17' //apps:server + +client: + bazel run --cxxopt='-std=c++17' //apps:client all: proto apis build diff --git a/WORKSPACE b/WORKSPACE index 455a654..56158a5 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -34,8 +34,9 @@ grpc_deps() load("@com_github_grpc_grpc//bazel:grpc_extra_deps.bzl", "grpc_extra_deps") grpc_extra_deps() -# new_local_repository( -# name = "usr_local", -# path = "/usr/local", -# build_file = "mysql.BUILD" -# ) \ No newline at end of file +# new_local_repository 允许将本地目录转换为bazel存储库 +new_local_repository( + name = "usr_local", + path = "/usr/local/mysql", + build_file = "mysql.BUILD" +) \ No newline at end of file diff --git a/apis/BUILD b/apis/BUILD index 4dec977..9608efb 100644 --- a/apis/BUILD +++ b/apis/BUILD @@ -1,13 +1,13 @@ cc_library( - name = "feepb", + name = "deduction", srcs = [ - 'cpp/protocol/v1/fee.grpc.pb.cc', - 'cpp/protocol/v1/fee.pb.cc', + 'cpp/protocol/v1/deduction.grpc.pb.cc', + 'cpp/protocol/v1/deduction.pb.cc', ], hdrs = [ - 'cpp/protocol/v1/fee.grpc.pb.h', - 'cpp/protocol/v1/fee.pb.h', + 'cpp/protocol/v1/deduction.grpc.pb.h', + 'cpp/protocol/v1/deduction.pb.h', ], deps = [ '@com_google_protobuf//:protobuf', diff --git a/apis/cpp/protocol/v1/deduction.grpc.pb.cc b/apis/cpp/protocol/v1/deduction.grpc.pb.cc new file mode 100644 index 0000000..ff269a3 --- /dev/null +++ b/apis/cpp/protocol/v1/deduction.grpc.pb.cc @@ -0,0 +1,144 @@ +// Generated by the gRPC C++ plugin. +// If you make any local change, they will be lost. +// source: deduction.proto + +#include "deduction.pb.h" +#include "deduction.grpc.pb.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +namespace protocol { +namespace payment { +namespace deduction { +namespace v1 { + +static const char* DeductionAdminApi_method_names[] = { + "/protocol.payment.deduction.v1.DeductionAdminApi/GetDeductionList", + "/protocol.payment.deduction.v1.DeductionAdminApi/AdminOp", +}; + +std::unique_ptr< DeductionAdminApi::Stub> DeductionAdminApi::NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options) { + (void)options; + std::unique_ptr< DeductionAdminApi::Stub> stub(new DeductionAdminApi::Stub(channel)); + return stub; +} + +DeductionAdminApi::Stub::Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel) + : channel_(channel), rpcmethod_GetDeductionList_(DeductionAdminApi_method_names[0], ::grpc::internal::RpcMethod::NORMAL_RPC, channel) + , rpcmethod_AdminOp_(DeductionAdminApi_method_names[1], ::grpc::internal::RpcMethod::NORMAL_RPC, channel) + {} + +::grpc::Status DeductionAdminApi::Stub::GetDeductionList(::grpc::ClientContext* context, const ::protocol::payment::deduction::v1::DeductionAdminReq& request, ::protocol::payment::deduction::v1::DeductionAdminResp* response) { + return ::grpc::internal::BlockingUnaryCall(channel_.get(), rpcmethod_GetDeductionList_, context, request, response); +} + +void DeductionAdminApi::Stub::experimental_async::GetDeductionList(::grpc::ClientContext* context, const ::protocol::payment::deduction::v1::DeductionAdminReq* request, ::protocol::payment::deduction::v1::DeductionAdminResp* response, std::function f) { + ::grpc_impl::internal::CallbackUnaryCall(stub_->channel_.get(), stub_->rpcmethod_GetDeductionList_, context, request, response, std::move(f)); +} + +void DeductionAdminApi::Stub::experimental_async::GetDeductionList(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::protocol::payment::deduction::v1::DeductionAdminResp* response, std::function f) { + ::grpc_impl::internal::CallbackUnaryCall(stub_->channel_.get(), stub_->rpcmethod_GetDeductionList_, context, request, response, std::move(f)); +} + +void DeductionAdminApi::Stub::experimental_async::GetDeductionList(::grpc::ClientContext* context, const ::protocol::payment::deduction::v1::DeductionAdminReq* request, ::protocol::payment::deduction::v1::DeductionAdminResp* response, ::grpc::experimental::ClientUnaryReactor* reactor) { + ::grpc_impl::internal::ClientCallbackUnaryFactory::Create(stub_->channel_.get(), stub_->rpcmethod_GetDeductionList_, context, request, response, reactor); +} + +void DeductionAdminApi::Stub::experimental_async::GetDeductionList(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::protocol::payment::deduction::v1::DeductionAdminResp* response, ::grpc::experimental::ClientUnaryReactor* reactor) { + ::grpc_impl::internal::ClientCallbackUnaryFactory::Create(stub_->channel_.get(), stub_->rpcmethod_GetDeductionList_, context, request, response, reactor); +} + +::grpc::ClientAsyncResponseReader< ::protocol::payment::deduction::v1::DeductionAdminResp>* DeductionAdminApi::Stub::AsyncGetDeductionListRaw(::grpc::ClientContext* context, const ::protocol::payment::deduction::v1::DeductionAdminReq& request, ::grpc::CompletionQueue* cq) { + return ::grpc_impl::internal::ClientAsyncResponseReaderFactory< ::protocol::payment::deduction::v1::DeductionAdminResp>::Create(channel_.get(), cq, rpcmethod_GetDeductionList_, context, request, true); +} + +::grpc::ClientAsyncResponseReader< ::protocol::payment::deduction::v1::DeductionAdminResp>* DeductionAdminApi::Stub::PrepareAsyncGetDeductionListRaw(::grpc::ClientContext* context, const ::protocol::payment::deduction::v1::DeductionAdminReq& request, ::grpc::CompletionQueue* cq) { + return ::grpc_impl::internal::ClientAsyncResponseReaderFactory< ::protocol::payment::deduction::v1::DeductionAdminResp>::Create(channel_.get(), cq, rpcmethod_GetDeductionList_, context, request, false); +} + +::grpc::Status DeductionAdminApi::Stub::AdminOp(::grpc::ClientContext* context, const ::protocol::payment::deduction::v1::DeductionAdminReq& request, ::protocol::payment::deduction::v1::DeductionAdminResp* response) { + return ::grpc::internal::BlockingUnaryCall(channel_.get(), rpcmethod_AdminOp_, context, request, response); +} + +void DeductionAdminApi::Stub::experimental_async::AdminOp(::grpc::ClientContext* context, const ::protocol::payment::deduction::v1::DeductionAdminReq* request, ::protocol::payment::deduction::v1::DeductionAdminResp* response, std::function f) { + ::grpc_impl::internal::CallbackUnaryCall(stub_->channel_.get(), stub_->rpcmethod_AdminOp_, context, request, response, std::move(f)); +} + +void DeductionAdminApi::Stub::experimental_async::AdminOp(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::protocol::payment::deduction::v1::DeductionAdminResp* response, std::function f) { + ::grpc_impl::internal::CallbackUnaryCall(stub_->channel_.get(), stub_->rpcmethod_AdminOp_, context, request, response, std::move(f)); +} + +void DeductionAdminApi::Stub::experimental_async::AdminOp(::grpc::ClientContext* context, const ::protocol::payment::deduction::v1::DeductionAdminReq* request, ::protocol::payment::deduction::v1::DeductionAdminResp* response, ::grpc::experimental::ClientUnaryReactor* reactor) { + ::grpc_impl::internal::ClientCallbackUnaryFactory::Create(stub_->channel_.get(), stub_->rpcmethod_AdminOp_, context, request, response, reactor); +} + +void DeductionAdminApi::Stub::experimental_async::AdminOp(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::protocol::payment::deduction::v1::DeductionAdminResp* response, ::grpc::experimental::ClientUnaryReactor* reactor) { + ::grpc_impl::internal::ClientCallbackUnaryFactory::Create(stub_->channel_.get(), stub_->rpcmethod_AdminOp_, context, request, response, reactor); +} + +::grpc::ClientAsyncResponseReader< ::protocol::payment::deduction::v1::DeductionAdminResp>* DeductionAdminApi::Stub::AsyncAdminOpRaw(::grpc::ClientContext* context, const ::protocol::payment::deduction::v1::DeductionAdminReq& request, ::grpc::CompletionQueue* cq) { + return ::grpc_impl::internal::ClientAsyncResponseReaderFactory< ::protocol::payment::deduction::v1::DeductionAdminResp>::Create(channel_.get(), cq, rpcmethod_AdminOp_, context, request, true); +} + +::grpc::ClientAsyncResponseReader< ::protocol::payment::deduction::v1::DeductionAdminResp>* DeductionAdminApi::Stub::PrepareAsyncAdminOpRaw(::grpc::ClientContext* context, const ::protocol::payment::deduction::v1::DeductionAdminReq& request, ::grpc::CompletionQueue* cq) { + return ::grpc_impl::internal::ClientAsyncResponseReaderFactory< ::protocol::payment::deduction::v1::DeductionAdminResp>::Create(channel_.get(), cq, rpcmethod_AdminOp_, context, request, false); +} + +DeductionAdminApi::Service::Service() { + AddMethod(new ::grpc::internal::RpcServiceMethod( + DeductionAdminApi_method_names[0], + ::grpc::internal::RpcMethod::NORMAL_RPC, + new ::grpc::internal::RpcMethodHandler< DeductionAdminApi::Service, ::protocol::payment::deduction::v1::DeductionAdminReq, ::protocol::payment::deduction::v1::DeductionAdminResp>( + [](DeductionAdminApi::Service* service, + ::grpc_impl::ServerContext* ctx, + const ::protocol::payment::deduction::v1::DeductionAdminReq* req, + ::protocol::payment::deduction::v1::DeductionAdminResp* resp) { + return service->GetDeductionList(ctx, req, resp); + }, this))); + AddMethod(new ::grpc::internal::RpcServiceMethod( + DeductionAdminApi_method_names[1], + ::grpc::internal::RpcMethod::NORMAL_RPC, + new ::grpc::internal::RpcMethodHandler< DeductionAdminApi::Service, ::protocol::payment::deduction::v1::DeductionAdminReq, ::protocol::payment::deduction::v1::DeductionAdminResp>( + [](DeductionAdminApi::Service* service, + ::grpc_impl::ServerContext* ctx, + const ::protocol::payment::deduction::v1::DeductionAdminReq* req, + ::protocol::payment::deduction::v1::DeductionAdminResp* resp) { + return service->AdminOp(ctx, req, resp); + }, this))); +} + +DeductionAdminApi::Service::~Service() { +} + +::grpc::Status DeductionAdminApi::Service::GetDeductionList(::grpc::ServerContext* context, const ::protocol::payment::deduction::v1::DeductionAdminReq* request, ::protocol::payment::deduction::v1::DeductionAdminResp* response) { + (void) context; + (void) request; + (void) response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); +} + +::grpc::Status DeductionAdminApi::Service::AdminOp(::grpc::ServerContext* context, const ::protocol::payment::deduction::v1::DeductionAdminReq* request, ::protocol::payment::deduction::v1::DeductionAdminResp* response) { + (void) context; + (void) request; + (void) response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); +} + + +} // namespace protocol +} // namespace payment +} // namespace deduction +} // namespace v1 + diff --git a/apis/cpp/protocol/v1/deduction.grpc.pb.h b/apis/cpp/protocol/v1/deduction.grpc.pb.h new file mode 100644 index 0000000..4267283 --- /dev/null +++ b/apis/cpp/protocol/v1/deduction.grpc.pb.h @@ -0,0 +1,524 @@ +// Generated by the gRPC C++ plugin. +// If you make any local change, they will be lost. +// source: deduction.proto +#ifndef GRPC_deduction_2eproto__INCLUDED +#define GRPC_deduction_2eproto__INCLUDED + +#include "deduction.pb.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace protocol { +namespace payment { +namespace deduction { +namespace v1 { + +// The greeting service definition. +class DeductionAdminApi final { + public: + static constexpr char const* service_full_name() { + return "protocol.payment.deduction.v1.DeductionAdminApi"; + } + class StubInterface { + public: + virtual ~StubInterface() {} + virtual ::grpc::Status GetDeductionList(::grpc::ClientContext* context, const ::protocol::payment::deduction::v1::DeductionAdminReq& request, ::protocol::payment::deduction::v1::DeductionAdminResp* response) = 0; + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::protocol::payment::deduction::v1::DeductionAdminResp>> AsyncGetDeductionList(::grpc::ClientContext* context, const ::protocol::payment::deduction::v1::DeductionAdminReq& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::protocol::payment::deduction::v1::DeductionAdminResp>>(AsyncGetDeductionListRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::protocol::payment::deduction::v1::DeductionAdminResp>> PrepareAsyncGetDeductionList(::grpc::ClientContext* context, const ::protocol::payment::deduction::v1::DeductionAdminReq& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::protocol::payment::deduction::v1::DeductionAdminResp>>(PrepareAsyncGetDeductionListRaw(context, request, cq)); + } + virtual ::grpc::Status AdminOp(::grpc::ClientContext* context, const ::protocol::payment::deduction::v1::DeductionAdminReq& request, ::protocol::payment::deduction::v1::DeductionAdminResp* response) = 0; + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::protocol::payment::deduction::v1::DeductionAdminResp>> AsyncAdminOp(::grpc::ClientContext* context, const ::protocol::payment::deduction::v1::DeductionAdminReq& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::protocol::payment::deduction::v1::DeductionAdminResp>>(AsyncAdminOpRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::protocol::payment::deduction::v1::DeductionAdminResp>> PrepareAsyncAdminOp(::grpc::ClientContext* context, const ::protocol::payment::deduction::v1::DeductionAdminReq& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::protocol::payment::deduction::v1::DeductionAdminResp>>(PrepareAsyncAdminOpRaw(context, request, cq)); + } + class experimental_async_interface { + public: + virtual ~experimental_async_interface() {} + virtual void GetDeductionList(::grpc::ClientContext* context, const ::protocol::payment::deduction::v1::DeductionAdminReq* request, ::protocol::payment::deduction::v1::DeductionAdminResp* response, std::function) = 0; + virtual void GetDeductionList(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::protocol::payment::deduction::v1::DeductionAdminResp* response, std::function) = 0; + #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL + virtual void GetDeductionList(::grpc::ClientContext* context, const ::protocol::payment::deduction::v1::DeductionAdminReq* request, ::protocol::payment::deduction::v1::DeductionAdminResp* response, ::grpc::ClientUnaryReactor* reactor) = 0; + #else + virtual void GetDeductionList(::grpc::ClientContext* context, const ::protocol::payment::deduction::v1::DeductionAdminReq* request, ::protocol::payment::deduction::v1::DeductionAdminResp* response, ::grpc::experimental::ClientUnaryReactor* reactor) = 0; + #endif + #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL + virtual void GetDeductionList(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::protocol::payment::deduction::v1::DeductionAdminResp* response, ::grpc::ClientUnaryReactor* reactor) = 0; + #else + virtual void GetDeductionList(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::protocol::payment::deduction::v1::DeductionAdminResp* response, ::grpc::experimental::ClientUnaryReactor* reactor) = 0; + #endif + virtual void AdminOp(::grpc::ClientContext* context, const ::protocol::payment::deduction::v1::DeductionAdminReq* request, ::protocol::payment::deduction::v1::DeductionAdminResp* response, std::function) = 0; + virtual void AdminOp(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::protocol::payment::deduction::v1::DeductionAdminResp* response, std::function) = 0; + #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL + virtual void AdminOp(::grpc::ClientContext* context, const ::protocol::payment::deduction::v1::DeductionAdminReq* request, ::protocol::payment::deduction::v1::DeductionAdminResp* response, ::grpc::ClientUnaryReactor* reactor) = 0; + #else + virtual void AdminOp(::grpc::ClientContext* context, const ::protocol::payment::deduction::v1::DeductionAdminReq* request, ::protocol::payment::deduction::v1::DeductionAdminResp* response, ::grpc::experimental::ClientUnaryReactor* reactor) = 0; + #endif + #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL + virtual void AdminOp(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::protocol::payment::deduction::v1::DeductionAdminResp* response, ::grpc::ClientUnaryReactor* reactor) = 0; + #else + virtual void AdminOp(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::protocol::payment::deduction::v1::DeductionAdminResp* response, ::grpc::experimental::ClientUnaryReactor* reactor) = 0; + #endif + }; + #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL + typedef class experimental_async_interface async_interface; + #endif + #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL + async_interface* async() { return experimental_async(); } + #endif + virtual class experimental_async_interface* experimental_async() { return nullptr; } + private: + virtual ::grpc::ClientAsyncResponseReaderInterface< ::protocol::payment::deduction::v1::DeductionAdminResp>* AsyncGetDeductionListRaw(::grpc::ClientContext* context, const ::protocol::payment::deduction::v1::DeductionAdminReq& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::protocol::payment::deduction::v1::DeductionAdminResp>* PrepareAsyncGetDeductionListRaw(::grpc::ClientContext* context, const ::protocol::payment::deduction::v1::DeductionAdminReq& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::protocol::payment::deduction::v1::DeductionAdminResp>* AsyncAdminOpRaw(::grpc::ClientContext* context, const ::protocol::payment::deduction::v1::DeductionAdminReq& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::protocol::payment::deduction::v1::DeductionAdminResp>* PrepareAsyncAdminOpRaw(::grpc::ClientContext* context, const ::protocol::payment::deduction::v1::DeductionAdminReq& request, ::grpc::CompletionQueue* cq) = 0; + }; + class Stub final : public StubInterface { + public: + Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel); + ::grpc::Status GetDeductionList(::grpc::ClientContext* context, const ::protocol::payment::deduction::v1::DeductionAdminReq& request, ::protocol::payment::deduction::v1::DeductionAdminResp* response) override; + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::protocol::payment::deduction::v1::DeductionAdminResp>> AsyncGetDeductionList(::grpc::ClientContext* context, const ::protocol::payment::deduction::v1::DeductionAdminReq& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::protocol::payment::deduction::v1::DeductionAdminResp>>(AsyncGetDeductionListRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::protocol::payment::deduction::v1::DeductionAdminResp>> PrepareAsyncGetDeductionList(::grpc::ClientContext* context, const ::protocol::payment::deduction::v1::DeductionAdminReq& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::protocol::payment::deduction::v1::DeductionAdminResp>>(PrepareAsyncGetDeductionListRaw(context, request, cq)); + } + ::grpc::Status AdminOp(::grpc::ClientContext* context, const ::protocol::payment::deduction::v1::DeductionAdminReq& request, ::protocol::payment::deduction::v1::DeductionAdminResp* response) override; + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::protocol::payment::deduction::v1::DeductionAdminResp>> AsyncAdminOp(::grpc::ClientContext* context, const ::protocol::payment::deduction::v1::DeductionAdminReq& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::protocol::payment::deduction::v1::DeductionAdminResp>>(AsyncAdminOpRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::protocol::payment::deduction::v1::DeductionAdminResp>> PrepareAsyncAdminOp(::grpc::ClientContext* context, const ::protocol::payment::deduction::v1::DeductionAdminReq& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::protocol::payment::deduction::v1::DeductionAdminResp>>(PrepareAsyncAdminOpRaw(context, request, cq)); + } + class experimental_async final : + public StubInterface::experimental_async_interface { + public: + void GetDeductionList(::grpc::ClientContext* context, const ::protocol::payment::deduction::v1::DeductionAdminReq* request, ::protocol::payment::deduction::v1::DeductionAdminResp* response, std::function) override; + void GetDeductionList(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::protocol::payment::deduction::v1::DeductionAdminResp* response, std::function) override; + #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL + void GetDeductionList(::grpc::ClientContext* context, const ::protocol::payment::deduction::v1::DeductionAdminReq* request, ::protocol::payment::deduction::v1::DeductionAdminResp* response, ::grpc::ClientUnaryReactor* reactor) override; + #else + void GetDeductionList(::grpc::ClientContext* context, const ::protocol::payment::deduction::v1::DeductionAdminReq* request, ::protocol::payment::deduction::v1::DeductionAdminResp* response, ::grpc::experimental::ClientUnaryReactor* reactor) override; + #endif + #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL + void GetDeductionList(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::protocol::payment::deduction::v1::DeductionAdminResp* response, ::grpc::ClientUnaryReactor* reactor) override; + #else + void GetDeductionList(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::protocol::payment::deduction::v1::DeductionAdminResp* response, ::grpc::experimental::ClientUnaryReactor* reactor) override; + #endif + void AdminOp(::grpc::ClientContext* context, const ::protocol::payment::deduction::v1::DeductionAdminReq* request, ::protocol::payment::deduction::v1::DeductionAdminResp* response, std::function) override; + void AdminOp(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::protocol::payment::deduction::v1::DeductionAdminResp* response, std::function) override; + #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL + void AdminOp(::grpc::ClientContext* context, const ::protocol::payment::deduction::v1::DeductionAdminReq* request, ::protocol::payment::deduction::v1::DeductionAdminResp* response, ::grpc::ClientUnaryReactor* reactor) override; + #else + void AdminOp(::grpc::ClientContext* context, const ::protocol::payment::deduction::v1::DeductionAdminReq* request, ::protocol::payment::deduction::v1::DeductionAdminResp* response, ::grpc::experimental::ClientUnaryReactor* reactor) override; + #endif + #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL + void AdminOp(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::protocol::payment::deduction::v1::DeductionAdminResp* response, ::grpc::ClientUnaryReactor* reactor) override; + #else + void AdminOp(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::protocol::payment::deduction::v1::DeductionAdminResp* response, ::grpc::experimental::ClientUnaryReactor* reactor) override; + #endif + private: + friend class Stub; + explicit experimental_async(Stub* stub): stub_(stub) { } + Stub* stub() { return stub_; } + Stub* stub_; + }; + class experimental_async_interface* experimental_async() override { return &async_stub_; } + + private: + std::shared_ptr< ::grpc::ChannelInterface> channel_; + class experimental_async async_stub_{this}; + ::grpc::ClientAsyncResponseReader< ::protocol::payment::deduction::v1::DeductionAdminResp>* AsyncGetDeductionListRaw(::grpc::ClientContext* context, const ::protocol::payment::deduction::v1::DeductionAdminReq& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::protocol::payment::deduction::v1::DeductionAdminResp>* PrepareAsyncGetDeductionListRaw(::grpc::ClientContext* context, const ::protocol::payment::deduction::v1::DeductionAdminReq& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::protocol::payment::deduction::v1::DeductionAdminResp>* AsyncAdminOpRaw(::grpc::ClientContext* context, const ::protocol::payment::deduction::v1::DeductionAdminReq& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::protocol::payment::deduction::v1::DeductionAdminResp>* PrepareAsyncAdminOpRaw(::grpc::ClientContext* context, const ::protocol::payment::deduction::v1::DeductionAdminReq& request, ::grpc::CompletionQueue* cq) override; + const ::grpc::internal::RpcMethod rpcmethod_GetDeductionList_; + const ::grpc::internal::RpcMethod rpcmethod_AdminOp_; + }; + static std::unique_ptr NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options = ::grpc::StubOptions()); + + class Service : public ::grpc::Service { + public: + Service(); + virtual ~Service(); + virtual ::grpc::Status GetDeductionList(::grpc::ServerContext* context, const ::protocol::payment::deduction::v1::DeductionAdminReq* request, ::protocol::payment::deduction::v1::DeductionAdminResp* response); + virtual ::grpc::Status AdminOp(::grpc::ServerContext* context, const ::protocol::payment::deduction::v1::DeductionAdminReq* request, ::protocol::payment::deduction::v1::DeductionAdminResp* response); + }; + template + class WithAsyncMethod_GetDeductionList : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithAsyncMethod_GetDeductionList() { + ::grpc::Service::MarkMethodAsync(0); + } + ~WithAsyncMethod_GetDeductionList() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status GetDeductionList(::grpc::ServerContext* /*context*/, const ::protocol::payment::deduction::v1::DeductionAdminReq* /*request*/, ::protocol::payment::deduction::v1::DeductionAdminResp* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestGetDeductionList(::grpc::ServerContext* context, ::protocol::payment::deduction::v1::DeductionAdminReq* request, ::grpc::ServerAsyncResponseWriter< ::protocol::payment::deduction::v1::DeductionAdminResp>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(0, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithAsyncMethod_AdminOp : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithAsyncMethod_AdminOp() { + ::grpc::Service::MarkMethodAsync(1); + } + ~WithAsyncMethod_AdminOp() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status AdminOp(::grpc::ServerContext* /*context*/, const ::protocol::payment::deduction::v1::DeductionAdminReq* /*request*/, ::protocol::payment::deduction::v1::DeductionAdminResp* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestAdminOp(::grpc::ServerContext* context, ::protocol::payment::deduction::v1::DeductionAdminReq* request, ::grpc::ServerAsyncResponseWriter< ::protocol::payment::deduction::v1::DeductionAdminResp>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(1, context, request, response, new_call_cq, notification_cq, tag); + } + }; + typedef WithAsyncMethod_GetDeductionList > AsyncService; + template + class ExperimentalWithCallbackMethod_GetDeductionList : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + ExperimentalWithCallbackMethod_GetDeductionList() { + #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL + ::grpc::Service:: + #else + ::grpc::Service::experimental(). + #endif + MarkMethodCallback(0, + new ::grpc_impl::internal::CallbackUnaryHandler< ::protocol::payment::deduction::v1::DeductionAdminReq, ::protocol::payment::deduction::v1::DeductionAdminResp>( + [this]( + #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL + ::grpc::CallbackServerContext* + #else + ::grpc::experimental::CallbackServerContext* + #endif + context, const ::protocol::payment::deduction::v1::DeductionAdminReq* request, ::protocol::payment::deduction::v1::DeductionAdminResp* response) { return this->GetDeductionList(context, request, response); }));} + void SetMessageAllocatorFor_GetDeductionList( + ::grpc::experimental::MessageAllocator< ::protocol::payment::deduction::v1::DeductionAdminReq, ::protocol::payment::deduction::v1::DeductionAdminResp>* allocator) { + #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(0); + #else + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::experimental().GetHandler(0); + #endif + static_cast<::grpc_impl::internal::CallbackUnaryHandler< ::protocol::payment::deduction::v1::DeductionAdminReq, ::protocol::payment::deduction::v1::DeductionAdminResp>*>(handler) + ->SetMessageAllocator(allocator); + } + ~ExperimentalWithCallbackMethod_GetDeductionList() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status GetDeductionList(::grpc::ServerContext* /*context*/, const ::protocol::payment::deduction::v1::DeductionAdminReq* /*request*/, ::protocol::payment::deduction::v1::DeductionAdminResp* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL + virtual ::grpc::ServerUnaryReactor* GetDeductionList( + ::grpc::CallbackServerContext* /*context*/, const ::protocol::payment::deduction::v1::DeductionAdminReq* /*request*/, ::protocol::payment::deduction::v1::DeductionAdminResp* /*response*/) + #else + virtual ::grpc::experimental::ServerUnaryReactor* GetDeductionList( + ::grpc::experimental::CallbackServerContext* /*context*/, const ::protocol::payment::deduction::v1::DeductionAdminReq* /*request*/, ::protocol::payment::deduction::v1::DeductionAdminResp* /*response*/) + #endif + { return nullptr; } + }; + template + class ExperimentalWithCallbackMethod_AdminOp : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + ExperimentalWithCallbackMethod_AdminOp() { + #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL + ::grpc::Service:: + #else + ::grpc::Service::experimental(). + #endif + MarkMethodCallback(1, + new ::grpc_impl::internal::CallbackUnaryHandler< ::protocol::payment::deduction::v1::DeductionAdminReq, ::protocol::payment::deduction::v1::DeductionAdminResp>( + [this]( + #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL + ::grpc::CallbackServerContext* + #else + ::grpc::experimental::CallbackServerContext* + #endif + context, const ::protocol::payment::deduction::v1::DeductionAdminReq* request, ::protocol::payment::deduction::v1::DeductionAdminResp* response) { return this->AdminOp(context, request, response); }));} + void SetMessageAllocatorFor_AdminOp( + ::grpc::experimental::MessageAllocator< ::protocol::payment::deduction::v1::DeductionAdminReq, ::protocol::payment::deduction::v1::DeductionAdminResp>* allocator) { + #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(1); + #else + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::experimental().GetHandler(1); + #endif + static_cast<::grpc_impl::internal::CallbackUnaryHandler< ::protocol::payment::deduction::v1::DeductionAdminReq, ::protocol::payment::deduction::v1::DeductionAdminResp>*>(handler) + ->SetMessageAllocator(allocator); + } + ~ExperimentalWithCallbackMethod_AdminOp() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status AdminOp(::grpc::ServerContext* /*context*/, const ::protocol::payment::deduction::v1::DeductionAdminReq* /*request*/, ::protocol::payment::deduction::v1::DeductionAdminResp* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL + virtual ::grpc::ServerUnaryReactor* AdminOp( + ::grpc::CallbackServerContext* /*context*/, const ::protocol::payment::deduction::v1::DeductionAdminReq* /*request*/, ::protocol::payment::deduction::v1::DeductionAdminResp* /*response*/) + #else + virtual ::grpc::experimental::ServerUnaryReactor* AdminOp( + ::grpc::experimental::CallbackServerContext* /*context*/, const ::protocol::payment::deduction::v1::DeductionAdminReq* /*request*/, ::protocol::payment::deduction::v1::DeductionAdminResp* /*response*/) + #endif + { return nullptr; } + }; + #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL + typedef ExperimentalWithCallbackMethod_GetDeductionList > CallbackService; + #endif + + typedef ExperimentalWithCallbackMethod_GetDeductionList > ExperimentalCallbackService; + template + class WithGenericMethod_GetDeductionList : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithGenericMethod_GetDeductionList() { + ::grpc::Service::MarkMethodGeneric(0); + } + ~WithGenericMethod_GetDeductionList() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status GetDeductionList(::grpc::ServerContext* /*context*/, const ::protocol::payment::deduction::v1::DeductionAdminReq* /*request*/, ::protocol::payment::deduction::v1::DeductionAdminResp* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template + class WithGenericMethod_AdminOp : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithGenericMethod_AdminOp() { + ::grpc::Service::MarkMethodGeneric(1); + } + ~WithGenericMethod_AdminOp() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status AdminOp(::grpc::ServerContext* /*context*/, const ::protocol::payment::deduction::v1::DeductionAdminReq* /*request*/, ::protocol::payment::deduction::v1::DeductionAdminResp* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template + class WithRawMethod_GetDeductionList : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawMethod_GetDeductionList() { + ::grpc::Service::MarkMethodRaw(0); + } + ~WithRawMethod_GetDeductionList() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status GetDeductionList(::grpc::ServerContext* /*context*/, const ::protocol::payment::deduction::v1::DeductionAdminReq* /*request*/, ::protocol::payment::deduction::v1::DeductionAdminResp* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestGetDeductionList(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(0, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithRawMethod_AdminOp : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawMethod_AdminOp() { + ::grpc::Service::MarkMethodRaw(1); + } + ~WithRawMethod_AdminOp() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status AdminOp(::grpc::ServerContext* /*context*/, const ::protocol::payment::deduction::v1::DeductionAdminReq* /*request*/, ::protocol::payment::deduction::v1::DeductionAdminResp* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestAdminOp(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(1, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class ExperimentalWithRawCallbackMethod_GetDeductionList : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + ExperimentalWithRawCallbackMethod_GetDeductionList() { + #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL + ::grpc::Service:: + #else + ::grpc::Service::experimental(). + #endif + MarkMethodRawCallback(0, + new ::grpc_impl::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( + [this]( + #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL + ::grpc::CallbackServerContext* + #else + ::grpc::experimental::CallbackServerContext* + #endif + context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->GetDeductionList(context, request, response); })); + } + ~ExperimentalWithRawCallbackMethod_GetDeductionList() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status GetDeductionList(::grpc::ServerContext* /*context*/, const ::protocol::payment::deduction::v1::DeductionAdminReq* /*request*/, ::protocol::payment::deduction::v1::DeductionAdminResp* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL + virtual ::grpc::ServerUnaryReactor* GetDeductionList( + ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) + #else + virtual ::grpc::experimental::ServerUnaryReactor* GetDeductionList( + ::grpc::experimental::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) + #endif + { return nullptr; } + }; + template + class ExperimentalWithRawCallbackMethod_AdminOp : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + ExperimentalWithRawCallbackMethod_AdminOp() { + #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL + ::grpc::Service:: + #else + ::grpc::Service::experimental(). + #endif + MarkMethodRawCallback(1, + new ::grpc_impl::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( + [this]( + #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL + ::grpc::CallbackServerContext* + #else + ::grpc::experimental::CallbackServerContext* + #endif + context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->AdminOp(context, request, response); })); + } + ~ExperimentalWithRawCallbackMethod_AdminOp() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status AdminOp(::grpc::ServerContext* /*context*/, const ::protocol::payment::deduction::v1::DeductionAdminReq* /*request*/, ::protocol::payment::deduction::v1::DeductionAdminResp* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL + virtual ::grpc::ServerUnaryReactor* AdminOp( + ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) + #else + virtual ::grpc::experimental::ServerUnaryReactor* AdminOp( + ::grpc::experimental::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) + #endif + { return nullptr; } + }; + template + class WithStreamedUnaryMethod_GetDeductionList : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithStreamedUnaryMethod_GetDeductionList() { + ::grpc::Service::MarkMethodStreamed(0, + new ::grpc::internal::StreamedUnaryHandler< + ::protocol::payment::deduction::v1::DeductionAdminReq, ::protocol::payment::deduction::v1::DeductionAdminResp>( + [this](::grpc_impl::ServerContext* context, + ::grpc_impl::ServerUnaryStreamer< + ::protocol::payment::deduction::v1::DeductionAdminReq, ::protocol::payment::deduction::v1::DeductionAdminResp>* streamer) { + return this->StreamedGetDeductionList(context, + streamer); + })); + } + ~WithStreamedUnaryMethod_GetDeductionList() override { + BaseClassMustBeDerivedFromService(this); + } + // disable regular version of this method + ::grpc::Status GetDeductionList(::grpc::ServerContext* /*context*/, const ::protocol::payment::deduction::v1::DeductionAdminReq* /*request*/, ::protocol::payment::deduction::v1::DeductionAdminResp* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + // replace default version of method with streamed unary + virtual ::grpc::Status StreamedGetDeductionList(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::protocol::payment::deduction::v1::DeductionAdminReq,::protocol::payment::deduction::v1::DeductionAdminResp>* server_unary_streamer) = 0; + }; + template + class WithStreamedUnaryMethod_AdminOp : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithStreamedUnaryMethod_AdminOp() { + ::grpc::Service::MarkMethodStreamed(1, + new ::grpc::internal::StreamedUnaryHandler< + ::protocol::payment::deduction::v1::DeductionAdminReq, ::protocol::payment::deduction::v1::DeductionAdminResp>( + [this](::grpc_impl::ServerContext* context, + ::grpc_impl::ServerUnaryStreamer< + ::protocol::payment::deduction::v1::DeductionAdminReq, ::protocol::payment::deduction::v1::DeductionAdminResp>* streamer) { + return this->StreamedAdminOp(context, + streamer); + })); + } + ~WithStreamedUnaryMethod_AdminOp() override { + BaseClassMustBeDerivedFromService(this); + } + // disable regular version of this method + ::grpc::Status AdminOp(::grpc::ServerContext* /*context*/, const ::protocol::payment::deduction::v1::DeductionAdminReq* /*request*/, ::protocol::payment::deduction::v1::DeductionAdminResp* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + // replace default version of method with streamed unary + virtual ::grpc::Status StreamedAdminOp(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::protocol::payment::deduction::v1::DeductionAdminReq,::protocol::payment::deduction::v1::DeductionAdminResp>* server_unary_streamer) = 0; + }; + typedef WithStreamedUnaryMethod_GetDeductionList > StreamedUnaryService; + typedef Service SplitStreamedService; + typedef WithStreamedUnaryMethod_GetDeductionList > StreamedService; +}; + +} // namespace v1 +} // namespace deduction +} // namespace payment +} // namespace protocol + + +#endif // GRPC_deduction_2eproto__INCLUDED diff --git a/apis/cpp/protocol/v1/deduction.pb.cc b/apis/cpp/protocol/v1/deduction.pb.cc new file mode 100644 index 0000000..3ba48c6 --- /dev/null +++ b/apis/cpp/protocol/v1/deduction.pb.cc @@ -0,0 +1,870 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: deduction.proto + +#include "deduction.pb.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +// @@protoc_insertion_point(includes) +#include +extern PROTOBUF_INTERNAL_EXPORT_deduction_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_DeductionStruct_deduction_2eproto; +namespace protocol { +namespace payment { +namespace deduction { +namespace v1 { +class DeductionStructDefaultTypeInternal { + public: + ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; +} _DeductionStruct_default_instance_; +class DeductionAdminRespDefaultTypeInternal { + public: + ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; +} _DeductionAdminResp_default_instance_; +class DeductionAdminReqDefaultTypeInternal { + public: + ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; +} _DeductionAdminReq_default_instance_; +} // namespace v1 +} // namespace deduction +} // namespace payment +} // namespace protocol +static void InitDefaultsscc_info_DeductionAdminReq_deduction_2eproto() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + + { + void* ptr = &::protocol::payment::deduction::v1::_DeductionAdminReq_default_instance_; + new (ptr) ::protocol::payment::deduction::v1::DeductionAdminReq(); + ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); + } + ::protocol::payment::deduction::v1::DeductionAdminReq::InitAsDefaultInstance(); +} + +::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_DeductionAdminReq_deduction_2eproto = + {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_DeductionAdminReq_deduction_2eproto}, {}}; + +static void InitDefaultsscc_info_DeductionAdminResp_deduction_2eproto() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + + { + void* ptr = &::protocol::payment::deduction::v1::_DeductionAdminResp_default_instance_; + new (ptr) ::protocol::payment::deduction::v1::DeductionAdminResp(); + ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); + } + ::protocol::payment::deduction::v1::DeductionAdminResp::InitAsDefaultInstance(); +} + +::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_DeductionAdminResp_deduction_2eproto = + {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_DeductionAdminResp_deduction_2eproto}, { + &scc_info_DeductionStruct_deduction_2eproto.base,}}; + +static void InitDefaultsscc_info_DeductionStruct_deduction_2eproto() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + + { + void* ptr = &::protocol::payment::deduction::v1::_DeductionStruct_default_instance_; + new (ptr) ::protocol::payment::deduction::v1::DeductionStruct(); + ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); + } + ::protocol::payment::deduction::v1::DeductionStruct::InitAsDefaultInstance(); +} + +::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_DeductionStruct_deduction_2eproto = + {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_DeductionStruct_deduction_2eproto}, {}}; + +static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_deduction_2eproto[3]; +static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_deduction_2eproto = nullptr; +static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_deduction_2eproto = nullptr; + +const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_deduction_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::protocol::payment::deduction::v1::DeductionStruct, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + PROTOBUF_FIELD_OFFSET(::protocol::payment::deduction::v1::DeductionStruct, title_), + PROTOBUF_FIELD_OFFSET(::protocol::payment::deduction::v1::DeductionStruct, desc_), + PROTOBUF_FIELD_OFFSET(::protocol::payment::deduction::v1::DeductionStruct, status_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::protocol::payment::deduction::v1::DeductionAdminResp, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + PROTOBUF_FIELD_OFFSET(::protocol::payment::deduction::v1::DeductionAdminResp, header_), + PROTOBUF_FIELD_OFFSET(::protocol::payment::deduction::v1::DeductionAdminResp, data_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::protocol::payment::deduction::v1::DeductionAdminReq, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + PROTOBUF_FIELD_OFFSET(::protocol::payment::deduction::v1::DeductionAdminReq, header_), +}; +static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { + { 0, -1, sizeof(::protocol::payment::deduction::v1::DeductionStruct)}, + { 8, -1, sizeof(::protocol::payment::deduction::v1::DeductionAdminResp)}, + { 15, -1, sizeof(::protocol::payment::deduction::v1::DeductionAdminReq)}, +}; + +static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = { + reinterpret_cast(&::protocol::payment::deduction::v1::_DeductionStruct_default_instance_), + reinterpret_cast(&::protocol::payment::deduction::v1::_DeductionAdminResp_default_instance_), + reinterpret_cast(&::protocol::payment::deduction::v1::_DeductionAdminReq_default_instance_), +}; + +const char descriptor_table_protodef_deduction_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = + "\n\017deduction.proto\022\035protocol.payment.dedu" + "ction.v1\">\n\017DeductionStruct\022\r\n\005title\030\001 \001" + "(\t\022\014\n\004desc\030\002 \001(\t\022\016\n\006status\030\003 \001(\r\"b\n\022Dedu" + "ctionAdminResp\022\016\n\006header\030\001 \001(\t\022<\n\004data\030\002" + " \003(\0132..protocol.payment.deduction.v1.Ded" + "uctionStruct\"#\n\021DeductionAdminReq\022\016\n\006hea" + "der\030\001 \001(\t2\200\002\n\021DeductionAdminApi\022y\n\020GetDe" + "ductionList\0220.protocol.payment.deduction" + ".v1.DeductionAdminReq\0321.protocol.payment" + ".deduction.v1.DeductionAdminResp\"\000\022p\n\007Ad" + "minOp\0220.protocol.payment.deduction.v1.De" + "ductionAdminReq\0321.protocol.payment.deduc" + "tion.v1.DeductionAdminResp\"\000b\006proto3" + ; +static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_deduction_2eproto_deps[1] = { +}; +static ::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase*const descriptor_table_deduction_2eproto_sccs[3] = { + &scc_info_DeductionAdminReq_deduction_2eproto.base, + &scc_info_DeductionAdminResp_deduction_2eproto.base, + &scc_info_DeductionStruct_deduction_2eproto.base, +}; +static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_deduction_2eproto_once; +static bool descriptor_table_deduction_2eproto_initialized = false; +const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_deduction_2eproto = { + &descriptor_table_deduction_2eproto_initialized, descriptor_table_protodef_deduction_2eproto, "deduction.proto", 516, + &descriptor_table_deduction_2eproto_once, descriptor_table_deduction_2eproto_sccs, descriptor_table_deduction_2eproto_deps, 3, 0, + schemas, file_default_instances, TableStruct_deduction_2eproto::offsets, + file_level_metadata_deduction_2eproto, 3, file_level_enum_descriptors_deduction_2eproto, file_level_service_descriptors_deduction_2eproto, +}; + +// Force running AddDescriptors() at dynamic initialization time. +static bool dynamic_init_dummy_deduction_2eproto = ( ::PROTOBUF_NAMESPACE_ID::internal::AddDescriptors(&descriptor_table_deduction_2eproto), true); +namespace protocol { +namespace payment { +namespace deduction { +namespace v1 { + +// =================================================================== + +void DeductionStruct::InitAsDefaultInstance() { +} +class DeductionStruct::_Internal { + public: +}; + +DeductionStruct::DeductionStruct() + : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) { + SharedCtor(); + // @@protoc_insertion_point(constructor:protocol.payment.deduction.v1.DeductionStruct) +} +DeductionStruct::DeductionStruct(const DeductionStruct& from) + : ::PROTOBUF_NAMESPACE_ID::Message(), + _internal_metadata_(nullptr) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + title_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_title().empty()) { + title_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.title_); + } + desc_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_desc().empty()) { + desc_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.desc_); + } + status_ = from.status_; + // @@protoc_insertion_point(copy_constructor:protocol.payment.deduction.v1.DeductionStruct) +} + +void DeductionStruct::SharedCtor() { + ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_DeductionStruct_deduction_2eproto.base); + title_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + desc_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + status_ = 0u; +} + +DeductionStruct::~DeductionStruct() { + // @@protoc_insertion_point(destructor:protocol.payment.deduction.v1.DeductionStruct) + SharedDtor(); +} + +void DeductionStruct::SharedDtor() { + title_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + desc_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void DeductionStruct::SetCachedSize(int size) const { + _cached_size_.Set(size); +} +const DeductionStruct& DeductionStruct::default_instance() { + ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_DeductionStruct_deduction_2eproto.base); + return *internal_default_instance(); +} + + +void DeductionStruct::Clear() { +// @@protoc_insertion_point(message_clear_start:protocol.payment.deduction.v1.DeductionStruct) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + title_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + desc_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + status_ = 0u; + _internal_metadata_.Clear(); +} + +const char* DeductionStruct::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + ::PROTOBUF_NAMESPACE_ID::uint32 tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + CHK_(ptr); + switch (tag >> 3) { + // string title = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + auto str = _internal_mutable_title(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "protocol.payment.deduction.v1.DeductionStruct.title")); + CHK_(ptr); + } else goto handle_unusual; + continue; + // string desc = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { + auto str = _internal_mutable_desc(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "protocol.payment.deduction.v1.DeductionStruct.desc")); + CHK_(ptr); + } else goto handle_unusual; + continue; + // uint32 status = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) { + status_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); + CHK_(ptr); + } else goto handle_unusual; + continue; + default: { + handle_unusual: + if ((tag & 7) == 4 || tag == 0) { + ctx->SetLastTag(tag); + goto success; + } + ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx); + CHK_(ptr != nullptr); + continue; + } + } // switch + } // while +success: + return ptr; +failure: + ptr = nullptr; + goto success; +#undef CHK_ +} + +::PROTOBUF_NAMESPACE_ID::uint8* DeductionStruct::_InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:protocol.payment.deduction.v1.DeductionStruct) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // string title = 1; + if (this->title().size() > 0) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_title().data(), static_cast(this->_internal_title().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "protocol.payment.deduction.v1.DeductionStruct.title"); + target = stream->WriteStringMaybeAliased( + 1, this->_internal_title(), target); + } + + // string desc = 2; + if (this->desc().size() > 0) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_desc().data(), static_cast(this->_internal_desc().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "protocol.payment.deduction.v1.DeductionStruct.desc"); + target = stream->WriteStringMaybeAliased( + 2, this->_internal_desc(), target); + } + + // uint32 status = 3; + if (this->status() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt32ToArray(3, this->_internal_status(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields(), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:protocol.payment.deduction.v1.DeductionStruct) + return target; +} + +size_t DeductionStruct::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:protocol.payment.deduction.v1.DeductionStruct) + size_t total_size = 0; + + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // string title = 1; + if (this->title().size() > 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_title()); + } + + // string desc = 2; + if (this->desc().size() > 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_desc()); + } + + // uint32 status = 3; + if (this->status() != 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt32Size( + this->_internal_status()); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( + _internal_metadata_, total_size, &_cached_size_); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void DeductionStruct::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { +// @@protoc_insertion_point(generalized_merge_from_start:protocol.payment.deduction.v1.DeductionStruct) + GOOGLE_DCHECK_NE(&from, this); + const DeductionStruct* source = + ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated( + &from); + if (source == nullptr) { + // @@protoc_insertion_point(generalized_merge_from_cast_fail:protocol.payment.deduction.v1.DeductionStruct) + ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); + } else { + // @@protoc_insertion_point(generalized_merge_from_cast_success:protocol.payment.deduction.v1.DeductionStruct) + MergeFrom(*source); + } +} + +void DeductionStruct::MergeFrom(const DeductionStruct& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:protocol.payment.deduction.v1.DeductionStruct) + GOOGLE_DCHECK_NE(&from, this); + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + if (from.title().size() > 0) { + + title_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.title_); + } + if (from.desc().size() > 0) { + + desc_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.desc_); + } + if (from.status() != 0) { + _internal_set_status(from._internal_status()); + } +} + +void DeductionStruct::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { +// @@protoc_insertion_point(generalized_copy_from_start:protocol.payment.deduction.v1.DeductionStruct) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void DeductionStruct::CopyFrom(const DeductionStruct& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:protocol.payment.deduction.v1.DeductionStruct) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool DeductionStruct::IsInitialized() const { + return true; +} + +void DeductionStruct::InternalSwap(DeductionStruct* other) { + using std::swap; + _internal_metadata_.Swap(&other->_internal_metadata_); + title_.Swap(&other->title_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); + desc_.Swap(&other->desc_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); + swap(status_, other->status_); +} + +::PROTOBUF_NAMESPACE_ID::Metadata DeductionStruct::GetMetadata() const { + return GetMetadataStatic(); +} + + +// =================================================================== + +void DeductionAdminResp::InitAsDefaultInstance() { +} +class DeductionAdminResp::_Internal { + public: +}; + +DeductionAdminResp::DeductionAdminResp() + : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) { + SharedCtor(); + // @@protoc_insertion_point(constructor:protocol.payment.deduction.v1.DeductionAdminResp) +} +DeductionAdminResp::DeductionAdminResp(const DeductionAdminResp& from) + : ::PROTOBUF_NAMESPACE_ID::Message(), + _internal_metadata_(nullptr), + data_(from.data_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + header_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_header().empty()) { + header_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.header_); + } + // @@protoc_insertion_point(copy_constructor:protocol.payment.deduction.v1.DeductionAdminResp) +} + +void DeductionAdminResp::SharedCtor() { + ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_DeductionAdminResp_deduction_2eproto.base); + header_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +DeductionAdminResp::~DeductionAdminResp() { + // @@protoc_insertion_point(destructor:protocol.payment.deduction.v1.DeductionAdminResp) + SharedDtor(); +} + +void DeductionAdminResp::SharedDtor() { + header_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void DeductionAdminResp::SetCachedSize(int size) const { + _cached_size_.Set(size); +} +const DeductionAdminResp& DeductionAdminResp::default_instance() { + ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_DeductionAdminResp_deduction_2eproto.base); + return *internal_default_instance(); +} + + +void DeductionAdminResp::Clear() { +// @@protoc_insertion_point(message_clear_start:protocol.payment.deduction.v1.DeductionAdminResp) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + data_.Clear(); + header_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + _internal_metadata_.Clear(); +} + +const char* DeductionAdminResp::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + ::PROTOBUF_NAMESPACE_ID::uint32 tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + CHK_(ptr); + switch (tag >> 3) { + // string header = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + auto str = _internal_mutable_header(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "protocol.payment.deduction.v1.DeductionAdminResp.header")); + CHK_(ptr); + } else goto handle_unusual; + continue; + // repeated .protocol.payment.deduction.v1.DeductionStruct data = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { + ptr -= 1; + do { + ptr += 1; + ptr = ctx->ParseMessage(_internal_add_data(), ptr); + CHK_(ptr); + if (!ctx->DataAvailable(ptr)) break; + } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<18>(ptr)); + } else goto handle_unusual; + continue; + default: { + handle_unusual: + if ((tag & 7) == 4 || tag == 0) { + ctx->SetLastTag(tag); + goto success; + } + ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx); + CHK_(ptr != nullptr); + continue; + } + } // switch + } // while +success: + return ptr; +failure: + ptr = nullptr; + goto success; +#undef CHK_ +} + +::PROTOBUF_NAMESPACE_ID::uint8* DeductionAdminResp::_InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:protocol.payment.deduction.v1.DeductionAdminResp) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // string header = 1; + if (this->header().size() > 0) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_header().data(), static_cast(this->_internal_header().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "protocol.payment.deduction.v1.DeductionAdminResp.header"); + target = stream->WriteStringMaybeAliased( + 1, this->_internal_header(), target); + } + + // repeated .protocol.payment.deduction.v1.DeductionStruct data = 2; + for (unsigned int i = 0, + n = static_cast(this->_internal_data_size()); i < n; i++) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage(2, this->_internal_data(i), target, stream); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields(), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:protocol.payment.deduction.v1.DeductionAdminResp) + return target; +} + +size_t DeductionAdminResp::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:protocol.payment.deduction.v1.DeductionAdminResp) + size_t total_size = 0; + + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // repeated .protocol.payment.deduction.v1.DeductionStruct data = 2; + total_size += 1UL * this->_internal_data_size(); + for (const auto& msg : this->data_) { + total_size += + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); + } + + // string header = 1; + if (this->header().size() > 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_header()); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( + _internal_metadata_, total_size, &_cached_size_); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void DeductionAdminResp::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { +// @@protoc_insertion_point(generalized_merge_from_start:protocol.payment.deduction.v1.DeductionAdminResp) + GOOGLE_DCHECK_NE(&from, this); + const DeductionAdminResp* source = + ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated( + &from); + if (source == nullptr) { + // @@protoc_insertion_point(generalized_merge_from_cast_fail:protocol.payment.deduction.v1.DeductionAdminResp) + ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); + } else { + // @@protoc_insertion_point(generalized_merge_from_cast_success:protocol.payment.deduction.v1.DeductionAdminResp) + MergeFrom(*source); + } +} + +void DeductionAdminResp::MergeFrom(const DeductionAdminResp& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:protocol.payment.deduction.v1.DeductionAdminResp) + GOOGLE_DCHECK_NE(&from, this); + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + data_.MergeFrom(from.data_); + if (from.header().size() > 0) { + + header_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.header_); + } +} + +void DeductionAdminResp::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { +// @@protoc_insertion_point(generalized_copy_from_start:protocol.payment.deduction.v1.DeductionAdminResp) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void DeductionAdminResp::CopyFrom(const DeductionAdminResp& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:protocol.payment.deduction.v1.DeductionAdminResp) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool DeductionAdminResp::IsInitialized() const { + return true; +} + +void DeductionAdminResp::InternalSwap(DeductionAdminResp* other) { + using std::swap; + _internal_metadata_.Swap(&other->_internal_metadata_); + data_.InternalSwap(&other->data_); + header_.Swap(&other->header_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} + +::PROTOBUF_NAMESPACE_ID::Metadata DeductionAdminResp::GetMetadata() const { + return GetMetadataStatic(); +} + + +// =================================================================== + +void DeductionAdminReq::InitAsDefaultInstance() { +} +class DeductionAdminReq::_Internal { + public: +}; + +DeductionAdminReq::DeductionAdminReq() + : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) { + SharedCtor(); + // @@protoc_insertion_point(constructor:protocol.payment.deduction.v1.DeductionAdminReq) +} +DeductionAdminReq::DeductionAdminReq(const DeductionAdminReq& from) + : ::PROTOBUF_NAMESPACE_ID::Message(), + _internal_metadata_(nullptr) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + header_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_header().empty()) { + header_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.header_); + } + // @@protoc_insertion_point(copy_constructor:protocol.payment.deduction.v1.DeductionAdminReq) +} + +void DeductionAdminReq::SharedCtor() { + ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_DeductionAdminReq_deduction_2eproto.base); + header_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +DeductionAdminReq::~DeductionAdminReq() { + // @@protoc_insertion_point(destructor:protocol.payment.deduction.v1.DeductionAdminReq) + SharedDtor(); +} + +void DeductionAdminReq::SharedDtor() { + header_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void DeductionAdminReq::SetCachedSize(int size) const { + _cached_size_.Set(size); +} +const DeductionAdminReq& DeductionAdminReq::default_instance() { + ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_DeductionAdminReq_deduction_2eproto.base); + return *internal_default_instance(); +} + + +void DeductionAdminReq::Clear() { +// @@protoc_insertion_point(message_clear_start:protocol.payment.deduction.v1.DeductionAdminReq) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + header_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + _internal_metadata_.Clear(); +} + +const char* DeductionAdminReq::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + ::PROTOBUF_NAMESPACE_ID::uint32 tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + CHK_(ptr); + switch (tag >> 3) { + // string header = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + auto str = _internal_mutable_header(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "protocol.payment.deduction.v1.DeductionAdminReq.header")); + CHK_(ptr); + } else goto handle_unusual; + continue; + default: { + handle_unusual: + if ((tag & 7) == 4 || tag == 0) { + ctx->SetLastTag(tag); + goto success; + } + ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx); + CHK_(ptr != nullptr); + continue; + } + } // switch + } // while +success: + return ptr; +failure: + ptr = nullptr; + goto success; +#undef CHK_ +} + +::PROTOBUF_NAMESPACE_ID::uint8* DeductionAdminReq::_InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:protocol.payment.deduction.v1.DeductionAdminReq) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // string header = 1; + if (this->header().size() > 0) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_header().data(), static_cast(this->_internal_header().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "protocol.payment.deduction.v1.DeductionAdminReq.header"); + target = stream->WriteStringMaybeAliased( + 1, this->_internal_header(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields(), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:protocol.payment.deduction.v1.DeductionAdminReq) + return target; +} + +size_t DeductionAdminReq::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:protocol.payment.deduction.v1.DeductionAdminReq) + size_t total_size = 0; + + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // string header = 1; + if (this->header().size() > 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_header()); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( + _internal_metadata_, total_size, &_cached_size_); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void DeductionAdminReq::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { +// @@protoc_insertion_point(generalized_merge_from_start:protocol.payment.deduction.v1.DeductionAdminReq) + GOOGLE_DCHECK_NE(&from, this); + const DeductionAdminReq* source = + ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated( + &from); + if (source == nullptr) { + // @@protoc_insertion_point(generalized_merge_from_cast_fail:protocol.payment.deduction.v1.DeductionAdminReq) + ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); + } else { + // @@protoc_insertion_point(generalized_merge_from_cast_success:protocol.payment.deduction.v1.DeductionAdminReq) + MergeFrom(*source); + } +} + +void DeductionAdminReq::MergeFrom(const DeductionAdminReq& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:protocol.payment.deduction.v1.DeductionAdminReq) + GOOGLE_DCHECK_NE(&from, this); + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + if (from.header().size() > 0) { + + header_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.header_); + } +} + +void DeductionAdminReq::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { +// @@protoc_insertion_point(generalized_copy_from_start:protocol.payment.deduction.v1.DeductionAdminReq) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void DeductionAdminReq::CopyFrom(const DeductionAdminReq& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:protocol.payment.deduction.v1.DeductionAdminReq) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool DeductionAdminReq::IsInitialized() const { + return true; +} + +void DeductionAdminReq::InternalSwap(DeductionAdminReq* other) { + using std::swap; + _internal_metadata_.Swap(&other->_internal_metadata_); + header_.Swap(&other->header_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} + +::PROTOBUF_NAMESPACE_ID::Metadata DeductionAdminReq::GetMetadata() const { + return GetMetadataStatic(); +} + + +// @@protoc_insertion_point(namespace_scope) +} // namespace v1 +} // namespace deduction +} // namespace payment +} // namespace protocol +PROTOBUF_NAMESPACE_OPEN +template<> PROTOBUF_NOINLINE ::protocol::payment::deduction::v1::DeductionStruct* Arena::CreateMaybeMessage< ::protocol::payment::deduction::v1::DeductionStruct >(Arena* arena) { + return Arena::CreateInternal< ::protocol::payment::deduction::v1::DeductionStruct >(arena); +} +template<> PROTOBUF_NOINLINE ::protocol::payment::deduction::v1::DeductionAdminResp* Arena::CreateMaybeMessage< ::protocol::payment::deduction::v1::DeductionAdminResp >(Arena* arena) { + return Arena::CreateInternal< ::protocol::payment::deduction::v1::DeductionAdminResp >(arena); +} +template<> PROTOBUF_NOINLINE ::protocol::payment::deduction::v1::DeductionAdminReq* Arena::CreateMaybeMessage< ::protocol::payment::deduction::v1::DeductionAdminReq >(Arena* arena) { + return Arena::CreateInternal< ::protocol::payment::deduction::v1::DeductionAdminReq >(arena); +} +PROTOBUF_NAMESPACE_CLOSE + +// @@protoc_insertion_point(global_scope) +#include diff --git a/apis/cpp/protocol/v1/deduction.pb.h b/apis/cpp/protocol/v1/deduction.pb.h new file mode 100644 index 0000000..a2c206f --- /dev/null +++ b/apis/cpp/protocol/v1/deduction.pb.h @@ -0,0 +1,874 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: deduction.proto + +#ifndef GOOGLE_PROTOBUF_INCLUDED_deduction_2eproto +#define GOOGLE_PROTOBUF_INCLUDED_deduction_2eproto + +#include +#include + +#include +#if PROTOBUF_VERSION < 3011000 +#error This file was generated by a newer version of protoc which is +#error incompatible with your Protocol Buffer headers. Please update +#error your headers. +#endif +#if 3011001 < PROTOBUF_MIN_PROTOC_VERSION +#error This file was generated by an older version of protoc which is +#error incompatible with your Protocol Buffer headers. Please +#error regenerate this file with a newer version of protoc. +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // IWYU pragma: export +#include // IWYU pragma: export +#include +// @@protoc_insertion_point(includes) +#include +#define PROTOBUF_INTERNAL_EXPORT_deduction_2eproto +PROTOBUF_NAMESPACE_OPEN +namespace internal { +class AnyMetadata; +} // namespace internal +PROTOBUF_NAMESPACE_CLOSE + +// Internal implementation detail -- do not use these members. +struct TableStruct_deduction_2eproto { + static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTableField entries[] + PROTOBUF_SECTION_VARIABLE(protodesc_cold); + static const ::PROTOBUF_NAMESPACE_ID::internal::AuxillaryParseTableField aux[] + PROTOBUF_SECTION_VARIABLE(protodesc_cold); + static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[3] + PROTOBUF_SECTION_VARIABLE(protodesc_cold); + static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[]; + static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[]; + static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[]; +}; +extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_deduction_2eproto; +namespace protocol { +namespace payment { +namespace deduction { +namespace v1 { +class DeductionAdminReq; +class DeductionAdminReqDefaultTypeInternal; +extern DeductionAdminReqDefaultTypeInternal _DeductionAdminReq_default_instance_; +class DeductionAdminResp; +class DeductionAdminRespDefaultTypeInternal; +extern DeductionAdminRespDefaultTypeInternal _DeductionAdminResp_default_instance_; +class DeductionStruct; +class DeductionStructDefaultTypeInternal; +extern DeductionStructDefaultTypeInternal _DeductionStruct_default_instance_; +} // namespace v1 +} // namespace deduction +} // namespace payment +} // namespace protocol +PROTOBUF_NAMESPACE_OPEN +template<> ::protocol::payment::deduction::v1::DeductionAdminReq* Arena::CreateMaybeMessage<::protocol::payment::deduction::v1::DeductionAdminReq>(Arena*); +template<> ::protocol::payment::deduction::v1::DeductionAdminResp* Arena::CreateMaybeMessage<::protocol::payment::deduction::v1::DeductionAdminResp>(Arena*); +template<> ::protocol::payment::deduction::v1::DeductionStruct* Arena::CreateMaybeMessage<::protocol::payment::deduction::v1::DeductionStruct>(Arena*); +PROTOBUF_NAMESPACE_CLOSE +namespace protocol { +namespace payment { +namespace deduction { +namespace v1 { + +// =================================================================== + +class DeductionStruct : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:protocol.payment.deduction.v1.DeductionStruct) */ { + public: + DeductionStruct(); + virtual ~DeductionStruct(); + + DeductionStruct(const DeductionStruct& from); + DeductionStruct(DeductionStruct&& from) noexcept + : DeductionStruct() { + *this = ::std::move(from); + } + + inline DeductionStruct& operator=(const DeductionStruct& from) { + CopyFrom(from); + return *this; + } + inline DeductionStruct& operator=(DeductionStruct&& from) noexcept { + if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const DeductionStruct& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const DeductionStruct* internal_default_instance() { + return reinterpret_cast( + &_DeductionStruct_default_instance_); + } + static constexpr int kIndexInFileMessages = + 0; + + friend void swap(DeductionStruct& a, DeductionStruct& b) { + a.Swap(&b); + } + inline void Swap(DeductionStruct* other) { + if (other == this) return; + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline DeductionStruct* New() const final { + return CreateMaybeMessage(nullptr); + } + + DeductionStruct* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const DeductionStruct& from); + void MergeFrom(const DeductionStruct& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(DeductionStruct* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "protocol.payment.deduction.v1.DeductionStruct"; + } + private: + inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const { + return nullptr; + } + inline void* MaybeArenaPtr() const { + return nullptr; + } + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_deduction_2eproto); + return ::descriptor_table_deduction_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kTitleFieldNumber = 1, + kDescFieldNumber = 2, + kStatusFieldNumber = 3, + }; + // string title = 1; + void clear_title(); + const std::string& title() const; + void set_title(const std::string& value); + void set_title(std::string&& value); + void set_title(const char* value); + void set_title(const char* value, size_t size); + std::string* mutable_title(); + std::string* release_title(); + void set_allocated_title(std::string* title); + private: + const std::string& _internal_title() const; + void _internal_set_title(const std::string& value); + std::string* _internal_mutable_title(); + public: + + // string desc = 2; + void clear_desc(); + const std::string& desc() const; + void set_desc(const std::string& value); + void set_desc(std::string&& value); + void set_desc(const char* value); + void set_desc(const char* value, size_t size); + std::string* mutable_desc(); + std::string* release_desc(); + void set_allocated_desc(std::string* desc); + private: + const std::string& _internal_desc() const; + void _internal_set_desc(const std::string& value); + std::string* _internal_mutable_desc(); + public: + + // uint32 status = 3; + void clear_status(); + ::PROTOBUF_NAMESPACE_ID::uint32 status() const; + void set_status(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_status() const; + void _internal_set_status(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // @@protoc_insertion_point(class_scope:protocol.payment.deduction.v1.DeductionStruct) + private: + class _Internal; + + ::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr title_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr desc_; + ::PROTOBUF_NAMESPACE_ID::uint32 status_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_deduction_2eproto; +}; +// ------------------------------------------------------------------- + +class DeductionAdminResp : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:protocol.payment.deduction.v1.DeductionAdminResp) */ { + public: + DeductionAdminResp(); + virtual ~DeductionAdminResp(); + + DeductionAdminResp(const DeductionAdminResp& from); + DeductionAdminResp(DeductionAdminResp&& from) noexcept + : DeductionAdminResp() { + *this = ::std::move(from); + } + + inline DeductionAdminResp& operator=(const DeductionAdminResp& from) { + CopyFrom(from); + return *this; + } + inline DeductionAdminResp& operator=(DeductionAdminResp&& from) noexcept { + if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const DeductionAdminResp& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const DeductionAdminResp* internal_default_instance() { + return reinterpret_cast( + &_DeductionAdminResp_default_instance_); + } + static constexpr int kIndexInFileMessages = + 1; + + friend void swap(DeductionAdminResp& a, DeductionAdminResp& b) { + a.Swap(&b); + } + inline void Swap(DeductionAdminResp* other) { + if (other == this) return; + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline DeductionAdminResp* New() const final { + return CreateMaybeMessage(nullptr); + } + + DeductionAdminResp* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const DeductionAdminResp& from); + void MergeFrom(const DeductionAdminResp& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(DeductionAdminResp* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "protocol.payment.deduction.v1.DeductionAdminResp"; + } + private: + inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const { + return nullptr; + } + inline void* MaybeArenaPtr() const { + return nullptr; + } + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_deduction_2eproto); + return ::descriptor_table_deduction_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kDataFieldNumber = 2, + kHeaderFieldNumber = 1, + }; + // repeated .protocol.payment.deduction.v1.DeductionStruct data = 2; + int data_size() const; + private: + int _internal_data_size() const; + public: + void clear_data(); + ::protocol::payment::deduction::v1::DeductionStruct* mutable_data(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::protocol::payment::deduction::v1::DeductionStruct >* + mutable_data(); + private: + const ::protocol::payment::deduction::v1::DeductionStruct& _internal_data(int index) const; + ::protocol::payment::deduction::v1::DeductionStruct* _internal_add_data(); + public: + const ::protocol::payment::deduction::v1::DeductionStruct& data(int index) const; + ::protocol::payment::deduction::v1::DeductionStruct* add_data(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::protocol::payment::deduction::v1::DeductionStruct >& + data() const; + + // string header = 1; + void clear_header(); + const std::string& header() const; + void set_header(const std::string& value); + void set_header(std::string&& value); + void set_header(const char* value); + void set_header(const char* value, size_t size); + std::string* mutable_header(); + std::string* release_header(); + void set_allocated_header(std::string* header); + private: + const std::string& _internal_header() const; + void _internal_set_header(const std::string& value); + std::string* _internal_mutable_header(); + public: + + // @@protoc_insertion_point(class_scope:protocol.payment.deduction.v1.DeductionAdminResp) + private: + class _Internal; + + ::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::protocol::payment::deduction::v1::DeductionStruct > data_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr header_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_deduction_2eproto; +}; +// ------------------------------------------------------------------- + +class DeductionAdminReq : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:protocol.payment.deduction.v1.DeductionAdminReq) */ { + public: + DeductionAdminReq(); + virtual ~DeductionAdminReq(); + + DeductionAdminReq(const DeductionAdminReq& from); + DeductionAdminReq(DeductionAdminReq&& from) noexcept + : DeductionAdminReq() { + *this = ::std::move(from); + } + + inline DeductionAdminReq& operator=(const DeductionAdminReq& from) { + CopyFrom(from); + return *this; + } + inline DeductionAdminReq& operator=(DeductionAdminReq&& from) noexcept { + if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const DeductionAdminReq& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const DeductionAdminReq* internal_default_instance() { + return reinterpret_cast( + &_DeductionAdminReq_default_instance_); + } + static constexpr int kIndexInFileMessages = + 2; + + friend void swap(DeductionAdminReq& a, DeductionAdminReq& b) { + a.Swap(&b); + } + inline void Swap(DeductionAdminReq* other) { + if (other == this) return; + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline DeductionAdminReq* New() const final { + return CreateMaybeMessage(nullptr); + } + + DeductionAdminReq* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const DeductionAdminReq& from); + void MergeFrom(const DeductionAdminReq& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(DeductionAdminReq* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "protocol.payment.deduction.v1.DeductionAdminReq"; + } + private: + inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const { + return nullptr; + } + inline void* MaybeArenaPtr() const { + return nullptr; + } + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_deduction_2eproto); + return ::descriptor_table_deduction_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kHeaderFieldNumber = 1, + }; + // string header = 1; + void clear_header(); + const std::string& header() const; + void set_header(const std::string& value); + void set_header(std::string&& value); + void set_header(const char* value); + void set_header(const char* value, size_t size); + std::string* mutable_header(); + std::string* release_header(); + void set_allocated_header(std::string* header); + private: + const std::string& _internal_header() const; + void _internal_set_header(const std::string& value); + std::string* _internal_mutable_header(); + public: + + // @@protoc_insertion_point(class_scope:protocol.payment.deduction.v1.DeductionAdminReq) + private: + class _Internal; + + ::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr header_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_deduction_2eproto; +}; +// =================================================================== + + +// =================================================================== + +#ifdef __GNUC__ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif // __GNUC__ +// DeductionStruct + +// string title = 1; +inline void DeductionStruct::clear_title() { + title_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} +inline const std::string& DeductionStruct::title() const { + // @@protoc_insertion_point(field_get:protocol.payment.deduction.v1.DeductionStruct.title) + return _internal_title(); +} +inline void DeductionStruct::set_title(const std::string& value) { + _internal_set_title(value); + // @@protoc_insertion_point(field_set:protocol.payment.deduction.v1.DeductionStruct.title) +} +inline std::string* DeductionStruct::mutable_title() { + // @@protoc_insertion_point(field_mutable:protocol.payment.deduction.v1.DeductionStruct.title) + return _internal_mutable_title(); +} +inline const std::string& DeductionStruct::_internal_title() const { + return title_.GetNoArena(); +} +inline void DeductionStruct::_internal_set_title(const std::string& value) { + + title_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value); +} +inline void DeductionStruct::set_title(std::string&& value) { + + title_.SetNoArena( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); + // @@protoc_insertion_point(field_set_rvalue:protocol.payment.deduction.v1.DeductionStruct.title) +} +inline void DeductionStruct::set_title(const char* value) { + GOOGLE_DCHECK(value != nullptr); + + title_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:protocol.payment.deduction.v1.DeductionStruct.title) +} +inline void DeductionStruct::set_title(const char* value, size_t size) { + + title_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:protocol.payment.deduction.v1.DeductionStruct.title) +} +inline std::string* DeductionStruct::_internal_mutable_title() { + + return title_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} +inline std::string* DeductionStruct::release_title() { + // @@protoc_insertion_point(field_release:protocol.payment.deduction.v1.DeductionStruct.title) + + return title_.ReleaseNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} +inline void DeductionStruct::set_allocated_title(std::string* title) { + if (title != nullptr) { + + } else { + + } + title_.SetAllocatedNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), title); + // @@protoc_insertion_point(field_set_allocated:protocol.payment.deduction.v1.DeductionStruct.title) +} + +// string desc = 2; +inline void DeductionStruct::clear_desc() { + desc_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} +inline const std::string& DeductionStruct::desc() const { + // @@protoc_insertion_point(field_get:protocol.payment.deduction.v1.DeductionStruct.desc) + return _internal_desc(); +} +inline void DeductionStruct::set_desc(const std::string& value) { + _internal_set_desc(value); + // @@protoc_insertion_point(field_set:protocol.payment.deduction.v1.DeductionStruct.desc) +} +inline std::string* DeductionStruct::mutable_desc() { + // @@protoc_insertion_point(field_mutable:protocol.payment.deduction.v1.DeductionStruct.desc) + return _internal_mutable_desc(); +} +inline const std::string& DeductionStruct::_internal_desc() const { + return desc_.GetNoArena(); +} +inline void DeductionStruct::_internal_set_desc(const std::string& value) { + + desc_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value); +} +inline void DeductionStruct::set_desc(std::string&& value) { + + desc_.SetNoArena( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); + // @@protoc_insertion_point(field_set_rvalue:protocol.payment.deduction.v1.DeductionStruct.desc) +} +inline void DeductionStruct::set_desc(const char* value) { + GOOGLE_DCHECK(value != nullptr); + + desc_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:protocol.payment.deduction.v1.DeductionStruct.desc) +} +inline void DeductionStruct::set_desc(const char* value, size_t size) { + + desc_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:protocol.payment.deduction.v1.DeductionStruct.desc) +} +inline std::string* DeductionStruct::_internal_mutable_desc() { + + return desc_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} +inline std::string* DeductionStruct::release_desc() { + // @@protoc_insertion_point(field_release:protocol.payment.deduction.v1.DeductionStruct.desc) + + return desc_.ReleaseNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} +inline void DeductionStruct::set_allocated_desc(std::string* desc) { + if (desc != nullptr) { + + } else { + + } + desc_.SetAllocatedNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), desc); + // @@protoc_insertion_point(field_set_allocated:protocol.payment.deduction.v1.DeductionStruct.desc) +} + +// uint32 status = 3; +inline void DeductionStruct::clear_status() { + status_ = 0u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 DeductionStruct::_internal_status() const { + return status_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 DeductionStruct::status() const { + // @@protoc_insertion_point(field_get:protocol.payment.deduction.v1.DeductionStruct.status) + return _internal_status(); +} +inline void DeductionStruct::_internal_set_status(::PROTOBUF_NAMESPACE_ID::uint32 value) { + + status_ = value; +} +inline void DeductionStruct::set_status(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_status(value); + // @@protoc_insertion_point(field_set:protocol.payment.deduction.v1.DeductionStruct.status) +} + +// ------------------------------------------------------------------- + +// DeductionAdminResp + +// string header = 1; +inline void DeductionAdminResp::clear_header() { + header_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} +inline const std::string& DeductionAdminResp::header() const { + // @@protoc_insertion_point(field_get:protocol.payment.deduction.v1.DeductionAdminResp.header) + return _internal_header(); +} +inline void DeductionAdminResp::set_header(const std::string& value) { + _internal_set_header(value); + // @@protoc_insertion_point(field_set:protocol.payment.deduction.v1.DeductionAdminResp.header) +} +inline std::string* DeductionAdminResp::mutable_header() { + // @@protoc_insertion_point(field_mutable:protocol.payment.deduction.v1.DeductionAdminResp.header) + return _internal_mutable_header(); +} +inline const std::string& DeductionAdminResp::_internal_header() const { + return header_.GetNoArena(); +} +inline void DeductionAdminResp::_internal_set_header(const std::string& value) { + + header_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value); +} +inline void DeductionAdminResp::set_header(std::string&& value) { + + header_.SetNoArena( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); + // @@protoc_insertion_point(field_set_rvalue:protocol.payment.deduction.v1.DeductionAdminResp.header) +} +inline void DeductionAdminResp::set_header(const char* value) { + GOOGLE_DCHECK(value != nullptr); + + header_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:protocol.payment.deduction.v1.DeductionAdminResp.header) +} +inline void DeductionAdminResp::set_header(const char* value, size_t size) { + + header_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:protocol.payment.deduction.v1.DeductionAdminResp.header) +} +inline std::string* DeductionAdminResp::_internal_mutable_header() { + + return header_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} +inline std::string* DeductionAdminResp::release_header() { + // @@protoc_insertion_point(field_release:protocol.payment.deduction.v1.DeductionAdminResp.header) + + return header_.ReleaseNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} +inline void DeductionAdminResp::set_allocated_header(std::string* header) { + if (header != nullptr) { + + } else { + + } + header_.SetAllocatedNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), header); + // @@protoc_insertion_point(field_set_allocated:protocol.payment.deduction.v1.DeductionAdminResp.header) +} + +// repeated .protocol.payment.deduction.v1.DeductionStruct data = 2; +inline int DeductionAdminResp::_internal_data_size() const { + return data_.size(); +} +inline int DeductionAdminResp::data_size() const { + return _internal_data_size(); +} +inline void DeductionAdminResp::clear_data() { + data_.Clear(); +} +inline ::protocol::payment::deduction::v1::DeductionStruct* DeductionAdminResp::mutable_data(int index) { + // @@protoc_insertion_point(field_mutable:protocol.payment.deduction.v1.DeductionAdminResp.data) + return data_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::protocol::payment::deduction::v1::DeductionStruct >* +DeductionAdminResp::mutable_data() { + // @@protoc_insertion_point(field_mutable_list:protocol.payment.deduction.v1.DeductionAdminResp.data) + return &data_; +} +inline const ::protocol::payment::deduction::v1::DeductionStruct& DeductionAdminResp::_internal_data(int index) const { + return data_.Get(index); +} +inline const ::protocol::payment::deduction::v1::DeductionStruct& DeductionAdminResp::data(int index) const { + // @@protoc_insertion_point(field_get:protocol.payment.deduction.v1.DeductionAdminResp.data) + return _internal_data(index); +} +inline ::protocol::payment::deduction::v1::DeductionStruct* DeductionAdminResp::_internal_add_data() { + return data_.Add(); +} +inline ::protocol::payment::deduction::v1::DeductionStruct* DeductionAdminResp::add_data() { + // @@protoc_insertion_point(field_add:protocol.payment.deduction.v1.DeductionAdminResp.data) + return _internal_add_data(); +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::protocol::payment::deduction::v1::DeductionStruct >& +DeductionAdminResp::data() const { + // @@protoc_insertion_point(field_list:protocol.payment.deduction.v1.DeductionAdminResp.data) + return data_; +} + +// ------------------------------------------------------------------- + +// DeductionAdminReq + +// string header = 1; +inline void DeductionAdminReq::clear_header() { + header_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} +inline const std::string& DeductionAdminReq::header() const { + // @@protoc_insertion_point(field_get:protocol.payment.deduction.v1.DeductionAdminReq.header) + return _internal_header(); +} +inline void DeductionAdminReq::set_header(const std::string& value) { + _internal_set_header(value); + // @@protoc_insertion_point(field_set:protocol.payment.deduction.v1.DeductionAdminReq.header) +} +inline std::string* DeductionAdminReq::mutable_header() { + // @@protoc_insertion_point(field_mutable:protocol.payment.deduction.v1.DeductionAdminReq.header) + return _internal_mutable_header(); +} +inline const std::string& DeductionAdminReq::_internal_header() const { + return header_.GetNoArena(); +} +inline void DeductionAdminReq::_internal_set_header(const std::string& value) { + + header_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value); +} +inline void DeductionAdminReq::set_header(std::string&& value) { + + header_.SetNoArena( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); + // @@protoc_insertion_point(field_set_rvalue:protocol.payment.deduction.v1.DeductionAdminReq.header) +} +inline void DeductionAdminReq::set_header(const char* value) { + GOOGLE_DCHECK(value != nullptr); + + header_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:protocol.payment.deduction.v1.DeductionAdminReq.header) +} +inline void DeductionAdminReq::set_header(const char* value, size_t size) { + + header_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:protocol.payment.deduction.v1.DeductionAdminReq.header) +} +inline std::string* DeductionAdminReq::_internal_mutable_header() { + + return header_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} +inline std::string* DeductionAdminReq::release_header() { + // @@protoc_insertion_point(field_release:protocol.payment.deduction.v1.DeductionAdminReq.header) + + return header_.ReleaseNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} +inline void DeductionAdminReq::set_allocated_header(std::string* header) { + if (header != nullptr) { + + } else { + + } + header_.SetAllocatedNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), header); + // @@protoc_insertion_point(field_set_allocated:protocol.payment.deduction.v1.DeductionAdminReq.header) +} + +#ifdef __GNUC__ + #pragma GCC diagnostic pop +#endif // __GNUC__ +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + + +// @@protoc_insertion_point(namespace_scope) + +} // namespace v1 +} // namespace deduction +} // namespace payment +} // namespace protocol + +// @@protoc_insertion_point(global_scope) + +#include +#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_deduction_2eproto diff --git a/apis/cpp/protocol/v1/fee.grpc.pb.cc b/apis/cpp/protocol/v1/fee.grpc.pb.cc deleted file mode 100644 index a175161..0000000 --- a/apis/cpp/protocol/v1/fee.grpc.pb.cc +++ /dev/null @@ -1,142 +0,0 @@ -// Generated by the gRPC C++ plugin. -// If you make any local change, they will be lost. -// source: fee.proto - -#include "fee.pb.h" -#include "fee.grpc.pb.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -namespace protocol { -namespace fee { -namespace v1 { - -static const char* FeeAdminApi_method_names[] = { - "/protocol.fee.v1.FeeAdminApi/Logout", - "/protocol.fee.v1.FeeAdminApi/AdminOp", -}; - -std::unique_ptr< FeeAdminApi::Stub> FeeAdminApi::NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options) { - (void)options; - std::unique_ptr< FeeAdminApi::Stub> stub(new FeeAdminApi::Stub(channel)); - return stub; -} - -FeeAdminApi::Stub::Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel) - : channel_(channel), rpcmethod_Logout_(FeeAdminApi_method_names[0], ::grpc::internal::RpcMethod::NORMAL_RPC, channel) - , rpcmethod_AdminOp_(FeeAdminApi_method_names[1], ::grpc::internal::RpcMethod::NORMAL_RPC, channel) - {} - -::grpc::Status FeeAdminApi::Stub::Logout(::grpc::ClientContext* context, const ::protocol::fee::v1::FeeAdminReq& request, ::protocol::fee::v1::FeeAdminResp* response) { - return ::grpc::internal::BlockingUnaryCall(channel_.get(), rpcmethod_Logout_, context, request, response); -} - -void FeeAdminApi::Stub::experimental_async::Logout(::grpc::ClientContext* context, const ::protocol::fee::v1::FeeAdminReq* request, ::protocol::fee::v1::FeeAdminResp* response, std::function f) { - ::grpc_impl::internal::CallbackUnaryCall(stub_->channel_.get(), stub_->rpcmethod_Logout_, context, request, response, std::move(f)); -} - -void FeeAdminApi::Stub::experimental_async::Logout(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::protocol::fee::v1::FeeAdminResp* response, std::function f) { - ::grpc_impl::internal::CallbackUnaryCall(stub_->channel_.get(), stub_->rpcmethod_Logout_, context, request, response, std::move(f)); -} - -void FeeAdminApi::Stub::experimental_async::Logout(::grpc::ClientContext* context, const ::protocol::fee::v1::FeeAdminReq* request, ::protocol::fee::v1::FeeAdminResp* response, ::grpc::experimental::ClientUnaryReactor* reactor) { - ::grpc_impl::internal::ClientCallbackUnaryFactory::Create(stub_->channel_.get(), stub_->rpcmethod_Logout_, context, request, response, reactor); -} - -void FeeAdminApi::Stub::experimental_async::Logout(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::protocol::fee::v1::FeeAdminResp* response, ::grpc::experimental::ClientUnaryReactor* reactor) { - ::grpc_impl::internal::ClientCallbackUnaryFactory::Create(stub_->channel_.get(), stub_->rpcmethod_Logout_, context, request, response, reactor); -} - -::grpc::ClientAsyncResponseReader< ::protocol::fee::v1::FeeAdminResp>* FeeAdminApi::Stub::AsyncLogoutRaw(::grpc::ClientContext* context, const ::protocol::fee::v1::FeeAdminReq& request, ::grpc::CompletionQueue* cq) { - return ::grpc_impl::internal::ClientAsyncResponseReaderFactory< ::protocol::fee::v1::FeeAdminResp>::Create(channel_.get(), cq, rpcmethod_Logout_, context, request, true); -} - -::grpc::ClientAsyncResponseReader< ::protocol::fee::v1::FeeAdminResp>* FeeAdminApi::Stub::PrepareAsyncLogoutRaw(::grpc::ClientContext* context, const ::protocol::fee::v1::FeeAdminReq& request, ::grpc::CompletionQueue* cq) { - return ::grpc_impl::internal::ClientAsyncResponseReaderFactory< ::protocol::fee::v1::FeeAdminResp>::Create(channel_.get(), cq, rpcmethod_Logout_, context, request, false); -} - -::grpc::Status FeeAdminApi::Stub::AdminOp(::grpc::ClientContext* context, const ::protocol::fee::v1::FeeAdminReq& request, ::protocol::fee::v1::FeeAdminResp* response) { - return ::grpc::internal::BlockingUnaryCall(channel_.get(), rpcmethod_AdminOp_, context, request, response); -} - -void FeeAdminApi::Stub::experimental_async::AdminOp(::grpc::ClientContext* context, const ::protocol::fee::v1::FeeAdminReq* request, ::protocol::fee::v1::FeeAdminResp* response, std::function f) { - ::grpc_impl::internal::CallbackUnaryCall(stub_->channel_.get(), stub_->rpcmethod_AdminOp_, context, request, response, std::move(f)); -} - -void FeeAdminApi::Stub::experimental_async::AdminOp(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::protocol::fee::v1::FeeAdminResp* response, std::function f) { - ::grpc_impl::internal::CallbackUnaryCall(stub_->channel_.get(), stub_->rpcmethod_AdminOp_, context, request, response, std::move(f)); -} - -void FeeAdminApi::Stub::experimental_async::AdminOp(::grpc::ClientContext* context, const ::protocol::fee::v1::FeeAdminReq* request, ::protocol::fee::v1::FeeAdminResp* response, ::grpc::experimental::ClientUnaryReactor* reactor) { - ::grpc_impl::internal::ClientCallbackUnaryFactory::Create(stub_->channel_.get(), stub_->rpcmethod_AdminOp_, context, request, response, reactor); -} - -void FeeAdminApi::Stub::experimental_async::AdminOp(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::protocol::fee::v1::FeeAdminResp* response, ::grpc::experimental::ClientUnaryReactor* reactor) { - ::grpc_impl::internal::ClientCallbackUnaryFactory::Create(stub_->channel_.get(), stub_->rpcmethod_AdminOp_, context, request, response, reactor); -} - -::grpc::ClientAsyncResponseReader< ::protocol::fee::v1::FeeAdminResp>* FeeAdminApi::Stub::AsyncAdminOpRaw(::grpc::ClientContext* context, const ::protocol::fee::v1::FeeAdminReq& request, ::grpc::CompletionQueue* cq) { - return ::grpc_impl::internal::ClientAsyncResponseReaderFactory< ::protocol::fee::v1::FeeAdminResp>::Create(channel_.get(), cq, rpcmethod_AdminOp_, context, request, true); -} - -::grpc::ClientAsyncResponseReader< ::protocol::fee::v1::FeeAdminResp>* FeeAdminApi::Stub::PrepareAsyncAdminOpRaw(::grpc::ClientContext* context, const ::protocol::fee::v1::FeeAdminReq& request, ::grpc::CompletionQueue* cq) { - return ::grpc_impl::internal::ClientAsyncResponseReaderFactory< ::protocol::fee::v1::FeeAdminResp>::Create(channel_.get(), cq, rpcmethod_AdminOp_, context, request, false); -} - -FeeAdminApi::Service::Service() { - AddMethod(new ::grpc::internal::RpcServiceMethod( - FeeAdminApi_method_names[0], - ::grpc::internal::RpcMethod::NORMAL_RPC, - new ::grpc::internal::RpcMethodHandler< FeeAdminApi::Service, ::protocol::fee::v1::FeeAdminReq, ::protocol::fee::v1::FeeAdminResp>( - [](FeeAdminApi::Service* service, - ::grpc_impl::ServerContext* ctx, - const ::protocol::fee::v1::FeeAdminReq* req, - ::protocol::fee::v1::FeeAdminResp* resp) { - return service->Logout(ctx, req, resp); - }, this))); - AddMethod(new ::grpc::internal::RpcServiceMethod( - FeeAdminApi_method_names[1], - ::grpc::internal::RpcMethod::NORMAL_RPC, - new ::grpc::internal::RpcMethodHandler< FeeAdminApi::Service, ::protocol::fee::v1::FeeAdminReq, ::protocol::fee::v1::FeeAdminResp>( - [](FeeAdminApi::Service* service, - ::grpc_impl::ServerContext* ctx, - const ::protocol::fee::v1::FeeAdminReq* req, - ::protocol::fee::v1::FeeAdminResp* resp) { - return service->AdminOp(ctx, req, resp); - }, this))); -} - -FeeAdminApi::Service::~Service() { -} - -::grpc::Status FeeAdminApi::Service::Logout(::grpc::ServerContext* context, const ::protocol::fee::v1::FeeAdminReq* request, ::protocol::fee::v1::FeeAdminResp* response) { - (void) context; - (void) request; - (void) response; - return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); -} - -::grpc::Status FeeAdminApi::Service::AdminOp(::grpc::ServerContext* context, const ::protocol::fee::v1::FeeAdminReq* request, ::protocol::fee::v1::FeeAdminResp* response) { - (void) context; - (void) request; - (void) response; - return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); -} - - -} // namespace protocol -} // namespace fee -} // namespace v1 - diff --git a/apis/cpp/protocol/v1/fee.grpc.pb.h b/apis/cpp/protocol/v1/fee.grpc.pb.h deleted file mode 100644 index e4c1921..0000000 --- a/apis/cpp/protocol/v1/fee.grpc.pb.h +++ /dev/null @@ -1,522 +0,0 @@ -// Generated by the gRPC C++ plugin. -// If you make any local change, they will be lost. -// source: fee.proto -#ifndef GRPC_fee_2eproto__INCLUDED -#define GRPC_fee_2eproto__INCLUDED - -#include "fee.pb.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace protocol { -namespace fee { -namespace v1 { - -// The greeting service definition. -class FeeAdminApi final { - public: - static constexpr char const* service_full_name() { - return "protocol.fee.v1.FeeAdminApi"; - } - class StubInterface { - public: - virtual ~StubInterface() {} - virtual ::grpc::Status Logout(::grpc::ClientContext* context, const ::protocol::fee::v1::FeeAdminReq& request, ::protocol::fee::v1::FeeAdminResp* response) = 0; - std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::protocol::fee::v1::FeeAdminResp>> AsyncLogout(::grpc::ClientContext* context, const ::protocol::fee::v1::FeeAdminReq& request, ::grpc::CompletionQueue* cq) { - return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::protocol::fee::v1::FeeAdminResp>>(AsyncLogoutRaw(context, request, cq)); - } - std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::protocol::fee::v1::FeeAdminResp>> PrepareAsyncLogout(::grpc::ClientContext* context, const ::protocol::fee::v1::FeeAdminReq& request, ::grpc::CompletionQueue* cq) { - return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::protocol::fee::v1::FeeAdminResp>>(PrepareAsyncLogoutRaw(context, request, cq)); - } - virtual ::grpc::Status AdminOp(::grpc::ClientContext* context, const ::protocol::fee::v1::FeeAdminReq& request, ::protocol::fee::v1::FeeAdminResp* response) = 0; - std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::protocol::fee::v1::FeeAdminResp>> AsyncAdminOp(::grpc::ClientContext* context, const ::protocol::fee::v1::FeeAdminReq& request, ::grpc::CompletionQueue* cq) { - return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::protocol::fee::v1::FeeAdminResp>>(AsyncAdminOpRaw(context, request, cq)); - } - std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::protocol::fee::v1::FeeAdminResp>> PrepareAsyncAdminOp(::grpc::ClientContext* context, const ::protocol::fee::v1::FeeAdminReq& request, ::grpc::CompletionQueue* cq) { - return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::protocol::fee::v1::FeeAdminResp>>(PrepareAsyncAdminOpRaw(context, request, cq)); - } - class experimental_async_interface { - public: - virtual ~experimental_async_interface() {} - virtual void Logout(::grpc::ClientContext* context, const ::protocol::fee::v1::FeeAdminReq* request, ::protocol::fee::v1::FeeAdminResp* response, std::function) = 0; - virtual void Logout(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::protocol::fee::v1::FeeAdminResp* response, std::function) = 0; - #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL - virtual void Logout(::grpc::ClientContext* context, const ::protocol::fee::v1::FeeAdminReq* request, ::protocol::fee::v1::FeeAdminResp* response, ::grpc::ClientUnaryReactor* reactor) = 0; - #else - virtual void Logout(::grpc::ClientContext* context, const ::protocol::fee::v1::FeeAdminReq* request, ::protocol::fee::v1::FeeAdminResp* response, ::grpc::experimental::ClientUnaryReactor* reactor) = 0; - #endif - #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL - virtual void Logout(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::protocol::fee::v1::FeeAdminResp* response, ::grpc::ClientUnaryReactor* reactor) = 0; - #else - virtual void Logout(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::protocol::fee::v1::FeeAdminResp* response, ::grpc::experimental::ClientUnaryReactor* reactor) = 0; - #endif - virtual void AdminOp(::grpc::ClientContext* context, const ::protocol::fee::v1::FeeAdminReq* request, ::protocol::fee::v1::FeeAdminResp* response, std::function) = 0; - virtual void AdminOp(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::protocol::fee::v1::FeeAdminResp* response, std::function) = 0; - #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL - virtual void AdminOp(::grpc::ClientContext* context, const ::protocol::fee::v1::FeeAdminReq* request, ::protocol::fee::v1::FeeAdminResp* response, ::grpc::ClientUnaryReactor* reactor) = 0; - #else - virtual void AdminOp(::grpc::ClientContext* context, const ::protocol::fee::v1::FeeAdminReq* request, ::protocol::fee::v1::FeeAdminResp* response, ::grpc::experimental::ClientUnaryReactor* reactor) = 0; - #endif - #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL - virtual void AdminOp(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::protocol::fee::v1::FeeAdminResp* response, ::grpc::ClientUnaryReactor* reactor) = 0; - #else - virtual void AdminOp(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::protocol::fee::v1::FeeAdminResp* response, ::grpc::experimental::ClientUnaryReactor* reactor) = 0; - #endif - }; - #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL - typedef class experimental_async_interface async_interface; - #endif - #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL - async_interface* async() { return experimental_async(); } - #endif - virtual class experimental_async_interface* experimental_async() { return nullptr; } - private: - virtual ::grpc::ClientAsyncResponseReaderInterface< ::protocol::fee::v1::FeeAdminResp>* AsyncLogoutRaw(::grpc::ClientContext* context, const ::protocol::fee::v1::FeeAdminReq& request, ::grpc::CompletionQueue* cq) = 0; - virtual ::grpc::ClientAsyncResponseReaderInterface< ::protocol::fee::v1::FeeAdminResp>* PrepareAsyncLogoutRaw(::grpc::ClientContext* context, const ::protocol::fee::v1::FeeAdminReq& request, ::grpc::CompletionQueue* cq) = 0; - virtual ::grpc::ClientAsyncResponseReaderInterface< ::protocol::fee::v1::FeeAdminResp>* AsyncAdminOpRaw(::grpc::ClientContext* context, const ::protocol::fee::v1::FeeAdminReq& request, ::grpc::CompletionQueue* cq) = 0; - virtual ::grpc::ClientAsyncResponseReaderInterface< ::protocol::fee::v1::FeeAdminResp>* PrepareAsyncAdminOpRaw(::grpc::ClientContext* context, const ::protocol::fee::v1::FeeAdminReq& request, ::grpc::CompletionQueue* cq) = 0; - }; - class Stub final : public StubInterface { - public: - Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel); - ::grpc::Status Logout(::grpc::ClientContext* context, const ::protocol::fee::v1::FeeAdminReq& request, ::protocol::fee::v1::FeeAdminResp* response) override; - std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::protocol::fee::v1::FeeAdminResp>> AsyncLogout(::grpc::ClientContext* context, const ::protocol::fee::v1::FeeAdminReq& request, ::grpc::CompletionQueue* cq) { - return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::protocol::fee::v1::FeeAdminResp>>(AsyncLogoutRaw(context, request, cq)); - } - std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::protocol::fee::v1::FeeAdminResp>> PrepareAsyncLogout(::grpc::ClientContext* context, const ::protocol::fee::v1::FeeAdminReq& request, ::grpc::CompletionQueue* cq) { - return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::protocol::fee::v1::FeeAdminResp>>(PrepareAsyncLogoutRaw(context, request, cq)); - } - ::grpc::Status AdminOp(::grpc::ClientContext* context, const ::protocol::fee::v1::FeeAdminReq& request, ::protocol::fee::v1::FeeAdminResp* response) override; - std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::protocol::fee::v1::FeeAdminResp>> AsyncAdminOp(::grpc::ClientContext* context, const ::protocol::fee::v1::FeeAdminReq& request, ::grpc::CompletionQueue* cq) { - return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::protocol::fee::v1::FeeAdminResp>>(AsyncAdminOpRaw(context, request, cq)); - } - std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::protocol::fee::v1::FeeAdminResp>> PrepareAsyncAdminOp(::grpc::ClientContext* context, const ::protocol::fee::v1::FeeAdminReq& request, ::grpc::CompletionQueue* cq) { - return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::protocol::fee::v1::FeeAdminResp>>(PrepareAsyncAdminOpRaw(context, request, cq)); - } - class experimental_async final : - public StubInterface::experimental_async_interface { - public: - void Logout(::grpc::ClientContext* context, const ::protocol::fee::v1::FeeAdminReq* request, ::protocol::fee::v1::FeeAdminResp* response, std::function) override; - void Logout(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::protocol::fee::v1::FeeAdminResp* response, std::function) override; - #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL - void Logout(::grpc::ClientContext* context, const ::protocol::fee::v1::FeeAdminReq* request, ::protocol::fee::v1::FeeAdminResp* response, ::grpc::ClientUnaryReactor* reactor) override; - #else - void Logout(::grpc::ClientContext* context, const ::protocol::fee::v1::FeeAdminReq* request, ::protocol::fee::v1::FeeAdminResp* response, ::grpc::experimental::ClientUnaryReactor* reactor) override; - #endif - #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL - void Logout(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::protocol::fee::v1::FeeAdminResp* response, ::grpc::ClientUnaryReactor* reactor) override; - #else - void Logout(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::protocol::fee::v1::FeeAdminResp* response, ::grpc::experimental::ClientUnaryReactor* reactor) override; - #endif - void AdminOp(::grpc::ClientContext* context, const ::protocol::fee::v1::FeeAdminReq* request, ::protocol::fee::v1::FeeAdminResp* response, std::function) override; - void AdminOp(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::protocol::fee::v1::FeeAdminResp* response, std::function) override; - #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL - void AdminOp(::grpc::ClientContext* context, const ::protocol::fee::v1::FeeAdminReq* request, ::protocol::fee::v1::FeeAdminResp* response, ::grpc::ClientUnaryReactor* reactor) override; - #else - void AdminOp(::grpc::ClientContext* context, const ::protocol::fee::v1::FeeAdminReq* request, ::protocol::fee::v1::FeeAdminResp* response, ::grpc::experimental::ClientUnaryReactor* reactor) override; - #endif - #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL - void AdminOp(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::protocol::fee::v1::FeeAdminResp* response, ::grpc::ClientUnaryReactor* reactor) override; - #else - void AdminOp(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::protocol::fee::v1::FeeAdminResp* response, ::grpc::experimental::ClientUnaryReactor* reactor) override; - #endif - private: - friend class Stub; - explicit experimental_async(Stub* stub): stub_(stub) { } - Stub* stub() { return stub_; } - Stub* stub_; - }; - class experimental_async_interface* experimental_async() override { return &async_stub_; } - - private: - std::shared_ptr< ::grpc::ChannelInterface> channel_; - class experimental_async async_stub_{this}; - ::grpc::ClientAsyncResponseReader< ::protocol::fee::v1::FeeAdminResp>* AsyncLogoutRaw(::grpc::ClientContext* context, const ::protocol::fee::v1::FeeAdminReq& request, ::grpc::CompletionQueue* cq) override; - ::grpc::ClientAsyncResponseReader< ::protocol::fee::v1::FeeAdminResp>* PrepareAsyncLogoutRaw(::grpc::ClientContext* context, const ::protocol::fee::v1::FeeAdminReq& request, ::grpc::CompletionQueue* cq) override; - ::grpc::ClientAsyncResponseReader< ::protocol::fee::v1::FeeAdminResp>* AsyncAdminOpRaw(::grpc::ClientContext* context, const ::protocol::fee::v1::FeeAdminReq& request, ::grpc::CompletionQueue* cq) override; - ::grpc::ClientAsyncResponseReader< ::protocol::fee::v1::FeeAdminResp>* PrepareAsyncAdminOpRaw(::grpc::ClientContext* context, const ::protocol::fee::v1::FeeAdminReq& request, ::grpc::CompletionQueue* cq) override; - const ::grpc::internal::RpcMethod rpcmethod_Logout_; - const ::grpc::internal::RpcMethod rpcmethod_AdminOp_; - }; - static std::unique_ptr NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options = ::grpc::StubOptions()); - - class Service : public ::grpc::Service { - public: - Service(); - virtual ~Service(); - virtual ::grpc::Status Logout(::grpc::ServerContext* context, const ::protocol::fee::v1::FeeAdminReq* request, ::protocol::fee::v1::FeeAdminResp* response); - virtual ::grpc::Status AdminOp(::grpc::ServerContext* context, const ::protocol::fee::v1::FeeAdminReq* request, ::protocol::fee::v1::FeeAdminResp* response); - }; - template - class WithAsyncMethod_Logout : public BaseClass { - private: - void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} - public: - WithAsyncMethod_Logout() { - ::grpc::Service::MarkMethodAsync(0); - } - ~WithAsyncMethod_Logout() override { - BaseClassMustBeDerivedFromService(this); - } - // disable synchronous version of this method - ::grpc::Status Logout(::grpc::ServerContext* /*context*/, const ::protocol::fee::v1::FeeAdminReq* /*request*/, ::protocol::fee::v1::FeeAdminResp* /*response*/) override { - abort(); - return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); - } - void RequestLogout(::grpc::ServerContext* context, ::protocol::fee::v1::FeeAdminReq* request, ::grpc::ServerAsyncResponseWriter< ::protocol::fee::v1::FeeAdminResp>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { - ::grpc::Service::RequestAsyncUnary(0, context, request, response, new_call_cq, notification_cq, tag); - } - }; - template - class WithAsyncMethod_AdminOp : public BaseClass { - private: - void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} - public: - WithAsyncMethod_AdminOp() { - ::grpc::Service::MarkMethodAsync(1); - } - ~WithAsyncMethod_AdminOp() override { - BaseClassMustBeDerivedFromService(this); - } - // disable synchronous version of this method - ::grpc::Status AdminOp(::grpc::ServerContext* /*context*/, const ::protocol::fee::v1::FeeAdminReq* /*request*/, ::protocol::fee::v1::FeeAdminResp* /*response*/) override { - abort(); - return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); - } - void RequestAdminOp(::grpc::ServerContext* context, ::protocol::fee::v1::FeeAdminReq* request, ::grpc::ServerAsyncResponseWriter< ::protocol::fee::v1::FeeAdminResp>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { - ::grpc::Service::RequestAsyncUnary(1, context, request, response, new_call_cq, notification_cq, tag); - } - }; - typedef WithAsyncMethod_Logout > AsyncService; - template - class ExperimentalWithCallbackMethod_Logout : public BaseClass { - private: - void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} - public: - ExperimentalWithCallbackMethod_Logout() { - #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL - ::grpc::Service:: - #else - ::grpc::Service::experimental(). - #endif - MarkMethodCallback(0, - new ::grpc_impl::internal::CallbackUnaryHandler< ::protocol::fee::v1::FeeAdminReq, ::protocol::fee::v1::FeeAdminResp>( - [this]( - #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL - ::grpc::CallbackServerContext* - #else - ::grpc::experimental::CallbackServerContext* - #endif - context, const ::protocol::fee::v1::FeeAdminReq* request, ::protocol::fee::v1::FeeAdminResp* response) { return this->Logout(context, request, response); }));} - void SetMessageAllocatorFor_Logout( - ::grpc::experimental::MessageAllocator< ::protocol::fee::v1::FeeAdminReq, ::protocol::fee::v1::FeeAdminResp>* allocator) { - #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL - ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(0); - #else - ::grpc::internal::MethodHandler* const handler = ::grpc::Service::experimental().GetHandler(0); - #endif - static_cast<::grpc_impl::internal::CallbackUnaryHandler< ::protocol::fee::v1::FeeAdminReq, ::protocol::fee::v1::FeeAdminResp>*>(handler) - ->SetMessageAllocator(allocator); - } - ~ExperimentalWithCallbackMethod_Logout() override { - BaseClassMustBeDerivedFromService(this); - } - // disable synchronous version of this method - ::grpc::Status Logout(::grpc::ServerContext* /*context*/, const ::protocol::fee::v1::FeeAdminReq* /*request*/, ::protocol::fee::v1::FeeAdminResp* /*response*/) override { - abort(); - return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); - } - #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL - virtual ::grpc::ServerUnaryReactor* Logout( - ::grpc::CallbackServerContext* /*context*/, const ::protocol::fee::v1::FeeAdminReq* /*request*/, ::protocol::fee::v1::FeeAdminResp* /*response*/) - #else - virtual ::grpc::experimental::ServerUnaryReactor* Logout( - ::grpc::experimental::CallbackServerContext* /*context*/, const ::protocol::fee::v1::FeeAdminReq* /*request*/, ::protocol::fee::v1::FeeAdminResp* /*response*/) - #endif - { return nullptr; } - }; - template - class ExperimentalWithCallbackMethod_AdminOp : public BaseClass { - private: - void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} - public: - ExperimentalWithCallbackMethod_AdminOp() { - #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL - ::grpc::Service:: - #else - ::grpc::Service::experimental(). - #endif - MarkMethodCallback(1, - new ::grpc_impl::internal::CallbackUnaryHandler< ::protocol::fee::v1::FeeAdminReq, ::protocol::fee::v1::FeeAdminResp>( - [this]( - #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL - ::grpc::CallbackServerContext* - #else - ::grpc::experimental::CallbackServerContext* - #endif - context, const ::protocol::fee::v1::FeeAdminReq* request, ::protocol::fee::v1::FeeAdminResp* response) { return this->AdminOp(context, request, response); }));} - void SetMessageAllocatorFor_AdminOp( - ::grpc::experimental::MessageAllocator< ::protocol::fee::v1::FeeAdminReq, ::protocol::fee::v1::FeeAdminResp>* allocator) { - #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL - ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(1); - #else - ::grpc::internal::MethodHandler* const handler = ::grpc::Service::experimental().GetHandler(1); - #endif - static_cast<::grpc_impl::internal::CallbackUnaryHandler< ::protocol::fee::v1::FeeAdminReq, ::protocol::fee::v1::FeeAdminResp>*>(handler) - ->SetMessageAllocator(allocator); - } - ~ExperimentalWithCallbackMethod_AdminOp() override { - BaseClassMustBeDerivedFromService(this); - } - // disable synchronous version of this method - ::grpc::Status AdminOp(::grpc::ServerContext* /*context*/, const ::protocol::fee::v1::FeeAdminReq* /*request*/, ::protocol::fee::v1::FeeAdminResp* /*response*/) override { - abort(); - return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); - } - #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL - virtual ::grpc::ServerUnaryReactor* AdminOp( - ::grpc::CallbackServerContext* /*context*/, const ::protocol::fee::v1::FeeAdminReq* /*request*/, ::protocol::fee::v1::FeeAdminResp* /*response*/) - #else - virtual ::grpc::experimental::ServerUnaryReactor* AdminOp( - ::grpc::experimental::CallbackServerContext* /*context*/, const ::protocol::fee::v1::FeeAdminReq* /*request*/, ::protocol::fee::v1::FeeAdminResp* /*response*/) - #endif - { return nullptr; } - }; - #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL - typedef ExperimentalWithCallbackMethod_Logout > CallbackService; - #endif - - typedef ExperimentalWithCallbackMethod_Logout > ExperimentalCallbackService; - template - class WithGenericMethod_Logout : public BaseClass { - private: - void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} - public: - WithGenericMethod_Logout() { - ::grpc::Service::MarkMethodGeneric(0); - } - ~WithGenericMethod_Logout() override { - BaseClassMustBeDerivedFromService(this); - } - // disable synchronous version of this method - ::grpc::Status Logout(::grpc::ServerContext* /*context*/, const ::protocol::fee::v1::FeeAdminReq* /*request*/, ::protocol::fee::v1::FeeAdminResp* /*response*/) override { - abort(); - return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); - } - }; - template - class WithGenericMethod_AdminOp : public BaseClass { - private: - void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} - public: - WithGenericMethod_AdminOp() { - ::grpc::Service::MarkMethodGeneric(1); - } - ~WithGenericMethod_AdminOp() override { - BaseClassMustBeDerivedFromService(this); - } - // disable synchronous version of this method - ::grpc::Status AdminOp(::grpc::ServerContext* /*context*/, const ::protocol::fee::v1::FeeAdminReq* /*request*/, ::protocol::fee::v1::FeeAdminResp* /*response*/) override { - abort(); - return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); - } - }; - template - class WithRawMethod_Logout : public BaseClass { - private: - void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} - public: - WithRawMethod_Logout() { - ::grpc::Service::MarkMethodRaw(0); - } - ~WithRawMethod_Logout() override { - BaseClassMustBeDerivedFromService(this); - } - // disable synchronous version of this method - ::grpc::Status Logout(::grpc::ServerContext* /*context*/, const ::protocol::fee::v1::FeeAdminReq* /*request*/, ::protocol::fee::v1::FeeAdminResp* /*response*/) override { - abort(); - return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); - } - void RequestLogout(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { - ::grpc::Service::RequestAsyncUnary(0, context, request, response, new_call_cq, notification_cq, tag); - } - }; - template - class WithRawMethod_AdminOp : public BaseClass { - private: - void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} - public: - WithRawMethod_AdminOp() { - ::grpc::Service::MarkMethodRaw(1); - } - ~WithRawMethod_AdminOp() override { - BaseClassMustBeDerivedFromService(this); - } - // disable synchronous version of this method - ::grpc::Status AdminOp(::grpc::ServerContext* /*context*/, const ::protocol::fee::v1::FeeAdminReq* /*request*/, ::protocol::fee::v1::FeeAdminResp* /*response*/) override { - abort(); - return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); - } - void RequestAdminOp(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { - ::grpc::Service::RequestAsyncUnary(1, context, request, response, new_call_cq, notification_cq, tag); - } - }; - template - class ExperimentalWithRawCallbackMethod_Logout : public BaseClass { - private: - void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} - public: - ExperimentalWithRawCallbackMethod_Logout() { - #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL - ::grpc::Service:: - #else - ::grpc::Service::experimental(). - #endif - MarkMethodRawCallback(0, - new ::grpc_impl::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( - [this]( - #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL - ::grpc::CallbackServerContext* - #else - ::grpc::experimental::CallbackServerContext* - #endif - context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->Logout(context, request, response); })); - } - ~ExperimentalWithRawCallbackMethod_Logout() override { - BaseClassMustBeDerivedFromService(this); - } - // disable synchronous version of this method - ::grpc::Status Logout(::grpc::ServerContext* /*context*/, const ::protocol::fee::v1::FeeAdminReq* /*request*/, ::protocol::fee::v1::FeeAdminResp* /*response*/) override { - abort(); - return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); - } - #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL - virtual ::grpc::ServerUnaryReactor* Logout( - ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) - #else - virtual ::grpc::experimental::ServerUnaryReactor* Logout( - ::grpc::experimental::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) - #endif - { return nullptr; } - }; - template - class ExperimentalWithRawCallbackMethod_AdminOp : public BaseClass { - private: - void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} - public: - ExperimentalWithRawCallbackMethod_AdminOp() { - #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL - ::grpc::Service:: - #else - ::grpc::Service::experimental(). - #endif - MarkMethodRawCallback(1, - new ::grpc_impl::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( - [this]( - #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL - ::grpc::CallbackServerContext* - #else - ::grpc::experimental::CallbackServerContext* - #endif - context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->AdminOp(context, request, response); })); - } - ~ExperimentalWithRawCallbackMethod_AdminOp() override { - BaseClassMustBeDerivedFromService(this); - } - // disable synchronous version of this method - ::grpc::Status AdminOp(::grpc::ServerContext* /*context*/, const ::protocol::fee::v1::FeeAdminReq* /*request*/, ::protocol::fee::v1::FeeAdminResp* /*response*/) override { - abort(); - return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); - } - #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL - virtual ::grpc::ServerUnaryReactor* AdminOp( - ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) - #else - virtual ::grpc::experimental::ServerUnaryReactor* AdminOp( - ::grpc::experimental::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) - #endif - { return nullptr; } - }; - template - class WithStreamedUnaryMethod_Logout : public BaseClass { - private: - void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} - public: - WithStreamedUnaryMethod_Logout() { - ::grpc::Service::MarkMethodStreamed(0, - new ::grpc::internal::StreamedUnaryHandler< - ::protocol::fee::v1::FeeAdminReq, ::protocol::fee::v1::FeeAdminResp>( - [this](::grpc_impl::ServerContext* context, - ::grpc_impl::ServerUnaryStreamer< - ::protocol::fee::v1::FeeAdminReq, ::protocol::fee::v1::FeeAdminResp>* streamer) { - return this->StreamedLogout(context, - streamer); - })); - } - ~WithStreamedUnaryMethod_Logout() override { - BaseClassMustBeDerivedFromService(this); - } - // disable regular version of this method - ::grpc::Status Logout(::grpc::ServerContext* /*context*/, const ::protocol::fee::v1::FeeAdminReq* /*request*/, ::protocol::fee::v1::FeeAdminResp* /*response*/) override { - abort(); - return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); - } - // replace default version of method with streamed unary - virtual ::grpc::Status StreamedLogout(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::protocol::fee::v1::FeeAdminReq,::protocol::fee::v1::FeeAdminResp>* server_unary_streamer) = 0; - }; - template - class WithStreamedUnaryMethod_AdminOp : public BaseClass { - private: - void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} - public: - WithStreamedUnaryMethod_AdminOp() { - ::grpc::Service::MarkMethodStreamed(1, - new ::grpc::internal::StreamedUnaryHandler< - ::protocol::fee::v1::FeeAdminReq, ::protocol::fee::v1::FeeAdminResp>( - [this](::grpc_impl::ServerContext* context, - ::grpc_impl::ServerUnaryStreamer< - ::protocol::fee::v1::FeeAdminReq, ::protocol::fee::v1::FeeAdminResp>* streamer) { - return this->StreamedAdminOp(context, - streamer); - })); - } - ~WithStreamedUnaryMethod_AdminOp() override { - BaseClassMustBeDerivedFromService(this); - } - // disable regular version of this method - ::grpc::Status AdminOp(::grpc::ServerContext* /*context*/, const ::protocol::fee::v1::FeeAdminReq* /*request*/, ::protocol::fee::v1::FeeAdminResp* /*response*/) override { - abort(); - return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); - } - // replace default version of method with streamed unary - virtual ::grpc::Status StreamedAdminOp(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::protocol::fee::v1::FeeAdminReq,::protocol::fee::v1::FeeAdminResp>* server_unary_streamer) = 0; - }; - typedef WithStreamedUnaryMethod_Logout > StreamedUnaryService; - typedef Service SplitStreamedService; - typedef WithStreamedUnaryMethod_Logout > StreamedService; -}; - -} // namespace v1 -} // namespace fee -} // namespace protocol - - -#endif // GRPC_fee_2eproto__INCLUDED diff --git a/apis/cpp/protocol/v1/fee.pb.cc b/apis/cpp/protocol/v1/fee.pb.cc deleted file mode 100644 index aae8b46..0000000 --- a/apis/cpp/protocol/v1/fee.pb.cc +++ /dev/null @@ -1,610 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: fee.proto - -#include "fee.pb.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -// @@protoc_insertion_point(includes) -#include -namespace protocol { -namespace fee { -namespace v1 { -class FeeAdminRespDefaultTypeInternal { - public: - ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; -} _FeeAdminResp_default_instance_; -class FeeAdminReqDefaultTypeInternal { - public: - ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; -} _FeeAdminReq_default_instance_; -} // namespace v1 -} // namespace fee -} // namespace protocol -static void InitDefaultsscc_info_FeeAdminReq_fee_2eproto() { - GOOGLE_PROTOBUF_VERIFY_VERSION; - - { - void* ptr = &::protocol::fee::v1::_FeeAdminReq_default_instance_; - new (ptr) ::protocol::fee::v1::FeeAdminReq(); - ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); - } - ::protocol::fee::v1::FeeAdminReq::InitAsDefaultInstance(); -} - -::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_FeeAdminReq_fee_2eproto = - {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_FeeAdminReq_fee_2eproto}, {}}; - -static void InitDefaultsscc_info_FeeAdminResp_fee_2eproto() { - GOOGLE_PROTOBUF_VERIFY_VERSION; - - { - void* ptr = &::protocol::fee::v1::_FeeAdminResp_default_instance_; - new (ptr) ::protocol::fee::v1::FeeAdminResp(); - ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); - } - ::protocol::fee::v1::FeeAdminResp::InitAsDefaultInstance(); -} - -::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_FeeAdminResp_fee_2eproto = - {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_FeeAdminResp_fee_2eproto}, {}}; - -static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_fee_2eproto[2]; -static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_fee_2eproto = nullptr; -static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_fee_2eproto = nullptr; - -const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_fee_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(::protocol::fee::v1::FeeAdminResp, _internal_metadata_), - ~0u, // no _extensions_ - ~0u, // no _oneof_case_ - ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(::protocol::fee::v1::FeeAdminResp, cmd_), - PROTOBUF_FIELD_OFFSET(::protocol::fee::v1::FeeAdminResp, result_), - ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(::protocol::fee::v1::FeeAdminReq, _internal_metadata_), - ~0u, // no _extensions_ - ~0u, // no _oneof_case_ - ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(::protocol::fee::v1::FeeAdminReq, cmd_), - PROTOBUF_FIELD_OFFSET(::protocol::fee::v1::FeeAdminReq, header_), -}; -static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - { 0, -1, sizeof(::protocol::fee::v1::FeeAdminResp)}, - { 7, -1, sizeof(::protocol::fee::v1::FeeAdminReq)}, -}; - -static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = { - reinterpret_cast(&::protocol::fee::v1::_FeeAdminResp_default_instance_), - reinterpret_cast(&::protocol::fee::v1::_FeeAdminReq_default_instance_), -}; - -const char descriptor_table_protodef_fee_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = - "\n\tfee.proto\022\017protocol.fee.v1\"+\n\014FeeAdmin" - "Resp\022\013\n\003cmd\030\001 \001(\t\022\016\n\006result\030\002 \001(\t\"*\n\013Fee" - "AdminReq\022\013\n\003cmd\030\001 \001(\t\022\016\n\006header\030\002 \001(\t2\240\001" - "\n\013FeeAdminApi\022G\n\006Logout\022\034.protocol.fee.v" - "1.FeeAdminReq\032\035.protocol.fee.v1.FeeAdmin" - "Resp\"\000\022H\n\007AdminOp\022\034.protocol.fee.v1.FeeA" - "dminReq\032\035.protocol.fee.v1.FeeAdminResp\"\000" - "b\006proto3" - ; -static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_fee_2eproto_deps[1] = { -}; -static ::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase*const descriptor_table_fee_2eproto_sccs[2] = { - &scc_info_FeeAdminReq_fee_2eproto.base, - &scc_info_FeeAdminResp_fee_2eproto.base, -}; -static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_fee_2eproto_once; -static bool descriptor_table_fee_2eproto_initialized = false; -const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_fee_2eproto = { - &descriptor_table_fee_2eproto_initialized, descriptor_table_protodef_fee_2eproto, "fee.proto", 288, - &descriptor_table_fee_2eproto_once, descriptor_table_fee_2eproto_sccs, descriptor_table_fee_2eproto_deps, 2, 0, - schemas, file_default_instances, TableStruct_fee_2eproto::offsets, - file_level_metadata_fee_2eproto, 2, file_level_enum_descriptors_fee_2eproto, file_level_service_descriptors_fee_2eproto, -}; - -// Force running AddDescriptors() at dynamic initialization time. -static bool dynamic_init_dummy_fee_2eproto = ( ::PROTOBUF_NAMESPACE_ID::internal::AddDescriptors(&descriptor_table_fee_2eproto), true); -namespace protocol { -namespace fee { -namespace v1 { - -// =================================================================== - -void FeeAdminResp::InitAsDefaultInstance() { -} -class FeeAdminResp::_Internal { - public: -}; - -FeeAdminResp::FeeAdminResp() - : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) { - SharedCtor(); - // @@protoc_insertion_point(constructor:protocol.fee.v1.FeeAdminResp) -} -FeeAdminResp::FeeAdminResp(const FeeAdminResp& from) - : ::PROTOBUF_NAMESPACE_ID::Message(), - _internal_metadata_(nullptr) { - _internal_metadata_.MergeFrom(from._internal_metadata_); - cmd_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); - if (!from._internal_cmd().empty()) { - cmd_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.cmd_); - } - result_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); - if (!from._internal_result().empty()) { - result_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.result_); - } - // @@protoc_insertion_point(copy_constructor:protocol.fee.v1.FeeAdminResp) -} - -void FeeAdminResp::SharedCtor() { - ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_FeeAdminResp_fee_2eproto.base); - cmd_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); - result_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); -} - -FeeAdminResp::~FeeAdminResp() { - // @@protoc_insertion_point(destructor:protocol.fee.v1.FeeAdminResp) - SharedDtor(); -} - -void FeeAdminResp::SharedDtor() { - cmd_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); - result_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); -} - -void FeeAdminResp::SetCachedSize(int size) const { - _cached_size_.Set(size); -} -const FeeAdminResp& FeeAdminResp::default_instance() { - ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_FeeAdminResp_fee_2eproto.base); - return *internal_default_instance(); -} - - -void FeeAdminResp::Clear() { -// @@protoc_insertion_point(message_clear_start:protocol.fee.v1.FeeAdminResp) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - cmd_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); - result_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); - _internal_metadata_.Clear(); -} - -const char* FeeAdminResp::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { -#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure - while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); - CHK_(ptr); - switch (tag >> 3) { - // string cmd = 1; - case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { - auto str = _internal_mutable_cmd(); - ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); - CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "protocol.fee.v1.FeeAdminResp.cmd")); - CHK_(ptr); - } else goto handle_unusual; - continue; - // string result = 2; - case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { - auto str = _internal_mutable_result(); - ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); - CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "protocol.fee.v1.FeeAdminResp.result")); - CHK_(ptr); - } else goto handle_unusual; - continue; - default: { - handle_unusual: - if ((tag & 7) == 4 || tag == 0) { - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx); - CHK_(ptr != nullptr); - continue; - } - } // switch - } // while -success: - return ptr; -failure: - ptr = nullptr; - goto success; -#undef CHK_ -} - -::PROTOBUF_NAMESPACE_ID::uint8* FeeAdminResp::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { - // @@protoc_insertion_point(serialize_to_array_start:protocol.fee.v1.FeeAdminResp) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - // string cmd = 1; - if (this->cmd().size() > 0) { - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( - this->_internal_cmd().data(), static_cast(this->_internal_cmd().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, - "protocol.fee.v1.FeeAdminResp.cmd"); - target = stream->WriteStringMaybeAliased( - 1, this->_internal_cmd(), target); - } - - // string result = 2; - if (this->result().size() > 0) { - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( - this->_internal_result().data(), static_cast(this->_internal_result().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, - "protocol.fee.v1.FeeAdminResp.result"); - target = stream->WriteStringMaybeAliased( - 2, this->_internal_result(), target); - } - - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( - _internal_metadata_.unknown_fields(), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:protocol.fee.v1.FeeAdminResp) - return target; -} - -size_t FeeAdminResp::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:protocol.fee.v1.FeeAdminResp) - size_t total_size = 0; - - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - // string cmd = 1; - if (this->cmd().size() > 0) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( - this->_internal_cmd()); - } - - // string result = 2; - if (this->result().size() > 0) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( - this->_internal_result()); - } - - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; -} - -void FeeAdminResp::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_merge_from_start:protocol.fee.v1.FeeAdminResp) - GOOGLE_DCHECK_NE(&from, this); - const FeeAdminResp* source = - ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated( - &from); - if (source == nullptr) { - // @@protoc_insertion_point(generalized_merge_from_cast_fail:protocol.fee.v1.FeeAdminResp) - ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); - } else { - // @@protoc_insertion_point(generalized_merge_from_cast_success:protocol.fee.v1.FeeAdminResp) - MergeFrom(*source); - } -} - -void FeeAdminResp::MergeFrom(const FeeAdminResp& from) { -// @@protoc_insertion_point(class_specific_merge_from_start:protocol.fee.v1.FeeAdminResp) - GOOGLE_DCHECK_NE(&from, this); - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - if (from.cmd().size() > 0) { - - cmd_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.cmd_); - } - if (from.result().size() > 0) { - - result_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.result_); - } -} - -void FeeAdminResp::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_copy_from_start:protocol.fee.v1.FeeAdminResp) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -void FeeAdminResp::CopyFrom(const FeeAdminResp& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:protocol.fee.v1.FeeAdminResp) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool FeeAdminResp::IsInitialized() const { - return true; -} - -void FeeAdminResp::InternalSwap(FeeAdminResp* other) { - using std::swap; - _internal_metadata_.Swap(&other->_internal_metadata_); - cmd_.Swap(&other->cmd_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - GetArenaNoVirtual()); - result_.Swap(&other->result_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - GetArenaNoVirtual()); -} - -::PROTOBUF_NAMESPACE_ID::Metadata FeeAdminResp::GetMetadata() const { - return GetMetadataStatic(); -} - - -// =================================================================== - -void FeeAdminReq::InitAsDefaultInstance() { -} -class FeeAdminReq::_Internal { - public: -}; - -FeeAdminReq::FeeAdminReq() - : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) { - SharedCtor(); - // @@protoc_insertion_point(constructor:protocol.fee.v1.FeeAdminReq) -} -FeeAdminReq::FeeAdminReq(const FeeAdminReq& from) - : ::PROTOBUF_NAMESPACE_ID::Message(), - _internal_metadata_(nullptr) { - _internal_metadata_.MergeFrom(from._internal_metadata_); - cmd_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); - if (!from._internal_cmd().empty()) { - cmd_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.cmd_); - } - header_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); - if (!from._internal_header().empty()) { - header_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.header_); - } - // @@protoc_insertion_point(copy_constructor:protocol.fee.v1.FeeAdminReq) -} - -void FeeAdminReq::SharedCtor() { - ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_FeeAdminReq_fee_2eproto.base); - cmd_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); - header_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); -} - -FeeAdminReq::~FeeAdminReq() { - // @@protoc_insertion_point(destructor:protocol.fee.v1.FeeAdminReq) - SharedDtor(); -} - -void FeeAdminReq::SharedDtor() { - cmd_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); - header_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); -} - -void FeeAdminReq::SetCachedSize(int size) const { - _cached_size_.Set(size); -} -const FeeAdminReq& FeeAdminReq::default_instance() { - ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_FeeAdminReq_fee_2eproto.base); - return *internal_default_instance(); -} - - -void FeeAdminReq::Clear() { -// @@protoc_insertion_point(message_clear_start:protocol.fee.v1.FeeAdminReq) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - cmd_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); - header_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); - _internal_metadata_.Clear(); -} - -const char* FeeAdminReq::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { -#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure - while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); - CHK_(ptr); - switch (tag >> 3) { - // string cmd = 1; - case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { - auto str = _internal_mutable_cmd(); - ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); - CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "protocol.fee.v1.FeeAdminReq.cmd")); - CHK_(ptr); - } else goto handle_unusual; - continue; - // string header = 2; - case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { - auto str = _internal_mutable_header(); - ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); - CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "protocol.fee.v1.FeeAdminReq.header")); - CHK_(ptr); - } else goto handle_unusual; - continue; - default: { - handle_unusual: - if ((tag & 7) == 4 || tag == 0) { - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx); - CHK_(ptr != nullptr); - continue; - } - } // switch - } // while -success: - return ptr; -failure: - ptr = nullptr; - goto success; -#undef CHK_ -} - -::PROTOBUF_NAMESPACE_ID::uint8* FeeAdminReq::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { - // @@protoc_insertion_point(serialize_to_array_start:protocol.fee.v1.FeeAdminReq) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - // string cmd = 1; - if (this->cmd().size() > 0) { - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( - this->_internal_cmd().data(), static_cast(this->_internal_cmd().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, - "protocol.fee.v1.FeeAdminReq.cmd"); - target = stream->WriteStringMaybeAliased( - 1, this->_internal_cmd(), target); - } - - // string header = 2; - if (this->header().size() > 0) { - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( - this->_internal_header().data(), static_cast(this->_internal_header().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, - "protocol.fee.v1.FeeAdminReq.header"); - target = stream->WriteStringMaybeAliased( - 2, this->_internal_header(), target); - } - - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( - _internal_metadata_.unknown_fields(), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:protocol.fee.v1.FeeAdminReq) - return target; -} - -size_t FeeAdminReq::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:protocol.fee.v1.FeeAdminReq) - size_t total_size = 0; - - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - // string cmd = 1; - if (this->cmd().size() > 0) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( - this->_internal_cmd()); - } - - // string header = 2; - if (this->header().size() > 0) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( - this->_internal_header()); - } - - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; -} - -void FeeAdminReq::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_merge_from_start:protocol.fee.v1.FeeAdminReq) - GOOGLE_DCHECK_NE(&from, this); - const FeeAdminReq* source = - ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated( - &from); - if (source == nullptr) { - // @@protoc_insertion_point(generalized_merge_from_cast_fail:protocol.fee.v1.FeeAdminReq) - ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); - } else { - // @@protoc_insertion_point(generalized_merge_from_cast_success:protocol.fee.v1.FeeAdminReq) - MergeFrom(*source); - } -} - -void FeeAdminReq::MergeFrom(const FeeAdminReq& from) { -// @@protoc_insertion_point(class_specific_merge_from_start:protocol.fee.v1.FeeAdminReq) - GOOGLE_DCHECK_NE(&from, this); - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - if (from.cmd().size() > 0) { - - cmd_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.cmd_); - } - if (from.header().size() > 0) { - - header_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.header_); - } -} - -void FeeAdminReq::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_copy_from_start:protocol.fee.v1.FeeAdminReq) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -void FeeAdminReq::CopyFrom(const FeeAdminReq& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:protocol.fee.v1.FeeAdminReq) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool FeeAdminReq::IsInitialized() const { - return true; -} - -void FeeAdminReq::InternalSwap(FeeAdminReq* other) { - using std::swap; - _internal_metadata_.Swap(&other->_internal_metadata_); - cmd_.Swap(&other->cmd_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - GetArenaNoVirtual()); - header_.Swap(&other->header_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - GetArenaNoVirtual()); -} - -::PROTOBUF_NAMESPACE_ID::Metadata FeeAdminReq::GetMetadata() const { - return GetMetadataStatic(); -} - - -// @@protoc_insertion_point(namespace_scope) -} // namespace v1 -} // namespace fee -} // namespace protocol -PROTOBUF_NAMESPACE_OPEN -template<> PROTOBUF_NOINLINE ::protocol::fee::v1::FeeAdminResp* Arena::CreateMaybeMessage< ::protocol::fee::v1::FeeAdminResp >(Arena* arena) { - return Arena::CreateInternal< ::protocol::fee::v1::FeeAdminResp >(arena); -} -template<> PROTOBUF_NOINLINE ::protocol::fee::v1::FeeAdminReq* Arena::CreateMaybeMessage< ::protocol::fee::v1::FeeAdminReq >(Arena* arena) { - return Arena::CreateInternal< ::protocol::fee::v1::FeeAdminReq >(arena); -} -PROTOBUF_NAMESPACE_CLOSE - -// @@protoc_insertion_point(global_scope) -#include diff --git a/apis/cpp/protocol/v1/fee.pb.h b/apis/cpp/protocol/v1/fee.pb.h deleted file mode 100644 index 6ef47d5..0000000 --- a/apis/cpp/protocol/v1/fee.pb.h +++ /dev/null @@ -1,653 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: fee.proto - -#ifndef GOOGLE_PROTOBUF_INCLUDED_fee_2eproto -#define GOOGLE_PROTOBUF_INCLUDED_fee_2eproto - -#include -#include - -#include -#if PROTOBUF_VERSION < 3011000 -#error This file was generated by a newer version of protoc which is -#error incompatible with your Protocol Buffer headers. Please update -#error your headers. -#endif -#if 3011001 < PROTOBUF_MIN_PROTOC_VERSION -#error This file was generated by an older version of protoc which is -#error incompatible with your Protocol Buffer headers. Please -#error regenerate this file with a newer version of protoc. -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include // IWYU pragma: export -#include // IWYU pragma: export -#include -// @@protoc_insertion_point(includes) -#include -#define PROTOBUF_INTERNAL_EXPORT_fee_2eproto -PROTOBUF_NAMESPACE_OPEN -namespace internal { -class AnyMetadata; -} // namespace internal -PROTOBUF_NAMESPACE_CLOSE - -// Internal implementation detail -- do not use these members. -struct TableStruct_fee_2eproto { - static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTableField entries[] - PROTOBUF_SECTION_VARIABLE(protodesc_cold); - static const ::PROTOBUF_NAMESPACE_ID::internal::AuxillaryParseTableField aux[] - PROTOBUF_SECTION_VARIABLE(protodesc_cold); - static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[2] - PROTOBUF_SECTION_VARIABLE(protodesc_cold); - static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[]; - static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[]; - static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[]; -}; -extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_fee_2eproto; -namespace protocol { -namespace fee { -namespace v1 { -class FeeAdminReq; -class FeeAdminReqDefaultTypeInternal; -extern FeeAdminReqDefaultTypeInternal _FeeAdminReq_default_instance_; -class FeeAdminResp; -class FeeAdminRespDefaultTypeInternal; -extern FeeAdminRespDefaultTypeInternal _FeeAdminResp_default_instance_; -} // namespace v1 -} // namespace fee -} // namespace protocol -PROTOBUF_NAMESPACE_OPEN -template<> ::protocol::fee::v1::FeeAdminReq* Arena::CreateMaybeMessage<::protocol::fee::v1::FeeAdminReq>(Arena*); -template<> ::protocol::fee::v1::FeeAdminResp* Arena::CreateMaybeMessage<::protocol::fee::v1::FeeAdminResp>(Arena*); -PROTOBUF_NAMESPACE_CLOSE -namespace protocol { -namespace fee { -namespace v1 { - -// =================================================================== - -class FeeAdminResp : - public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:protocol.fee.v1.FeeAdminResp) */ { - public: - FeeAdminResp(); - virtual ~FeeAdminResp(); - - FeeAdminResp(const FeeAdminResp& from); - FeeAdminResp(FeeAdminResp&& from) noexcept - : FeeAdminResp() { - *this = ::std::move(from); - } - - inline FeeAdminResp& operator=(const FeeAdminResp& from) { - CopyFrom(from); - return *this; - } - inline FeeAdminResp& operator=(FeeAdminResp&& from) noexcept { - if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { - if (this != &from) InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { - return GetDescriptor(); - } - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { - return GetMetadataStatic().descriptor; - } - static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { - return GetMetadataStatic().reflection; - } - static const FeeAdminResp& default_instance(); - - static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY - static inline const FeeAdminResp* internal_default_instance() { - return reinterpret_cast( - &_FeeAdminResp_default_instance_); - } - static constexpr int kIndexInFileMessages = - 0; - - friend void swap(FeeAdminResp& a, FeeAdminResp& b) { - a.Swap(&b); - } - inline void Swap(FeeAdminResp* other) { - if (other == this) return; - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - inline FeeAdminResp* New() const final { - return CreateMaybeMessage(nullptr); - } - - FeeAdminResp* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { - return CreateMaybeMessage(arena); - } - void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; - void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; - void CopyFrom(const FeeAdminResp& from); - void MergeFrom(const FeeAdminResp& from); - PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; - bool IsInitialized() const final; - - size_t ByteSizeLong() const final; - const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; - int GetCachedSize() const final { return _cached_size_.Get(); } - - private: - inline void SharedCtor(); - inline void SharedDtor(); - void SetCachedSize(int size) const final; - void InternalSwap(FeeAdminResp* other); - friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; - static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { - return "protocol.fee.v1.FeeAdminResp"; - } - private: - inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const { - return nullptr; - } - inline void* MaybeArenaPtr() const { - return nullptr; - } - public: - - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; - private: - static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { - ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_fee_2eproto); - return ::descriptor_table_fee_2eproto.file_level_metadata[kIndexInFileMessages]; - } - - public: - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - enum : int { - kCmdFieldNumber = 1, - kResultFieldNumber = 2, - }; - // string cmd = 1; - void clear_cmd(); - const std::string& cmd() const; - void set_cmd(const std::string& value); - void set_cmd(std::string&& value); - void set_cmd(const char* value); - void set_cmd(const char* value, size_t size); - std::string* mutable_cmd(); - std::string* release_cmd(); - void set_allocated_cmd(std::string* cmd); - private: - const std::string& _internal_cmd() const; - void _internal_set_cmd(const std::string& value); - std::string* _internal_mutable_cmd(); - public: - - // string result = 2; - void clear_result(); - const std::string& result() const; - void set_result(const std::string& value); - void set_result(std::string&& value); - void set_result(const char* value); - void set_result(const char* value, size_t size); - std::string* mutable_result(); - std::string* release_result(); - void set_allocated_result(std::string* result); - private: - const std::string& _internal_result() const; - void _internal_set_result(const std::string& value); - std::string* _internal_mutable_result(); - public: - - // @@protoc_insertion_point(class_scope:protocol.fee.v1.FeeAdminResp) - private: - class _Internal; - - ::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_; - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr cmd_; - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr result_; - mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - friend struct ::TableStruct_fee_2eproto; -}; -// ------------------------------------------------------------------- - -class FeeAdminReq : - public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:protocol.fee.v1.FeeAdminReq) */ { - public: - FeeAdminReq(); - virtual ~FeeAdminReq(); - - FeeAdminReq(const FeeAdminReq& from); - FeeAdminReq(FeeAdminReq&& from) noexcept - : FeeAdminReq() { - *this = ::std::move(from); - } - - inline FeeAdminReq& operator=(const FeeAdminReq& from) { - CopyFrom(from); - return *this; - } - inline FeeAdminReq& operator=(FeeAdminReq&& from) noexcept { - if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { - if (this != &from) InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { - return GetDescriptor(); - } - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { - return GetMetadataStatic().descriptor; - } - static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { - return GetMetadataStatic().reflection; - } - static const FeeAdminReq& default_instance(); - - static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY - static inline const FeeAdminReq* internal_default_instance() { - return reinterpret_cast( - &_FeeAdminReq_default_instance_); - } - static constexpr int kIndexInFileMessages = - 1; - - friend void swap(FeeAdminReq& a, FeeAdminReq& b) { - a.Swap(&b); - } - inline void Swap(FeeAdminReq* other) { - if (other == this) return; - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - inline FeeAdminReq* New() const final { - return CreateMaybeMessage(nullptr); - } - - FeeAdminReq* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { - return CreateMaybeMessage(arena); - } - void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; - void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; - void CopyFrom(const FeeAdminReq& from); - void MergeFrom(const FeeAdminReq& from); - PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; - bool IsInitialized() const final; - - size_t ByteSizeLong() const final; - const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; - int GetCachedSize() const final { return _cached_size_.Get(); } - - private: - inline void SharedCtor(); - inline void SharedDtor(); - void SetCachedSize(int size) const final; - void InternalSwap(FeeAdminReq* other); - friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; - static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { - return "protocol.fee.v1.FeeAdminReq"; - } - private: - inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const { - return nullptr; - } - inline void* MaybeArenaPtr() const { - return nullptr; - } - public: - - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; - private: - static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { - ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_fee_2eproto); - return ::descriptor_table_fee_2eproto.file_level_metadata[kIndexInFileMessages]; - } - - public: - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - enum : int { - kCmdFieldNumber = 1, - kHeaderFieldNumber = 2, - }; - // string cmd = 1; - void clear_cmd(); - const std::string& cmd() const; - void set_cmd(const std::string& value); - void set_cmd(std::string&& value); - void set_cmd(const char* value); - void set_cmd(const char* value, size_t size); - std::string* mutable_cmd(); - std::string* release_cmd(); - void set_allocated_cmd(std::string* cmd); - private: - const std::string& _internal_cmd() const; - void _internal_set_cmd(const std::string& value); - std::string* _internal_mutable_cmd(); - public: - - // string header = 2; - void clear_header(); - const std::string& header() const; - void set_header(const std::string& value); - void set_header(std::string&& value); - void set_header(const char* value); - void set_header(const char* value, size_t size); - std::string* mutable_header(); - std::string* release_header(); - void set_allocated_header(std::string* header); - private: - const std::string& _internal_header() const; - void _internal_set_header(const std::string& value); - std::string* _internal_mutable_header(); - public: - - // @@protoc_insertion_point(class_scope:protocol.fee.v1.FeeAdminReq) - private: - class _Internal; - - ::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_; - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr cmd_; - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr header_; - mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - friend struct ::TableStruct_fee_2eproto; -}; -// =================================================================== - - -// =================================================================== - -#ifdef __GNUC__ - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wstrict-aliasing" -#endif // __GNUC__ -// FeeAdminResp - -// string cmd = 1; -inline void FeeAdminResp::clear_cmd() { - cmd_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); -} -inline const std::string& FeeAdminResp::cmd() const { - // @@protoc_insertion_point(field_get:protocol.fee.v1.FeeAdminResp.cmd) - return _internal_cmd(); -} -inline void FeeAdminResp::set_cmd(const std::string& value) { - _internal_set_cmd(value); - // @@protoc_insertion_point(field_set:protocol.fee.v1.FeeAdminResp.cmd) -} -inline std::string* FeeAdminResp::mutable_cmd() { - // @@protoc_insertion_point(field_mutable:protocol.fee.v1.FeeAdminResp.cmd) - return _internal_mutable_cmd(); -} -inline const std::string& FeeAdminResp::_internal_cmd() const { - return cmd_.GetNoArena(); -} -inline void FeeAdminResp::_internal_set_cmd(const std::string& value) { - - cmd_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value); -} -inline void FeeAdminResp::set_cmd(std::string&& value) { - - cmd_.SetNoArena( - &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:protocol.fee.v1.FeeAdminResp.cmd) -} -inline void FeeAdminResp::set_cmd(const char* value) { - GOOGLE_DCHECK(value != nullptr); - - cmd_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:protocol.fee.v1.FeeAdminResp.cmd) -} -inline void FeeAdminResp::set_cmd(const char* value, size_t size) { - - cmd_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:protocol.fee.v1.FeeAdminResp.cmd) -} -inline std::string* FeeAdminResp::_internal_mutable_cmd() { - - return cmd_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); -} -inline std::string* FeeAdminResp::release_cmd() { - // @@protoc_insertion_point(field_release:protocol.fee.v1.FeeAdminResp.cmd) - - return cmd_.ReleaseNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); -} -inline void FeeAdminResp::set_allocated_cmd(std::string* cmd) { - if (cmd != nullptr) { - - } else { - - } - cmd_.SetAllocatedNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), cmd); - // @@protoc_insertion_point(field_set_allocated:protocol.fee.v1.FeeAdminResp.cmd) -} - -// string result = 2; -inline void FeeAdminResp::clear_result() { - result_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); -} -inline const std::string& FeeAdminResp::result() const { - // @@protoc_insertion_point(field_get:protocol.fee.v1.FeeAdminResp.result) - return _internal_result(); -} -inline void FeeAdminResp::set_result(const std::string& value) { - _internal_set_result(value); - // @@protoc_insertion_point(field_set:protocol.fee.v1.FeeAdminResp.result) -} -inline std::string* FeeAdminResp::mutable_result() { - // @@protoc_insertion_point(field_mutable:protocol.fee.v1.FeeAdminResp.result) - return _internal_mutable_result(); -} -inline const std::string& FeeAdminResp::_internal_result() const { - return result_.GetNoArena(); -} -inline void FeeAdminResp::_internal_set_result(const std::string& value) { - - result_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value); -} -inline void FeeAdminResp::set_result(std::string&& value) { - - result_.SetNoArena( - &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:protocol.fee.v1.FeeAdminResp.result) -} -inline void FeeAdminResp::set_result(const char* value) { - GOOGLE_DCHECK(value != nullptr); - - result_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:protocol.fee.v1.FeeAdminResp.result) -} -inline void FeeAdminResp::set_result(const char* value, size_t size) { - - result_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:protocol.fee.v1.FeeAdminResp.result) -} -inline std::string* FeeAdminResp::_internal_mutable_result() { - - return result_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); -} -inline std::string* FeeAdminResp::release_result() { - // @@protoc_insertion_point(field_release:protocol.fee.v1.FeeAdminResp.result) - - return result_.ReleaseNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); -} -inline void FeeAdminResp::set_allocated_result(std::string* result) { - if (result != nullptr) { - - } else { - - } - result_.SetAllocatedNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), result); - // @@protoc_insertion_point(field_set_allocated:protocol.fee.v1.FeeAdminResp.result) -} - -// ------------------------------------------------------------------- - -// FeeAdminReq - -// string cmd = 1; -inline void FeeAdminReq::clear_cmd() { - cmd_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); -} -inline const std::string& FeeAdminReq::cmd() const { - // @@protoc_insertion_point(field_get:protocol.fee.v1.FeeAdminReq.cmd) - return _internal_cmd(); -} -inline void FeeAdminReq::set_cmd(const std::string& value) { - _internal_set_cmd(value); - // @@protoc_insertion_point(field_set:protocol.fee.v1.FeeAdminReq.cmd) -} -inline std::string* FeeAdminReq::mutable_cmd() { - // @@protoc_insertion_point(field_mutable:protocol.fee.v1.FeeAdminReq.cmd) - return _internal_mutable_cmd(); -} -inline const std::string& FeeAdminReq::_internal_cmd() const { - return cmd_.GetNoArena(); -} -inline void FeeAdminReq::_internal_set_cmd(const std::string& value) { - - cmd_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value); -} -inline void FeeAdminReq::set_cmd(std::string&& value) { - - cmd_.SetNoArena( - &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:protocol.fee.v1.FeeAdminReq.cmd) -} -inline void FeeAdminReq::set_cmd(const char* value) { - GOOGLE_DCHECK(value != nullptr); - - cmd_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:protocol.fee.v1.FeeAdminReq.cmd) -} -inline void FeeAdminReq::set_cmd(const char* value, size_t size) { - - cmd_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:protocol.fee.v1.FeeAdminReq.cmd) -} -inline std::string* FeeAdminReq::_internal_mutable_cmd() { - - return cmd_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); -} -inline std::string* FeeAdminReq::release_cmd() { - // @@protoc_insertion_point(field_release:protocol.fee.v1.FeeAdminReq.cmd) - - return cmd_.ReleaseNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); -} -inline void FeeAdminReq::set_allocated_cmd(std::string* cmd) { - if (cmd != nullptr) { - - } else { - - } - cmd_.SetAllocatedNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), cmd); - // @@protoc_insertion_point(field_set_allocated:protocol.fee.v1.FeeAdminReq.cmd) -} - -// string header = 2; -inline void FeeAdminReq::clear_header() { - header_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); -} -inline const std::string& FeeAdminReq::header() const { - // @@protoc_insertion_point(field_get:protocol.fee.v1.FeeAdminReq.header) - return _internal_header(); -} -inline void FeeAdminReq::set_header(const std::string& value) { - _internal_set_header(value); - // @@protoc_insertion_point(field_set:protocol.fee.v1.FeeAdminReq.header) -} -inline std::string* FeeAdminReq::mutable_header() { - // @@protoc_insertion_point(field_mutable:protocol.fee.v1.FeeAdminReq.header) - return _internal_mutable_header(); -} -inline const std::string& FeeAdminReq::_internal_header() const { - return header_.GetNoArena(); -} -inline void FeeAdminReq::_internal_set_header(const std::string& value) { - - header_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value); -} -inline void FeeAdminReq::set_header(std::string&& value) { - - header_.SetNoArena( - &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:protocol.fee.v1.FeeAdminReq.header) -} -inline void FeeAdminReq::set_header(const char* value) { - GOOGLE_DCHECK(value != nullptr); - - header_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:protocol.fee.v1.FeeAdminReq.header) -} -inline void FeeAdminReq::set_header(const char* value, size_t size) { - - header_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:protocol.fee.v1.FeeAdminReq.header) -} -inline std::string* FeeAdminReq::_internal_mutable_header() { - - return header_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); -} -inline std::string* FeeAdminReq::release_header() { - // @@protoc_insertion_point(field_release:protocol.fee.v1.FeeAdminReq.header) - - return header_.ReleaseNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); -} -inline void FeeAdminReq::set_allocated_header(std::string* header) { - if (header != nullptr) { - - } else { - - } - header_.SetAllocatedNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), header); - // @@protoc_insertion_point(field_set_allocated:protocol.fee.v1.FeeAdminReq.header) -} - -#ifdef __GNUC__ - #pragma GCC diagnostic pop -#endif // __GNUC__ -// ------------------------------------------------------------------- - - -// @@protoc_insertion_point(namespace_scope) - -} // namespace v1 -} // namespace fee -} // namespace protocol - -// @@protoc_insertion_point(global_scope) - -#include -#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_fee_2eproto diff --git a/apis/protocol/v1/deduction.proto b/apis/protocol/v1/deduction.proto new file mode 100644 index 0000000..a54c85f --- /dev/null +++ b/apis/protocol/v1/deduction.proto @@ -0,0 +1,23 @@ +syntax = "proto3"; + +package protocol.payment.deduction.v1; + +// The greeting service definition. +service DeductionAdminApi { + rpc GetDeductionList(DeductionAdminReq) returns (DeductionAdminResp) {} + rpc AdminOp(DeductionAdminReq) returns (DeductionAdminResp) {} +} +message DeductionStruct { + string title = 1; + string desc = 2; + uint32 status = 3; +} + +message DeductionAdminResp { + string header = 1; + repeated DeductionStruct data = 2; +} + +message DeductionAdminReq { + string header = 1; +} diff --git a/apis/protocol/v1/fee.proto b/apis/protocol/v1/fee.proto deleted file mode 100644 index c2d231e..0000000 --- a/apis/protocol/v1/fee.proto +++ /dev/null @@ -1,19 +0,0 @@ -syntax = "proto3"; - -package protocol.fee.v1; - -// The greeting service definition. -service FeeAdminApi { - rpc Logout(FeeAdminReq) returns (FeeAdminResp){} - rpc AdminOp(FeeAdminReq) returns (FeeAdminResp){} -} - -message FeeAdminResp { - string cmd = 1; - string result = 2; -} - -message FeeAdminReq { - string cmd = 1; - string header = 2; -} diff --git a/apps/3rd/sql/mysqlplus.h b/apps/3rd/sql/mysqlplus.h new file mode 100644 index 0000000..ceca684 --- /dev/null +++ b/apps/3rd/sql/mysqlplus.h @@ -0,0 +1,1369 @@ +/* + +Modern C++ wrapper for MySQL with simple and convenient usage + +History: + VERSION DATE CHANGES + 1.2.0.0 2019 Mar 05 Multiple-statement queries + 1.1.0.0 2019 Mar 01 Prepared statements, error support in `result' + 1.0.0.0 2017 Jan 22 First publication + +Author: + Dao Trung Kien https://github.com/daotrungkien + +Contributors: + Dominik Thalhammer https://github.com/Thalhammer + Samuel Borgman https://github.com/sambrg + + +Macro Flags: + NO_STD_OPTIONAL : using std::experimental::optional by polyfill instead of std::optional in C++17 + +*/ + + + + +#pragma once + + +#ifdef _MSC_VER +#include +#endif + +// #include +// #include + +// Fix(slonguo): change include path +// see mysql.BUILD +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "polyfill/function_traits.h" +#include "polyfill/datetime.h" + + +// Fix(slonguo): uncomment the following #define would +// cause multiple errors when compiling on MacOS 10.15.3 (19D76) +// with clang info: +// Apple clang version 11.0.0 (clang-1100.0.33.17) +// Target: x86_64-apple-darwin19.3.0 +// Thread model: posix +#define NO_STD_OPTIONAL + +#ifndef NO_STD_OPTIONAL +#include +#else +#include "polyfill/optional.hpp" +#endif + + + +namespace daotk { + + namespace mysql { + + // Fix(slonguo): mysql 8.x discarded `my_bool` type + // https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-1.html + using my_bool = bool; + + template + using function_traits = typename sqlite::utility::function_traits; + +#ifndef NO_STD_OPTIONAL + template + using optional = typename std::optional; +#else + template + using optional = typename std::experimental::optional; +#endif + + + inline std::string format_string_vargs(const char* fmt_str, va_list args) { + std::size_t size = 256; + std::vector buf(size); + + while (true) { + int needed = std::vsnprintf(&buf[0], size, fmt_str, args); + + if (needed <= (int)size && needed >= 0) + return &buf[0]; + + size = (needed > 0) ? (needed + 1) : (size * 2); + buf.resize(size); + } + } + + inline std::string format_string(const char* fmt_str, ...) { + va_list vargs; + va_start(vargs, fmt_str); + std::string res = format_string_vargs(fmt_str, vargs); + va_end(vargs); + // Fix(slonguo): fix compiler warning compaint + // return std::move(res); + return res; + } + + + + class mysql_exception : public std::exception { + protected: + unsigned int err_number; + std::string err_msg; + + public: + mysql_exception(MYSQL* conn) { + err_number = mysql_errno(conn); + err_msg = mysql_error(conn); + } + + virtual const char* what() const noexcept { + return err_msg.c_str(); + } + + unsigned int error_number() const { + return err_number; + } + + const std::string& error_message() const { + return err_msg; + } + }; + + class mysqlpp_exception : public std::exception { + public: + enum error_code { + result_already_fetched, + empty_result + }; + + protected: + error_code err; + std::string err_msg; + + public: + mysqlpp_exception(error_code _err) + : err(_err) + { + err_msg = format_string("Error: %d", err); + } + + virtual const char* what() const noexcept { + return err_msg.c_str(); + } + + const std::string& error_message() const { + return err_msg; + } + }; + + + + + class result; + class connection; + + + // iterator class that can be used for iterating returned result rows + template + class result_iterator : std::iterator, int> { + protected: + result* res; + std::shared_ptr> data; + std::size_t row_index; + + + template + typename std::enable_if<(I > 0), void>::type + fetch_impl(); + + template + typename std::enable_if<(I == 0), void>::type + fetch_impl(); + + void fetch(); + + void set_index(std::size_t i) { + row_index = i; + data.reset(); + } + + public: + result_iterator() { + res = nullptr; + row_index = 0; + } + + result_iterator(result* _res, std::size_t _row_index) + : res(_res), row_index(_row_index) + { } + + result_iterator(result_iterator& itr) { + res = itr.res; + row_index = itr.row_index; + data = itr.data; + } + + result_iterator(result_iterator&& itr) { + res = itr.res; + row_index = itr.row_index; + data = std::move(itr.data); + } + + void operator =(result_iterator& itr) { + res = itr.res; + row_index = itr.row_index; + data = itr.data; + } + + void operator =(result_iterator&& itr) { + res = itr.res; + row_index = itr.row_index; + data = std::move(itr.data); + } + + result_iterator& operator ++() { + set_index(row_index + 1); + return *this; + } + + result_iterator operator ++(int) { + result_iterator tmp(*this); + set_index(row_index + 1); + return tmp; + } + + result_iterator& operator --() { + set_index(row_index - 1); + return *this; + } + + result_iterator operator --(int) { + result_iterator tmp(*this); + set_index(row_index - 1); + return tmp; + } + + result_iterator& operator +=(int n) { + set_index(row_index + n); + return *this; + } + + result_iterator& operator -=(int n) { + set_index(row_index - n); + return *this; + } + + result_iterator operator +(int n) { + return result_iterator(res, row_index + n); + } + + result_iterator operator -(int n) { + return result_iterator(res, row_index - n); + } + + bool operator == (const result_iterator& itr) const { + return row_index == itr.row_index; + } + bool operator != (const result_iterator& itr) const { + return row_index != itr.row_index; + } + bool operator > (const result_iterator& itr) const { + return row_index > itr.row_index; + } + bool operator < (const result_iterator& itr) const { + return row_index < itr.row_index; + } + bool operator >= (const result_iterator& itr) const { + return row_index >= itr.row_index; + } + bool operator <= (const result_iterator& itr) const { + return row_index <= itr.row_index; + } + + std::tuple& operator *() { + if (!data) fetch(); + return *data; + } + + std::tuple* operator ->() { + if (!data) fetch(); + return data.get(); + } + }; + + + // container-like result class + template + class result_containter { + + public: + using tuple_type = std::tuple; + + friend class result; + + protected: + result* res; + + result_containter(result* _res) + : res(_res) + {} + + public: + result_iterator begin(); + result_iterator end(); + }; + + + + // result fetching + class result { + + friend class connection; + + protected: + MYSQL* my_conn = nullptr; + bool fetched = false; + + // used only when `mode == mode_fetch' + std::vector< std::vector > rows; + std::vector< std::vector >::iterator current_row_itr; + unsigned int num_fields; + + + result(MYSQL* _my_conn, bool fetch_now = false) + : my_conn(_my_conn) + { + if (fetch_now) fetch(); + } + + void check_condition() { + if (!fetched) fetch(); + } + + + + template + using nth_argument_type = typename function_traits::template argument; + + template + typename std::enable_if<(sizeof...(Values) < function_traits::arity), bool>::type + bind_and_call(Function&& callback, Values&&... values) { + nth_argument_type value; + get_value(sizeof...(Values), value); + + return bind_and_call(callback, std::forward(values)..., std::move(value)); + } + + template + typename std::enable_if<(sizeof...(Values) == function_traits::arity), bool>::type + bind_and_call(Function&& callback, Values&&... values) { + return callback(std::forward(values)...); + } + + public: + result(const result& r) = delete; + void operator =(const result& r) = delete; + + result() { + } + + result(result&& r) noexcept { + my_conn = r.my_conn; + fetched = r.fetched; + + rows = std::move(r.rows); + current_row_itr = r.current_row_itr; + + r.my_conn = nullptr; + r.fetched = false; + } + + void operator =(result&& r) noexcept { + free(); + + my_conn = r.my_conn; + fetched = r.fetched; + + rows = std::move(r.rows); + current_row_itr = r.current_row_itr; + + r.my_conn = nullptr; + r.fetched = false; + } + + virtual ~result() { + free(); + } + + void free() { + if (!fetched) { + if (my_conn != nullptr) { + // mysql_use_result must be called for SELECT, SHOW,... + // https://dev.mysql.com/doc/refman/8.0/en/mysql-use-result.html + MYSQL_RES* _res = mysql_use_result(my_conn); + if (_res != nullptr) mysql_free_result(_res); + } + } + else { + rows.clear(); + } + + my_conn = nullptr; + fetched = false; + } + + // store result internally for further queries to avoid Error #2014 (Commands out of sync) + void fetch() { + if (fetched) throw mysqlpp_exception(mysqlpp_exception::result_already_fetched); + MYSQL_RES* _res = mysql_store_result(my_conn); + + num_fields = mysql_num_fields(_res); + if (num_fields > 0) { + while (MYSQL_ROW _row = mysql_fetch_row(_res)) { + auto fetch_lengths = mysql_fetch_lengths(_res); + if (fetch_lengths == nullptr) throw mysql_exception{ my_conn }; + + std::vector rowdata; + for (unsigned int i = 0; i < num_fields; i++) + rowdata.push_back(std::string(_row[i], fetch_lengths[i])); + rows.push_back(rowdata); + } + + current_row_itr = rows.begin(); + } + + mysql_free_result(_res); + + fetched = true; + } + + // return number of rows + std::size_t count() { + check_condition(); + + return rows.size(); + } + + // return number of fields + unsigned int fields() { + check_condition(); + + return num_fields; + } + + // return true if no data was returned + bool is_empty() { + return count() == 0; + } + + // return true if passed the last row + bool eof() { + check_condition(); + + return current_row_itr == rows.end(); + } + + // go to first row + void reset() { + seek(0); + } + + // go to nth row + void seek(std::size_t n) { + check_condition(); + + current_row_itr = rows.begin() + n; + } + + // go to next row + void next() { + check_condition(); + + current_row_itr++; + } + + // go to previous row + void prev() { + check_condition(); + + current_row_itr--; + } + + // return curent row index + std::size_t tell() { + check_condition(); + + return current_row_itr - rows.begin(); + } + + // iterate through all rows, each time execute the callback function + template + int each(Function callback) { + reset(); + + int count = 0; + while (!eof()) { + count++; + if (!bind_and_call(callback)) break; + next(); + } + + return count; + } + + // create an object that can be used to iterate through the rows like STL containers + template + result_containter as_container() { + return result_containter{this}; + } + + + + + // get-value functions in different ways and types... + + const char* get_field_data(int i) { + check_condition(); + + if (current_row_itr == rows.end() || (*current_row_itr)[i].empty()) return nullptr; + return (*current_row_itr)[i].c_str(); + } + + bool get_value(int i, bool& value) { + const char* s = get_field_data(i); + if (s == nullptr) return false; + + try { + value = (std::stoi(s) != 0); + return true; + } + catch (std::exception&) { + return false; + } + } + + bool get_value(int i, int& value) { + const char* s = get_field_data(i); + if (s == nullptr) return false; + + try { + value = std::stoi(s); + return true; + } + catch (std::exception&) { + return false; + } + } + + bool get_value(int i, unsigned int& value) { + const char* s = get_field_data(i); + if (s == nullptr) return false; + + try { + value = (unsigned int)std::stoul(s); + return true; + } + catch (std::exception&) { + return false; + } + } + + bool get_value(int i, long& value) { + const char* s = get_field_data(i); + if (s == nullptr) return false; + + try { + value = std::stol(s); + return true; + } + catch (std::exception&) { + return false; + } + } + + bool get_value(int i, unsigned long& value) { + const char* s = get_field_data(i); + if (s == nullptr) return false; + + try { + value = std::stoul(s); + return true; + } + catch (std::exception&) { + return false; + } + } + + bool get_value(int i, long long& value) { + const char* s = get_field_data(i); + if (s == nullptr) return false; + + try { + value = std::stoll(s); + return true; + } + catch (std::exception&) { + return false; + } + } + + bool get_value(int i, unsigned long long& value) { + const char* s = get_field_data(i); + if (s == nullptr) return false; + + try { + value = std::stoull(s); + return true; + } + catch (std::exception&) { + return false; + } + } + + bool get_value(int i, float& value) { + const char* s = get_field_data(i); + if (s == nullptr) return false; + + try { + value = std::stof(s); + return true; + } + catch (std::exception&) { + return false; + } + } + + bool get_value(int i, double& value) { + const char* s = get_field_data(i); + if (s == nullptr) return false; + + try { + value = std::stod(s); + return true; + } + catch (std::exception&) { + return false; + } + } + + bool get_value(int i, long double& value) { + const char* s = get_field_data(i); + if (s == nullptr) return false; + + try { + value = std::stold(s); + return true; + } + catch (std::exception&) { + return false; + } + } + + bool get_value(int i, std::string& value) { + const char* s = get_field_data(i); + if (s == nullptr) return false; + + value = s; + return true; + } + + bool get_value(int i, datetime& value) { + const char* s = get_field_data(i); + if (s == nullptr) return false; + + value.from_sql(s); + return true; + } + + template + bool get_value(Value& value) { + return get_value(0, value); + } + + template + Value get_value(int i = 0) { + Value v; + get_value(i, v); +// if (!get_value(i, v)) throw mysqlpp_exception(mysqlpp_exception::empty_result); + return std::move(v); + } + + template + void get_value(int i, optional& value) { + Value v; + if (get_value(i, v)) value = v; + } + + template + void get_value(optional& value) { + get_value(0, value); + } + + template + Value operator[](int i) { + Value v; + if (!get_value(i, v)) throw mysqlpp_exception(mysqlpp_exception::empty_result); + return std::move(v); + } + + + protected: + template + void fetch_impl(int i, Value& value) { + get_value(i, value); + } + + template + void fetch_impl(int i, Value& value, Values&... values) { + get_value(i, value); + fetch_impl(i + 1, std::forward(values)...); + } + + public: + // get data from every fields of the current row + template + bool fetch(Values&... values) { + check_condition(); + + if (current_row_itr == rows.end()) return false; + + fetch_impl(0, std::forward(values)...); + return true; + } + }; + + + struct connect_options { + connect_options( + const std::string &_server = "", + const std::string _username = "", + const std::string _password = "", + const std::string _dbname = "", + unsigned int _timeout = 0, + bool _autoreconnect = false, + const std::string _init_command = "", + const std::string _charset = "", + unsigned int _port = 0, + unsigned long _client_flag = 0 + ) : server(_server), + username(_username), + password(_password), + dbname(_dbname), + timeout(_timeout), + autoreconnect(_autoreconnect), + init_command(_init_command), + charset(_charset), + port(_port), + client_flag(_client_flag) + {} + + std::string server; + std::string username; + std::string password; + std::string dbname; + unsigned int timeout; + bool autoreconnect; + std::string init_command; + std::string charset; + unsigned int port; + unsigned long client_flag; + }; + + + // database connection and query... + class connection : public std::enable_shared_from_this { + + friend class prepared_stmt; + + protected: + MYSQL* my_conn; + mutable std::mutex mutex; // mutex needs to be locked while using a prepared stmt + + // added(slonguo): + // see: https://zh.cppreference.com/w/cpp/memory/enable_shared_from_this + // we'd also need a connection pool(see utils/conn_pool.hpp) + public: + std::shared_ptr getptr() { + return shared_from_this(); + } + + public: + // open a connection (close the old one if already open), return true if successful + bool open(const connect_options& options) { + if (is_open()) close(); + + std::lock_guard mg(mutex); + + my_conn = mysql_init(nullptr); + if (my_conn == nullptr) return false; + + if (options.autoreconnect) { + my_bool b = options.autoreconnect; + mysql_options(my_conn, MYSQL_OPT_RECONNECT, &b); + } + if (!options.charset.empty()) mysql_options(my_conn, MYSQL_SET_CHARSET_NAME, options.charset.c_str()); + if (!options.init_command.empty()) mysql_options(my_conn, MYSQL_INIT_COMMAND, options.init_command.c_str()); + if (options.timeout > 0) mysql_options(my_conn, MYSQL_OPT_CONNECT_TIMEOUT, (char*)&options.timeout); + + if (nullptr == mysql_real_connect(my_conn, options.server.c_str(), options.username.c_str(), options.password.c_str(), options.dbname.c_str(), options.port, NULL, options.client_flag)) { + mysql_close(my_conn); + my_conn = nullptr; + return false; + } + + return true; + } + + // open a connection (close the old one if already open), return true if successful + bool open(std::string server, std::string username, std::string password, std::string dbname = "", unsigned int timeout = 0) { + return open(connect_options(server, username, password, dbname, timeout)); + } + + connection() + : my_conn(nullptr) + { } + + connection(const connect_options& opts) + : my_conn(nullptr) + { + open(opts); + } + + connection(std::string server, std::string username, std::string password, std::string dbname = "", unsigned int timeout = 0) + : my_conn(nullptr) + { + open(server, username, password, dbname, timeout); + } + + void close() { + std::lock_guard mg(mutex); + + if (my_conn != nullptr) { + mysql_close(my_conn); + my_conn = nullptr; + } + } + + virtual ~connection() { + close(); + } + + operator bool() const { + return is_open(); + } + + bool is_open() const { + if(my_conn == nullptr) return false; + std::lock_guard mg(mutex); + return mysql_ping(my_conn) == 0; + } + + // raw MySQL connection in case needed + MYSQL* get_raw_connection() const { + return my_conn; + } + + + // wrapping of some functions + + int set_server_option(enum_mysql_set_option option) { + return mysql_set_server_option(my_conn, option); + } + + unsigned long long last_insert_id() const { + return mysql_insert_id(my_conn); + } + + unsigned long long affected_rows() const { + return mysql_affected_rows(my_conn); + } + + unsigned int error_code() const { + return mysql_errno(my_conn); + } + + const char* error_message() const { + return mysql_error(my_conn); + } + + public: + // execute query given by string and return result + result query(const std::string& query_str) { + std::lock_guard mg(mutex); + + int ret = mysql_real_query(my_conn, query_str.c_str(), query_str.length()); + if (ret != 0) throw mysql_exception{ my_conn }; + + return result{ my_conn, false }; + } + + // execute query with printf-style substitutions and return result + template + result query(const std::string& fmt_str, Values... values) { + return query( format_string(fmt_str.c_str(), std::forward(values)...) ); + } + + // multiple statement query execution + std::vector mquery(const std::string& query_str) { + std::lock_guard mg(mutex); + + int ret = mysql_real_query(my_conn, query_str.c_str(), query_str.length()); + if (ret != 0) throw mysql_exception{ my_conn }; + + std::vector res; + do { + res.push_back(result{ my_conn, true }); + } while (mysql_next_result(my_conn) == 0); + + // Fix(slonguo): fix clang warning complaint + // return std::move(res); + return res; + } + + // multiple statement query execution with printf-style substitutions and return result + template + std::vector mquery(const std::string& fmt_str, Values... values) { + return mquery(format_string(fmt_str.c_str(), std::forward(values)...)); + } + + // like query(), but no result returned + void exec(const std::string& query_str) { + std::lock_guard mg(mutex); + + int ret = mysql_real_query(my_conn, query_str.c_str(), query_str.length()); + if (ret != 0) throw mysql_exception{ my_conn }; + + // mysql_use_result must be called for SELECT, SHOW,... + // https://dev.mysql.com/doc/refman/8.0/en/mysql-use-result.html + MYSQL_RES* myres = mysql_use_result(my_conn); + if (myres != nullptr) mysql_free_result(myres); + } + + // like query(), but no result returned + template + void exec(const std::string& fmt_str, Values... values) { + exec(format_string(fmt_str.c_str(), std::forward(values)...) ); + } + }; + + + + + + + template + template + typename std::enable_if<(I > 0), void>::type + result_iterator::fetch_impl() { + res->get_value(I, std::get(*data)); + fetch_impl(); + } + + template + template + typename std::enable_if<(I == 0), void>::type + result_iterator::fetch_impl() { + res->get_value(I, std::get(*data)); + } + + template + void result_iterator::fetch() { + res->seek(row_index); + data = std::make_shared>(); + fetch_impl(); + } + + + template + result_iterator result_containter::begin() { + return result_iterator{res, 0}; + } + + template + result_iterator result_containter::end() { + return result_iterator{res, res->count()}; + } + + namespace stmt_bind_detail { + struct my_bind_base { + MYSQL_BIND* bind; + virtual ~my_bind_base() {} + // Called before executing the statement + virtual void pre_execute() {} + // Called after executing the statement + virtual void post_execute() {} + // Called before fetching result + virtual void pre_fetch() {} + // If post_fetch returns true, we call mysql_stmt_fetch_column again (for example for strings) + virtual bool post_fetch() { return false; } + // Only called of post_fetch returned true, after mysql_stmt_fetch_column was called + virtual void post_refetch() {} + }; + + template + struct my_bind : my_bind_base { + }; + + template + struct my_number_bind : my_bind_base { + T* data; + + virtual void pre_execute() override { update(); } + virtual void pre_fetch() override { update(); } + + void update() { + memset(bind, 0x00, sizeof(MYSQL_BIND)); + bind->buffer = data; + bind->buffer_type = mysql_type; + bind->is_null_value = false; + bind->is_unsigned = std::is_unsigned::value; + } + }; + + template + struct my_optional_number_bind : my_bind_base { + optional* data; + T pdata; + + virtual void pre_execute() override { + memset(bind, 0x00, sizeof(MYSQL_BIND)); + if (data->has_value()) { + pdata = data->value(); + } + bind->buffer = &pdata; + bind->buffer_type = mysql_type; + bind->is_null_value = data->has_value(); + bind->is_unsigned = std::is_unsigned::value; + } + + virtual void pre_fetch() override { + memset(bind, 0x00, sizeof(MYSQL_BIND)); + bind->buffer = &pdata; + bind->buffer_type = mysql_type; + bind->is_unsigned = std::is_unsigned::value; + bind->is_null = &bind->is_null_value; + } + + virtual bool post_fetch() override { + if (bind->is_null_value) { + data->reset(); + } + else { + *data = pdata; + } + return false; + } + }; + + template<> struct my_bind : my_number_bind {}; + template<> struct my_bind : my_number_bind {}; + template<> struct my_bind : my_number_bind {}; + template<> struct my_bind : my_number_bind {}; + template<> struct my_bind : my_number_bind {}; + template<> struct my_bind : my_number_bind {}; + template<> struct my_bind : my_number_bind {}; + template<> struct my_bind : my_number_bind {}; + template<> struct my_bind : my_number_bind {}; + template<> struct my_bind : my_number_bind {}; + + template<> struct my_bind : my_number_bind {}; + + template<> struct my_bind> : my_optional_number_bind {}; + template<> struct my_bind> : my_optional_number_bind {}; + template<> struct my_bind> : my_optional_number_bind {}; + template<> struct my_bind> : my_optional_number_bind {}; + template<> struct my_bind> : my_optional_number_bind {}; + template<> struct my_bind> : my_optional_number_bind {}; + template<> struct my_bind> : my_optional_number_bind {}; + template<> struct my_bind> : my_optional_number_bind {}; + template<> struct my_bind> : my_optional_number_bind {}; + template<> struct my_bind> : my_optional_number_bind {}; + + template<> struct my_bind> : my_optional_number_bind {}; + + template<> + struct my_bind : my_bind_base { + std::string* data; + virtual void pre_execute() override { + memset(bind, 0x00, sizeof(MYSQL_BIND)); + if (data != nullptr) { + bind->buffer = (void*)data->data(); + bind->buffer_length = data->size(); + bind->buffer_type = MYSQL_TYPE_STRING; + bind->is_null_value = false; + bind->length_value = data->size(); + } + else { + bind->buffer_type = MYSQL_TYPE_NULL; + } + bind->length = &bind->length_value; + bind->is_null = &bind->is_null_value; + } + virtual void pre_fetch() override { + memset(bind, 0x00, sizeof(MYSQL_BIND)); + bind->buffer_type = MYSQL_TYPE_STRING; + // libmysql debug build breaks if buffer_length is 0 + data->resize(1); + bind->buffer = (void*)data->data(); + bind->buffer_length = data->size(); + bind->is_null_value = false; + bind->length = &bind->length_value; + bind->is_null = &bind->is_null_value; + } + virtual bool post_fetch() override { + if (bind->length_value > 0) { + data->resize(bind->length_value); + bind->buffer = (void*)data->data(); + bind->buffer_length = data->size(); + return true; + } + else { + data->clear(); + return false; + } + } + }; + + template<> + struct my_bind> : my_bind_base { + optional* data; + + virtual void pre_execute() override { + memset(bind, 0x00, sizeof(MYSQL_BIND)); + if (data->has_value()) { + bind->buffer = (void*)data->value().data(); + bind->buffer_length = data->value().size(); + bind->buffer_type = MYSQL_TYPE_STRING; + bind->is_null_value = false; + bind->length_value = bind->buffer_length; + } + else { + bind->is_null_value = true; + } + bind->length = &bind->length_value; + bind->is_null = &bind->is_null_value; + } + virtual void pre_fetch() override { + memset(bind, 0x00, sizeof(MYSQL_BIND)); + bind->buffer_type = MYSQL_TYPE_STRING; + + // Init temp + *data = std::string(); + + // libmysql debug build breaks if buffer_length is 0 + auto& pdata = data->value(); + pdata.resize(1); + bind->buffer = (void*)pdata.data(); + bind->buffer_length = pdata.size(); + bind->is_null_value = false; + bind->length = &bind->length_value; + bind->is_null = &bind->is_null_value; + } + + virtual bool post_fetch() override { + if (bind->is_null_value) { + data->reset(); + return false; + } + else { + auto& pdata = data->value(); + if (bind->length_value > 0) { + pdata.resize(bind->length_value); + bind->buffer = (void*)pdata.data(); + bind->buffer_length = pdata.size(); + return true; + } + else { + pdata.clear(); + return false; + } + } + } + }; + } + + class prepared_stmt : public std::enable_shared_from_this { + private: + connection& con; + std::unique_ptr stmt; + + class mysql_bind_set { + private: + std::vector _binds_mysql; + std::vector> _wrappers; + + public: + mysql_bind_set(std::size_t size) { + _binds_mysql.resize(size); + _wrappers.resize(size); + } + + MYSQL_BIND* binds() { + return (MYSQL_BIND*)_binds_mysql.data(); + } + + std::size_t size() { + return _wrappers.size(); + } + + + void pre_execute() { + for (auto& e : _wrappers) + e->pre_execute(); + } + + void post_execute() { + for (auto& e : _wrappers) + e->post_execute(); + } + + void pre_fetch() { + for (auto& e : _wrappers) + e->pre_fetch(); + } + + std::vector post_fetch() { + std::vector res; + for (std::size_t i = 0; i < _wrappers.size(); i++) { + if (_wrappers[i]->post_fetch()) + res.push_back(i); + } + return res; + } + + void post_refetch(const std::vector& items) { + for (auto& e : items) + _wrappers[e]->post_refetch(); + } + + + template + void set_variable(std::size_t idx, T& arg) { + if (idx >= _wrappers.size()) + throw std::out_of_range("Invalid binding index"); + auto wrap = std::make_unique>(); + wrap->data = &arg; + wrap->bind = &_binds_mysql[idx]; + _wrappers[idx] = std::move(wrap); + } + + template + void bind_variables(const Args &... args) { + bind_variables_impl(0, args...); + } + + private: + template + void bind_variables_impl(std::size_t idx, const T& arg) { + this->set_variable(idx, const_cast(arg)); + } + + template + void bind_variables_impl(std::size_t idx, const T1& arg1, const Args &... args) { + bind_variables_impl(idx, arg1); + bind_variables_impl(idx + 1, args...); + } + }; + + mysql_bind_set param_binds; + mysql_bind_set result_binds; + + public: + prepared_stmt(connection& pcon, const std::string& query) + : con(pcon), stmt(nullptr, [](MYSQL_STMT* stmt) { mysql_stmt_close(stmt); }), param_binds(0), result_binds(0) + { + std::unique_lock lck(con.mutex); + stmt.reset(mysql_stmt_init(con.my_conn)); + + if (!stmt) // Out of memory is the only returned error + throw std::bad_alloc(); + + if (mysql_stmt_prepare(stmt.get(), query.c_str(), query.size())) + throw std::runtime_error(std::string("Failed to prepare stmt: ") + mysql_stmt_error(stmt.get())); + + auto param_count = mysql_stmt_param_count(stmt.get()); + param_binds = mysql_bind_set(param_count); + + std::unique_ptr meta(mysql_stmt_result_metadata(stmt.get()), mysql_free_result); + if (meta) { + // Not all queries produce a result set + auto result_count = mysql_num_fields(meta.get()); + result_binds = mysql_bind_set(result_count); + } + } + + // query with printf-style substitutions + template + prepared_stmt(connection& pcon, const std::string& fmt_str, Values... values) + : prepared_stmt(pcon, format_string(fmt_str.c_str(), std::forward(values)...)) + {} + + virtual ~prepared_stmt() { + std::unique_lock lck(con.mutex); + stmt.reset(); + } + + // added(slonguo): + // see: https://zh.cppreference.com/w/cpp/memory/enable_shared_from_this + public: + std::shared_ptr getptr() { + return shared_from_this(); + } + + bool execute() { + std::unique_lock lck(con.mutex); + param_binds.pre_execute(); + if (mysql_stmt_bind_param(stmt.get(), param_binds.binds())) + return false; + if (mysql_stmt_execute(stmt.get())) + return false; + param_binds.post_execute(); + return true; + } + + template + void bind_param(const Args &... args) { + param_binds.bind_variables(args...); + } + + template + void bind_result(Args &... args) { + result_binds.bind_variables(args...); + } + + bool fetch() { + std::unique_lock lck(con.mutex); + result_binds.pre_fetch(); + if (mysql_stmt_bind_result(stmt.get(), result_binds.binds())) + return false; + int rc = mysql_stmt_fetch(stmt.get()); + if (rc == MYSQL_DATA_TRUNCATED || rc == 0) { + auto refetch = result_binds.post_fetch(); + for (auto& i : refetch) { + if (mysql_stmt_fetch_column(stmt.get(), &result_binds.binds()[i], (unsigned int)i, 0)) + return false; + } + result_binds.post_refetch(refetch); + return true; + } + else return false; + } + + unsigned int error_code() const { + return mysql_stmt_errno(stmt.get()); + } + + const char* error_message() const { + return mysql_stmt_error(stmt.get()); + } + }; + } +} diff --git a/apps/3rd/sql/polyfill/datetime.h b/apps/3rd/sql/polyfill/datetime.h new file mode 100644 index 0000000..b9885f1 --- /dev/null +++ b/apps/3rd/sql/polyfill/datetime.h @@ -0,0 +1,129 @@ +#pragma once + + +#include +#include +#include +#include + + +namespace daotk { + namespace mysql { + + class datetime { + public: + int year, month, day, hour, minute; + float sec; + bool with_date, with_time; + + public: + datetime() + : with_date(false), with_time(false) + { } + + datetime(time_t ts) { + tm t; +#ifdef _MSC_VER + localtime_s(&t, &ts); +#else + localtime_r(&ts, &t); +#endif + year = t.tm_year; + month = t.tm_mon; + day = t.tm_mday; + hour = t.tm_hour; + minute = t.tm_min; + sec = (float)t.tm_sec; + } + + datetime(int _year, int _mon, int _day, int _hour, int _min, float _sec) + : year(_year), month(_mon), day(_day), hour(_hour), minute(_min), sec(_sec), + with_date(true), with_time(true) + { } + + datetime(int _year, int _mon, int _day) + : year(_year), month(_mon), day(_day), + with_date(true), with_time(false) + { } + + datetime(int _hour, int _min, float _sec) + : hour(_hour), minute(_min), sec(_sec), + with_date(false), with_time(true) + { } + + void from_sql(const char* sql) { + with_date = (strchr(sql, '-') != nullptr); + with_time = (strchr(sql, ':') != nullptr); + + std::istringstream str(sql); + if (with_date) { + str >> year; + + str.ignore(); + str >> month; + + str.ignore(); + str >> day; + + str.ignore(); + } + + if (with_time) { + str >> hour; + + str.ignore(); + str >> minute; + + str.ignore(); + str >> sec; + } + } + + std::string to_sql(bool with_sec_frac = true) const { + std::ostringstream str; + + if (with_date) { + str << year << '-' + << std::setfill('0') << std::setw(2) + << month << '-' + << day; + + if (with_time) str << ' '; + } + + if (with_time) { + str << std::setfill('0') << std::setw(2) + << hour << ':' + << minute << ':'; + + if (with_sec_frac) { + str << std::setprecision(3) << std::setw(6) + << sec; + } + else { + str << (int)sec; + } + } + + return str.str(); + } + + operator time_t() const { + tm t; + t.tm_year = with_date ? year : 0; + t.tm_mon = with_date ? month : 0; + t.tm_mday = with_date ? day : 0; + t.tm_hour = with_time ? hour : 0; + t.tm_min = with_time ? minute : 0; + t.tm_sec = with_time ? (int)sec : 0; + return mktime(&t); + } + + operator double() const { + return (double)time_t(*this) + sec - (int)sec; + } + + }; + + } +} diff --git a/apps/3rd/sql/polyfill/function_traits.h b/apps/3rd/sql/polyfill/function_traits.h new file mode 100644 index 0000000..b357618 --- /dev/null +++ b/apps/3rd/sql/polyfill/function_traits.h @@ -0,0 +1,57 @@ +#pragma once + +#include +#include + +namespace sqlite { + namespace utility { + + template struct function_traits; + + template + struct function_traits : public function_traits< + decltype(&std::remove_reference::type::operator()) + > { }; + + template < + typename ClassType, + typename ReturnType, + typename... Arguments + > + struct function_traits< + ReturnType(ClassType::*)(Arguments...) const + > { + using result_type = ReturnType; + + template + using argument = typename std::tuple_element< + Index, + std::tuple + >::type; + + static const std::size_t arity = sizeof...(Arguments); + }; + + /* support the non-const operator () + * this will work with user defined functors */ + template < + typename ClassType, + typename ReturnType, + typename... Arguments + > + struct function_traits< + ReturnType(ClassType::*)(Arguments...) + > { + using result_type = ReturnType; + + template + using argument = typename std::tuple_element< + Index, + std::tuple + >::type; + + static const std::size_t arity = sizeof...(Arguments); + }; + + } +} diff --git a/apps/3rd/sql/polyfill/optional.hpp b/apps/3rd/sql/polyfill/optional.hpp new file mode 100644 index 0000000..7b9148f --- /dev/null +++ b/apps/3rd/sql/polyfill/optional.hpp @@ -0,0 +1,1052 @@ +// Copyright (C) 2011 - 2012 Andrzej Krzemienski. +// +// Use, modification, and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// The idea and interface is based on Boost.Optional library +// authored by Fernando Luis Cacciola Carballal + +# ifndef ___OPTIONAL_HPP___ +# define ___OPTIONAL_HPP___ + +# include +# include +# include +# include +# include +# include +# include + +# define TR2_OPTIONAL_REQUIRES(...) typename enable_if<__VA_ARGS__::value, bool>::type = false + +# if defined __GNUC__ // NOTE: GNUC is also defined for Clang +# if (__GNUC__ == 4) && (__GNUC_MINOR__ >= 8) +# define TR2_OPTIONAL_GCC_4_8_AND_HIGHER___ +# elif (__GNUC__ > 4) +# define TR2_OPTIONAL_GCC_4_8_AND_HIGHER___ +# endif +# +# if (__GNUC__ == 4) && (__GNUC_MINOR__ >= 7) +# define TR2_OPTIONAL_GCC_4_7_AND_HIGHER___ +# elif (__GNUC__ > 4) +# define TR2_OPTIONAL_GCC_4_7_AND_HIGHER___ +# endif +# +# if (__GNUC__ == 4) && (__GNUC_MINOR__ == 8) && (__GNUC_PATCHLEVEL__ >= 1) +# define TR2_OPTIONAL_GCC_4_8_1_AND_HIGHER___ +# elif (__GNUC__ == 4) && (__GNUC_MINOR__ >= 9) +# define TR2_OPTIONAL_GCC_4_8_1_AND_HIGHER___ +# elif (__GNUC__ > 4) +# define TR2_OPTIONAL_GCC_4_8_1_AND_HIGHER___ +# endif +# endif +# +# if defined __clang_major__ +# if (__clang_major__ == 3 && __clang_minor__ >= 5) +# define TR2_OPTIONAL_CLANG_3_5_AND_HIGHTER_ +# elif (__clang_major__ > 3) +# define TR2_OPTIONAL_CLANG_3_5_AND_HIGHTER_ +# endif +# if defined TR2_OPTIONAL_CLANG_3_5_AND_HIGHTER_ +# define TR2_OPTIONAL_CLANG_3_4_2_AND_HIGHER_ +# elif (__clang_major__ == 3 && __clang_minor__ == 4 && __clang_patchlevel__ >= 2) +# define TR2_OPTIONAL_CLANG_3_4_2_AND_HIGHER_ +# endif +# endif +# +# if defined _MSC_VER +# if (_MSC_VER >= 1900) +# define TR2_OPTIONAL_MSVC_2015_AND_HIGHER___ +# endif +# endif + +# if defined __clang__ +# if (__clang_major__ > 2) || (__clang_major__ == 2) && (__clang_minor__ >= 9) +# define OPTIONAL_HAS_THIS_RVALUE_REFS 1 +# else +# define OPTIONAL_HAS_THIS_RVALUE_REFS 0 +# endif +# elif defined TR2_OPTIONAL_GCC_4_8_1_AND_HIGHER___ +# define OPTIONAL_HAS_THIS_RVALUE_REFS 1 +# elif defined TR2_OPTIONAL_MSVC_2015_AND_HIGHER___ +# define OPTIONAL_HAS_THIS_RVALUE_REFS 1 +# else +# define OPTIONAL_HAS_THIS_RVALUE_REFS 0 +# endif + + +# if defined TR2_OPTIONAL_GCC_4_8_1_AND_HIGHER___ +# define OPTIONAL_HAS_CONSTEXPR_INIT_LIST 1 +# define OPTIONAL_CONSTEXPR_INIT_LIST constexpr +# else +# define OPTIONAL_HAS_CONSTEXPR_INIT_LIST 0 +# define OPTIONAL_CONSTEXPR_INIT_LIST +# endif + +# if defined TR2_OPTIONAL_CLANG_3_5_AND_HIGHTER_ && (defined __cplusplus) && (__cplusplus != 201103L) +# define OPTIONAL_HAS_MOVE_ACCESSORS 1 +# else +# define OPTIONAL_HAS_MOVE_ACCESSORS 0 +# endif + +# // In C++11 constexpr implies const, so we need to make non-const members also non-constexpr +# if (defined __cplusplus) && (__cplusplus == 201103L) +# define OPTIONAL_MUTABLE_CONSTEXPR +# else +# define OPTIONAL_MUTABLE_CONSTEXPR constexpr +# endif + +namespace std{ + +namespace experimental{ + +// BEGIN workaround for missing is_trivially_destructible +# if defined TR2_OPTIONAL_GCC_4_8_AND_HIGHER___ + // leave it: it is already there +# elif defined TR2_OPTIONAL_CLANG_3_4_2_AND_HIGHER_ + // leave it: it is already there +# elif defined TR2_OPTIONAL_MSVC_2015_AND_HIGHER___ + // leave it: it is already there +# elif defined TR2_OPTIONAL_DISABLE_EMULATION_OF_TYPE_TRAITS + // leave it: the user doesn't want it +# else + template + using is_trivially_destructible = std::has_trivial_destructor; +# endif +// END workaround for missing is_trivially_destructible + +# if (defined TR2_OPTIONAL_GCC_4_7_AND_HIGHER___) + // leave it; our metafunctions are already defined. +# elif defined TR2_OPTIONAL_CLANG_3_4_2_AND_HIGHER_ + // leave it; our metafunctions are already defined. +# elif defined TR2_OPTIONAL_MSVC_2015_AND_HIGHER___ + // leave it: it is already there +# elif defined TR2_OPTIONAL_DISABLE_EMULATION_OF_TYPE_TRAITS + // leave it: the user doesn't want it +# else + + +// workaround for missing traits in GCC and CLANG +template +struct is_nothrow_move_constructible +{ + constexpr static bool value = std::is_nothrow_constructible::value; +}; + + +template +struct is_assignable +{ + template + constexpr static bool has_assign(...) { return false; } + + template () = std::declval(), true)) > + // the comma operator is necessary for the cases where operator= returns void + constexpr static bool has_assign(bool) { return true; } + + constexpr static bool value = has_assign(true); +}; + + +template +struct is_nothrow_move_assignable +{ + template + struct has_nothrow_move_assign { + constexpr static bool value = false; + }; + + template + struct has_nothrow_move_assign { + constexpr static bool value = noexcept( std::declval() = std::declval() ); + }; + + constexpr static bool value = has_nothrow_move_assign::value>::value; +}; +// end workaround + + +# endif + + + +// 20.5.4, optional for object types +template class optional; + +// 20.5.5, optional for lvalue reference types +template class optional; + + +// workaround: std utility functions aren't constexpr yet +template inline constexpr T&& constexpr_forward(typename std::remove_reference::type& t) noexcept +{ + return static_cast(t); +} + +template inline constexpr T&& constexpr_forward(typename std::remove_reference::type&& t) noexcept +{ + static_assert(!std::is_lvalue_reference::value, "!!"); + return static_cast(t); +} + +template inline constexpr typename std::remove_reference::type&& constexpr_move(T&& t) noexcept +{ + return static_cast::type&&>(t); +} + + +#if defined NDEBUG +# define TR2_OPTIONAL_ASSERTED_EXPRESSION(CHECK, EXPR) (EXPR) +#else +# define TR2_OPTIONAL_ASSERTED_EXPRESSION(CHECK, EXPR) ((CHECK) ? (EXPR) : ([]{assert(!#CHECK);}(), (EXPR))) +#endif + + +namespace detail_ +{ + +// static_addressof: a constexpr version of addressof +template +struct has_overloaded_addressof +{ + template + constexpr static bool has_overload(...) { return false; } + + template ().operator&()) > + constexpr static bool has_overload(bool) { return true; } + + constexpr static bool value = has_overload(true); +}; + +template )> +constexpr T* static_addressof(T& ref) +{ + return &ref; +} + +template )> +T* static_addressof(T& ref) +{ + return std::addressof(ref); +} + + +// the call to convert(b) has return type A and converts b to type A iff b decltype(b) is implicitly convertible to A +template +constexpr U convert(U v) { return v; } + +} // namespace detail + + +constexpr struct trivial_init_t{} trivial_init{}; + + +// 20.5.6, In-place construction +constexpr struct in_place_t{} in_place{}; + + +// 20.5.7, Disengaged state indicator +struct nullopt_t +{ + struct init{}; + constexpr explicit nullopt_t(init){} +}; +constexpr nullopt_t nullopt{nullopt_t::init()}; + + +// 20.5.8, class bad_optional_access +class bad_optional_access : public logic_error { +public: + explicit bad_optional_access(const string& what_arg) : logic_error{what_arg} {} + explicit bad_optional_access(const char* what_arg) : logic_error{what_arg} {} +}; + + +template +union storage_t +{ + unsigned char dummy_; + T value_; + + constexpr storage_t( trivial_init_t ) noexcept : dummy_() {}; + + template + constexpr storage_t( Args&&... args ) : value_(constexpr_forward(args)...) {} + + ~storage_t(){} +}; + + +template +union constexpr_storage_t +{ + unsigned char dummy_; + T value_; + + constexpr constexpr_storage_t( trivial_init_t ) noexcept : dummy_() {}; + + template + constexpr constexpr_storage_t( Args&&... args ) : value_(constexpr_forward(args)...) {} + + ~constexpr_storage_t() = default; +}; + + +template +struct optional_base +{ + bool init_; + storage_t storage_; + + constexpr optional_base() noexcept : init_(false), storage_(trivial_init) {}; + + explicit constexpr optional_base(const T& v) : init_(true), storage_(v) {} + + explicit constexpr optional_base(T&& v) : init_(true), storage_(constexpr_move(v)) {} + + template explicit optional_base(in_place_t, Args&&... args) + : init_(true), storage_(constexpr_forward(args)...) {} + + template >)> + explicit optional_base(in_place_t, std::initializer_list il, Args&&... args) + : init_(true), storage_(il, std::forward(args)...) {} + + ~optional_base() { if (init_) storage_.value_.T::~T(); } +}; + + +template +struct constexpr_optional_base +{ + bool init_; + constexpr_storage_t storage_; + + constexpr constexpr_optional_base() noexcept : init_(false), storage_(trivial_init) {}; + + explicit constexpr constexpr_optional_base(const T& v) : init_(true), storage_(v) {} + + explicit constexpr constexpr_optional_base(T&& v) : init_(true), storage_(constexpr_move(v)) {} + + template explicit constexpr constexpr_optional_base(in_place_t, Args&&... args) + : init_(true), storage_(constexpr_forward(args)...) {} + + template >)> + OPTIONAL_CONSTEXPR_INIT_LIST explicit constexpr_optional_base(in_place_t, std::initializer_list il, Args&&... args) + : init_(true), storage_(il, std::forward(args)...) {} + + ~constexpr_optional_base() = default; +}; + +template +using OptionalBase = typename std::conditional< + is_trivially_destructible::value, // if possible + constexpr_optional_base::type>, // use base with trivial destructor + optional_base::type> +>::type; + + + +template +class optional : private OptionalBase +{ + static_assert( !std::is_same::type, nullopt_t>::value, "bad T" ); + static_assert( !std::is_same::type, in_place_t>::value, "bad T" ); + + + constexpr bool initialized() const noexcept { return OptionalBase::init_; } + typename std::remove_const::type* dataptr() { return std::addressof(OptionalBase::storage_.value_); } + constexpr const T* dataptr() const { return detail_::static_addressof(OptionalBase::storage_.value_); } + +# if OPTIONAL_HAS_THIS_RVALUE_REFS == 1 + constexpr const T& contained_val() const& { return OptionalBase::storage_.value_; } +# if OPTIONAL_HAS_MOVE_ACCESSORS == 1 + OPTIONAL_MUTABLE_CONSTEXPR T&& contained_val() && { return std::move(OptionalBase::storage_.value_); } + OPTIONAL_MUTABLE_CONSTEXPR T& contained_val() & { return OptionalBase::storage_.value_; } +# else + T& contained_val() & { return OptionalBase::storage_.value_; } + T&& contained_val() && { return std::move(OptionalBase::storage_.value_); } +# endif +# else + constexpr const T& contained_val() const { return OptionalBase::storage_.value_; } + T& contained_val() { return OptionalBase::storage_.value_; } +# endif + + void clear() noexcept { + if (initialized()) dataptr()->T::~T(); + OptionalBase::init_ = false; + } + + template + void initialize(Args&&... args) noexcept(noexcept(T(std::forward(args)...))) + { + assert(!OptionalBase::init_); + ::new (static_cast(dataptr())) T(std::forward(args)...); + OptionalBase::init_ = true; + } + + template + void initialize(std::initializer_list il, Args&&... args) noexcept(noexcept(T(il, std::forward(args)...))) + { + assert(!OptionalBase::init_); + ::new (static_cast(dataptr())) T(il, std::forward(args)...); + OptionalBase::init_ = true; + } + +public: + typedef T value_type; + + // 20.5.5.1, constructors + constexpr optional() noexcept : OptionalBase() {}; + constexpr optional(nullopt_t) noexcept : OptionalBase() {}; + + optional(const optional& rhs) + : OptionalBase() + { + if (rhs.initialized()) { + ::new (static_cast(dataptr())) T(*rhs); + OptionalBase::init_ = true; + } + } + + optional(optional&& rhs) noexcept(is_nothrow_move_constructible::value) + : OptionalBase() + { + if (rhs.initialized()) { + ::new (static_cast(dataptr())) T(std::move(*rhs)); + OptionalBase::init_ = true; + } + } + + constexpr optional(const T& v) : OptionalBase(v) {} + + constexpr optional(T&& v) : OptionalBase(constexpr_move(v)) {} + + template + explicit constexpr optional(in_place_t, Args&&... args) + : OptionalBase(in_place_t{}, constexpr_forward(args)...) {} + + template >)> + OPTIONAL_CONSTEXPR_INIT_LIST explicit optional(in_place_t, std::initializer_list il, Args&&... args) + : OptionalBase(in_place_t{}, il, constexpr_forward(args)...) {} + + // 20.5.4.2, Destructor + ~optional() = default; + + // 20.5.4.3, assignment + optional& operator=(nullopt_t) noexcept + { + clear(); + return *this; + } + + optional& operator=(const optional& rhs) + { + if (initialized() == true && rhs.initialized() == false) clear(); + else if (initialized() == false && rhs.initialized() == true) initialize(*rhs); + else if (initialized() == true && rhs.initialized() == true) contained_val() = *rhs; + return *this; + } + + optional& operator=(optional&& rhs) + noexcept(is_nothrow_move_assignable::value && is_nothrow_move_constructible::value) + { + if (initialized() == true && rhs.initialized() == false) clear(); + else if (initialized() == false && rhs.initialized() == true) initialize(std::move(*rhs)); + else if (initialized() == true && rhs.initialized() == true) contained_val() = std::move(*rhs); + return *this; + } + + template + auto operator=(U&& v) + -> typename enable_if + < + is_same::type, T>::value, + optional& + >::type + { + if (initialized()) { contained_val() = std::forward(v); } + else { initialize(std::forward(v)); } + return *this; + } + + + template + void emplace(Args&&... args) + { + clear(); + initialize(std::forward(args)...); + } + + template + void emplace(initializer_list il, Args&&... args) + { + clear(); + initialize(il, std::forward(args)...); + } + + // 20.5.4.4, Swap + void swap(optional& rhs) noexcept(is_nothrow_move_constructible::value && noexcept(swap(declval(), declval()))) + { + if (initialized() == true && rhs.initialized() == false) { rhs.initialize(std::move(**this)); clear(); } + else if (initialized() == false && rhs.initialized() == true) { initialize(std::move(*rhs)); rhs.clear(); } + else if (initialized() == true && rhs.initialized() == true) { using std::swap; swap(**this, *rhs); } + } + + // 20.5.4.5, Observers + + explicit constexpr operator bool() const noexcept { return initialized(); } + constexpr bool has_value() const noexcept { return initialized(); } + + constexpr T const* operator ->() const { + return TR2_OPTIONAL_ASSERTED_EXPRESSION(initialized(), dataptr()); + } + +# if OPTIONAL_HAS_MOVE_ACCESSORS == 1 + + OPTIONAL_MUTABLE_CONSTEXPR T* operator ->() { + assert (initialized()); + return dataptr(); + } + + constexpr T const& operator *() const& { + return TR2_OPTIONAL_ASSERTED_EXPRESSION(initialized(), contained_val()); + } + + OPTIONAL_MUTABLE_CONSTEXPR T& operator *() & { + assert (initialized()); + return contained_val(); + } + + OPTIONAL_MUTABLE_CONSTEXPR T&& operator *() && { + assert (initialized()); + return constexpr_move(contained_val()); + } + + constexpr T const& value() const& { + return initialized() ? contained_val() : (throw bad_optional_access("bad optional access"), contained_val()); + } + + OPTIONAL_MUTABLE_CONSTEXPR T& value() & { + return initialized() ? contained_val() : (throw bad_optional_access("bad optional access"), contained_val()); + } + + OPTIONAL_MUTABLE_CONSTEXPR T&& value() && { + if (!initialized()) throw bad_optional_access("bad optional access"); + return std::move(contained_val()); + } + +# else + + T* operator ->() { + assert (initialized()); + return dataptr(); + } + + constexpr T const& operator *() const { + return TR2_OPTIONAL_ASSERTED_EXPRESSION(initialized(), contained_val()); + } + + T& operator *() { + assert (initialized()); + return contained_val(); + } + + constexpr T const& value() const { + return initialized() ? contained_val() : (throw bad_optional_access("bad optional access"), contained_val()); + } + + T& value() { + return initialized() ? contained_val() : (throw bad_optional_access("bad optional access"), contained_val()); + } + +# endif + +# if OPTIONAL_HAS_THIS_RVALUE_REFS == 1 + + template + constexpr T value_or(V&& v) const& + { + return *this ? **this : detail_::convert(constexpr_forward(v)); + } + +# if OPTIONAL_HAS_MOVE_ACCESSORS == 1 + + template + OPTIONAL_MUTABLE_CONSTEXPR T value_or(V&& v) && + { + return *this ? constexpr_move(const_cast&>(*this).contained_val()) : detail_::convert(constexpr_forward(v)); + } + +# else + + template + T value_or(V&& v) && + { + return *this ? constexpr_move(const_cast&>(*this).contained_val()) : detail_::convert(constexpr_forward(v)); + } + +# endif + +# else + + template + constexpr T value_or(V&& v) const + { + return *this ? **this : detail_::convert(constexpr_forward(v)); + } + +# endif + + // 20.6.3.6, modifiers + void reset() noexcept { clear(); } +}; + + +template +class optional +{ + static_assert( !std::is_same::value, "bad T" ); + static_assert( !std::is_same::value, "bad T" ); + T* ref; + +public: + + // 20.5.5.1, construction/destruction + constexpr optional() noexcept : ref(nullptr) {} + + constexpr optional(nullopt_t) noexcept : ref(nullptr) {} + + constexpr optional(T& v) noexcept : ref(detail_::static_addressof(v)) {} + + optional(T&&) = delete; + + constexpr optional(const optional& rhs) noexcept : ref(rhs.ref) {} + + explicit constexpr optional(in_place_t, T& v) noexcept : ref(detail_::static_addressof(v)) {} + + explicit optional(in_place_t, T&&) = delete; + + ~optional() = default; + + // 20.5.5.2, mutation + optional& operator=(nullopt_t) noexcept { + ref = nullptr; + return *this; + } + + // optional& operator=(const optional& rhs) noexcept { + // ref = rhs.ref; + // return *this; + // } + + // optional& operator=(optional&& rhs) noexcept { + // ref = rhs.ref; + // return *this; + // } + + template + auto operator=(U&& rhs) noexcept + -> typename enable_if + < + is_same::type, optional>::value, + optional& + >::type + { + ref = rhs.ref; + return *this; + } + + template + auto operator=(U&& rhs) noexcept + -> typename enable_if + < + !is_same::type, optional>::value, + optional& + >::type + = delete; + + void emplace(T& v) noexcept { + ref = detail_::static_addressof(v); + } + + void emplace(T&&) = delete; + + + void swap(optional& rhs) noexcept + { + std::swap(ref, rhs.ref); + } + + // 20.5.5.3, observers + constexpr T* operator->() const { + return TR2_OPTIONAL_ASSERTED_EXPRESSION(ref, ref); + } + + constexpr T& operator*() const { + return TR2_OPTIONAL_ASSERTED_EXPRESSION(ref, *ref); + } + + constexpr T& value() const { + return ref ? *ref : (throw bad_optional_access("bad optional access"), *ref); + } + + explicit constexpr operator bool() const noexcept { + return ref != nullptr; + } + + constexpr bool has_value() const noexcept { + return ref != nullptr; + } + + template + constexpr typename decay::type value_or(V&& v) const + { + return *this ? **this : detail_::convert::type>(constexpr_forward(v)); + } + + // x.x.x.x, modifiers + void reset() noexcept { ref = nullptr; } +}; + + +template +class optional +{ + static_assert( sizeof(T) == 0, "optional rvalue references disallowed" ); +}; + + +// 20.5.8, Relational operators +template constexpr bool operator==(const optional& x, const optional& y) +{ + return bool(x) != bool(y) ? false : bool(x) == false ? true : *x == *y; +} + +template constexpr bool operator!=(const optional& x, const optional& y) +{ + return !(x == y); +} + +template constexpr bool operator<(const optional& x, const optional& y) +{ + return (!y) ? false : (!x) ? true : *x < *y; +} + +template constexpr bool operator>(const optional& x, const optional& y) +{ + return (y < x); +} + +template constexpr bool operator<=(const optional& x, const optional& y) +{ + return !(y < x); +} + +template constexpr bool operator>=(const optional& x, const optional& y) +{ + return !(x < y); +} + + +// 20.5.9, Comparison with nullopt +template constexpr bool operator==(const optional& x, nullopt_t) noexcept +{ + return (!x); +} + +template constexpr bool operator==(nullopt_t, const optional& x) noexcept +{ + return (!x); +} + +template constexpr bool operator!=(const optional& x, nullopt_t) noexcept +{ + return bool(x); +} + +template constexpr bool operator!=(nullopt_t, const optional& x) noexcept +{ + return bool(x); +} + +template constexpr bool operator<(const optional&, nullopt_t) noexcept +{ + return false; +} + +template constexpr bool operator<(nullopt_t, const optional& x) noexcept +{ + return bool(x); +} + +template constexpr bool operator<=(const optional& x, nullopt_t) noexcept +{ + return (!x); +} + +template constexpr bool operator<=(nullopt_t, const optional&) noexcept +{ + return true; +} + +template constexpr bool operator>(const optional& x, nullopt_t) noexcept +{ + return bool(x); +} + +template constexpr bool operator>(nullopt_t, const optional&) noexcept +{ + return false; +} + +template constexpr bool operator>=(const optional&, nullopt_t) noexcept +{ + return true; +} + +template constexpr bool operator>=(nullopt_t, const optional& x) noexcept +{ + return (!x); +} + + + +// 20.5.10, Comparison with T +template constexpr bool operator==(const optional& x, const T& v) +{ + return bool(x) ? *x == v : false; +} + +template constexpr bool operator==(const T& v, const optional& x) +{ + return bool(x) ? v == *x : false; +} + +template constexpr bool operator!=(const optional& x, const T& v) +{ + return bool(x) ? *x != v : true; +} + +template constexpr bool operator!=(const T& v, const optional& x) +{ + return bool(x) ? v != *x : true; +} + +template constexpr bool operator<(const optional& x, const T& v) +{ + return bool(x) ? *x < v : true; +} + +template constexpr bool operator>(const T& v, const optional& x) +{ + return bool(x) ? v > *x : true; +} + +template constexpr bool operator>(const optional& x, const T& v) +{ + return bool(x) ? *x > v : false; +} + +template constexpr bool operator<(const T& v, const optional& x) +{ + return bool(x) ? v < *x : false; +} + +template constexpr bool operator>=(const optional& x, const T& v) +{ + return bool(x) ? *x >= v : false; +} + +template constexpr bool operator<=(const T& v, const optional& x) +{ + return bool(x) ? v <= *x : false; +} + +template constexpr bool operator<=(const optional& x, const T& v) +{ + return bool(x) ? *x <= v : true; +} + +template constexpr bool operator>=(const T& v, const optional& x) +{ + return bool(x) ? v >= *x : true; +} + + +// Comparison of optional with T +template constexpr bool operator==(const optional& x, const T& v) +{ + return bool(x) ? *x == v : false; +} + +template constexpr bool operator==(const T& v, const optional& x) +{ + return bool(x) ? v == *x : false; +} + +template constexpr bool operator!=(const optional& x, const T& v) +{ + return bool(x) ? *x != v : true; +} + +template constexpr bool operator!=(const T& v, const optional& x) +{ + return bool(x) ? v != *x : true; +} + +template constexpr bool operator<(const optional& x, const T& v) +{ + return bool(x) ? *x < v : true; +} + +template constexpr bool operator>(const T& v, const optional& x) +{ + return bool(x) ? v > *x : true; +} + +template constexpr bool operator>(const optional& x, const T& v) +{ + return bool(x) ? *x > v : false; +} + +template constexpr bool operator<(const T& v, const optional& x) +{ + return bool(x) ? v < *x : false; +} + +template constexpr bool operator>=(const optional& x, const T& v) +{ + return bool(x) ? *x >= v : false; +} + +template constexpr bool operator<=(const T& v, const optional& x) +{ + return bool(x) ? v <= *x : false; +} + +template constexpr bool operator<=(const optional& x, const T& v) +{ + return bool(x) ? *x <= v : true; +} + +template constexpr bool operator>=(const T& v, const optional& x) +{ + return bool(x) ? v >= *x : true; +} + +// Comparison of optional with T +template constexpr bool operator==(const optional& x, const T& v) +{ + return bool(x) ? *x == v : false; +} + +template constexpr bool operator==(const T& v, const optional& x) +{ + return bool(x) ? v == *x : false; +} + +template constexpr bool operator!=(const optional& x, const T& v) +{ + return bool(x) ? *x != v : true; +} + +template constexpr bool operator!=(const T& v, const optional& x) +{ + return bool(x) ? v != *x : true; +} + +template constexpr bool operator<(const optional& x, const T& v) +{ + return bool(x) ? *x < v : true; +} + +template constexpr bool operator>(const T& v, const optional& x) +{ + return bool(x) ? v > *x : true; +} + +template constexpr bool operator>(const optional& x, const T& v) +{ + return bool(x) ? *x > v : false; +} + +template constexpr bool operator<(const T& v, const optional& x) +{ + return bool(x) ? v < *x : false; +} + +template constexpr bool operator>=(const optional& x, const T& v) +{ + return bool(x) ? *x >= v : false; +} + +template constexpr bool operator<=(const T& v, const optional& x) +{ + return bool(x) ? v <= *x : false; +} + +template constexpr bool operator<=(const optional& x, const T& v) +{ + return bool(x) ? *x <= v : true; +} + +template constexpr bool operator>=(const T& v, const optional& x) +{ + return bool(x) ? v >= *x : true; +} + + +// 20.5.12, Specialized algorithms +template +void swap(optional& x, optional& y) noexcept(noexcept(x.swap(y))) +{ + x.swap(y); +} + + +template +constexpr optional::type> make_optional(T&& v) +{ + return optional::type>(constexpr_forward(v)); +} + +template +constexpr optional make_optional(reference_wrapper v) +{ + return optional(v.get()); +} + + +} // namespace experimental +} // namespace std + +namespace std +{ + template + struct hash> + { + typedef typename hash::result_type result_type; + typedef std::experimental::optional argument_type; + + constexpr result_type operator()(argument_type const& arg) const { + return arg ? std::hash{}(*arg) : result_type{}; + } + }; + + template + struct hash> + { + typedef typename hash::result_type result_type; + typedef std::experimental::optional argument_type; + + constexpr result_type operator()(argument_type const& arg) const { + return arg ? std::hash{}(*arg) : result_type{}; + } + }; +} + +# undef TR2_OPTIONAL_REQUIRES +# undef TR2_OPTIONAL_ASSERTED_EXPRESSION + +# endif //___OPTIONAL_HPP___ diff --git a/apps/BUILD b/apps/BUILD index 4afc6d9..4a441b9 100644 --- a/apps/BUILD +++ b/apps/BUILD @@ -18,6 +18,20 @@ cc_library( deps = [":3rd_md5"] ) +cc_library( + name = "3rd_mysqlplus", + hdrs = [ + "3rd/sql/mysqlplus.h", + "3rd/sql/polyfill/datetime.h", + "3rd/sql/polyfill/function_traits.h", + "3rd/sql/polyfill/optional.hpp" + ], + deps = [ + "@usr_local//:mysql_build" + ], + visibility = ["//visibility:public"] +) + cc_binary( name = "client", @@ -29,7 +43,7 @@ cc_binary( ":3rd_json", ":utils_strings", "@com_github_grpc_grpc//:grpc++", - "//apis:feepb", + "//apis:deduction", ], ) @@ -41,6 +55,7 @@ cc_binary( copts = [], deps = [ "@com_github_grpc_grpc//:grpc++", - "//apis:feepb", + "//apis:deduction", + ":3rd_mysqlplus", ], ) \ No newline at end of file diff --git a/apps/client.cc b/apps/client.cc index 396d2b1..8949fe4 100644 --- a/apps/client.cc +++ b/apps/client.cc @@ -2,7 +2,7 @@ #include #include -#include "apis/cpp/protocol/v1/fee.grpc.pb.h" +#include "apis/cpp/protocol/v1/deduction.grpc.pb.h" #include "apps/utils/strings.hpp" #include "apps/3rd/json.hpp" @@ -12,48 +12,63 @@ using grpc::ClientContext; using grpc::Status; -using protocol::fee::v1::FeeAdminApi; -using protocol::fee::v1::FeeAdminReq; -using protocol::fee::v1::FeeAdminResp; +using protocol::payment::deduction::v1::DeductionAdminApi; +using protocol::payment::deduction::v1::DeductionAdminReq; +using protocol::payment::deduction::v1::DeductionAdminResp; using utils::CmdMap; -class FeeAdminClient +class DeductionAdmin { -public: - FeeAdminClient(shared_ptr channel) - : stub_(FeeAdminApi::NewStub(channel)) {} - - void Exec(string cmd) - { - FeeAdminReq req; - req.set_cmd(cmd); - - FeeAdminResp resp; - ClientContext ctx; - Status status = stub_->AdminOp(&ctx, req, &resp); + public: + DeductionAdmin(shared_ptr channel) + : stub_(DeductionAdminApi::NewStub(channel)) + + { + reqHandlers = { + {"getlist", &DeductionAdmin::getList}, + }; + printOp.add_whitespace = true; + printOp.always_print_primitive_fields = true; + printOp.preserve_proto_field_names = true; + } - if (status.ok()) + void Exec(string cmd, string data) { - // cout << "[header]code:" << resp.mutable_header()->code() << ", msg:" + resp.mutable_header()->message() << endl; - cout << "[body]" << endl << resp.result() << endl; + auto it = reqHandlers.find(cmd); + if (it == reqHandlers.end()) + { + cout << "invalid cmd:" << cmd << data << endl; + return; + } + (this->*(it->second))(data); } - else + private: + void getList(string data) { - cout << "resp abnormal" << endl; - cout << "code:" << status.error_code() << ": " << status.error_message() << endl; - cout << status.error_details() << endl; + DeductionAdminReq req; + // JsonStringToMessage(data, &req, parseOp); + DeductionAdminResp resp; + ClientContext ctx; + Status status = stub_->GetDeductionList(&ctx, req, &resp); + string printJ; + MessageToJsonString(resp, &printJ, printOp); + cout << "\ngrpc code:" << status.error_code() << " , msg:" << status.error_message() << endl; + cout << printJ << endl; } - } private: - unique_ptr stub_; + using func = void (DeductionAdmin::*)(string); + google::protobuf::util::JsonPrintOptions printOp; + google::protobuf::util::JsonParseOptions parseOp; + + unique_ptr stub_; + unordered_map reqHandlers; }; CmdMap cmdMap = { { - "config", { - {"setjson_config", "eg:config set {\"kick_mode\":1}"}, - {"show", "show config info(db user/passwd obscured)"}, + "getlist", { + {"(no args)", "eg:config set {\"kick_mode\":1}"}, } }, { @@ -69,32 +84,8 @@ CmdMap cmdMap = { }, }; -// int main(int argc, char** argv) { -// string address = "localhost"; -// string port = "50051"; -// string server_address = address + ":" + port; -// cout << "Client querying server address: " << server_address << endl; - - -// // Instantiate the client. It requires a channel, out of which the actual RPCs -// // are created. This channel models a connection to an endpoint (in this case, -// // localhost at port 50051). We indicate that the channel isn't authenticated -// // (use of InsecureChannelCredentials()). -// Client greeter(grpc::CreateChannel( -// server_address, grpc::InsecureChannelCredentials())); -// string user("world"); - -// string reply = greeter.SayHello(user); -// cout << "Greeter received: " << reply << endl; - -// reply = greeter.SayHelloAgain(user); -// cout << "Greeter received: " << reply << endl; - -// return 0; -// } - -vector quits = {"exit", "quit", "bye"}; -vector helps = {"help", "info", "man"}; +vector quits = {"exit"}; +vector helps = {"help"}; string adminPrompt = "admin> "; string _exitPrompt = "Au revoir.\n"; string defaultAddr = "127.0.0.1:12345"; @@ -108,7 +99,7 @@ int main(int argc, char **argv) string address = "localhost"; string port = "50051"; string server_address = address + ":" + port; - FeeAdminClient client(grpc::CreateChannel(server_address, grpc::InsecureChannelCredentials())); + DeductionAdmin client(grpc::CreateChannel(server_address, grpc::InsecureChannelCredentials())); while (1) { cout << adminPrompt; @@ -117,10 +108,11 @@ int main(int argc, char **argv) if (elts.empty()) continue; string cmd = elts[0]; utils::toLower(cmd); + string params = elts[1]; if (!utils::isWord(cmd)) { - cout << errorPrompt; + cout << errorPrompt; continue; } if (utils::in(cmd, helps)) @@ -136,18 +128,13 @@ int main(int argc, char **argv) } if (utils::in(cmd, quits)) break; + if (cmdMap.find(cmd) == cmdMap.end()) { utils::help(cmdMap); continue; } - - // valid command. send request - // string s1, s2; - // if (elts.size() == 2){s1 = elts[1];} - // else if (elts.size() > 2){s1 = elts[1], s2 = elts[2];} - - client.Exec(cmd); + client.Exec(cmd, elts[1]); } cout << _exitPrompt; diff --git a/apps/server.cc b/apps/server.cc index 67be70f..5d11665 100644 --- a/apps/server.cc +++ b/apps/server.cc @@ -3,7 +3,11 @@ #include #include -#include "apis/cpp/protocol/v1/fee.grpc.pb.h" +#include "apis/cpp/protocol/v1/deduction.grpc.pb.h" +#include "apps/3rd/sql/mysqlplus.h" + +using namespace std; +using namespace daotk::mysql; using std::string; @@ -12,23 +16,43 @@ using grpc::ServerBuilder; using grpc::ServerContext; using grpc::Status; -using protocol::fee::v1::FeeAdminApi; -using protocol::fee::v1::FeeAdminReq; -using protocol::fee::v1::FeeAdminResp; +using protocol::payment::deduction::v1::DeductionAdminApi; +using protocol::payment::deduction::v1::DeductionAdminReq; +using protocol::payment::deduction::v1::DeductionAdminResp; +using protocol::payment::deduction::v1::DeductionStruct; + // Logic and data behind the server's behavior. -class FeeAdminServer final : public FeeAdminApi::Service { - Status Logout(ServerContext* context, const FeeAdminReq* req, FeeAdminResp* res) override { - string result("Logout "); - res->set_result(result); +class FeeAdminServer final : public DeductionAdminApi::Service { + Status GetDeductionList(ServerContext* context, const DeductionAdminReq* req, DeductionAdminResp* res) override { + connection my{ "127.0.0.1", "root", "nai6514531", "payment" }; + if (!my) { + cout << "Connection failed" << endl; + } + + DeductionStruct data; + int status; + string desc; + string title; + auto deduction_list = my.query("select * from deduction"); + + while (!deduction_list.eof()) { + deduction_list.fetch(status, desc, title); + cout << "title: " << title << ", status: " << status << ", desc: " << desc; + cout << endl; + data.set_title(title); + data.set_desc(desc); + data.set_status(status); + res->mutable_data()->Add(std::move(data)); + deduction_list.next(); + } return Status::OK; } - Status AdminOp(ServerContext* context, const FeeAdminReq* req, FeeAdminResp* res) override { + Status AdminOp(ServerContext* context, const DeductionAdminReq* req, DeductionAdminResp* res) override { string result("success hanlder"); - string cmd = req->cmd(); - std::cout << cmd << std::endl; - res->set_result(result); + string header = req->header(); + std::cout << header << std::endl; return Status::OK; } }; diff --git a/bazel-bin b/bazel-bin index 0595317..3ea3eca 120000 --- a/bazel-bin +++ b/bazel-bin @@ -1 +1 @@ -/private/var/tmp/_bazel_shadow.zhou/86aaa1c74cb8972971bba0b384e4cbb9/execroot/__main__/bazel-out/darwin-fastbuild/bin \ No newline at end of file +/private/var/tmp/_bazel_shadow.zhou/6fbdc6cc7078392c0659db38a84279a1/execroot/__main__/bazel-out/darwin-dbg/bin \ No newline at end of file diff --git a/bazel-out b/bazel-out index 722369c..5b52083 120000 --- a/bazel-out +++ b/bazel-out @@ -1 +1 @@ -/private/var/tmp/_bazel_shadow.zhou/86aaa1c74cb8972971bba0b384e4cbb9/execroot/__main__/bazel-out \ No newline at end of file +/private/var/tmp/_bazel_shadow.zhou/6fbdc6cc7078392c0659db38a84279a1/execroot/__main__/bazel-out \ No newline at end of file diff --git a/bazel-pms b/bazel-pms new file mode 120000 index 0000000..2aec6ae --- /dev/null +++ b/bazel-pms @@ -0,0 +1 @@ +/private/var/tmp/_bazel_shadow.zhou/6fbdc6cc7078392c0659db38a84279a1/execroot/__main__ \ No newline at end of file diff --git a/bazel-testlogs b/bazel-testlogs index ad7c5c3..5f16393 120000 --- a/bazel-testlogs +++ b/bazel-testlogs @@ -1 +1 @@ -/private/var/tmp/_bazel_shadow.zhou/86aaa1c74cb8972971bba0b384e4cbb9/execroot/__main__/bazel-out/darwin-fastbuild/testlogs \ No newline at end of file +/private/var/tmp/_bazel_shadow.zhou/6fbdc6cc7078392c0659db38a84279a1/execroot/__main__/bazel-out/darwin-dbg/testlogs \ No newline at end of file diff --git a/mysql.BUILD b/mysql.BUILD new file mode 100644 index 0000000..5cb01f0 --- /dev/null +++ b/mysql.BUILD @@ -0,0 +1,9 @@ + +# https://docs.bazel.build/versions/master/be/c-cpp.html#cc_library +cc_library( + name = "mysql_build", + srcs = ["lib/libmysqlclient.dylib"], + hdrs = glob(["include/**"]), + includes = ["include"], + visibility = ["//visibility:public"] +) \ No newline at end of file