Loading...
Searching...
No Matches
etl::bit_stream_writer Class Reference

Writes bits streams. More...

`#include <bit_stream.h>`

## Public Types

typedef char | value_type
typedef value_type * | iterator
typedef const value_type * | const_iterator
typedef etl::span< value_type > | callback_parameter_type
typedef etl::delegate< void(callback_parameter_type)> | callback_type

## Public Member Functions

template<size_t Length>
| bit_stream_writer (const etl::span< char, Length > &span_, etl::bit_order bit_order_, callback_type callback_=callback_type(), etl::endian byte_order_=etl::endian::big)
| Construct from span.
template<size_t Length>
| bit_stream_writer (const etl::span< unsigned char, Length > &span_, etl::bit_order bit_order_, callback_type callback_=callback_type(), etl::endian byte_order_=etl::endian::big)
| Construct from span.
| bit_stream_writer (void *begin_, void *end_, etl::bit_order bit_order_, callback_type callback_=callback_type(), etl::endian byte_order_=etl::endian::big)
| Construct from range.
| bit_stream_writer (void *begin_, size_t length_chars_, etl::bit_order bit_order_, callback_type callback_=callback_type(), etl::endian byte_order_=etl::endian::big)
| Construct from begin and length.
void | restart ()
| Sets the indexes back to the beginning of the stream.
size_t | capacity_bytes () const
| Returns the maximum capacity in bytes.
size_t | capacity_bits () const
| Returns the maximum capacity in bits.
bool | empty () const
| Returns true if the bitsteam indexes have been reset.
bool | full () const
| Returns true if the bitsteam indexes have reached the end.
void | write_unchecked (bool value)
| Writes a boolean to the stream.
bool | write (bool value)
| Writes a boolean to the stream.
template<typename T>
etl::enable_if< etl::is_integral< T >::value, void >::type | write_unchecked (T value, uint_least8_t nbits=CHAR_BIT *sizeof(T))
| For integral types.
template<typename T>
etl::enable_if< etl::is_integral< T >::value, bool >::type | write (T value, uint_least8_t nbits=CHAR_BIT *sizeof(T))
| For integral types.
bool | skip (size_t nbits)
size_t | size_bytes () const
| Returns the number of bytes used in the stream.
size_t | size_bits () const
| Returns the number of bits used in the stream.
template<size_t Nbits>
size_t | available () const
template<typename T>
size_t | available () const
size_t | available (size_t nbits) const
size_t | available_bits () const
| The number of bits left in the stream.
iterator | begin ()
| Returns start of the stream.
const_iterator | begin () const
| Returns start of the stream.
const_iterator | cbegin () const
| Returns start of the stream.
iterator | end ()
| Returns end of the stream.
const_iterator | end () const
| Returns end of the stream.
const_iterator | cend () const
| Returns end of the stream.
etl::span< char > | used_data ()
| Returns a span of the used portion of the stream.
etl::span< const char > | used_data () const
| Returns a span of the used portion of the stream.
etl::span< char > | data ()
| Returns a span of whole the stream.
etl::span< const char > | data () const
| Returns a span of whole the stream.
void | flush ()
| Flush the last byte, if partially filled, to the callback, if valid.
void | set_callback (callback_type callback_)
| Sets the function to call after every write.
callback_type | get_callback () const
| Gets the function to call after every write.

## Detailed Description

Writes bits streams.

## Member Function Documentation

## available() [1/3]

template<typename T>

size_t etl::bit_stream_writer::available | ( |  | ) | const

inline

The number of T available in the stream. Compile time.

## available() [2/3]

template<size_t Nbits>

size_t etl::bit_stream_writer::available | ( |  | ) | const

inline

The number of multiples of 'Nbits' available in the stream. Compile time.

## available() [3/3]

size_t etl::bit_stream_writer::available | ( | size_t | nbits | ) | const

inline

The number of 'bit width' available in the stream. Run time.

## skip()

bool etl::bit_stream_writer::skip | ( | size_t | nbits | ) |

inline

Skip n bits, 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:

- include/etl/bit_stream.h