ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
Modification.h

The typed modifications, beyond the book. More...

Files

file  ADS/Modification.h
 The typed modifications, beyond the book: the vocabulary by which a structure tells the observers attached to it what changed, by small values that carry the old and the new state, and the policies that decide, in the type of the structure, who listens and at what cost (see Typed modifications).

Namespaces

namespace  ADS::mod::reduce
 how two changes of one attribute of one item compose in a batch: the last value (last), the least or the largest of the two (min, max), or the sum of the differences (sum)

Concepts

concept  ADS::ReoptPolicy
 a recompute policy: whether to compute from scratch before a repair, whether to abandon a repair while it runs (polled by the observer with its work \( w \) so far), and the record of the outcome after it
concept  ADS::mod::invertible
 an event that has an inverse
concept  ADS::mod::observes
 an observer of the event E
concept  ADS::mod::observes_span
 an observer of the spans of E, an event or the variant of the events
concept  ADS::mod::groups
 an observer told of the start and of the end of each batch
concept  ADS::mod::refuses
 an observer that may refuse the change E before it is made
concept  ADS::mod::auditable
 an observer that can check itself against the structure \( s \)
concept  ADS::mod::lazy
 an observer that queues the events and works at its next query
concept  ADS::mod::counted
 an observer that reports counts of its own
concept  ADS::mod::with_policy
 an observer with a recompute policy [see ReoptPolicy], and the statistics of a query after \( k \) more events: at the close of a batch the subject asks its scratch(), and sends Rebuilt instead of the events when it answers yes
concept  ADS::mod::masked
 an observer with a filter of the kinds at run time: the bit \( i \) of mask() for the \( i \)-th event of the structure
concept  ADS::mod::observer_of
 an observer of at least one of the events of the list L

Classes

class  ADS::Refused
 a change refused by the prepare() of an observer, before anything changed More...
struct  ADS::no_rebuild_t
 the promise of quiet( s , no_rebuild ): nobody needs to know More...
struct  ADS::Reopt
 how a query of an observer brought its solution up to date (the outcomes, \( 0 \) to \( 2 \)), and why (the causes, which refine the outcome from scratch and the repair) More...
struct  ADS::ReoptStats
 what a recompute policy reads: the work is a count of elementary operations of the observer (nodes, edges, extractions), never a time, so that a policy decides the same on every machine More...
struct  ADS::RatioPolicy
 the default recompute policy: from scratch when the net events exceed \( \rho \) times the size, a repair abandoned when its work exceeds \( \alpha \) times that of a computation from scratch or when an element is extracted again more than \( \beta \) times; the values that are not exact (floating point) summed again after \( \mathit{period} \) times the size of changes, by the compensated sum of Neumaier when asked More...
class  ADS::NeumaierSum< T >
 a sum of values of T that follows additions and subtractions, with the compensation of Neumaier when T is floating and it is asked: the error after \( k \) terms is then of the order of \( \varepsilon \) times the sum of their absolute values, instead of \( k \varepsilon \) times More...
struct  ADS::mod::effect
 the effects of an event, as bits: a bit not set is a guarantee More...
struct  ADS::mod::reduction_of< A >
 the reduction of the attribute A: A::reduction if it has one, reduce::last otherwise More...
struct  ADS::mod::reduction_of< A >
 the reduction of an attribute that declares one More...
struct  ADS::mod::list< E >
 a list of types, the events of a structure [see Modification.h] More...
struct  ADS::mod::Inserted< H, K, V >
 the item of handle \( h \), key \( k \) and value \( v \) inserted More...
struct  ADS::mod::Inserted< H, K, void >
 the item of handle \( h \) and key \( k \) inserted, with no value More...
struct  ADS::mod::Erased< H, K, V >
 the item of handle \( h \), key \( k \) and value \( v \) erased, told before the removal outside a batch More...
struct  ADS::mod::Erased< H, K, void >
 the item of handle \( h \) and key \( k \) erased, with no value More...
struct  ADS::mod::Changed< A, H, V >
 the attribute A of the item of handle \( h \) changed from from to to More...
struct  ADS::mod::Relocated< H >
 the item of handle from moved to the handle to, for the structures whose handles are not stable More...
struct  ADS::mod::Permuted< H >
 the items permuted: the handle before of each handle after More...
struct  ADS::mod::BulkInserted< H >
 the items of the handles hs inserted by one bulk operation More...
struct  ADS::mod::BulkErased< H >
 the items of the handles hs erased by one bulk operation More...
struct  ADS::mod::Shifted< A, D >
 every value of the attribute A moved by delta More...
struct  ADS::mod::Replaced< A >
 every value of the attribute A replaced More...
struct  ADS::mod::Cleared
 the structure emptied More...
struct  ADS::mod::Rebuilt
 anything may have changed: forget and recompute More...
struct  ADS::mod::Group
 what a batch tells group_begin(): the versions of the subject before and after it, and the number of its events after the coalescing More...
struct  ADS::mod::Counts
 the counts of an observer kept by the subject at the level of the audits More...
