Embedded Template Library 1.0
etl::byte_stream_reader Class Reference

#include <byte_stream.h>

Public Types

typedef char * iterator
 
typedef const char * const_iterator
 

Public Member Functions

 byte_stream_reader (etl::span< char > span_, etl::endian stream_endianness_)
 Construct from span.
 
 byte_stream_reader (etl::span< const char > span_, etl::endian stream_endianness_)
 Construct from span.
 
 byte_stream_reader (const void *begin_, const void *end_, etl::endian stream_endianness_)
 Construct from range.
 
 byte_stream_reader (const void *begin_, size_t length_, etl::endian stream_endianness_)
 Construct from begin and length.
 
template<typename T , size_t Size>
 byte_stream_reader (T(&begin_)[Size], etl::endian stream_endianness_)
 Construct from array.
 
template<typename T , size_t Size>
 byte_stream_reader (const T(&begin_)[Size], etl::endian stream_endianness_)
 Construct from const array.
 
template<typename T >
etl::enable_if< etl::is_integral< T >::value||etl::is_floating_point< T >::value, T >::type read_unchecked ()
 Read a value from the stream.
 
template<typename T >
etl::enable_if< etl::is_integral< T >::value||etl::is_floating_point< T >::value, etl::optional< T > >::type read ()
 Read a value from the stream.
 
template<typename T >
etl::enable_if< sizeof(T)==1U, etl::span< constT > >::type read_unchecked (size_t n)
 Read a byte range from the stream.
 
template<typename T >
etl::enable_if< sizeof(T)==1U, etl::optional< etl::span< constT > > >::type read (size_t n)
 Read a byte range from the stream.
 
template<typename T >
etl::enable_if< etl::is_integral< T >::value||etl::is_floating_point< T >::value, etl::span< constT > >::type read_unchecked (etl::span< T > range)
 Read a range of T from the stream.
 
template<typename T >
etl::enable_if< etl::is_integral< T >::value||etl::is_floating_point< T >::value, etl::optional< etl::span< constT > > >::type read (etl::span< T > range)
 Read a range of T from the stream.
 
template<typename T >
etl::enable_if< etl::is_integral< T >::value||etl::is_floating_point< T >::value, etl::span< constT > >::type read_unchecked (T *start, size_t length)
 Read a range of T from the stream.
 
template<typename T >
etl::enable_if< etl::is_integral< T >::value||etl::is_floating_point< T >::value, etl::optional< etl::span< constT > > >::type read (T *start, size_t length)
 Read a range of T from the stream.
 
template<typename T >
bool skip (size_t n)
 
void restart (size_t n=0U)
 Sets the index back to the position in the stream. Default = 0.
 
const_iterator begin () const
 Returns start of the stream.
 
const_iterator end () const
 Returns end of the stream.
 
const_iterator cbegin () const
 Returns start of the stream.
 
const_iterator cend () const
 Returns end of the stream.
 
etl::span< const char > used_data () const
 Returns a span of the used portion of the stream.
 
etl::span< const char > free_data () const
 Returns a span of the free portion of the stream.
 
etl::span< const char > data () const
 Returns a span of whole the stream.
 
bool empty () const
 Returns true if the byte stream is empty.
 
size_t size_bytes () const
 Returns the number of bytes used in the stream.
 
template<typename T >
size_t available () const
 The number of T left in the stream.
 
size_t available_bytes () const
 The number of bytes left in the stream.
 

Detailed Description

Decodes byte streams. Data must be stored in the stream in network order.

Member Function Documentation

◆ skip()

template<typename T >
bool etl::byte_stream_reader::skip ( size_t  n)
inline

Skip n items of T, up to the maximum space available. Returns true if the skip was possible. Returns false if the full skip size was not possible.


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