class io_buffer


class io_buffer

Public Member Functions

explicit
io_buffer (
    std::size_t buffer_capacity = default_buffer_capacity
)

Constructs an I/O buffer with the given capacity.

Parameters:
  • buffer_capacity:

    The capacity to use for the I/O buffer.

std::size_t
get_capacity ()
const noexcept

Returns the capacity of this I/O buffer.

std::size_t
get_size ()
const noexcept

Returns the size of this I/O buffer.

void
set_size (
    std::size_t new_size
)
noexcept

Sets the size of this I/O buffer.

Parameters:
  • new_size:

    The new size of this I/O buffer.

std::size_t
get_position ()
const noexcept

Returns the position of this I/O buffer.

void
set_position (
    std::size_t new_position
)
noexcept

Sets the position of this I/O buffer.

Parameters:
  • new_position:

    The new position of this I/O buffer.

std::byte*
get_data ()
noexcept

Returns a pointer to the beginning of this I/O buffer's data.

bool
is_read_dirty ()
const noexcept

Returns true if this I/O buffer is read-dirty. Otherwise, returns false.

void
set_read_dirty (
    bool new_read_dirty_flag
)
noexcept

Sets whether this I/O buffer is read-dirty.

Parameters:
  • new_read_dirty_flag:

    The new read-dirty flag for this I/O buffer.

bool
is_write_dirty ()
const noexcept

Returns true if this I/O buffer is write-dirty. Otherwise, returns false.

void
set_write_dirty (
    bool new_write_dirty_flag
)
noexcept

Sets whether this I/O buffer is write-dirty.

Parameters:
  • new_write_dirty_flag:

    The new write-dirty flag for this I/O buffer.

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

Reads byte_count bytes from this I/O buffer 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 I/O buffer.

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

Writes byte_count bytes from the data array to this I/O buffer.

Parameters:
  • data:

    The array of bytes that will be written to this I/O buffer.

  • byte_count:

    The number of bytes to write to this I/O buffer.

Public Data Members

const int default_buffer_capacity


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 2022.