class input_resource


class input_resource
    : public virtual transfer_resource

Description

An input resource is a source of input. It's an object you can read data from.

Public Member Functions

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

Constructs an input resource with the given buffer capacity.

Parameters:
  • buffer_capacity:

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

input_resource (
    const input_resource& other
)

Copy-constructs an input_resource from an existing one.

Parameters:
  • other:

    The input_resource to copy from.

input_resource&
operator = (
    const input_resource& other
)

Copy-assigns an input_resource into this one.

Parameters:
  • other:

    The input_resource to copy from.

input_resource (
    input_resource&& other
)
noexcept

Move-constructs an input_resource from an existing one.

Parameters:
  • other:

    The input_resource to move from.

input_resource&
operator = (
    input_resource&& other
)
noexcept

Move-assigns an input_resource into this one.

Parameters:
  • other:

    The input_resource to move from.

virtual
std::size_t
read (
    std::byte* data,
    std::size_t byte_count
)

Reads byte_count bytes from this input resource and places them in the provided data array.

Parameters:
  • data:

    The array into which the read bytes will be placed.

  • byte_count:

    The number of bytes to read from this input resource.

void
tie (
    output_resource& resource
)
noexcept

Ties the given output resource to this input resource. The tied output resource is flushed when this input resource is read from.

Protected Member Functions

virtual
std::size_t
read_raw (
    std::byte* data,
    std::size_t byte_count,
    read_request rr
)
= 0

Reads byte_count bytes from this input resource and places them in the provided data array.

Parameters:
  • data:

    The array into which the read bytes will be placed.

  • byte_count:

    The number of bytes to read from this input resource.

  • rr:

    The kind of read request that is being issued to this input resource.

std::size_t
fill ()

Fills the buffer and returns the number of bytes read.



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.