Pixie
Loading...
Searching...
No Matches
pixie::MonotoneIntegerVector< Vector > Class Template Reference

Owning duplicate-preserving monotone adapter over an integer vector. More...

#include <monotone.h>

Inheritance diagram for pixie::MonotoneIntegerVector< Vector >:
pixie::MonotoneIntegerVectorBase< MonotoneIntegerVector< Vector >, Vector::value_type > pixie::SerializationBase< MonotoneIntegerVector< Vector > > pixie::IntegerVectorBase< MonotoneIntegerVector< Vector >, Value >

Public Types

using value_type = typename Vector::value_type
 Stored unsigned integer type inherited from the nested vector.
 
using size_type = std::size_t
 Type used for element counts and positions.
 
- Public Types inherited from pixie::IntegerVectorBase< MonotoneIntegerVector< Vector >, Value >
using value_type
 Stored integer type.
 
using size_type
 Type used for element counts and zero-based positions.
 

Public Member Functions

 MonotoneIntegerVector (Vector vector)
 Take ownership of vector after validating nondecreasing order.
 
size_type size_impl () const
 Return the number of retained values.
 
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 memory owned below the nested vector.
 
size_type lower_bound_index_impl (value_type x) const
 Return the first index whose value is at least x.
 
size_type upper_bound_index_impl (value_type x) const
 Return the first index whose value is greater than x.
 
void serialize_impl (BinaryWriter &writer) const
 Write a version-1 monotone wrapper around one nested vector artifact.
 
- Public Member Functions inherited from pixie::MonotoneIntegerVectorBase< MonotoneIntegerVector< Vector >, Vector::value_type >
size_type lower_bound_index (value_type x) const
 Return the first index whose value is greater than or equal to x.
 
size_type upper_bound_index (value_type x) const
 Return the first index whose value is greater than x.
 
bool contains (value_type x) const
 Return whether at least one element equals x.
 
size_type count (value_type x) const
 Return the number of elements equal to x.
 
- Public Member Functions inherited from pixie::IntegerVectorBase< MonotoneIntegerVector< Vector >, Value >
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< MonotoneIntegerVector< Vector > >
void serialize (BinaryWriter &writer) const
 Serialize this value through its concrete implementation.
 

Static Public Member Functions

static MonotoneIntegerVector deserialize_impl (BinaryReader &reader, DeserializationValidation validation=DeserializationValidation::kQuick)
 Restore one framed monotone vector and advance reader on success.
 
- Static Public Member Functions inherited from pixie::SerializationBase< MonotoneIntegerVector< Vector > >
static MonotoneIntegerVector< Vector > deserialize (BinaryReader &reader, Context &&... context)
 Restore exactly Derived and advance reader on success.
 
static MonotoneIntegerVector< Vector > deserialize (std::span< const std::byte > &data, Context &&... context)
 Restore exactly Derived and advance a mutable byte span.
 

Detailed Description

template<class Vector>
requires requires { typename Vector::value_type; } && IntegerVectorValue<typename Vector::value_type> && std::derived_from< Vector, IntegerVectorBase<Vector, typename Vector::value_type>>
class pixie::MonotoneIntegerVector< Vector >

Owning duplicate-preserving monotone adapter over an integer vector.

Template Parameters
VectorImmutable integer-vector implementation owned by value.

Public construction scans once and rejects decreasing adjacent values. The underlying vector remains private so the nondecreasing invariant cannot be invalidated. Bounds use logarithmic index-based binary search for this adapter.

Constructor & Destructor Documentation

◆ MonotoneIntegerVector()

template<class Vector>
pixie::MonotoneIntegerVector< Vector >::MonotoneIntegerVector ( Vector vector)
inlineexplicit

Take ownership of vector after validating nondecreasing order.

Exceptions
std::invalid_argumentif any value is smaller than its predecessor.

Member Function Documentation

◆ deserialize_impl()

template<class Vector>
static MonotoneIntegerVector pixie::MonotoneIntegerVector< Vector >::deserialize_impl ( BinaryReader & reader,
DeserializationValidation validation = DeserializationValidation::kQuick )
inlinestatic

Restore one framed monotone vector and advance reader on success.

Quick validation checks both frames but trusts the encoded ordering. Full validation also scans all decoded values and rejects a decrease. The nested vector determines whether restored storage is owned or borrowed. Failure leaves reader unchanged.

◆ serialize_impl()

template<class Vector>
void pixie::MonotoneIntegerVector< Vector >::serialize_impl ( BinaryWriter & writer) const
inline

Write a version-1 monotone wrapper around one nested vector artifact.

Exceptions
std::invalid_argumentif the wrapper would not start at an eight-byte-aligned writer offset.

The documentation for this class was generated from the following file: