class output_resource


class output_resource
    : public virtual transfer_resource

Description

An output resource is a destination for output. It's an object you can write data to.

Public Member Functions

explicit
output_resource (
    std::size_t buffer_capacity = io_buffer::default_buffer_capacity
)

Constructs an output resource with the given buffer capacity.

Parameters:
  • buffer_capacity:

    The capacity of the I/O buffer. If this is zero, the output resource is completely unbuffered.

output_resource (
    const output_resource& other
)

Copy-constructs an output_resource from an existing one.

Parameters:
  • other:

    The output_resource to copy from.

output_resource&
operator = (
    const output_resource& other
)

Copy-assigns an output_resource into this one.

Parameters:
  • other:

    The output_resource to copy from.

output_resource (
    output_resource&& other
)
noexcept

Move-constructs an output_resource from an existing one.

Parameters:
  • other:

    The output_resource to move from.

output_resource&
operator = (
    output_resource&& other
)
noexcept

Move-assigns an output_resource into this one.

Parameters:
  • other:

    The output_resource to move from.

virtual
std::size_t
write (
    const std::byte* data,
    std::size_t byte_count
)

Writes byte_count bytes from the data array to this output resource.

Parameters:
  • data:

    The array of bytes that will be written to this output resource.

  • byte_count:

    The number of bytes to write to this output resource.

void
flush ()

Flushes this output resource, ensuring that any data that has previously been requested to be written out actually gets written out.

Protected Member Functions

virtual
std::size_t
write_raw (
    const std::byte* data,
    std::size_t byte_count
)
= 0

Writes byte_count bytes from the data array to this output resource.

Parameters:
  • data:

    The array of bytes that will be written to this output resource.

  • byte_count:

    The number of bytes to write to this output resource.



Copyright © 2022-2025 Daniel T. McGinnis

CCL was first published in 2022, and is still actively maintained.

This website was first published in 2022, and is still actively maintained.

This specific web page was first published in 2023.