Consider having Fw::Buffer::getSerializeRepr
return an object instead of a reference
#2714
Labels
Fw::Buffer::getSerializeRepr
return an object instead of a reference
#2714
Fw::Buffer::getSerializeRepr
currently returns a reference into a serialize buffer stored as a member ofFw::Buffer
. There are some issues with this:getSerializeRepr
, you're not sure what state the serialize buffer is in. It depends on what has previously been done with the buffer.Fw::Buffer
. It would be better for theFw::Buffer
to be read-only in this case.Instead we could have
getSerializeRepr
return an object, sayFw::ExternalSerializeBufferWithMemberCopy
. That way the user would own the serialize representation, and it could be freshly initialized each time it is requested. An argument togetSerializeRepr
could specify whether the representation is for serialization (in which case the internal serial pointer should be set to zero) or deserialization (in which case the internal serial pointer should be set to the end of the data). Access to the buffer for deserialization would be read-only.The text was updated successfully, but these errors were encountered: