xoreos
0.0.5
|
A template implementing a bit stream writer for different data memory layouts. More...
#include <bitstreamwriter.h>
Public Member Functions | |
BitStreamWriterImpl (WriteStream *stream, bool disposeAfterUse=false) | |
Create a bit stream using this input data stream and optionally delete it on destruction. More... | |
BitStreamWriterImpl (WriteStream &stream) | |
Create a bit stream using this input data stream. More... | |
~BitStreamWriterImpl () | |
void | putBit (bool bit) |
Write a bit to the bit stream. More... | |
void | putBits (uint32 bits, size_t n) |
Write a multi-bit value to the bit stream. More... | |
void | flush () |
Flush the stream, forcing all cached bits to the written. More... | |
Public Member Functions inherited from Common::BitStreamWriter | |
virtual | ~BitStreamWriter () |
Private Member Functions | |
void | writeData (uint64 data) |
Write a data value. More... | |
void | writeValue () |
Write the full data value. More... | |
Private Attributes | |
DisposablePtr< WriteStream > | _stream |
The output stream. More... | |
uint64 | _value |
Current value. More... | |
uint8 | _inValue |
Position within the current value. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from Common::BitStreamWriter | |
BitStreamWriter () | |
A template implementing a bit stream writer for different data memory layouts.
Such a bit stream writer accepts bits one at a time, and writes them in chunks of valueBits bits to the data stream.
For example, a bit stream writer with the layout parameters 32, true, false for valueBits, isLE and isMSB2LSB, writes 32bit little-endian values to the data stream, ordering the bits LSB to MSB.
Definition at line 70 of file bitstreamwriter.h.
|
inline |
Create a bit stream using this input data stream and optionally delete it on destruction.
Definition at line 113 of file bitstreamwriter.h.
References Common::BitStreamWriterImpl< valueBits, isLE, isMSB2LSB >::_stream.
|
inline |
Create a bit stream using this input data stream.
Definition at line 123 of file bitstreamwriter.h.
|
inline |
Definition at line 130 of file bitstreamwriter.h.
|
inlinevirtual |
Flush the stream, forcing all cached bits to the written.
This will resync the stream back to valueBits boundaries, padding with 0 bits
Implements Common::BitStreamWriter.
Definition at line 175 of file bitstreamwriter.h.
References Common::BitStreamWriterImpl< valueBits, isLE, isMSB2LSB >::_inValue, Common::BitStreamWriterImpl< valueBits, isLE, isMSB2LSB >::_stream, Common::BitStreamWriterImpl< valueBits, isLE, isMSB2LSB >::_value, and Common::BitStreamWriterImpl< valueBits, isLE, isMSB2LSB >::writeValue().
Referenced by Sound::WwRIFFVorbisStream::generateHeaderComment(), Sound::WwRIFFVorbisStream::generateHeaderIdentification(), and Sound::WwRIFFVorbisStream::generateHeaderSetup().
|
inlinevirtual |
Write a bit to the bit stream.
Implements Common::BitStreamWriter.
Definition at line 134 of file bitstreamwriter.h.
References Common::BitStreamWriterImpl< valueBits, isLE, isMSB2LSB >::_inValue, Common::BitStreamWriterImpl< valueBits, isLE, isMSB2LSB >::_value, and Common::BitStreamWriterImpl< valueBits, isLE, isMSB2LSB >::writeValue().
Referenced by Sound::WwRIFFVorbisStream::generateHeaderSetup(), and Common::BitStreamWriterImpl< valueBits, isLE, isMSB2LSB >::putBits().
|
inlinevirtual |
Write a multi-bit value to the bit stream.
Implements Common::BitStreamWriter.
Definition at line 150 of file bitstreamwriter.h.
References Common::BitStreamWriterImpl< valueBits, isLE, isMSB2LSB >::putBit().
Referenced by Sound::WwRIFFVorbisStream::generateHeaderComment(), Sound::WwRIFFVorbisStream::generateHeaderIdentification(), and Sound::WwRIFFVorbisStream::generateHeaderSetup().
|
inlineprivate |
Write a data value.
Definition at line 78 of file bitstreamwriter.h.
References Common::BitStreamWriterImpl< valueBits, isLE, isMSB2LSB >::_stream.
Referenced by Common::BitStreamWriterImpl< valueBits, isLE, isMSB2LSB >::writeValue().
|
inlineprivate |
Write the full data value.
Definition at line 101 of file bitstreamwriter.h.
References Common::BitStreamWriterImpl< valueBits, isLE, isMSB2LSB >::_value, and Common::BitStreamWriterImpl< valueBits, isLE, isMSB2LSB >::writeData().
Referenced by Common::BitStreamWriterImpl< valueBits, isLE, isMSB2LSB >::flush(), and Common::BitStreamWriterImpl< valueBits, isLE, isMSB2LSB >::putBit().
|
private |
Position within the current value.
Definition at line 75 of file bitstreamwriter.h.
Referenced by Common::BitStreamWriterImpl< valueBits, isLE, isMSB2LSB >::flush(), and Common::BitStreamWriterImpl< valueBits, isLE, isMSB2LSB >::putBit().
|
private |
The output stream.
Definition at line 72 of file bitstreamwriter.h.
Referenced by Common::BitStreamWriterImpl< valueBits, isLE, isMSB2LSB >::BitStreamWriterImpl(), Common::BitStreamWriterImpl< valueBits, isLE, isMSB2LSB >::flush(), and Common::BitStreamWriterImpl< valueBits, isLE, isMSB2LSB >::writeData().
|
private |
Current value.
Definition at line 74 of file bitstreamwriter.h.
Referenced by Common::BitStreamWriterImpl< valueBits, isLE, isMSB2LSB >::flush(), Common::BitStreamWriterImpl< valueBits, isLE, isMSB2LSB >::putBit(), and Common::BitStreamWriterImpl< valueBits, isLE, isMSB2LSB >::writeValue().