Streams#

Defined in namespace hal

#include <libhal-util/streams.hpp>

group Streams

Functions

explicit stream_find(std::span<hal::byte const> p_sequence)#

Construct a new find object.

Parameters:

p_sequence – - sequence to search for. The lifetime of this data pointed to by this span must outlive this object, or not be used when the lifetime of that data is no longer available.

explicit stream_fill(std::span<hal::byte> p_buffer)#

Construct a new fill object.

Parameters:

p_buffer – - buffer to read data into

stream_fill(std::span<hal::byte> p_buffer, size_t const &p_fill_amount)#

Construct a new fill object.

Parameters:
  • p_buffer – - buffer to read data into

  • p_fill_amount – - reference to a size value to limit the fill amount by.

stream_fill_upto(std::span<hal::byte const> p_sequence, std::span<hal::byte> p_buffer)#

Construct a new fill upto object.

Parameters:
  • p_sequence – - sequence to search for. The lifetime of this data pointed to by this span must outlive this object, or not be used when the lifetime of that data is no longer available.

  • p_buffer – - buffer to fill data into

explicit stream_parse() = default#

Construct a new parse object.

explicit stream_skip(size_t p_skip)#

Construct a new skip object.

class stream_find#
#include <streams.hpp>

Discard received bytes until the sequence is found.

Public Functions

explicit stream_find(std::span<hal::byte const> p_sequence)#

Construct a new find object.

Parameters:

p_sequence – - sequence to search for. The lifetime of this data pointed to by this span must outlive this object, or not be used when the lifetime of that data is no longer available.

class stream_fill#
#include <streams.hpp>

Non-blocking callable for reading serial data into a buffer.

Public Functions

explicit stream_fill(std::span<hal::byte> p_buffer)#

Construct a new fill object.

Parameters:

p_buffer – - buffer to read data into

stream_fill(std::span<hal::byte> p_buffer, size_t const &p_fill_amount)#

Construct a new fill object.

Parameters:
  • p_buffer – - buffer to read data into

  • p_fill_amount – - reference to a size value to limit the fill amount by.

class stream_fill_upto#
#include <streams.hpp>

Discard received bytes until the sequence is found.

Public Functions

stream_fill_upto(std::span<hal::byte const> p_sequence, std::span<hal::byte> p_buffer)#

Construct a new fill upto object.

Parameters:
  • p_sequence – - sequence to search for. The lifetime of this data pointed to by this span must outlive this object, or not be used when the lifetime of that data is no longer available.

  • p_buffer – - buffer to fill data into

template<std::unsigned_integral T>
class stream_parse#
#include <streams.hpp>

Read bytes from stream and convert to integer.

Public Functions

explicit stream_parse() = default#

Construct a new parse object.

inline T const &value()#
Returns:

T& - return an immutable reference to the value

class stream_skip#
#include <streams.hpp>

Skip number of bytes in a byte stream.

Public Functions

explicit stream_skip(size_t p_skip)#

Construct a new skip object.