struct  ADS::mod::Direct
 how a subject calls an observer: Direct calls on() and the optional parts by their names; an adapter with the same static functions lets an object with another interface be an observer [see Via] More...
struct  ADS::mod::Via< O, A >
 the observer O called through the adapter A, an argument of Static More...
struct  ADS::mod::coalesce_traits< L >
 the net effect of the events of a batch of the structures whose events are the list L: by default the rule of Typed modifications (an insertion and an erasure of one handle cancel, an erasure and an insertion become changes, consecutive changes of one attribute compose, everything before the last Cleared or Rebuilt is dropped, the shifts add up); a structure with a rule of its own specializes it More...
struct  ADS::NoObservers
 nobody listens: the subject is empty and every test is false at compile time, so that the structure compiles to its plain code More...
struct  ADS::Static< O >
 the static observers O... (or mod::Via< O , A >), references called directly in the order of the arguments More...
struct  ADS::Dynamic< L >
 observers attached at run time, the events those of the structure (or the list L, which must be them) More...
struct  ADS::Both< St, Dy >
 the static observers of St, then those attached at run time More...
struct  ADS::Both< Static< O... >, Dynamic< L > >
 the static observers O..., then those attached at run time More...
class  ADS::Batch< S >
 a batch of RAII on the structure \( s \) [see batch()] More...
class  ADS::Quiet< S >
 a mute of RAII on the structure \( s \) [see quiet()] More...
class  ADS::UndoLog< L >
 an observer that records the invertible events of L, which carry the old values, and brings a structure back to a checkpoint by replaying their inverses through its apply(), in one batch: any structure with apply() becomes undoable, at one event per change More...
class  ADS::Shadow< Inc, Scratch, Eq >
 an observer that forwards every event to an incremental observer and to one that computes from scratch, and compares their answers at each query by Eq: an audit of the incremental one by recomputation, at a cost of about twice the work More...
struct  ADS::mod::Value
 the attribute of the value of an item More...
struct  ADS::mod::Key
 the attribute of a key that orders the items More...
struct  ADS::mod::Cost
 the cost of an arc More...
struct  ADS::mod::Upper
 the upper bound of an arc More...
struct  ADS::mod::Lower
 the lower bound of an arc More...
struct  ADS::mod::Supply
 the supply of a node More...
struct  ADS::mod::Parent
 the parent of a node in a forest, -1 at a root More...
struct  ADS::mod::reduce::last
 the value after the second change More...
struct  ADS::mod::reduce::min
 the least of the two values after More...
struct  ADS::mod::reduce::max
 the largest of the two values after More...
struct  ADS::mod::reduce::sum
 the first value after plus the second difference More...

Typedefs

template<class L>
using ADS::mod::variant_t = typename detail::variant_of< L >::type
 the variant of the events of the list L, the type of a buffer
template<class H, class V>
using ADS::mod::Assigned = Changed< Value , H , V >
 the value of an item changed
template<class H, class K>
using ADS::mod::KeyChanged = Changed< Key , H , K >
 the key of an item changed

Enumerations

enum class  ADS::Keep { ADS::Keep::Yes , ADS::Keep::Detach }
 what an on() that returns it asks: to stay, or to be detached after the event, with no exception More...
enum class  ADS::mod::Role {
  ADS::mod::Role::Insert , ADS::mod::Role::Erase , ADS::mod::Role::Change , ADS::mod::Role::Relocate ,
  ADS::mod::Role::Permute , ADS::mod::Role::BulkInsert , ADS::mod::Role::BulkErase , ADS::mod::Role::Shift ,
  ADS::mod::Role::Replace , ADS::mod::Role::Clear , ADS::mod::Role::Rebuild , ADS::mod::Role::Other
}
 the role of an event in the coalescing of a batch More...

Functions

template<class H, class K, class V>
constexpr Erased< H, K, V > ADS::mod::inverse (const Inserted< H, K, V > &e)
 the erasure that undoes an insertion
template<class H, class K, class V>
constexpr Inserted< H, K, V > ADS::mod::inverse (const Erased< H, K, V > &e)
 the insertion that undoes an erasure
template<class A, class H, class V>
constexpr Changed< A, H, V > ADS::mod::inverse (const Changed< A, H, V > &e)
 the change back
template<class H>
constexpr Relocated< H > ADS::mod::inverse (const Relocated< H > &e)
 the move back
template<class A, class D>
constexpr Shifted< A, D > ADS::mod::inverse (const Shifted< A, D > &e)
 the shift back
template<class S>
Batch< S > ADS::batch (S &s)
 a batch on the structure \( s \), open while it lives: its events are collected, and the outermost batch sends their net effect at its end
template<class S>
Quiet< S > ADS::quiet (S &s)
 a mute on the structure \( s \): no event while it lives, Rebuilt to every observer at its end (inside a batch, the events collected before are dropped, and the batch sends Rebuilt and the events after the mute)
template<class S>
Quiet< S > ADS::quiet (S &s, no_rebuild_t)
 a mute on the structure \( s \) that nobody needs to know: no event, and at the level of the audits the observers audited at its end

