src/plugins/ctf/common/src: add item sequence iterator API
This patch adds the item sequence iterator API, internal to the `ctf`
plugin, to be used by the source components (`src.ctf.fs`
and `src.ctf.lttng-live`).
An item sequence iterator can decode a sequence of packets using:
• A medium, which provides binary stream data to the iterator.
• A CTF IR trace class, which describes how to decode said data.
This makes it possible to completely decode CTF data streams without
ever needing to create trace IR objects. In other words, it's a
standalone CTF decoding library which, minus a few utilities borrowed
from the Babeltrace project, could even be reused in other projects.
The value of an item sequence iterator is an item. The item sequence
iterator doesn't actually create items as it advances: it has one
instance of each concrete item class and sets a pointer to one of those
as it advances (it's a single-pass input iterator).
Seek a specific packet beginning with the seekPkt() method.
Methods which make the iterator decode may append a cause to the error
of the current thread and throw `bt2c::Error`.
┌──────────────────────────────────────────────────────────────────────┐
│ NOTE: Currently, this isn't an STL-compliant iterator class: you │
│ can't copy an instance and you can't get an end iterator, because │
│ there's no item sequence (container) class (you need to check │
│ whether or not the next() method returns `nullptr`). Also, the │
│ typical STL type aliases such as `value` and `reference` aren't part │
│ of the class. │
└──────────────────────────────────────────────────────────────────────┘
This API and its implementation are inspired by the yactfr
(<https://github.com/eepp/yactfr>) element sequence iterator API,
conveniently written by the same author 😉.
Please read the class comments of `ctf::src::ItemSeqIter` and
`ctf::src::Medium` to learn how to use this API and how it
works internally.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I423cc934d2425331a09f16ba40fbeb6b5496ff3a
Reviewed-on: https://review.lttng.org/c/babeltrace/+/7966
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12256
This page took 0.024841 seconds and 4 git commands to generate.