xentara-utils v1.2.1
Xentara utilities library
|
A specialization for MemoryOutputDevice that uses void
as element type.
More...
#include <io/MemoryOutputDevice.hpp>
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::MemoryOutputDeviceBase | |
using | size_type = std::size_t |
The type used for sizes. | |
using | difference_type = std::ptrdiff_t |
The type used for distances. | |
Public Member Functions | |
template<memory::VoidPointer Pointer> requires std::is_same_v<std::remove_volatile_t<std::remove_pointer_t<Pointer>>, Void> | |
MemoryOutputDevice (Pointer begin, Pointer end) | |
Constructs a stream that writes to a memory region defined by a pair of pointers. | |
template<memory::VoidPointer Pointer> requires std::is_same_v<std::remove_volatile_t<std::remove_pointer_t<Pointer>>, Void> | |
MemoryOutputDevice (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::MemoryOutputDeviceBase | |
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. | |
auto | truncate () -> void |
Truncates the data at the current position. | |
auto | clear () -> void |
Clears all written data and resets the write position to the beginning. | |
Public Member Functions inherited from xentara::utils::io::OutputDevice | |
virtual | ~OutputDevice () noexcept(false)=0 |
Virtual, throwing destructor. | |
template<std::ranges::contiguous_range Data> requires std::same_as<std::remove_cv_t<std::ranges::range_value_t<Data>>, std::byte> | |
auto | write (const Data &data) -> void |
Writes a block of data. | |
auto | writeByte (std::byte byte) -> void |
Write a single byte. | |
template<std::ranges::contiguous_range Data> requires std::same_as<std::remove_cv_t<std::ranges::range_value_t<Data>>, std::byte> | |
auto | writeChunk (const Data &data) -> std::ranges::range_size_t< Data > |
Writes a single chunk of data contained in an iterator range. | |
template<std::ranges::contiguous_range Data> requires std::same_as<std::remove_cv_t<std::ranges::range_value_t<Data>>, std::byte> | |
auto | tryWrite (const Data &data) -> std::ranges::range_size_t< Data > |
Write as much of a data block as is possible without blocking. | |
auto | tryWriteByte (std::byte byte) -> bool |
Write a single byte, if this can be done without blocking. | |
template<std::contiguous_iterator Iterator, std::sized_sentinel_for< Iterator > Sentinel> requires std::same_as<std::remove_cv_t<std::iter_value_t<Iterator>>, std::byte> | |
auto | write (Iterator first, Sentinel last) -> void |
Writes the data contained in an iterator range. | |
template<std::contiguous_iterator Iterator, std::sized_sentinel_for< Iterator > Sentinel> requires std::same_as<std::remove_cv_t<std::iter_value_t<Iterator>>, std::byte> | |
auto | writeChunk (Iterator first, Sentinel last) -> Iterator |
Writes a single chunk of data from an an iterator range. | |
template<std::contiguous_iterator Iterator, std::sized_sentinel_for< Iterator > Sentinel> requires std::same_as<std::iter_value_t<Iterator>, std::byte> | |
auto | tryWrite (Iterator first, Sentinel last) -> Iterator |
Write as much of the data contained in an iterator range as is possible without blocking. | |
auto | write (const std::byte *data, std::size_t size) -> void |
Write a block of data. | |
auto | writeChunk (const std::byte *data, std::size_t size) -> std::size_t |
Writes a single chunk of data. | |
auto | tryWrite (const std::byte *data, std::size_t size) -> std::size_t |
Write as much of a data block as is possible without blocking. | |
auto | writePosition () const -> std::optional< std::size_t > |
Gets the current write position within the device. | |
auto | setWritePosition (std::size_t position) -> std::optional< std::size_t > |
Sets the current write position within the device. | |
auto | moveWritePosition (std::ptrdiff_t offset, std::ios_base::seekdir origin=std::ios_base::cur) -> std::optional< std::size_t > |
Advances or retreats the current write position within the device. | |
auto | waitUntilWritable (std::chrono::nanoseconds timeout) -> bool |
Waits for the device to be able to accept more write data within a certain time. | |
auto | writeTimeout () const noexcept -> std::chrono::nanoseconds |
Returns the write timeout for communication devices. | |
Public Member Functions inherited from xentara::utils::io::DeviceBase | |
virtual | ~DeviceBase () noexcept(false)=0 |
Virtual, throwing destructor. | |
auto | deviceDescription () const -> std::string |
Get a description of the device. | |
Additional Inherited Members | |
Protected Member Functions inherited from xentara::utils::io::OutputDevice | |
virtual auto | doWrite (const std::byte *data, std::size_t size) -> std::size_t=0 |
Called by the framework to write data up to a maximum size. | |
virtual auto | doWaitUntilWritable (std::optional< std::chrono::nanoseconds > timeout) -> bool |
Called by the framework to wait for the device to be able to accept more write data with an optional timeout. | |
virtual auto | doWaitUntilWritableAndWrite (const std::byte *data, std::size_t size, std::chrono::nanoseconds timeout) -> std::size_t |
Called by the framework to wait for the device to be able to accept more write data, and then write to it. | |
virtual auto | doGetWriteTimeout () const noexcept -> std::chrono::nanoseconds |
Called by the framework to get the write timeout. | |
virtual auto | doGetWritePosition () const -> std::optional< std::size_t > |
Called by the framework to get the current write position within the device. | |
virtual auto | doSetWritePosition (std::size_t position) -> std::optional< std::size_t > |
Called by the framework to set the current write position within the device. | |
virtual auto | doMoveWritePosition (std::ptrdiff_t offset, std::ios_base::seekdir origin=std::ios_base::cur) -> std::optional< std::size_t > |
Called by the framework to advance or retreat the current write position within the device. | |
Protected Member Functions inherited from xentara::utils::io::DeviceBase | |
virtual auto | doGetDeviceDescription () const -> std::string=0 |
Called by the framework to get a description of the device. | |
A specialization for MemoryOutputDevice that uses void
as element type.
Must | be the (possibly volatile qualified) type void . |
using xentara::utils::io::MemoryOutputDevice< Void >::const_pointer = const value_type * |
A const pointer to an element.
using xentara::utils::io::MemoryOutputDevice< Void >::pointer = value_type * |
A pointer to an element.
using xentara::utils::io::MemoryOutputDevice< Void >::value_type = Void |
The element type.
xentara::utils::io::MemoryOutputDevice< Void >::MemoryOutputDevice | ( | Pointer | begin, |
Pointer | end | ||
) |
Constructs a stream that writes to a memory region defined by a pair of pointers.
begin | An pointer to the beginning of the memory region |
end | An pointer one byte past the end of the memory region |
xentara::utils::io::MemoryOutputDevice< Void >::MemoryOutputDevice | ( | Pointer | begin, |
std::size_t | size | ||
) |
Constructs a stream that writes to a memory region defined by a pointer and a size.
begin | An pointer to the beginning of the memory region |
size | The size of the memory region |
|
noexcept |
Access to the data.