Double ended buffer combining vector and stream‐like interfaces.

Synopsis

Declared in <streams.h>

class DataStream;

Description

>> and << read and write unformatted data using the above serialization templates. Fills with data in linear time; some stringstream implementations take Nˆ2 time.

Type Aliases

Name

Description

allocator_type

Allocator type of the underlying container.

const_iterator

Const iterator over the stream's elements.

const_reference

Const reference to an element of the stream.

difference_type

Signed difference type of the underlying container.

iterator

Mutable iterator over the stream's elements.

reference

Reference to an element of the stream.

reverse_iterator

Reverse iterator over the stream's elements.

size_type

Unsigned size type of the underlying container.

value_type

Element type stored in the stream.

Member Functions

Name

Description

DataStream [constructor]

Constructors

GetMemoryUsage

Compute total memory usage of this object (own memory + any dynamic memory).

begin

begin overloads

clear

Empty the stream and reset the read position.

data

data overloads

empty

Return true if no unread elements remain.

end

end overloads

ignore

Skip num_ignore bytes from the front of the stream, advancing the read position.

operator>>

Deserialize an object from the front of the stream and return this stream.

operator[]

Subscript operators

read

Read bytes from the front of the stream into dst, advancing the read position.

reserve

Reserve capacity for n unread elements.

resize

Resize the unread region to n elements, filling new ones with c.

size

Return the number of unread elements.

str

Return the unread contents of the stream as a std::string.

write

Append a buffer of bytes to the end of the stream.

operator<<

Serialize an object to the end of the stream and return this stream.

Protected Type Aliases

Name

Description

vector_type

Underlying byte container type backing the stream.

Protected Data Members

Name

Description

m_read_pos

Offset of the first unread byte within vch.

vch

Backing buffer holding both already‐read and unread bytes.

Created with MrDocs