|
| std::size_t | size_bytes () const |
| | Return the logical exposed storage size in bytes.
|
| |
|
std::size_t | size_bits () const |
| | Return the exposed storage size in bits.
|
| |
|
bool | empty () const |
| | Check whether the storage is empty.
|
| |
|
position_type | begin_position () const |
| | Return the first logical byte position currently exposed.
|
| |
|
position_type | end_position () const |
| | Return the position one past the last logical byte exposed.
|
| |
|
bool | contains (position_type position, std::size_t count_bytes) const |
| | Return whether a complete logical range is currently exposed.
|
| |
|
std::span< const std::byte > | as_bytes () const |
| | Return a contiguous read-only view of all logical exposed bytes.
|
| |
| SplitSpan< std::byte > | segments () |
| | Return all logical bytes as one or two writable physical spans.
|
| |
| SplitSpan< const std::byte > | segments () const |
| | Return all logical bytes as one or two physical spans.
|
| |
| SplitSpan< std::byte > | segments (position_type position, std::size_t count_bytes) |
| | Return a checked writable logical byte range as one or two spans.
|
| |
| SplitSpan< const std::byte > | segments (position_type position, std::size_t count_bytes) const |
| | Return a checked logical byte range as one or two physical spans.
|
| |
| std::span< const std::uint16_t > | as_words16 () const |
| | Return a read-only view as 16-bit words.
|
| |
| std::span< const std::uint64_t > | as_words64 () const |
| | Return a read-only view as 64-bit words.
|
| |
|
auto | view () const |
| | Return a non-owning read-only view of all exposed bytes.
|
| |
| auto | view (std::size_t offset_bytes, std::size_t count_bytes) const |
| | Return a non-owning read-only byte subrange.
|
| |
|
void | serialize_impl (BinaryWriter &writer) const |
| | Serialize the exposed bytes with a 64-bit little-endian size prefix.
|
| |
|
void | resize (std::size_t size_bits) |
| | Resize mutable storage to hold at least size_bits bits.
|
| |
|
auto | writable_bytes () |
| | Return writable storage bytes.
|
| |
|
auto | writable_words16 () |
| | Return writable storage as 16-bit words.
|
| |
|
auto | writable_words64 () |
| | Return writable storage as 64-bit words.
|
| |
|
std::size_t | allocated_bytes () const |
| | Return bytes reserved by an owning storage implementation.
|
| |
|
void | shrink_to_fit () |
| | Request release of unused reserved storage.
|
| |
|
void | serialize (BinaryWriter &writer) const |
| | Serialize this value through its concrete implementation.
|
| |
template<class Impl>
class pixie::StorageBase< Impl >
CRTP facade for byte-addressable storage.
Impl must provide size_bytes_impl() and the following required extension points.
- Required:
begin_position_impl() const - Returns the absolute logical position of the first exposed byte as a
position_type. The result may advance when an implementation evicts bytes, but positions of retained bytes do not change.
- Required:
end_position_impl() const - Returns the absolute logical position one past the last exposed byte as a
position_type. It must be at least begin_position_impl(), and their difference must be representable by std::size_t and equal size_bytes_impl().
- Required:
segments_impl(position, count_bytes) const - Accepts a
position_type and a std::size_t and returns SplitSpan<const std::byte> containing exactly the bytes in [position, position + count_bytes). The physical spans are ordered by logical position and their combined size equals count_bytes. Before calling this hook, the facade verifies without overflow that position is in the closed range from begin_position_impl() through end_position_impl() and that count_bytes <= end_position_impl() - position; an empty range at the end position is valid. The returned spans borrow the implementation's backing storage. The implementation must document the backing storage's ownership requirements and the operations that invalidate its spans.
- Optional:
segments_impl(position, count_bytes) - A mutable implementation may provide this extension point to enable writable segment access. It accepts the same parameter types as the const overload and returns
SplitSpan<std::byte>. It has the same range, ordering, size, lifetime, and invalidation contract as the const overload, and writes through the returned spans modify the corresponding logical bytes. If the implementation also provides prepare_segments_impl(position, count_bytes), the facade calls that hook before validating the range. The preparation hook must make the complete requested range available or throw without changing the implementation.
- Template Parameters
-
| Impl | Concrete storage implementation. |