70#ifndef __ADS_OrderMaintenanceList
71 #define __ADS_OrderMaintenanceList
114 static constexpr std::size_t
B = 64;
129 [[nodiscard]] std::size_t
size(
void )
const {
return( f_n ); }
171 ADS_PRE( a && b && a->bucket && b->bucket );
172 return( a->bucket == b->bucket ? a->label < b->label
173 : a->bucket->label < b->bucket->label );
177 [[nodiscard]]
static const T &
value(
Element e ) {
return( e->item ); }
191 [[nodiscard]] std::pair< std::size_t , std::size_t >
193 return( std::pair< std::size_t , std::size_t >( f_relabels , f_work ) );
202 Node * prev =
nullptr;
203 Node * next =
nullptr;
204 Bucket * bucket =
nullptr;
205 std::uint64_t label = 0;
211 Bucket * prev =
nullptr;
212 Bucket * next =
nullptr;
213 Node * head =
nullptr;
214 std::size_t
size = 0;
215 std::uint64_t label = 0;
219 static constexpr std::uint64_t kU = std::uint64_t( 1 ) << 63;
222 void relabelBucket( Bucket * b );
227 void split( Bucket * b );
255 void addBucketAfter( Bucket * b , Bucket * c );
259 [[nodiscard]]
bool valid(
const Bucket * b )
const;
262 [[nodiscard]]
static const std::array< double , 64 > & caps(
void );
265 Node * f_first =
nullptr;
267 std::size_t f_relabels = 0;
268 std::size_t f_work = 0;
280#include "ADS/sequence/impl/OrderMaintenanceList.tpp"
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
static const T & value(Element e)
the item of
Definition OrderMaintenanceList.h:177
static constexpr std::size_t B
the most elements of a bucket
Definition OrderMaintenanceList.h:114
OrderMaintenanceList(const OrderMaintenanceList &)=delete
no copy, since the elements are pointers
void remove(Element e)
out of the list, and its bucket if it empties, in time, no label changed
const Node * Element
an element of the list, valid until it is removed
Definition OrderMaintenanceList.h:111
T Item
the type of the items
Definition OrderMaintenanceList.h:108
bool testBefore(Element a, Element b) const
whether comes before , by the labels of their buckets and by their local labels, in time
Definition OrderMaintenanceList.h:170
Element first(void) const
the first element, nil if the list is empty
Definition OrderMaintenanceList.h:180
std::pair< std::size_t, std::size_t > relabelWork(void) const
the number of the relabelings of a range of buckets so far, and the labels written by them and by the...
Definition OrderMaintenanceList.h:192
~OrderMaintenanceList()
frees the elements
Element next(Element e) const
the element after , nil after the last
Definition OrderMaintenanceList.h:184
OrderMaintenanceList(void)=default
the empty list
Element addAfter(Element e, const T &v)
a new element of right after , at the front if is nil, in amortized time
OrderMaintenanceList & operator=(const OrderMaintenanceList &)=delete
no copy, since the elements are pointers
std::size_t size(void) const
the number of elements
Definition OrderMaintenanceList.h:129
#define ADS_PRE(cond)
[check]
Definition Contract.h:121