![]() |
Pixie
|
Immutable runtime-width packed integer vector over configurable storage. More...
#include <packed.h>
Public Types | |
| using | value_type = Value |
| Stored unsigned integer type. | |
| using | size_type = std::size_t |
| Type used for element counts, widths, and positions. | |
Public Types inherited from pixie::IntegerVectorBase< BasicPackedIntegerVector< Storage, std::uint64_t >, std::uint64_t > | |
| using | value_type |
| Stored integer type. | |
| using | size_type |
| Type used for element counts and zero-based positions. | |
Public Member Functions | |
| BasicPackedIntegerVector ()=default | |
| Construct an empty width-zero vector. | |
| BasicPackedIntegerVector (std::span< const value_type > values) | |
Pack values using their minimum required width. | |
| BasicPackedIntegerVector (std::span< const value_type > values, size_type width) | |
Pack values after validating an explicit maximum width. | |
| size_type | width () const |
Return the logical runtime width in bits, in [0, digits(Value)]. | |
| size_type | size_impl () const |
| Return the logical number of elements. | |
| value_type | value_at_impl (size_type position) const |
| Read one valid zero-based position without bounds checking. | |
| void | copy_to_impl (size_type begin, std::span< value_type > output) const |
| Copy a range already validated by the public facade. | |
| size_type | memory_usage_bytes_impl () const |
| Return inline bytes plus owned storage capacity. | |
| void | serialize_impl (BinaryWriter &writer) const |
| Write a version-1 canonical little-endian packed-vector artifact. | |
Public Member Functions inherited from pixie::IntegerVectorBase< BasicPackedIntegerVector< Storage, std::uint64_t >, std::uint64_t > | |
| size_type | size () const |
| Return the logical number of elements. | |
| bool | empty () const |
| Return whether the vector has no elements. | |
| value_type | operator[] (size_type position) const |
Read the element at zero-based position without bounds checking. | |
| value_type | at (size_type position) const |
Read the element at zero-based position with bounds checking. | |
| void | copy_to (size_type begin, std::span< value_type > output) const |
Copy a checked contiguous source range into output. | |
| size_type | memory_usage_bytes () const |
| Return total memory owned by this vector when supported. | |
Public Member Functions inherited from pixie::SerializationBase< BasicPackedIntegerVector< Storage, std::uint64_t > > | |
| void | serialize (BinaryWriter &writer) const |
| Serialize this value through its concrete implementation. | |
Static Public Member Functions | |
| static BasicPackedIntegerVector | deserialize_impl (BinaryReader &reader, DeserializationValidation validation=DeserializationValidation::kQuick) |
Restore one packed-vector artifact and advance reader on success. | |
Static Public Member Functions inherited from pixie::SerializationBase< BasicPackedIntegerVector< Storage, std::uint64_t > > | |
| static BasicPackedIntegerVector< Storage, std::uint64_t > | deserialize (BinaryReader &reader, Context &&... context) |
Restore exactly Derived and advance reader on success. | |
| static BasicPackedIntegerVector< Storage, std::uint64_t > | deserialize (std::span< const std::byte > &data, Context &&... context) |
Restore exactly Derived and advance a mutable byte span. | |
Immutable runtime-width packed integer vector over configurable storage.
| Storage | AlignedStorage for an owner or ReadOnlyStorageView for a zero-copy view. |
| Value | Unsigned element type other than bool, no wider than 64 bits. |
Values are packed LSB-first into 64-bit words. An owning vector stores cache-line-padded allocation internally, but only logical packed words are serialized. A view borrows its serialized payload; the backing bytes must remain alive, immutable, and aligned for the view's lifetime.
|
inlineexplicit |
Pack values using their minimum required width.
Empty and all-zero inputs use width zero and no payload.
| std::length_error | if the packed dimensions overflow size_t. |
|
inline |
Pack values after validating an explicit maximum width.
Width must be in [0, digits(value_type)]. Every value must fit; values are never truncated. Empty and all-zero inputs are normalized to canonical width zero.
| std::invalid_argument | if the width is invalid or a value does not fit. |
| std::length_error | if the packed dimensions overflow size_t. |
|
inlinestatic |
Restore one packed-vector artifact and advance reader on success.
Owner restoration decodes canonical words into independent aligned storage. View restoration retains an exact span into the reader's backing bytes, which must remain alive and immutable. Views require native little-endian word order and eight-byte-aligned payload bytes. Quick mode validates complete framing and safe dimensions; full mode also requires unused high bits in the final logical word to be zero. Failure leaves reader unchanged.
| std::invalid_argument | for malformed, incompatible, unaligned, or noncanonical input. |
| std::length_error | for unrepresentable dimensions. |
|
inline |
Return inline bytes plus owned storage capacity.
A read-only view excludes all borrowed backing bytes.
|
inline |
Write a version-1 canonical little-endian packed-vector artifact.
Exactly ceil(size() * width() / 64) logical words are written; owner allocation padding is excluded. The artifact can later be restored as either an independent owner or a zero-copy read-only view.
| std::invalid_argument | if the artifact would not begin at an eight-byte-aligned writer offset. |