xentara-utils v1.2.1
Xentara utilities library
Loading...
Searching...
No Matches
xentara::utils::io::MemoryOutputStream< Element, void > Class Template Referencefinal

A specialization for MemoryOutputStream that uses void as element type. More...

#include <io/MemoryOutputStream.hpp>

+ Inheritance diagram for xentara::utils::io::MemoryOutputStream< Element, void >:

Public Types

using value_type = void
 The element type.
 
using pointer = value_type *
 A pointer to an element.
 
using const_pointer = const value_type *
 A const pointer to an element.
 
- Public Types inherited from xentara::utils::io::MemoryOutputStreamBase< Element >
using size_type = std::size_t
 The type used for sizes.
 
using difference_type = std::ptrdiff_t
 The type used for distances.
 
- Public Types inherited from xentara::utils::io::OutputStream< Element >
using element_type = Element
 The element type.
 

Public Member Functions

template<memory::VoidPointer Pointer>
 MemoryOutputStream (Pointer begin, Pointer end)
 Constructs a stream that writes to a memory region defined by a pair of pointers.
 
template<memory::VoidPointer Pointer>
 MemoryOutputStream (Pointer begin, std::size_t size)
 Constructs a stream that writes to a memory region defined by a pointer and a size.
 
auto data () const noexcept -> const value_type *
 Access to the data.
 
- Public Member Functions inherited from xentara::utils::io::MemoryOutputStreamBase< Element >
auto empty () const noexcept -> bool
 Determines whether the data is empty.
 
auto size () const noexcept -> size_type
 Gets the size of the data.
 
auto capacity () const noexcept -> size_type
 Gets the capacity of the data.
 
- Public Member Functions inherited from xentara::utils::io::OutputStream< Element >
virtual ~OutputStream () noexcept(false)=0
 Virtual, throwing destructor.
 
auto write (Element element) -> void
 Write a single element to the stream.
 
template<std::ranges::contiguous_range Data>
requires std::same_as<std::remove_cv_t<std::ranges::range_value_t<Data>>, Element>
auto write (const Data &data) -> void
 Write a block of data.
 
template<std::size_t kDataSize>
auto write (const Element(&data)[kDataSize]) -> void
 Write a block of data contained in an array.
 
template<std::contiguous_iterator Iterator, std::sized_sentinel_for< Iterator > Sentinel>
requires std::same_as<std::remove_cv_t<std::iter_value_t<Iterator>>, Element>
auto write (Iterator first, Sentinel last) -> void
 Write a block of data contained in an iterator range.
 
auto write (const Element *data, std::size_t size) -> void
 Write a block of data contained in a region of memory.
 
auto write (const Element *nullTerminatedString) -> void
 Write a NULL-teminated string.
 
auto flush () -> void
 Flushes the buffer.
 
- Public Member Functions inherited from xentara::utils::io::StreamBase
virtual ~StreamBase () noexcept(false)=0
 Virtual, throwing destructor.
 
auto streamDescription () const -> std::string
 Get a description of the device.
 

Additional Inherited Members

- Protected Member Functions inherited from xentara::utils::io::OutputStream< Element >
 OutputStream () noexcept=default
 Default constructor.
 
 OutputStream (Element *bufferBegin, Element *bufferEnd) noexcept
 Constructor that sets an initially empty buffer.
 
 OutputStream (Element *bufferBegin, Element *bufferEnd, Element *dataEnd) noexcept
 Constructor that sets a buffer that possibly already contains some data.
 
 OutputStream (OutputStream &&other) noexcept
 Move constructor.
 
auto operator= (OutputStream &&rhs) noexcept -> OutputStream &
 Move assignemnt operator.
 
auto setWriteBuffer (Element *bufferBegin, Element *bufferEnd) noexcept -> void
 Sets a new empty buffer.
 
auto setWriteBuffer (Element *bufferBegin, Element *bufferEnd, Element *dataEnd) noexcept -> void
 Sets the buffer.
 
auto setWriteDataEnd (Element *dataEnd) noexcept -> void
 Sets the end of the data within the buffer.
 
auto writeBufferBegin () const -> Element *
 Writes back the buffer start position.
 
auto writeBufferEnd () const -> Element *
 Writes back the buffer end position.
 
auto writeBufferSize () const -> std::size_t
 Gets the buffer size.
 
auto writeDataBegin () const -> Element *
 Returns the beginning of data in the buffer.
 
auto writeDataEnd () const -> Element *
 Returns the end of the data in the buffer.
 
auto writeDataSize () const -> std::size_t
 Returns the size of the unwritten data in the buffer.
 
auto freeBufferBegin () const -> Element *
 Returns the beginning of the free region of the buffer.
 
auto freeBufferSize () const -> std::size_t
 Returns the size of the unwritten data in the buffer.
 
virtual auto doFlushWriteBuffer () -> void
 Called by the framework to write the buffered data to the underlying device once it is full.
 
virtual auto doWrite (const Element *data, std::size_t size) -> std::size_t=0
 Called by the framework to write data from a memory region to the underlying device.
 
- Protected Member Functions inherited from xentara::utils::io::StreamBase
virtual auto doGetStreamDescription () const -> std::string=0
 Called by the framework to get a description of the stream.
 

Detailed Description

template<StreamElement Element>
class xentara::utils::io::MemoryOutputStream< Element, void >

A specialization for MemoryOutputStream that uses void as element type.

Template Parameters
Mustbe the (possibly volatile qualified) type void.

Member Typedef Documentation

◆ const_pointer

template<StreamElement Element>
using xentara::utils::io::MemoryOutputStream< Element, void >::const_pointer = const value_type *

A const pointer to an element.

◆ pointer

template<StreamElement Element>
using xentara::utils::io::MemoryOutputStream< Element, void >::pointer = value_type *

A pointer to an element.

◆ value_type

template<StreamElement Element>
using xentara::utils::io::MemoryOutputStream< Element, void >::value_type = void

The element type.

Constructor & Destructor Documentation

◆ MemoryOutputStream() [1/2]

template<StreamElement Element>
template<memory::VoidPointer Pointer>
xentara::utils::io::MemoryOutputStream< Element, void >::MemoryOutputStream ( Pointer  begin,
Pointer  end 
)

Constructs a stream that writes to a memory region defined by a pair of pointers.

Parameters
beginAn pointer to the beginning of the memory region
endAn pointer one byte past the end of the memory region

◆ MemoryOutputStream() [2/2]

template<StreamElement Element>
template<memory::VoidPointer Pointer>
xentara::utils::io::MemoryOutputStream< Element, void >::MemoryOutputStream ( Pointer  begin,
std::size_t  size 
)

Constructs a stream that writes to a memory region defined by a pointer and a size.

Parameters
beginAn pointer to the beginning of the memory region
sizeThe size of the memory region

Member Function Documentation

◆ data()

template<StreamElement Element>
auto xentara::utils::io::MemoryOutputStream< Element, void >::data ( ) const -> const value_type *
noexcept

Access to the data.

Returns
A pointer to the begining of the written data.