template <int MAX_FIELD_ID>
class SelectiveTypedProtoDecoder
Defined at line 694 of file ../../third_party/perfetto/include/perfetto/protozero/proto_decoder.h
TypedProtoDecoder with selective decoding. Ids allowlisted in the mask are
decoded into the O(1) dense storage as usual; every other field --
including ids beyond MAX_FIELD_ID, which TypedProtoDecoder drops -- is
appended, in wire order, to a spill area and can be iterated via
unknown_fields(). Spilled fields are not visible to Get()/at() (which
return an invalid field) or GetRepeated().
This is a separate subclass rather than an extra TypedProtoDecoder
constructor so that the spill bookkeeping costs the plain decode path
nothing: decoders are constructed per nested message, and even
zero-initializing one extra pointer member per construction is measurable
end-to-end.
Usage:
static constexpr SelectiveDecodeMask
<TracePacket
::kTimestampFieldNumber,
TracePacket::kInternedDataFieldNumber>
kMask{};
SelectiveTypedProtoDecoder
<MAX
_FIELD_ID> decoder(data, size, kMask);
for (const Field
&
f : decoder.unknown_fields()) { ... }
Public Methods
template <uint32_t... kFieldIds>
void SelectiveTypedProtoDecoder<MAX_FIELD_ID> (const uint8_t *buffer,size_tlength,const SelectiveDecodeMask<kFieldIds...> &mask)
The dense window is capped at the mask's extent: |num_fields_| is the
only id bound the decode loop checks, so capping it both bounds the mask
read and makes every id above the mask spill, letting the mask be sized
to the allowlisted ids only rather than to MAX_FIELD_ID.
|mask| is only read during this call.
Defined at line 704 of file ../../third_party/perfetto/include/perfetto/protozero/proto_decoder.h
UnknownFieldRange unknown_fields ()
The spilled fields, in wire order. Repeated fields appear once per
occurrence.
Defined at line 730 of file ../../third_party/perfetto/include/perfetto/protozero/proto_decoder.h
void SelectiveTypedProtoDecoder<MAX_FIELD_ID> (SelectiveTypedProtoDecoder<MAX_FIELD_ID> && other)
Defined at line 734 of file ../../third_party/perfetto/include/perfetto/protozero/proto_decoder.h
SelectiveTypedProtoDecoder<MAX_FIELD_ID> & operator= (SelectiveTypedProtoDecoder<MAX_FIELD_ID> && other)
Defined at line 742 of file ../../third_party/perfetto/include/perfetto/protozero/proto_decoder.h