8#ifndef META_OCEAN_IO_SERIALIZATION_VECTOR_OUTPUT_STREAM_H
9#define META_OCEAN_IO_SERIALIZATION_VECTOR_OUTPUT_STREAM_H
71 int_type
overflow(int_type character)
override;
88 pos_type
seekoff(off_type offset, std::ios_base::seekdir direction, std::ios_base::openmode mode = std::ios_base::out)
override;
96 pos_type
seekpos(pos_type position, std::ios_base::openmode mode = std::ios_base::out)
override;
108 void reserve(
const size_t capacity);
153 const void*
data()
const;
This class implements a custom stream buffer that stores data in a vector.
Definition VectorOutputStream.h:41
size_t currentPosition_
The current position in the buffer for writing, with range [0, infinity).
Definition VectorOutputStream.h:133
pos_type seekoff(off_type offset, std::ios_base::seekdir direction, std::ios_base::openmode mode=std::ios_base::out) override
Repositions the stream position indicator using relative offsets.
int_type overflow(int_type character) override
Writes a single character to the buffer when the put area is full.
void reserve(const size_t capacity)
Reserves memory for the buffer to avoid reallocations during writing.
Definition VectorOutputStream.h:188
size_t size() const
Returns the current size of the buffer.
Definition VectorOutputStream.h:183
const Buffer & buffer() const
Returns a const reference to the internal buffer.
Definition VectorOutputStream.h:193
void clear()
Clears the buffer content.
Definition VectorOutputStream.h:203
std::vector< char > Buffer
Definition of the buffer type storing the stream data.
Definition VectorOutputStream.h:45
Buffer buffer_
The internal vector storing the stream data.
Definition VectorOutputStream.h:130
VectorStreamBuffer()=default
Creates a new vector stream buffer with an empty buffer.
std::streamsize xsputn(const char *data, std::streamsize size) override
Writes a sequence of characters to the buffer.
pos_type seekpos(pos_type position, std::ios_base::openmode mode=std::ios_base::out) override
Repositions the stream position indicator to an absolute position.
VectorStreamBuffer streamBuffer_
The internal stream buffer storing the data.
Definition VectorOutputStream.h:169
size_t size() const
Returns the current size of the stream.
Definition VectorOutputStream.h:226
VectorOutputStream()
Creates a new vector output stream with an empty buffer.
Definition VectorOutputStream.h:209
void clear()
Clears the stream content.
Definition VectorOutputStream.h:231
const void * data() const
Returns a pointer to the stream data.
Definition VectorOutputStream.h:221
Namespace of the Ocean IO Serialization library.
Definition DataSample.h:29
Namespace of the Ocean IO library.
Definition Base64.h:17
The namespace covering the entire Ocean framework.
Definition Accessor.h:15