CIRCT 24.0.0git
Loading...
Searching...
No Matches
SerialCoordInput Struct Reference
Inheritance diagram for SerialCoordInput:
Collaboration diagram for SerialCoordInput:

Public Member Functions

 SerialCoordInput ()
void yTranslation (uint32_t yTrans)
uint32_t yTranslation () const
void xTranslation (uint32_t xTrans)
uint32_t xTranslation () const
void appendCoord (uint32_t x, uint32_t y)
const std::vector< SerialCoordData > & getCoords () const
size_t numSegments () const override
 Number of segments in the message.
Segment segment (size_t idx) const override
 Get a segment by index. Throws if the segment has been take()n.
 SerialCoordInput (uint32_t xTrans, uint32_t yTrans, std::vector< SerialCoordData > &coords, services::HostMemAllocator *allocator=nullptr)
size_t numSegments () const override
 Number of segments in the message.
Segment segment (size_t idx) const override
 Get a segment by index. Throws if the segment has been take()n.
std::unique_ptr< services::HostMemRegion > take (size_t segIdx) override
 Optionally called by a backend once it has transmitted segment segIdx, to obtain ownership of the HostMem region backing it (e.g.
Public Member Functions inherited from esi::SegmentedMessageData
virtual ~SegmentedMessageData ()=default
size_t totalSize () const
 Total size across all segments.
bool empty () const
 True if totalSize() == 0.
virtual MessageData toMessageData () const
 Flatten all segments into a standard MessageData.

Private Attributes

SerialCoordHeader header
std::vector< SerialCoordData > coords
SerialCoordHeader footer
bool coordsInRegion = false
std::unique_ptr< services::HostMemRegion > coordsRegion
size_t coordsBytes

Detailed Description

Definition at line 2228 of file esitester.cpp.

Constructor & Destructor Documentation

◆ SerialCoordInput() [1/2]

SerialCoordInput::SerialCoordInput ( )
inline

Definition at line 2235 of file esitester.cpp.

References footer, and header.

◆ SerialCoordInput() [2/2]

SerialCoordInput::SerialCoordInput ( uint32_t xTrans,
uint32_t yTrans,
std::vector< SerialCoordData > & coords,
services::HostMemAllocator * allocator = nullptr )
inline

Definition at line 196 of file loopback.cpp.

References coords, coordsBytes, coordsInRegion, coordsRegion, footer, header, and if().

Member Function Documentation

◆ appendCoord()

void SerialCoordInput::appendCoord ( uint32_t x,
uint32_t y )
inline

Definition at line 2250 of file esitester.cpp.

References coords, and header.

◆ getCoords()

const std::vector< SerialCoordData > & SerialCoordInput::getCoords ( ) const
inline

Definition at line 2254 of file esitester.cpp.

References coords.

◆ numSegments() [1/2]

size_t SerialCoordInput::numSegments ( ) const
inlineoverridevirtual

Number of segments in the message.

Implements esi::SegmentedMessageData.

Definition at line 2256 of file esitester.cpp.

Referenced by take().

◆ numSegments() [2/2]

size_t SerialCoordInput::numSegments ( ) const
inlineoverridevirtual

Number of segments in the message.

Implements esi::SegmentedMessageData.

Definition at line 216 of file loopback.cpp.

◆ segment() [1/2]

Segment SerialCoordInput::segment ( size_t idx) const
inlineoverridevirtual

Get a segment by index. Throws if the segment has been take()n.

Implements esi::SegmentedMessageData.

Definition at line 2257 of file esitester.cpp.

References coords, footer, and header.

Referenced by checkHostMemTake().

◆ segment() [2/2]

Segment SerialCoordInput::segment ( size_t idx) const
inlineoverridevirtual

Get a segment by index. Throws if the segment has been take()n.

Implements esi::SegmentedMessageData.

Definition at line 217 of file loopback.cpp.

References coords, coordsBytes, coordsInRegion, coordsRegion, footer, and header.

◆ take()

std::unique_ptr< services::HostMemRegion > SerialCoordInput::take ( size_t segIdx)
inlineoverridevirtual

Optionally called by a backend once it has transmitted segment segIdx, to obtain ownership of the HostMem region backing it (e.g.

to re-use the region or return it to a pool).

Returns nullptr, leaving the segment accessible, if the segment isn't backed by a region or the message doesn't transfer region ownership. Otherwise, marks the segment as taken – after which segment(segIdx) (and thus anything which reads the whole message, such as toMessageData()) and further calls to take(segIdx) throw – and returns the region if no other untaken segment references it, or nullptr if some still do. Since several segments may share a region, a backend which calls take() on each segment as it is transmitted receives each region exactly once, after the last segment using it.

Since SegmentedMessageDataCursor reads segments via segment(), a backend must not take a segment which a cursor over the message can still reach, and must not take a segment it may need to retransmit. Any cursor (including one created after the take()) throws when it reaches a taken segment. Segment copies of a taken segment obtained before the take() are invalid: their data may point into a region which has been re-used.

The default implementation returns nullptr.

Reimplemented from esi::SegmentedMessageData.

Definition at line 234 of file loopback.cpp.

References coordsInRegion, coordsRegion, and numSegments().

Referenced by checkHostMemTake().

◆ xTranslation() [1/2]

uint32_t SerialCoordInput::xTranslation ( ) const
inline

Definition at line 2249 of file esitester.cpp.

References header.

◆ xTranslation() [2/2]

void SerialCoordInput::xTranslation ( uint32_t xTrans)
inline

Definition at line 2248 of file esitester.cpp.

References header.

◆ yTranslation() [1/2]

uint32_t SerialCoordInput::yTranslation ( ) const
inline

Definition at line 2247 of file esitester.cpp.

References header.

◆ yTranslation() [2/2]

void SerialCoordInput::yTranslation ( uint32_t yTrans)
inline

Definition at line 2246 of file esitester.cpp.

References header.

Member Data Documentation

◆ coords

std::vector< SerialCoordData > SerialCoordInput::coords
private

Definition at line 2231 of file esitester.cpp.

Referenced by appendCoord(), getCoords(), segment(), and SerialCoordInput().

◆ coordsBytes

size_t SerialCoordInput::coordsBytes
private

Definition at line 193 of file loopback.cpp.

Referenced by segment(), and SerialCoordInput().

◆ coordsInRegion

bool SerialCoordInput::coordsInRegion = false
private

Definition at line 190 of file loopback.cpp.

Referenced by segment(), SerialCoordInput(), and take().

◆ coordsRegion

std::unique_ptr<services::HostMemRegion> SerialCoordInput::coordsRegion
private

Definition at line 192 of file loopback.cpp.

Referenced by segment(), SerialCoordInput(), and take().

◆ footer

SerialCoordHeader SerialCoordInput::footer
private

Definition at line 2232 of file esitester.cpp.

Referenced by segment(), SerialCoordInput(), and SerialCoordInput().

◆ header

SerialCoordHeader SerialCoordInput::header
private

The documentation for this struct was generated from the following files: