ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
ADS::lemon_interop::DaryHeap< PR, IM, CMP, D, Policy > Class Template Reference

an IndexedDaryHeap of ADS as a heap of LEMON, on the cross-reference map IM of the caller More...

#include <ADS/interop/lemon/Heaps.h>

Public types

enum  State { IN_HEAP = 0 , PRE_HEAP = -1 , POST_HEAP = -2 }
 the states of an item, those of LEMON More...
using ItemIntMap = IM
 the cross-reference map
using Prio = PR
 the priorities
using Item = typename IM::Key
 the items
using Pair = std::pair< Item , Prio >
 an item with its priority
using Key = CmpKey< PR , CMP >
 the keys of the heap of ADS
using Heap = IndexedDaryHeap< Key , D , Policy >
 the heap of ADS

Public member functions

 DaryHeap (ItemIntMap &m)
 the empty heap on the map \( m \)
 DaryHeap (ItemIntMap &m, const CMP &)
 the empty heap on the map \( m \), the comparator not kept
int size (void) const
 the number of items
bool empty (void) const
 whether there is no item
void clear (void)
 all the items removed, the map left as it is (as in LEMON)
void push (const Item &i, const Prio &p)
 inserts the item \( i \) with the priority \( p \), in a free slot
void push (const Pair &x)
 inserts the pair \( x \)
Item top (void) const
 the item of least priority
Prio prio (void) const
 the least priority
void pop (void)
 removes the item of least priority, POST_HEAP from now on
void erase (const Item &i)
 removes the item \( i \), if it is in the heap
Prio operator[] (const Item &i) const
 the priority of the item \( i \)
void set (const Item &i, const Prio &p)
 the priority of \( i \) set to \( p \), inserting it if needed
void decrease (const Item &i, const Prio &p)
 the priority of \( i \) lowered to \( p \)
void increase (const Item &i, const Prio &p)
 the priority of \( i \) raised to \( p \)
State state (const Item &i) const
 the state of the item \( i \), read from the map
void state (const Item &i, State st)
 the state of \( i \) set to \( st \), removing it from the heap if it was there; IN_HEAP changes nothing
Heap & heap (void)
 the heap of ADS, whose subject tells the changes, the slots their handles
const Heap & heap (void) const
 the heap of ADS
Heap::Subject & subject (void)
 the subject of the heap of ADS
const Item & item (int s) const
 the item of the slot \( s \), the handle of the events

Detailed description

template<class PR, class IM, class CMP = std::less< PR >, unsigned D = 4, class Policy = NoObservers>
class ADS::lemon_interop::DaryHeap< PR, IM, CMP, D, Policy >

an IndexedDaryHeap of ADS as a heap of LEMON, on the cross-reference map IM of the caller

Member typedef documentation

◆ Heap

template<class PR, class IM, class CMP = std::less< PR >, unsigned D = 4, class Policy = NoObservers>
using ADS::lemon_interop::DaryHeap< PR, IM, CMP, D, Policy >::Heap = IndexedDaryHeap< Key , D , Policy >

the heap of ADS

◆ Item

template<class PR, class IM, class CMP = std::less< PR >, unsigned D = 4, class Policy = NoObservers>
using ADS::lemon_interop::DaryHeap< PR, IM, CMP, D, Policy >::Item = typename IM::Key

the items

◆ ItemIntMap

template<class PR, class IM, class CMP = std::less< PR >, unsigned D = 4, class Policy = NoObservers>
using ADS::lemon_interop::DaryHeap< PR, IM, CMP, D, Policy >::ItemIntMap = IM

the cross-reference map

◆ Key

template<class PR, class IM, class CMP = std::less< PR >, unsigned D = 4, class Policy = NoObservers>
using ADS::lemon_interop::DaryHeap< PR, IM, CMP, D, Policy >::Key = CmpKey< PR , CMP >

the keys of the heap of ADS

◆ Pair

template<class PR, class IM, class CMP = std::less< PR >, unsigned D = 4, class Policy = NoObservers>
using ADS::lemon_interop::DaryHeap< PR, IM, CMP, D, Policy >::Pair = std::pair< Item , Prio >

an item with its priority

◆ Prio

template<class PR, class IM, class CMP = std::less< PR >, unsigned D = 4, class Policy = NoObservers>
using ADS::lemon_interop::DaryHeap< PR, IM, CMP, D, Policy >::Prio = PR

the priorities

Member enumeration documentation

◆ State

template<class PR, class IM, class CMP = std::less< PR >, unsigned D = 4, class Policy = NoObservers>
enum ADS::lemon_interop::DaryHeap::State

the states of an item, those of LEMON

Enumerator
IN_HEAP 
PRE_HEAP 
POST_HEAP 

Constructor and destructor documentation

◆ DaryHeap() [1/2]

template<class PR, class IM, class CMP = std::less< PR >, unsigned D = 4, class Policy = NoObservers>
ADS::lemon_interop::DaryHeap< PR, IM, CMP, D, Policy >::DaryHeap ( ItemIntMap & m)
inlineexplicit

the empty heap on the map \( m \)

◆ DaryHeap() [2/2]

template<class PR, class IM, class CMP = std::less< PR >, unsigned D = 4, class Policy = NoObservers>
ADS::lemon_interop::DaryHeap< PR, IM, CMP, D, Policy >::DaryHeap ( ItemIntMap & m,
const CMP &  )
inline

the empty heap on the map \( m \), the comparator not kept

Member function documentation

◆ clear()

template<class PR, class IM, class CMP = std::less< PR >, unsigned D = 4, class Policy = NoObservers>
void ADS::lemon_interop::DaryHeap< PR, IM, CMP, D, Policy >::clear ( void )
inline

all the items removed, the map left as it is (as in LEMON)

◆ decrease()

template<class PR, class IM, class CMP = std::less< PR >, unsigned D = 4, class Policy = NoObservers>
void ADS::lemon_interop::DaryHeap< PR, IM, CMP, D, Policy >::decrease ( const Item & i,
const Prio & p )
inline

the priority of \( i \) lowered to \( p \)

Precondition
\( i \) is in the heap, \( p \) not after its priority

◆ empty()

template<class PR, class IM, class CMP = std::less< PR >, unsigned D = 4, class Policy = NoObservers>
bool ADS::lemon_interop::DaryHeap< PR, IM, CMP, D, Policy >::empty ( void ) const
inlinenodiscard

whether there is no item

◆ erase()

template<class PR, class IM, class CMP = std::less< PR >, unsigned D = 4, class Policy = NoObservers>
void ADS::lemon_interop::DaryHeap< PR, IM, CMP, D, Policy >::erase ( const Item & i)
inline

removes the item \( i \), if it is in the heap

◆ heap() [1/2]

template<class PR, class IM, class CMP = std::less< PR >, unsigned D = 4, class Policy = NoObservers>
Heap & ADS::lemon_interop::DaryHeap< PR, IM, CMP, D, Policy >::heap ( void )
inlinenodiscard

the heap of ADS, whose subject tells the changes, the slots their handles

◆ heap() [2/2]

template<class PR, class IM, class CMP = std::less< PR >, unsigned D = 4, class Policy = NoObservers>
const Heap & ADS::lemon_interop::DaryHeap< PR, IM, CMP, D, Policy >::heap ( void ) const
inlinenodiscard

the heap of ADS

◆ increase()

template<class PR, class IM, class CMP = std::less< PR >, unsigned D = 4, class Policy = NoObservers>
void ADS::lemon_interop::DaryHeap< PR, IM, CMP, D, Policy >::increase ( const Item & i,
const Prio & p )
inline

the priority of \( i \) raised to \( p \)

Precondition
\( i \) is in the heap, \( p \) not before its priority

◆ item()

