Public Member Functions

Memory_Stream< T > Class Template Reference

Provides possibility to work with memory buffer through a Simple_Stream interface. Please note that Read and Write operations both increment internal pointer (in the same way as file operations). If the end of buffer is reached operations will not fail - only return less bytes (or zero) than required by Read or Write. More...

#include <Memory_Stream.h>

Inheritance diagram for Memory_Stream< T >:
Inheritance graph
[legend]
Collaboration diagram for Memory_Stream< T >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Memory_Stream (T *buf, size_t size)
 Constructs Memory_Stream from provided memory buffer of given size.
int Read (T *buf, size_t len, size_t *read)
 Reads a number of T values from stream.
int Write (T *buf, size_t len, size_t *written)
 Writes a number of T values to stream.
int Flush ()
 Flushes the internal buffer, useful when you need to make sure the data is passed to the Stream backend (could be some file) from Stream internal buffer.

Detailed Description

template<typename T>
class MCPN::Memory_Stream< T >

Provides possibility to work with memory buffer through a Simple_Stream interface. Please note that Read and Write operations both increment internal pointer (in the same way as file operations). If the end of buffer is reached operations will not fail - only return less bytes (or zero) than required by Read or Write.

MCPN Logo
kr0st © 2010