Closed tsaubergine closed 10 months ago
Likely just use a new message level extension ((dccl.msg).omit_id
, defaults to false).
syntax="proto2";
import "dccl/option_extensions.proto";
message NavigationReport {
option (dccl.msg) = { codec_version: 4
omit_id: true
max_bytes: 32 };
}
On decode we would somehow pass in the Descriptor to use, such as a new template overload to decode:
template <typename CharIterator, typename ProtobufMessage>
CharIterator decode(CharIterator begin, CharIterator end, ProtobufMessage* msg,
bool header_only = false);
which can be called as:
dccl::Codec codec;
std::string bytes;
NavigationReport report; // we know the type via some external mechanism (or it's the only type we're using on a particular link)
codec.decode(bytes.begin(), bytes.end(), &report);
I've found a number of cases where I want to encode a DCCL message without the ID field (knowing that this information is available elsewhere).
Make this easier to do.