From bb110e8cbb5f0915f0a6b4e49d9c48a5a8c033b7 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Mon, 14 Dec 2020 18:05:37 +0100 Subject: [PATCH] Add PrimitiveWrapper response logging --- src/common/logging/vst3.cpp | 4 ---- src/common/logging/vst3.h | 8 +++++++- src/common/serialization/vst3/base.h | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/common/logging/vst3.cpp b/src/common/logging/vst3.cpp index d242b43e..db4fe48b 100644 --- a/src/common/logging/vst3.cpp +++ b/src/common/logging/vst3.cpp @@ -207,10 +207,6 @@ void Vst3Logger::log_request(bool is_host_vst, const WantsConfiguration&) { }); } -void Vst3Logger::log_response(bool is_host_vst, const uint32& value) { - log_response_base(is_host_vst, [&](auto& message) { message << value; }); -} - void Vst3Logger::log_response(bool is_host_vst, const Ack&) { log_response_base(is_host_vst, [&](auto& message) { message << "ACK"; }); } diff --git a/src/common/logging/vst3.h b/src/common/logging/vst3.h index 813e6add..4634bfaa 100644 --- a/src/common/logging/vst3.h +++ b/src/common/logging/vst3.h @@ -77,7 +77,6 @@ class Vst3Logger { void log_request(bool is_host_vst, const YaPluginFactory::SetHostContext&); void log_request(bool is_host_vst, const WantsConfiguration&); - void log_response(bool is_host_vst, const uint32&); void log_response(bool is_host_vst, const Ack&); void log_response( bool is_host_vst, @@ -91,6 +90,13 @@ class Vst3Logger { void log_response(bool is_host_vst, const YaPluginFactory::ConstructArgs&); void log_response(bool is_host_vst, const Configuration&); + template + void log_response(bool is_host_vst, const PrimitiveWrapper& value) { + // For logging all primitive return values other than `tresult` + log_response_base(is_host_vst, + [&](auto& message) { message << value; }); + } + Logger& logger; private: diff --git a/src/common/serialization/vst3/base.h b/src/common/serialization/vst3/base.h index 1d7057e9..9798d9e3 100644 --- a/src/common/serialization/vst3/base.h +++ b/src/common/serialization/vst3/base.h @@ -71,7 +71,7 @@ class PrimitiveWrapper { PrimitiveWrapper() {} PrimitiveWrapper(T value) : value(value) {} - operator T() { return value; } + operator T() const { return value; } template void serialize(S& s) {