Variables

constexpr no_rebuild_t ADS::no_rebuild {}
 the promise of quiet( s , no_rebuild )
template<class E>
constexpr Role ADS::mod::role_of = detail::declared_role< E >()
 the role of the event E, Role::Other if it declares none
template<class E>
constexpr unsigned ADS::mod::effects_of = detail::declared_effects< E >()
 the effects of the event E, all of them if it declares none
template<class E>
constexpr bool ADS::mod::must_not_throw
 whether on() of the event E must not throw: the erasures, the clearing, the rebuilding and the replacement, after which an observer left half updated could not be repaired
template<class E, class L>
constexpr std::size_t ADS::mod::index_v = detail::index_in< E , L >::value
 the position of E in the list L, its size if absent
template<class E, class L>
constexpr bool ADS::mod::contains_v = index_v< E , L > < L::size
 whether E is in the list L

Detailed description

The typed modifications, beyond the book.

The definitions, the invariants and the costs of the area are in Theory of the foundations.

Typedef documentation

◆ Assigned

template<class H, class V>
using ADS::mod::Assigned = Changed< Value , H , V >

the value of an item changed

◆ KeyChanged

template<class H, class K>
using ADS::mod::KeyChanged = Changed< Key , H , K >

the key of an item changed

◆ variant_t

template<class L>
using ADS::mod::variant_t = typename detail::variant_of< L >::type

the variant of the events of the list L, the type of a buffer

Enumeration type documentation

◆ Keep

enum class ADS::Keep
strong

what an on() that returns it asks: to stay, or to be detached after the event, with no exception

Enumerator
Yes 
Detach 

◆ Role

enum class ADS::mod::Role
strong

the role of an event in the coalescing of a batch

Enumerator
Insert 
Erase 
Change 
Relocate 
Permute 
BulkInsert 
BulkErase 
Shift 
Replace 
Clear 
Rebuild 
Other 

Function documentation

◆ batch()

template<class S>
Batch< S > ADS::batch ( S & s)
nodiscard

a batch on the structure \( s \), open while it lives: its events are collected, and the outermost batch sends their net effect at its end

◆ inverse() [1/5]

template<class A, class H, class V>
Changed< A, H, V > ADS::mod::inverse ( const Changed< A, H, V > & e)
nodiscardconstexpr

the change back

◆ inverse() [2/5]

template<class H, class K, class V>
Inserted< H, K, V > ADS::mod::inverse ( const Erased< H, K, V > & e)
nodiscardconstexpr

the insertion that undoes an erasure

◆ inverse() [3/5]

template<class H, class K, class V>
Erased< H, K, V > ADS::mod::inverse ( const Inserted< H, K, V > & e)
nodiscardconstexpr

the erasure that undoes an insertion

◆ inverse() [4/5]

template<class H>
Relocated< H > ADS::mod::inverse ( const Relocated< H > & e)
nodiscardconstexpr

the move back

◆ inverse() [5/5]

template<class A, class D>
Shifted< A, D > ADS::mod::inverse ( const Shifted< A, D > & e)
nodiscardconstexpr

the shift back

◆ quiet() [1/2]

template<class S>
Quiet< S > ADS::quiet ( S & s)
nodiscard

a mute on the structure \( s \): no event while it lives, Rebuilt to every observer at its end (inside a batch, the events collected before are dropped, and the batch sends Rebuilt and the events after the mute)

◆ quiet() [2/2]

template<class S>
Quiet< S > ADS::quiet ( S & s,
no_rebuild_t  )
nodiscard

a mute on the structure \( s \) that nobody needs to know: no event, and at the level of the audits the observers audited at its end

Variable documentation

◆ contains_v

template<class E, class L>
bool ADS::mod::contains_v = index_v< E , L > < L::size
inlineconstexpr

whether E is in the list L

◆ effects_of

template<class E>
unsigned ADS::mod::effects_of = detail::declared_effects< E >()
inlineconstexpr

the effects of the event E, all of them if it declares none

◆ index_v

template<class E, class L>
std::size_t ADS::mod::index_v = detail::index_in< E , L >::value
inlineconstexpr

the position of E in the list L, its size if absent

◆ must_not_throw

template<class E>
bool ADS::mod::must_not_throw
inlineconstexpr
Initial value:
=
constexpr Role role_of
the role of the event E, Role::Other if it declares none
Definition Modification.h:414
@ Replace
Definition Modification.h:381
@ Rebuild
Definition Modification.h:383
@ BulkErase
Definition Modification.h:379
@ Clear
Definition Modification.h:382
@ Erase
Definition Modification.h:374

whether on() of the event E must not throw: the erasures, the clearing, the rebuilding and the replacement, after which an observer left half updated could not be repaired

◆ no_rebuild

no_rebuild_t ADS::no_rebuild {}
inlineconstexpr

the promise of quiet( s , no_rebuild )

◆ role_of

template<class E>
Role ADS::mod::role_of = detail::declared_role< E >()
inlineconstexpr

the role of the event E, Role::Other if it declares none