roo_io
API Documentation for roo_io
Loading...
Searching...
No Matches
roo_io::MemoryOutputStream< PtrType > Class Template Reference

#include <memory_output_stream.h>

Inheritance diagram for roo_io::MemoryOutputStream< PtrType >:
[legend]
Collaboration diagram for roo_io::MemoryOutputStream< PtrType >:
[legend]

Public Member Functions

 MemoryOutputStream ()
 
 MemoryOutputStream (PtrType begin, PtrType end)
 
size_t write (const byte *buf, size_t count) override
 Attempts to write up to count bytes from buf.
 
void close () override
 Flushes and closes this stream.
 
Status status () const override
 Returns underlying stream status.
 
byteptr () const
 
- Public Member Functions inherited from roo_io::OutputStream
virtual ~OutputStream ()
 
bool isOpen () const
 Returns whether stream is considered open.
 
virtual size_t tryWrite (const byte *buf, size_t count)
 Attempts to write without indefinite blocking.
 
virtual size_t writeFully (const byte *buf, size_t count)
 Attempts to write count bytes from buf.
 
virtual void flush ()
 Flushes buffered data to the underlying sink.
 

Detailed Description

template<typename PtrType>
class roo_io::MemoryOutputStream< PtrType >

Definition at line 8 of file memory_output_stream.h.

Constructor & Destructor Documentation

◆ MemoryOutputStream() [1/2]

template<typename PtrType >
roo_io::MemoryOutputStream< PtrType >::MemoryOutputStream ( )
inline

Definition at line 10 of file memory_output_stream.h.

◆ MemoryOutputStream() [2/2]

template<typename PtrType >
roo_io::MemoryOutputStream< PtrType >::MemoryOutputStream ( PtrType  begin,
PtrType  end 
)
inline

Definition at line 12 of file memory_output_stream.h.

Member Function Documentation

◆ close()

template<typename PtrType >
void roo_io::MemoryOutputStream< PtrType >::close ( )
inlineoverridevirtual

Flushes and closes this stream.

On success, if status was kOk, status transitions to kClosed. On failure, status reflects encountered error.

Reimplemented from roo_io::OutputStream.

Definition at line 27 of file memory_output_stream.h.

References roo_io::kClosed, and roo_io::kOk.

◆ ptr()

template<typename PtrType >
byte * roo_io::MemoryOutputStream< PtrType >::ptr ( ) const
inline

Definition at line 35 of file memory_output_stream.h.

◆ status()

template<typename PtrType >
Status roo_io::MemoryOutputStream< PtrType >::status ( ) const
inlineoverridevirtual

Returns underlying stream status.

Updated by write/flush operations. Status is either kOk or an error (never kEndOfStream).

Implements roo_io::OutputStream.

Definition at line 33 of file memory_output_stream.h.

◆ write()

template<typename PtrType >
size_t roo_io::MemoryOutputStream< PtrType >::write ( const byte buf,
size_t  count 
)
inlineoverridevirtual

Attempts to write up to count bytes from buf.

Updates status.

Contract:

  • On success (status() == kOk), returns at least one byte.
  • On error, may return zero or number of bytes written before failure.

If pre-call status is not kOk, call should have no effect and return zero.

Successful return does not guarantee data reached final sink until flush() succeeds.

Returns
Number of bytes written.

Implements roo_io::OutputStream.

Definition at line 15 of file memory_output_stream.h.

References roo_io::count, roo_io::kNoSpaceLeftOnDevice, and roo_io::kOk.


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