tvm
Loading...
Searching...
No Matches
Public Member Functions | List of all members
tvm::support::BytesOutStream Class Reference

Write-only stream that appends to a caller-provided std::string. More...

#include <bytes_io.h>

Inheritance diagram for tvm::support::BytesOutStream:
Collaboration diagram for tvm::support::BytesOutStream:

Public Member Functions

 BytesOutStream (std::string *buffer)
 
size_t Write (const void *ptr, size_t size) override
 Write raw bytes to the stream.
 
size_t Read (void *, size_t) override
 Read raw bytes from the stream.
 
virtual size_t Read (void *ptr, size_t size)=0
 Read raw bytes from the stream.
 
template<typename T >
bool Read (T *out_data)
 Read a typed value using Serializer<T>.
 
virtual size_t Write (const void *ptr, size_t size)=0
 Write raw bytes to the stream.
 
template<typename T >
void Write (const T &data)
 Write a typed value using Serializer<T>.
 
- Public Member Functions inherited from tvm::support::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.
 

Detailed Description

Write-only stream that appends to a caller-provided std::string.

Constructor & Destructor Documentation

◆ BytesOutStream()

tvm::support::BytesOutStream::BytesOutStream ( std::string *  buffer)
inlineexplicit

Member Function Documentation

◆ Read() [1/3]

template<typename T >
bool tvm::support::Stream::Read ( T *  out_data)
inline

Read a typed value using Serializer<T>.

Template Parameters
TThe data type (must have a Serializer<T> specialization).
Parameters
out_dataPointer to receive the value.
Returns
true on success.

◆ Read() [2/3]

size_t tvm::support::BytesOutStream::Read ( void *  ptr,
size_t  size 
)
inlineoverridevirtual

Read raw bytes from the stream.

Parameters
ptrDestination buffer.
sizeNumber of bytes to read.
Returns
Number of bytes actually read.

Implements tvm::support::Stream.

◆ Read() [3/3]

virtual size_t tvm::support::Stream::Read ( void *  ptr,
size_t  size 
)
virtual

Read raw bytes from the stream.

Parameters
ptrDestination buffer.
sizeNumber of bytes to read.
Returns
Number of bytes actually read.

Implements tvm::support::Stream.

◆ Write() [1/3]

template<typename T >
void tvm::support::Stream::Write ( const T &  data)
inline

Write a typed value using Serializer<T>.

Template Parameters
TThe data type (must have a Serializer<T> specialization).
Parameters
dataThe value to write.

◆ Write() [2/3]

size_t tvm::support::BytesOutStream::Write ( const void *  ptr,
size_t  size 
)
inlineoverridevirtual

Write raw bytes to the stream.

Parameters
ptrSource buffer.
sizeNumber of bytes to write.
Returns
Number of bytes actually written.

Implements tvm::support::Stream.

◆ Write() [3/3]

virtual size_t tvm::support::Stream::Write ( const void *  ptr,
size_t  size 
)
virtual

Write raw bytes to the stream.

Parameters
ptrSource buffer.
sizeNumber of bytes to write.
Returns
Number of bytes actually written.

Implements tvm::support::Stream.


The documentation for this class was generated from the following file: