Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
openlcb::CollectData Struct Reference

Helper class that acts as a data sink for a stream receiver. More...

#include <async_stream_test_helper.hxx>

Inheritance diagram for openlcb::CollectData:
FlowInterface< ByteBuffer >

Public Member Functions

void send (ByteBuffer *msg, unsigned prio) override
 Entry point to the flow.
 
string qtake ()
 Takes a single element from the queue, and releases it.
 
- Public Member Functions inherited from FlowInterface< ByteBuffer >
virtual Poolpool ()
 
virtual ByteBuffertype_helper ()
 This function is never user in the code, but GDB can use it to infer the correct message types.
 
ByteBufferalloc ()
 Synchronously allocates a message buffer from the pool of this flow.
 
void alloc_async (Executable *target)
 Asynchronously allocates a message buffer from the pool of this flow.
 

Public Attributes

string data
 Bytes that arrived so far.
 
Q q
 Holds buffers.
 
bool keepBuffers_ {false}
 if true, the buffers are added to the queue instead of unref'ed.
 

Additional Inherited Members

- Public Types inherited from FlowInterface< ByteBuffer >
typedef ByteBuffer message_type
 Stores the message template type for external reference.
 
- Static Public Member Functions inherited from FlowInterface< ByteBuffer >
static ByteBuffercast_alloc (QMember *entry)
 Down casts and initializes an asynchronous allocation result to the appropriate flow's buffer type.
 

Detailed Description

Helper class that acts as a data sink for a stream receiver.

This class collects the bytes in a string. By default the stream is unthrottled (all buffers are immediately freed), but there are provisions to let the test manually drive how fast the incoming data buffers get freed.

Definition at line 25 of file async_stream_test_helper.hxx.

Member Function Documentation

◆ qtake()

string openlcb::CollectData::qtake ( )
inline

Takes a single element from the queue, and releases it.

Definition at line 45 of file async_stream_test_helper.hxx.

◆ send()

void openlcb::CollectData::send ( ByteBuffer message,
unsigned  priority 
)
inlineoverridevirtual

Entry point to the flow.

Users of the flow should call this mehtod to send a buffer to the flow.

Parameters
messagebuffer to send to the flow
prioritywhich priority back the flow should process it. Lower numbers mean process earlier.

Implements FlowInterface< ByteBuffer >.

Definition at line 34 of file async_stream_test_helper.hxx.

Member Data Documentation

◆ data

string openlcb::CollectData::data

Bytes that arrived so far.

Definition at line 28 of file async_stream_test_helper.hxx.

◆ keepBuffers_

bool openlcb::CollectData::keepBuffers_ {false}

if true, the buffers are added to the queue instead of unref'ed.

Definition at line 32 of file async_stream_test_helper.hxx.

◆ q

Q openlcb::CollectData::q

Holds buffers.

Definition at line 30 of file async_stream_test_helper.hxx.


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