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 &data) |
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 143 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 458 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 472 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 491 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 504 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 525 of file binary_stream.cpp.