`ctf` plugin: add `ctf::src::MsgIter` class
Original patch by Simon.
Philippe's changes over original patch (no functional change intended):
* Conform to the Babeltrace 2 coding style for new C++11 code and to
some naming conventions of the common part of the `ctf` plugin.
* Add many public and internal comments.
* Rename `Quirks` class to `MsgIterQuirks`.
Also, rename the quirks to the generic `pktEndDefClkValZero`,
`eventRecordDefClkValGtNextPktBeginDefClkVal`, and
`eventRecordDefClkValLtPktBeginDefClkVal` names to decouple this API
from specific tracers.
* Remove `MsgIterItemVisitor`.
Instead, MsgIter::_handleItem() dispatches the item to a specific
handling method based on its numeric type.
Move the relevant members of `MsgIterItemVisitor` into `MsgIter`
itself.
* In `_StackFrame`, rename everything named "field" to "sub-field" so as
to remove some ambiguity.
* Add MsgIter::_stackTop*() helper methods which defer to the
corresponding method on the top stack frame.
* Add MsgIter::_stackPush() and MsgIter::_stackPop() helper methods.
* Add MsgIter::_addMsgToQueue() helper method.
* Only log item details when the `TRACE` level is enabled.
* Handle `PktMagicNumberItem`: validate the magic number value.
* Handle `MetadataStreamUuidItem`: validate the UUID.
The `MsgIter` constructor now accepts an `expectedMetadataStreamUuid`
parameter (optional UUID) which is the expected metadata stream UUID
to compare to.
* Handle variable-length integer field items, adding the
MsgIter::_handleUIntFieldItem() and MsgIter::_handleSIntFieldItem()
helper method templates to do so.
* Handle BLOB field items.
A new data member, `_mCurBlobFieldDataOffset`, tracks the current BLOB
field data offset to write to when handling the next
`BlobFieldSectionItem` (we can't append to a BLOB field like when
handling `StrFieldSubstrItem`).
* Handle optional field items, adding a member to
`MsgIter::_StackFrame::_Field`.
* In MsgIter::_StackFrame::goToNextSubField(), unconditionally increment
`_mSubFieldIndex`: curSubField() doesn't care about `_mSubFieldIndex`
for the variant/option field cases anyway.
Therefore, make curSubFieldAndGoToNextSubField() reuse curSubField()
and goToNextSubField() to remove some almost duplicate code.
Change-Id: If2dd82b43f4d19a16ec4420c13c9a3686034766d
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8227
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
This page took 0.026677 seconds and 5 git commands to generate.