From 8bfaade2a64dbb545a0f3e7a69d9d67eb6066995 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Thu, 20 May 2021 14:08:06 +0200 Subject: [PATCH] Change wording in the MessageReference bitsery ext I had to reread the docstrings to remember what `deseerialization_store` was, so it probably needed a better name. --- src/common/bitsery/ext/message-reference.h | 30 +++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/common/bitsery/ext/message-reference.h b/src/common/bitsery/ext/message-reference.h index 17e47368..e2da77a0 100644 --- a/src/common/bitsery/ext/message-reference.h +++ b/src/common/bitsery/ext/message-reference.h @@ -29,9 +29,9 @@ namespace ext { * An adapter for serializing zero-copy references to objects using * `MessageHandler`. The idea is that when serializing, we just read data * from the object pointed at by the reference. Then when deserializing, we'll - * write the data to some `std::option` (so we don't have to initialize an - * unused object on the serializing side), and we'll then change our reference - * to point to the value contained within that option. + * write the data to some backing `std::option` (so we don't have to + * initialize an unused object on the serializing side), and we'll then change + * our reference to point to the value contained within that option. * * This lets us serialize 'references' to objects that can be backed by actual * persistent objects. That way we can avoid allocations during the processing @@ -41,12 +41,12 @@ template class MessageReference { public: /** - * @param deseerialization_store The object we'll deserialize into, so we - * can point the `MessageReference` to this object. On the serializing - * side this won't be touched. + * @param backing_object The object we'll deserialize into, so we can point + * the `MessageReference` to this object. On the serializing side this + * won't be touched. */ - MessageReference(std::optional& deseerialization_store) - : deseerialization_store(deseerialization_store){}; + MessageReference(std::optional& backing_object) + : backing_object(backing_object){}; template void serialize(Ser& ser, @@ -57,23 +57,23 @@ class MessageReference { template void deserialize(Des& des, ::MessageReference& object_ref, Fnc&&) const { - if (!deseerialization_store) { - deseerialization_store.emplace(); + if (!backing_object) { + backing_object.emplace(); } // Since we cannot directly deserialize into a reference, we'll // deserialize into this (persistent) backing object and then point the // reference to this object. - des.object(*deseerialization_store); - object_ref = *deseerialization_store; + des.object(*backing_object); + object_ref = *backing_object; } private: /** - * The actual `T` we'll deserialize into so we can point the reference to - * that object after deserializing. + * This contains the actual `T` we'll deserialize into so we can point the + * reference to that object after deserializing. */ - std::optional& deseerialization_store; + std::optional& backing_object; }; } // namespace ext