|
|
template<memory::MemoryIterator Iterator>
requires std::is_same_v<std::remove_volatile_t<std::iter_value_t<Iterator>>, Element> |
| MemoryOutputDevice (Iterator begin, Iterator end) |
| Constructs a stream that writes to a memory region defined by a pair of iterators.
|
|
template<memory::MemoryIterator Iterator>
requires std::is_same_v<std::remove_volatile_t<std::iter_value_t<Iterator>>, Element> |
| MemoryOutputDevice (Iterator begin, std::iter_difference_t< Iterator > size) |
| Constructs a stream that writes to a memory region defined by an iterator and a size.
|
|
template<memory::MemoryRegion Region>
requires std::is_same_v<std::remove_volatile_t<std::ranges::range_value_t<Region>>, Element> |
| MemoryOutputDevice (Region ®ion) |
| Constructs a stream that writes to a memory region.
|
|
|
auto | at (size_type index) const -> const_reference |
| Accesses the element at a certain index.
|
|
auto | operator[] (size_type index) const noexcept -> const_reference |
| Subscript operator.
|
|
auto | front () const noexcept -> const_reference |
| Returns the first element.
|
|
auto | back () const noexcept -> const_reference |
| Returns the last element.
|
|
auto | data () const noexcept -> const value_type * |
| Raw access to the data.
|
|
template<typename CharTraits = std::char_traits<Element>>
requires std::same_as<Element, char> || std::same_as<Element, char8_t> |
| operator std::basic_string_view< Element, CharTraits > () const |
| Returns the data written so far as a string view.
|
|
|
auto | begin () const noexcept -> const_iterator |
| Creates a begin iterator.
|
|
auto | cbegin () const noexcept -> const_iterator |
| Creates a begin iterator.
|
|
auto | end () const noexcept -> const_iterator |
| Creates an end iterator.
|
|
auto | cend () const noexcept -> const_iterator |
| Creates an end iterator.
|
|
auto | rbegin () const noexcept -> const_reverse_iterator |
| Creates a reverse begin iterator.
|
|
auto | crbegin () const noexcept -> const_reverse_iterator |
| Creates a reverse begin iterator.
|
|
auto | rend () const noexcept -> const_reverse_iterator |
| Creates a reverse end iterator.
|
|
auto | crend () const noexcept -> const_reverse_iterator |
| Creates a reverse end iterator.
|
|
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.
|
|
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.
|
|
virtual | ~DeviceBase () noexcept(false)=0 |
| Virtual, throwing destructor.
|
|
auto | deviceDescription () const -> std::string |
| Get a description of the device.
|
|
template<typename Element = std::byte>
class xentara::utils::io::MemoryOutputDevice< Element >
A device that writes data to a memory region.
- Template Parameters
-
Element | The type for the elements. Must be std::byte , or another trivial type that is the same size as std::byte . Common types include char , unsigned char , and char8_t . |
- See also
- MemoryOutputDevice<Void>