template<class PR, class IM, class CMP = std::less< PR >, unsigned D = 4, class Policy = NoObservers>
const Item & ADS::lemon_interop::DaryHeap< PR, IM, CMP, D, Policy >::item ( int s) const
inlinenodiscard

the item of the slot \( s \), the handle of the events

Precondition
\( s \) is a slot in use

◆ operator[]()

template<class PR, class IM, class CMP = std::less< PR >, unsigned D = 4, class Policy = NoObservers>
Prio ADS::lemon_interop::DaryHeap< PR, IM, CMP, D, Policy >::operator[] ( const Item & i) const
inlinenodiscard

the priority of the item \( i \)

Precondition
\( i \) is in the heap

◆ pop()

template<class PR, class IM, class CMP = std::less< PR >, unsigned D = 4, class Policy = NoObservers>
void ADS::lemon_interop::DaryHeap< PR, IM, CMP, D, Policy >::pop ( void )
inline

removes the item of least priority, POST_HEAP from now on

Precondition
the heap is not empty

◆ prio()

template<class PR, class IM, class CMP = std::less< PR >, unsigned D = 4, class Policy = NoObservers>
Prio ADS::lemon_interop::DaryHeap< PR, IM, CMP, D, Policy >::prio ( void ) const
inlinenodiscard

the least priority

Precondition
the heap is not empty

◆ push() [1/2]

template<class PR, class IM, class CMP, unsigned D, class Policy>
void ADS::lemon_interop::DaryHeap< PR, IM, CMP, D, Policy >::push ( const Item & i,
const Prio & p )

inserts the item \( i \) with the priority \( p \), in a free slot

Precondition
\( i \) is not in the heap

◆ push() [2/2]

template<class PR, class IM, class CMP = std::less< PR >, unsigned D = 4, class Policy = NoObservers>
void ADS::lemon_interop::DaryHeap< PR, IM, CMP, D, Policy >::push ( const Pair & x)
inline

inserts the pair \( x \)

Precondition
its item is not in the heap

◆ set()

template<class PR, class IM, class CMP = std::less< PR >, unsigned D = 4, class Policy = NoObservers>
void ADS::lemon_interop::DaryHeap< PR, IM, CMP, D, Policy >::set ( const Item & i,
const Prio & p )
inline

the priority of \( i \) set to \( p \), inserting it if needed

◆ size()

template<class PR, class IM, class CMP = std::less< PR >, unsigned D = 4, class Policy = NoObservers>
int ADS::lemon_interop::DaryHeap< PR, IM, CMP, D, Policy >::size ( void ) const
inlinenodiscard

the number of items

◆ state() [1/2]

template<class PR, class IM, class CMP = std::less< PR >, unsigned D = 4, class Policy = NoObservers>
State ADS::lemon_interop::DaryHeap< PR, IM, CMP, D, Policy >::state ( const Item & i) const
inlinenodiscard

the state of the item \( i \), read from the map

◆ state() [2/2]

template<class PR, class IM, class CMP = std::less< PR >, unsigned D = 4, class Policy = NoObservers>
void ADS::lemon_interop::DaryHeap< PR, IM, CMP, D, Policy >::state ( const Item & i,
State st )
inline

the state of \( i \) set to \( st \), removing it from the heap if it was there; IN_HEAP changes nothing

◆ subject()

template<class PR, class IM, class CMP = std::less< PR >, unsigned D = 4, class Policy = NoObservers>
Heap::Subject & ADS::lemon_interop::DaryHeap< PR, IM, CMP, D, Policy >::subject ( void )
inlinenodiscard

the subject of the heap of ADS

◆ top()

template<class PR, class IM, class CMP = std::less< PR >, unsigned D = 4, class Policy = NoObservers>
Item ADS::lemon_interop::DaryHeap< PR, IM, CMP, D, Policy >::top ( void ) const
inlinenodiscard

the item of least priority

Precondition
the heap is not empty

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