From 9d68493af119fc5e0cdbb68a80dd853e29752e26 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Thu, 5 Mar 2020 19:47:31 +0100 Subject: [PATCH] Shorten buffer_type to buffer_t --- src/common/communication.h | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/common/communication.h b/src/common/communication.h index 2f731d40..10b43761 100644 --- a/src/common/communication.h +++ b/src/common/communication.h @@ -207,14 +207,15 @@ void serialize(S& s, AEffect& plugin) { } // I don't want to editor 'include/vestige/aeffect.h`. That's why this type -// trait and the above serialization function are here.` +// trait and the above serialization function are here.` Clang complains that +// `buffer` should be qualified (and only in some cases), so `buffer_t` it is. template -struct buffer_type { +struct buffer_t { using type = typename T::buffer_type; }; template <> -struct buffer_type { +struct buffer_t { using type = ArrayBuffer<128>; }; @@ -231,16 +232,17 @@ struct buffer_type { template inline void write_object(Socket& socket, const T& object, - typename buffer_type::type& buffer) { - auto length = bitsery::quickSerialization< - OutputAdapter::type>>(buffer, object); + typename buffer_t::type& buffer) { + auto length = + bitsery::quickSerialization::type>>( + buffer, object); socket.send(boost::asio::buffer(buffer, length)); } template inline void write_object(Socket& socket, const T& object) { - typename buffer_type::type buffer; + typename buffer_t::type buffer; write_object(socket, object, buffer); } @@ -262,12 +264,12 @@ inline void write_object(Socket& socket, const T& object) { template inline T& read_object(Socket& socket, T& object, - typename buffer_type::type& buffer) { + typename buffer_t::type& buffer) { auto message_length = socket.receive(boost::asio::buffer(buffer)); - auto [_, success] = bitsery::quickDeserialization< - InputAdapter::type>>( - {buffer.begin(), message_length}, object); + auto [_, success] = + bitsery::quickDeserialization::type>>( + {buffer.begin(), message_length}, object); if (!success) { throw std::runtime_error("Deserialization failure in call:" + @@ -279,7 +281,7 @@ inline T& read_object(Socket& socket, template inline T& read_object(Socket& socket, T& object) { - typename buffer_type::type buffer; + typename buffer_t::type buffer; return read_object(socket, object, buffer); }