template <typename Decoder>
class SelectiveTypedProtoDecoder
Defined at line 707 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
<TypedProtoDecoder
<MAX
_FIELD_ID>> decoder(
data, size, kMask);
for (const Field
&
f : decoder.unknown_fields()) { ... }
Public Methods
template <uint32_t... kFieldIds>
void SelectiveTypedProtoDecoder<Decoder> (const uint8_t *buffer,size_tlength,const SelectiveDecodeMask<kFieldIds...> &mask)
|Decoder| is a TypedProtoDecoder or a generated message decoder, whose
typed accessors this class inherits. 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 the decoder's max field id. |mask| is only read during this call.
Defined at line 716 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 739 of file ../../third_party/perfetto/include/perfetto/protozero/proto_decoder.h
void SelectiveTypedProtoDecoder<Decoder> (SelectiveTypedProtoDecoder<Decoder> && other)
Defined at line 743 of file ../../third_party/perfetto/include/perfetto/protozero/proto_decoder.h
SelectiveTypedProtoDecoder<Decoder> & operator= (SelectiveTypedProtoDecoder<Decoder> && other)
Defined at line 751 of file ../../third_party/perfetto/include/perfetto/protozero/proto_decoder.h