xentara-utils v2.0.4
The Xentara Utility Library
|
A device that reads data from memory. More...
#include <xentara/utils/io/MemoryInputDevice.hpp>
Public Member Functions | |
template<memory::MemoryIterator Iterator> | |
MemoryInputDevice (Iterator begin, Iterator end) | |
Constructs a device that reads from a memory region defined by a pair of iterators. | |
template<memory::MemoryIterator Iterator> | |
MemoryInputDevice (Iterator begin, std::iter_difference_t< Iterator > size) | |
Constructs a device that reads from a memory region defined by an iterator and a size. | |
template<memory::VoidPointer Pointer> | |
MemoryInputDevice (Pointer begin, Pointer end) | |
Constructs a device that reads from a memory region defined by a pair of pointers. | |
template<memory::VoidPointer Pointer> | |
MemoryInputDevice (Pointer begin, std::size_t size) | |
Constructs a device that reads from a memory region defined by an iterator and a size. | |
template<memory::MemoryRegion Region> | |
MemoryInputDevice (const Region ®ion) | |
Constructs a device that reads from a memory region. | |
Public Member Functions inherited from xentara::utils::io::InputDevice | |
virtual | ~InputDevice () noexcept(false)=0 |
Virtual, throwing destructor. | |
auto | read (std::size_t size) -> core::RawDataBlock |
Reads a block of data of a specific size. | |
auto | readByte () -> std::byte |
Reads a single byte. | |
auto | tryReadByte () -> std::optional< std::byte > |
Tries to read a single byte from a device. | |
auto | readAll () -> core::RawDataBlock |
Reads all remaining data. | |
auto | readAll (std::size_t maxSize) -> core::RawDataBlock |
Reads all remaining data up to a maximum size. | |
auto | readChunk () -> core::RawDataBlock |
Reads a single chunk of data. | |
auto | readChunk (std::size_t maxSize) -> core::RawDataBlock |
Reads a single chunk of data up to a maximum size. | |
auto | readAvailable () -> std::pair< core::RawDataBlock, bool > |
Reads all immediately available data. | |
auto | readAvailable (std::size_t maxSize) -> std::pair< core::RawDataBlock, bool > |
Reads immediately available data up to a maximum size. | |
template<std::size_t kArraySize> | |
auto | read (std::byte(&array)[kArraySize]) -> void |
Read a block of data into an array. | |
template<std::size_t kArraySize> | |
auto | read (std::array< std::byte, kArraySize > &array) -> void |
Read a block of data into an array. | |
template<std::size_t kArraySize> | |
auto | readChunk (std::byte(&array)[kArraySize]) -> core::RawDataBlock |
Reads a single chunk of data into an array. | |
template<std::size_t kArraySize> | |
auto | readChunk (std::array< std::byte, kArraySize > &array) -> core::RawDataBlock |
Reads a single chunk of data into an array. | |
template<std::size_t kArraySize> | |
auto | readAvailable (std::byte(&array)[kArraySize]) -> std::pair< std::size_t, bool > |
Reads immediately available data into an array. | |
template<std::size_t kArraySize> | |
auto | readAvailable (std::array< std::byte, kArraySize > &array) -> std::pair< std::size_t, bool > |
Reads immediately available data into an array. | |
template<std::contiguous_iterator Iterator, std::sized_sentinel_for< Iterator > Sentinel> requires std::same_as<std::remove_volatile_t<std::iter_value_t<Iterator>>, std::byte> | |
auto | read (Iterator first, Sentinel last) -> void |
Read data to fill 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 | readChunk (Iterator first, Sentinel last) -> Iterator |
Reads a single chunk of data data into 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 | readAvailable (Iterator first, Sentinel last) -> std::pair< Iterator, bool > |
Reads immediately available data into an iterator range. | |
auto | read (std::byte *buffer, std::size_t size) -> void |
Read a block of data into a buffer. | |
auto | readChunk (std::byte *buffer, std::size_t size) -> std::size_t |
Reads a single chunk of data into a buffer. | |
auto | readAvailable (std::byte *buffer, std::size_t size) -> std::pair< std::size_t, bool > |
Reads immediately available data into a buffer. | |
auto | availableReadSize () const -> std::optional< std::size_t > |
Get the number of bytes for reading without blocking. | |
auto | remainingReadSize () const -> std::optional< std::size_t > |
Get the number of bytes remaining before the end of the device. | |
auto | readPosition () const -> std::optional< std::size_t > |
Gets the current read position within the device. | |
auto | setReadPosition (std::size_t position) -> std::optional< std::size_t > |
Sets the current read position within the device. | |
auto | moveReadPosition (std::ptrdiff_t offset, std::ios_base::seekdir origin=std::ios_base::cur) -> std::optional< std::size_t > |
Advances or retreats the current read position within the device. | |
auto | advanceReadPosition (std::size_t offset) -> std::optional< std::size_t > |
Advance the current read position within the device. | |
auto | rewind () -> bool |
Sets the current read position to the beginning of the device. | |
auto | waitForData () -> void |
Waits for more read data to become available. | |
auto | waitForData (std::optional< std::chrono::nanoseconds > timeout) -> bool |
Waits for more read data to become available within a certain time. | |
auto | readTimeout () const noexcept -> std::chrono::nanoseconds |
Returns the read timeout for communication devices. | |
auto | throwEndOfStreamError () const -> void |
Throws an error denoting the end of the stream. | |
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::InputDevice | |
virtual auto | doRead (std::byte *buffer, std::size_t size) -> std::optional< std::size_t >=0 |
Called by the framework to read available data into a buffer up to a maximum size. | |
virtual auto | doThrowEndOfStreamError () const -> void |
Called by the framework to throw an error denoting the end of the stream. | |
virtual auto | doGetAvailableReadSize () const -> std::optional< std::size_t > |
Called by the framework to get the number of bytes that will be read by the next call to doRead(). | |
virtual auto | doGetRemainingReadSize () const -> std::optional< std::size_t > |
Called by the framework to get the number of bytes remaining before the end of the device. | |
virtual auto | doWaitForData (std::optional< std::chrono::nanoseconds > timeout) -> bool |
Called by the framework to wait for more read data to become available. | |
virtual auto | doWaitForDataAndRead (std::byte *buffer, std::size_t size, std::chrono::nanoseconds timeout) -> std::optional< std::size_t > |
Called by the framework to wait for read data to become available, and then read it. | |
virtual auto | doGetReadTimeout () const noexcept -> std::chrono::nanoseconds |
Called by the framework to get the read timeout. | |
virtual auto | doGetReadPosition () const -> std::optional< std::size_t > |
Called by the framework to get the current read position within the device. | |
virtual auto | doSetReadPosition (std::size_t position) -> std::optional< std::size_t > |
Called by the framework to set the current read position within the device. | |
virtual auto | doMoveReadPosition (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 read position within the device. | |
virtual auto | doAdvanceReadPosition (std::size_t offset) -> std::optional< std::size_t > |
Called by the framework to advance the current read 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 device that reads data from memory.
xentara::utils::io::MemoryInputDevice::MemoryInputDevice | ( | Iterator | begin, |
Iterator | end | ||
) |
Constructs a device that reads from a memory region defined by a pair of iterators.
begin | An iterator that points at the beginning of the memory region |
end | An iterator that points at the end of the memory region |
xentara::utils::io::MemoryInputDevice::MemoryInputDevice | ( | Iterator | begin, |
std::iter_difference_t< Iterator > | size | ||
) |
Constructs a device that reads from a memory region defined by an iterator and a size.
begin | An iterator that points at the beginning of the memory region |
size | The size of the memory region |
xentara::utils::io::MemoryInputDevice::MemoryInputDevice | ( | Pointer | begin, |
Pointer | end | ||
) |
Constructs a device that reads from a memory region defined by a pair of pointers.
begin | An iterator that points at the beginning of the memory region |
end | An iterator that points at the end of the memory region |
xentara::utils::io::MemoryInputDevice::MemoryInputDevice | ( | Pointer | begin, |
std::size_t | size | ||
) |
Constructs a device that reads from a memory region defined by an iterator and a size.
begin | An iterator that points at the beginning of the memory region |
size | The size of the memory region |
xentara::utils::io::MemoryInputDevice::MemoryInputDevice | ( | const Region & | region | ) |
Constructs a device that reads from a memory region.
region | The memory region |