|
tvm
|
Abstract binary stream for serialization. More...
#include <io.h>
Public Member Functions | |
| virtual size_t | Read (void *ptr, size_t size)=0 |
| Read raw bytes from the stream. | |
| virtual size_t | Write (const void *ptr, size_t size)=0 |
| Write raw bytes to the stream. | |
| virtual | ~Stream ()=default |
| Virtual destructor. | |
| template<typename T > | |
| void | Write (const T &data) |
| Write a typed value using Serializer<T>. | |
| template<typename T > | |
| bool | Read (T *out_data) |
| Read a typed value using Serializer<T>. | |
| template<typename T > | |
| void | WriteArray (const T *data, size_t num_elems) |
| Write an array of typed values element by element. | |
| template<typename T > | |
| bool | ReadArray (T *data, size_t num_elems) |
| Read an array of typed values element by element. | |
Abstract binary stream for serialization.
Subclasses implement the raw Read/Write byte methods. The template Write/Read methods delegate to Serializer for endian-aware, type-safe binary I/O.
using Stream::Read; and using Stream::Write; to make the template overloads visible (C++ name-hiding rule).
|
virtualdefault |
Virtual destructor.
Read a typed value using Serializer<T>.
| T | The data type (must have a Serializer<T> specialization). |
| out_data | Pointer to receive the value. |
Read raw bytes from the stream.
| ptr | Destination buffer. |
| size | Number of bytes to read. |
Read an array of typed values element by element.
| data | Pointer to the first element. |
| num_elems | Number of elements. |
Write a typed value using Serializer<T>.
| T | The data type (must have a Serializer<T> specialization). |
| data | The value to write. |
Write raw bytes to the stream.
| ptr | Source buffer. |
| size | Number of bytes to write. |
Write an array of typed values element by element.
| data | Pointer to the first element. |
| num_elems | Number of elements. |