|
CIRCT 24.0.0git
|
Cursor for incremental consumption of a SegmentedMessageData. More...
#include <Common.h>

Public Member Functions | |
| SegmentedMessageDataCursor (const SegmentedMessageData &msg) | |
| std::span< const uint8_t > | remaining () const |
| Contiguous span from current position to end of current segment. | |
| Segment | remainingSegment () const |
| The unconsumed part of the current segment, with its region. | |
| void | advance (size_t n) |
| Advance by n bytes, crossing segment boundaries as needed. | |
| bool | done () const |
| True when all segments have been consumed. | |
Private Attributes | |
| const SegmentedMessageData & | msg |
| size_t | segIdx = 0 |
| size_t | offset = 0 |
Cursor for incremental consumption of a SegmentedMessageData.
Tracks position across segment boundaries. Backends store this alongside a unique_ptr<SegmentedMessageData> for partial writes.
The cursor reads segments through SegmentedMessageData::segment() on every access and caches nothing, so it throws upon reaching a segment which has been take()n – regardless of whether it was created before or after the take().
Deliberately a separate class (not embedded in SegmentedMessageData) so that generated types have no hidden members — their layout matches the hardware wire format exactly.
|
inline |
| void SegmentedMessageDataCursor::advance | ( | size_t | n | ) |
Advance by n bytes, crossing segment boundaries as needed.
Definition at line 113 of file Common.cpp.
References done(), msg, offset, segIdx, and esi::Segment::size.
| bool SegmentedMessageDataCursor::done | ( | ) | const |
True when all segments have been consumed.
Definition at line 133 of file Common.cpp.
Referenced by advance().
| std::span< const uint8_t > SegmentedMessageDataCursor::remaining | ( | ) | const |
Contiguous span from current position to end of current segment.
Definition at line 95 of file Common.cpp.
References remainingSegment(), and esi::Segment::span().
| Segment SegmentedMessageDataCursor::remainingSegment | ( | ) | const |
The unconsumed part of the current segment, with its region.
data and size match remaining().
Definition at line 99 of file Common.cpp.
References esi::Segment::data, msg, offset, esi::Segment::region, segIdx, and esi::Segment::size.
Referenced by remaining().
|
private |
Definition at line 291 of file Common.h.
Referenced by advance(), done(), remainingSegment(), and SegmentedMessageDataCursor().
|
private |
Definition at line 293 of file Common.h.
Referenced by advance(), and remainingSegment().
|
private |
Definition at line 292 of file Common.h.
Referenced by advance(), done(), and remainingSegment().