#include <bit/obstream.h>
Inheritance diagram for bit::obstream:
Public Member Functions | |
obstream () | |
Create an obstream without an output sink. | |
obstream (std::ostream &output) | |
Create an obstream from a standard output stream. | |
virtual | ~obstream () |
Performs any stream cleanup including output of any remaining bits. | |
size_t | write_octets (unsigned char *buf, size_t octets) |
MSB write of up to n octets from a memory buffer. | |
size_t | write_octets (const unsigned char *buf, size_t octets) |
size_t | write_octets (unsigned char *buf, size_t bufsize, size_t octets) |
LSB write of up to n octets from a memory buffer of size m. | |
size_t | write_octets (const unsigned char *buf, size_t bufsize, size_t octets) |
size_t | write_bits (unsigned char *buf, size_t bits) |
MSB bit write of up to n bits from a memory buffer. | |
size_t | write_bits (const unsigned char *buf, size_t bits) |
size_t | write_bits (unsigned char *buf, size_t bufsize, size_t bits) |
LSB bit write of up to n bits from a memory buffer of size m octets with zero padding. | |
size_t | write_bits (const unsigned char *buf, size_t bufsize, size_t bits) |
template<typename T> | |
size_t | write_octets (T t, size_t n=sizeof(T)) |
LSB write of up to n octets from variable t with zero padding. | |
size_t | write_octets (uint16_t t, size_t n=2) |
size_t | write_octets (uint32_t t, size_t n=4) |
size_t | write_octets (uint64_t t, size_t n=8) |
size_t | write_octets (int16_t t, size_t n=2) |
size_t | write_octets (int32_t t, size_t n=4) |
size_t | write_octets (int64_t t, size_t n=8) |
template<typename T> | |
size_t | write_bits (T t, size_t n=sizeof(T)*8) |
LSB write of up to n bits from variable t with zero padding. | |
size_t | write_bits (uint16_t t, size_t n=2) |
size_t | write_bits (uint32_t t, size_t n=4) |
size_t | write_bits (uint64_t t, size_t n=8) |
size_t | write_bits (int16_t t, size_t n=2) |
size_t | write_bits (int32_t t, size_t n=4) |
size_t | write_bits (int64_t t, size_t n=8) |
void | flush (bool msb=true) |
Flush any remaining bits into the output stream using a default MSB ordering or LSB with one-octet width if parameter is false. | |
void | attach_stream (std::ostream &stream, bool clearbits=false) |
Set the associated output stream to stream. | |
void | detach_stream (bool clearbits=false) |
Remove the currently attached stream. | |
obstream () | |
Create an obstream without an output sink. | |
obstream (std::ostream &output) | |
Create an obstream from a standard output stream. | |
virtual | ~obstream () |
Performs any stream cleanup including output of any remaining bits. | |
size_t | write_octets (unsigned char *buf, size_t octets) |
MSB write of up to n octets from a memory buffer. | |
size_t | write_octets (const unsigned char *buf, size_t octets) |
size_t | write_octets (unsigned char *buf, size_t bufsize, size_t octets) |
LSB write of up to n octets from a memory buffer of size m. | |
size_t | write_octets (const unsigned char *buf, size_t bufsize, size_t octets) |
size_t | write_bits (unsigned char *buf, size_t bits) |
MSB bit write of up to n bits from a memory buffer. | |
size_t | write_bits (const unsigned char *buf, size_t bits) |
size_t | write_bits (unsigned char *buf, size_t bufsize, size_t bits) |
LSB bit write of up to n bits from a memory buffer of size m octets with zero padding. | |
size_t | write_bits (const unsigned char *buf, size_t bufsize, size_t bits) |
template<typename T> | |
size_t | write_octets (T t, size_t n=sizeof(T)) |
LSB write of up to n octets from variable t with zero padding. | |
size_t | write_octets (uint16_t t, size_t n=2) |
size_t | write_octets (uint32_t t, size_t n=4) |
size_t | write_octets (uint64_t t, size_t n=8) |
size_t | write_octets (int16_t t, size_t n=2) |
size_t | write_octets (int32_t t, size_t n=4) |
size_t | write_octets (int64_t t, size_t n=8) |
template<typename T> | |
size_t | write_bits (T t, size_t n=sizeof(T)*8) |
LSB write of up to n bits from variable t with zero padding. | |
size_t | write_bits (uint16_t t, size_t n=2) |
size_t | write_bits (uint32_t t, size_t n=4) |
size_t | write_bits (uint64_t t, size_t n=8) |
size_t | write_bits (int16_t t, size_t n=2) |
size_t | write_bits (int32_t t, size_t n=4) |
size_t | write_bits (int64_t t, size_t n=8) |
void | flush (bool msb=true) |
Flush any remaining bits into the output stream using a default MSB ordering or LSB with one-octet width if parameter is false. | |
void | attach_stream (std::ostream &stream, bool clearbits=false) |
Set the associated output stream to stream. | |
void | detach_stream (bool clearbits=false) |
Remove the currently attached stream. | |
obstream () | |
Create an obstream without an output sink. | |
obstream (std::ostream &output) | |
Create an obstream from a standard output stream. | |
virtual | ~obstream () |
Performs any stream cleanup including output of any remaining bits. | |
size_t | write_octets (unsigned char *buf, size_t octets) |
MSB write of up to n octets from a memory buffer. | |
size_t | write_octets (const unsigned char *buf, size_t octets) |
size_t | write_octets (unsigned char *buf, size_t bufsize, size_t octets) |
LSB write of up to n octets from a memory buffer of size m. | |
size_t | write_octets (const unsigned char *buf, size_t bufsize, size_t octets) |
size_t | write_bits (unsigned char *buf, size_t bits) |
MSB bit write of up to n bits from a memory buffer. | |
size_t | write_bits (const unsigned char *buf, size_t bits) |
size_t | write_bits (unsigned char *buf, size_t bufsize, size_t bits) |
LSB bit write of up to n bits from a memory buffer of size m octets with zero padding. | |
size_t | write_bits (const unsigned char *buf, size_t bufsize, size_t bits) |
template<typename T> | |
size_t | write_octets (T t, size_t n=sizeof(T)) |
LSB write of up to n octets from variable t with zero padding. | |
size_t | write_octets (uint16_t t, size_t n=2) |
size_t | write_octets (uint32_t t, size_t n=4) |
size_t | write_octets (uint64_t t, size_t n=8) |
size_t | write_octets (int16_t t, size_t n=2) |
size_t | write_octets (int32_t t, size_t n=4) |
size_t | write_octets (int64_t t, size_t n=8) |
template<typename T> | |
size_t | write_bits (T t, size_t n=sizeof(T)*8) |
LSB write of up to n bits from variable t with zero padding. | |
size_t | write_bits (uint16_t t, size_t n=2) |
size_t | write_bits (uint32_t t, size_t n=4) |
size_t | write_bits (uint64_t t, size_t n=8) |
size_t | write_bits (int16_t t, size_t n=2) |
size_t | write_bits (int32_t t, size_t n=4) |
size_t | write_bits (int64_t t, size_t n=8) |
void | flush (bool msb=true) |
Flush any remaining bits into the output stream using a default MSB ordering or LSB with one-octet width if parameter is false. | |
void | attach_stream (std::ostream &stream, bool clearbits=false) |
Set the associated output stream to stream. | |
void | detach_stream (bool clearbits=false) |
Remove the currently attached stream. | |
Protected Attributes | |
std::ostream * | m_output |
A pointer to the associated output stream. | |
std::ostream * | m_output |
A pointer to the associated output stream. | |
std::ostream * | m_output |
A pointer to the associated output stream. | |
Friends | |
obstream & | operator<< (obstream &s, const bits &b) |
obstream & | operator<< (obstream &s, const octets &o) |
obstream & | operator<< (obstream &s, const whole &w) |
template<typename T> | |
obstream & | operator<< (obstream &s, T &t) |
obstream & | operator<< (obstream &s, const bits &b) |
obstream & | operator<< (obstream &s, const octets &o) |
obstream & | operator<< (obstream &s, const whole &w) |
template<typename T> | |
obstream & | operator<< (obstream &s, T &t) |
obstream & | operator<< (obstream &s, const bits &b) |
obstream & | operator<< (obstream &s, const octets &o) |
obstream & | operator<< (obstream &s, const whole &w) |
template<typename T> | |
obstream & | operator<< (obstream &s, T &t) |
obstream::obstream | ( | std::ostream & | output | ) |
Create an obstream from a standard output stream.
The output stream will be the ultimate destination of the data.
bit::obstream::obstream | ( | std::ostream & | output | ) |
Create an obstream from a standard output stream.
The output stream will be the ultimate destination of the data.
bit::obstream::obstream | ( | std::ostream & | output | ) |
Create an obstream from a standard output stream.
The output stream will be the ultimate destination of the data.
size_t bit::obstream::write_octets | ( | unsigned char * | buf, | |
size_t | octets | |||
) | [inline] |
MSB write of up to n octets from a memory buffer.
size_t bit::obstream::write_octets | ( | unsigned char * | buf, | |
size_t | bufsize, | |||
size_t | octets | |||
) | [inline] |
LSB write of up to n octets from a memory buffer of size m.
LSB, is not necessarily x86 little endian! A write of 4 octets from a 6 octet buffer of 123456 results in 3456. If n is greater than m the result will be zero padded.
size_t bit::obstream::write_bits | ( | unsigned char * | buf, | |
size_t | bits | |||
) | [inline] |
MSB bit write of up to n bits from a memory buffer.
size_t bit::obstream::write_bits | ( | unsigned char * | buf, | |
size_t | bufsize, | |||
size_t | bits | |||
) | [inline] |
LSB bit write of up to n bits from a memory buffer of size m octets with zero padding.
No adjustment is made for x86 integer or any other architectures or types.
size_t bit::obstream::write_octets | ( | T | t, | |
size_t | n = sizeof(T) | |||
) | [inline] |
LSB write of up to n octets from variable t with zero padding.
For architecture specific integer types the "right" thing is done to result in a big-endian write. The default is to write the entire variable into the stream.
size_t bit::obstream::write_bits | ( | T | t, | |
size_t | n = sizeof(T)*8 | |||
) | [inline] |
LSB write of up to n bits from variable t with zero padding.
For architecture specific integer types the "right" thing is done to result in a big-endian write. The default is to write the entire variable into the stream.
void obstream::attach_stream | ( | std::ostream & | stream, | |
bool | clearbits = false | |||
) |
Set the associated output stream to stream.
clearbits | If true any cached bits will be cleared, and if false (default) cached bits remain in the stream for the next write. |
void obstream::detach_stream | ( | bool | clearbits = false |
) |
Remove the currently attached stream.
Futher attempts to write will fail, including subsequent attempts to flush any remaining bits. Therefore, if you're going to flush do it before this function call or set flushbits to true.
clearbits | If true any cached bits will be cleared, and if false (default) cached bits remain in the stream for the next write. |
size_t bit::obstream::write_octets | ( | unsigned char * | buf, | |
size_t | octets | |||
) | [inline] |
MSB write of up to n octets from a memory buffer.
size_t bit::obstream::write_octets | ( | unsigned char * | buf, | |
size_t | bufsize, | |||
size_t | octets | |||
) | [inline] |
LSB write of up to n octets from a memory buffer of size m.
LSB, is not necessarily x86 little endian! A write of 4 octets from a 6 octet buffer of 123456 results in 3456. If n is greater than m the result will be zero padded.
size_t bit::obstream::write_bits | ( | unsigned char * | buf, | |
size_t | bits | |||
) | [inline] |
MSB bit write of up to n bits from a memory buffer.
size_t bit::obstream::write_bits | ( | unsigned char * | buf, | |
size_t | bufsize, | |||
size_t | bits | |||
) | [inline] |
LSB bit write of up to n bits from a memory buffer of size m octets with zero padding.
No adjustment is made for x86 integer or any other architectures or types.
size_t bit::obstream::write_octets | ( | T | t, | |
size_t | n = sizeof(T) | |||
) |
LSB write of up to n octets from variable t with zero padding.
For architecture specific integer types the "right" thing is done to result in a big-endian write. The default is to write the entire variable into the stream.
size_t bit::obstream::write_bits | ( | T | t, | |
size_t | n = sizeof(T)*8 | |||
) |
LSB write of up to n bits from variable t with zero padding.
For architecture specific integer types the "right" thing is done to result in a big-endian write. The default is to write the entire variable into the stream.
void bit::obstream::attach_stream | ( | std::ostream & | stream, | |
bool | clearbits = false | |||
) |
Set the associated output stream to stream.
clearbits | If true any cached bits will be cleared, and if false (default) cached bits remain in the stream for the next write. |
void bit::obstream::detach_stream | ( | bool | clearbits = false |
) |
Remove the currently attached stream.
Futher attempts to write will fail, including subsequent attempts to flush any remaining bits. Therefore, if you're going to flush do it before this function call or set flushbits to true.
clearbits | If true any cached bits will be cleared, and if false (default) cached bits remain in the stream for the next write. |
size_t bit::obstream::write_octets | ( | unsigned char * | buf, | |
size_t | octets | |||
) | [inline] |
MSB write of up to n octets from a memory buffer.
size_t bit::obstream::write_octets | ( | unsigned char * | buf, | |
size_t | bufsize, | |||
size_t | octets | |||
) | [inline] |
LSB write of up to n octets from a memory buffer of size m.
LSB, is not necessarily x86 little endian! A write of 4 octets from a 6 octet buffer of 123456 results in 3456. If n is greater than m the result will be zero padded.
size_t bit::obstream::write_bits | ( | unsigned char * | buf, | |
size_t | bits | |||
) | [inline] |
MSB bit write of up to n bits from a memory buffer.
size_t bit::obstream::write_bits | ( | unsigned char * | buf, | |
size_t | bufsize, | |||
size_t | bits | |||
) | [inline] |
LSB bit write of up to n bits from a memory buffer of size m octets with zero padding.
No adjustment is made for x86 integer or any other architectures or types.
size_t bit::obstream::write_octets | ( | T | t, | |
size_t | n = sizeof(T) | |||
) |
LSB write of up to n octets from variable t with zero padding.
For architecture specific integer types the "right" thing is done to result in a big-endian write. The default is to write the entire variable into the stream.
size_t bit::obstream::write_bits | ( | T | t, | |
size_t | n = sizeof(T)*8 | |||
) |
LSB write of up to n bits from variable t with zero padding.
For architecture specific integer types the "right" thing is done to result in a big-endian write. The default is to write the entire variable into the stream.
void bit::obstream::attach_stream | ( | std::ostream & | stream, | |
bool | clearbits = false | |||
) |
Set the associated output stream to stream.
clearbits | If true any cached bits will be cleared, and if false (default) cached bits remain in the stream for the next write. |
void bit::obstream::detach_stream | ( | bool | clearbits = false |
) |
Remove the currently attached stream.
Futher attempts to write will fail, including subsequent attempts to flush any remaining bits. Therefore, if you're going to flush do it before this function call or set flushbits to true.
clearbits | If true any cached bits will be cleared, and if false (default) cached bits remain in the stream for the next write. |
std::ostream* bit::obstream::m_output [protected] |
A pointer to the associated output stream.
A reference is not used since it is anticipated that future versions will provide a constructor that does not require an associated stream.
std::ostream* bit::obstream::m_output [protected] |
A pointer to the associated output stream.
A reference is not used since it is anticipated that future versions will provide a constructor that does not require an associated stream.
std::ostream* bit::obstream::m_output [protected] |
A pointer to the associated output stream.
A reference is not used since it is anticipated that future versions will provide a constructor that does not require an associated stream.