Output binary stream. More...
Public Member Functions | |
OBinaryStream () | |
OBinaryStream (std::size_t size) | |
void | open (std::size_t size) |
void | setSize (std::size_t size) override |
void | squeeze () |
void | write (const char *data, std::size_t size) |
Public Member Functions inherited from bitpit::BinaryStream | |
char * | data () |
const char * | data () const |
bool | eof () const |
std::size_t | getCapacity () const |
int | getChunkCount () |
int | getChunkSize () |
std::size_t | getSize () const |
bool | seekg (std::size_t pos) |
bool | seekg (std::streamoff offset, std::ios_base::seekdir way) |
std::streampos | tellg () const |
Friends | |
template<typename T > | |
OBinaryStream & | operator<<) (OBinaryStream &stream, const T &value) |
Additional Inherited Members | |
Protected Member Functions inherited from bitpit::BinaryStream | |
BinaryStream () | |
BinaryStream (const char *buffer, std::size_t capacity) | |
BinaryStream (const std::vector< char > &buffer) | |
BinaryStream (std::size_t capacity) | |
void | open (const char *buffer, std::size_t capacity) |
void | open (std::size_t capacity) |
void | setCapacity (std::size_t capacity) |
Protected Attributes inherited from bitpit::BinaryStream | |
std::vector< char > | m_buffer |
std::size_t | m_pos |
std::size_t | m_size |
Output binary stream.
Definition at line 120 of file binary_stream.hpp.
bitpit::OBinaryStream::OBinaryStream | ( | ) |
bitpit::OBinaryStream::OBinaryStream | ( | std::size_t | size | ) |
Constructor.
Initialize a binary stream with the specified size. If the specified size if different from zero, the buffer capacity will be set equal to its size and the automatic expansion of the buffer wil be disabled.
[in] | size | is the size of the stream |
Definition at line 455 of file binary_stream.cpp.
void bitpit::OBinaryStream::open | ( | std::size_t | size | ) |
Open a binary stream with the specified size.
If the specified size if different from zero, the buffer capacity will be set equal to its size and the automatic expansion of the buffer wil be disabled.
[in] | size | is the buffer size |
Definition at line 469 of file binary_stream.cpp.
|
overridevirtual |
Set the size of the stream, expressed in bytes.
If the buffer is not expandable an exception is thrown.
[in] | size | is the new size (in bytes) of the stream |
Reimplemented from bitpit::BinaryStream.
Definition at line 488 of file binary_stream.cpp.
void bitpit::OBinaryStream::squeeze | ( | ) |
Requests the stream to reduce its size to fit the data currently contained in the stream.
Definition at line 501 of file binary_stream.cpp.
void bitpit::OBinaryStream::write | ( | const char * | data, |
std::size_t | size ) |
Write data into the stream.
[in] | data | is the memory that contain the data |
[in] | size | is the size (in bytes) of the data to be written into the stream |
Definition at line 522 of file binary_stream.cpp.