Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
bitpit::OBinaryStream Class Reference

Output binary stream. More...

Inheritance diagram for bitpit::OBinaryStream:
Inheritance graph
[legend]
Collaboration diagram for bitpit::OBinaryStream:
Collaboration graph
[legend]

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 >
OBinaryStreamoperator<<) (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
 

Detailed Description

Output binary stream.

Definition at line 143 of file binary_stream.hpp.

Constructor & Destructor Documentation

◆ OBinaryStream() [1/2]

bitpit::OBinaryStream::OBinaryStream ( )

Constructor.

Initialize an empty binary stream.

Definition at line 444 of file binary_stream.cpp.

◆ OBinaryStream() [2/2]

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.

Parameters
[in]sizeis the size of the stream

Definition at line 458 of file binary_stream.cpp.

Member Function Documentation

◆ open()

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.

Parameters
[in]sizeis the buffer size

Definition at line 472 of file binary_stream.cpp.

◆ setSize()

void bitpit::OBinaryStream::setSize ( std::size_t size)
overridevirtual

Set the size of the stream, expressed in bytes.

If the buffer is not expandable an exception is thrown.

Parameters
[in]sizeis the new size (in bytes) of the stream

Reimplemented from bitpit::BinaryStream.

Definition at line 491 of file binary_stream.cpp.

◆ squeeze()

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.

◆ write()

void bitpit::OBinaryStream::write ( const char * data,
std::size_t size )

Write data into the stream.

Parameters
[in]datais the memory that contain the data
[in]sizeis the size (in bytes) of the data to be written into the stream

Definition at line 525 of file binary_stream.cpp.


The documentation for this class was generated from the following files:
--- layout: doxygen_footer ---