Medial Code Documentation
|
Wrap resource into a dmlc stream. More...
#include <io.h>
Public Member Functions | |
AlignedResourceReadStream (std::shared_ptr< ResourceHandler > resource) | |
std::shared_ptr< ResourceHandler > | Share () noexcept(true) |
auto | Consume (std::size_t n_bytes) noexcept(true) |
Consume n_bytes of data, no copying is performed. | |
template<typename T > | |
auto | Consume (T *out) noexcept(false) -> std::enable_if_t< std::is_pod_v< T >, bool > |
virtual std::size_t | Tell () noexcept(true) |
std::size_t | Read (void *ptr, std::size_t n_bytes) noexcept(true) |
Read n_bytes of data, output is copied into ptr. | |
template<typename T > | |
auto | Read (T *out) noexcept(false) -> std::enable_if_t< std::is_pod_v< T >, bool > |
Read a primitive type. | |
template<typename T > | |
bool | Read (std::vector< T > *out) noexcept(true) |
Read a vector. | |
Wrap resource into a dmlc stream.
This class is to facilitate the use of mmap. Caller can optionally use the Read()
method or the Consume()
method. The former copies data into output, while the latter makes copy only if it's a primitive type.
Input is required to be aligned to IOAlignment().
|
inlinenoexcept |
Consume n_bytes of data, no copying is performed.
|
inlinenoexcept |
Read a vector.
|
inline |
Read a primitive type.