Priority queue. More...
#include <p_priority.hh>
Public Types | |
typedef p_double_piter< self_, mln_fwd_eiter(util::set< P > ), typename Q::bkd_piter > | bkd_piter |
Backward Site_Iterator associated type. | |
typedef Site_Set< void > | category |
typedef Q::element | element |
Element associated type. | |
typedef p_priority< P, Q > | exact_t |
typedef p_double_piter< self_, mln_bkd_eiter(util::set< P > ), typename Q::fwd_piter > | fwd_piter |
Forward Site_Iterator associated type. | |
typedef std::pair< P, element > | i_element |
Insertion element associated type. | |
typedef fwd_piter | piter |
Site_Iterator associated type. | |
typedef p_double_psite< self_, Q > | psite |
Psite associated type. | |
typedef subject< Q::site >::ret | site |
Site associated type. | |
Public Member Functions | |
void | clear () |
Clear the queue. | |
bool | exists_priority (const P &priority) const |
Test if the priority exists. | |
const Q::element & | front () const |
Give an element with highest priority. | |
bool | has (const psite &) const |
Test is the psite p belongs to this site set. | |
const P | highest_priority () const |
Give the highest priority. | |
void | insert (const p_priority< P, Q > &other) |
Insert elements from another priority queue. | |
void | insert (const i_element &p_e) |
Insert a pair p_e (priority p, element e). | |
bool | is_empty () const |
Test if the site set is empty. | |
bool | is_valid () const |
Test this set validity so returns always true. | |
const P | lowest_priority () const |
Give the lowest priority. | |
std::size_t | memory_size () const |
Return the size of this site set in memory. | |
unsigned | nsites () const |
Give the number of sites. | |
const Q & | operator() (const P &priority) const |
Give the queue with the priority priority . | |
p_priority () | |
Constructor. | |
void | pop () |
Pop (remove) from the queue an element with highest priority. | |
Q::element | pop_front () |
Return an element with highest priority and remove it from the set. | |
const util::set< P > & | priorities () const |
Give the set of priorities. | |
void | push (const P &priority, const element &e) |
Push in the queue with priority the element e . | |
const util::set< P > & | set_1_ () const |
const Q & | set_2_ (const P &priority) const |
Protected Types | |
typedef std::map< P, Q, util::ord< P > > | q_type_ |
Protected Member Functions | |
bool | run_ () const |
Protected Attributes | |
unsigned | n_ |
util::set< P > | p_ |
q_type_ | q_ |
Private Types | |
typedef p_priority< P, Q > | self_ |
Priority queue.
The parameter P
is the type of the priorities (for instance unsigned).
The parameter Q
is a type of queue (for instance p_queue<point2d>).
typedef p_double_piter< self_, mln_fwd_eiter(util::set<P>), typename Q ::bkd_piter > mln::p_priority< P, Q >::bkd_piter |
Backward Site_Iterator associated type.
typedef Site_Set<void> mln::Site_Set< p_priority< P, Q > >::category [inherited] |
Reimplemented from mln::Object< p_priority< P, Q > >.
typedef Q ::element mln::p_priority< P, Q >::element |
Element associated type.
typedef p_priority< P, Q > mln::Object< p_priority< P, Q > >::exact_t [inherited] |
typedef p_double_piter< self_, mln_bkd_eiter(util::set<P>), typename Q ::fwd_piter > mln::p_priority< P, Q >::fwd_piter |
Forward Site_Iterator associated type.
typedef std::pair<P, element> mln::p_priority< P, Q >::i_element |
Insertion element associated type.
typedef fwd_piter mln::p_priority< P, Q >::piter |
Site_Iterator associated type.
typedef p_double_psite<self_, Q> mln::p_priority< P, Q >::psite |
Psite associated type.
typedef std::map<P, Q, util::ord<P> > mln::p_priority< P, Q >::q_type_ [protected] |
typedef p_priority<P,Q> mln::p_priority< P, Q >::self_ [private] |
typedef subject<Q::site >::ret mln::internal::site_set_base_< Q::site , p_priority< P, Q > >::site [inherited] |
Site associated type.
mln::p_priority< P, Q >::p_priority | ( | ) | [inline] |
Constructor.
References mln::p_priority< P, Q >::run_().
void mln::p_priority< P, Q >::clear | ( | ) | [inline] |
Clear the queue.
References mln::p_priority< P, Q >::run_().
bool mln::p_priority< P, Q >::exists_priority | ( | const P & | priority | ) | const [inline] |
Test if the priority
exists.
References mln::p_priority< P, Q >::run_().
Referenced by mln::p_priority< P, Q >::operator()().
const Q::element & mln::p_priority< P, Q >::front | ( | ) | const [inline] |
Give an element with highest priority.
If several elements have this priority, the least recently inserted is chosen.
References mln::p_priority< P, Q >::highest_priority(), and mln::internal::site_set_base_< Q::site, p_priority< P, Q > >::is_empty().
Referenced by mln::morpho::watershed::impl::generic::flooding(), mln::morpho::watershed::impl::flooding_fastest(), and mln::morpho::meyer_wst().
bool mln::p_priority< P, Q >::has | ( | const psite & | ) | const [inline] |
Test is the psite p
belongs to this site set.
References mln::p_priority< P, Q >::run_().
const P mln::p_priority< P, Q >::highest_priority | ( | ) | const [inline] |
Give the highest priority.
References mln::internal::site_set_base_< Q::site, p_priority< P, Q > >::is_empty().
Referenced by mln::p_priority< P, Q >::front(), and mln::p_priority< P, Q >::pop().
void mln::p_priority< P, Q >::insert | ( | const i_element & | p_e | ) | [inline] |
Insert a pair p_e
(priority p, element e).
References mln::p_priority< P, Q >::push().
void mln::p_priority< P, Q >::insert | ( | const p_priority< P, Q > & | other | ) | [inline] |
Insert elements from another priority queue.
References mln::p_priority< P, Q >::n_, mln::p_priority< P, Q >::q_, and mln::p_priority< P, Q >::run_().
bool mln::internal::site_set_base_< Q::site , p_priority< P, Q > >::is_empty | ( | ) | const [inherited] |
Test if the site set is empty.
This final method dispatches to is_empty_ whose default implementation relies on the 'nsites' method.
Referenced by mln::morpho::watershed::impl::generic::flooding(), mln::morpho::watershed::impl::flooding_fastest(), mln::p_priority< P, Q >::front(), mln::p_priority< P, Q >::highest_priority(), mln::p_priority< P, Q >::lowest_priority(), mln::morpho::meyer_wst(), mln::p_priority< P, Q >::pop(), mln::geom::impl::seeds2tiling_roundness(), and mln::morpho::skeleton_constrained().
bool mln::p_priority< P, Q >::is_valid | ( | ) | const [inline] |
Test this set validity so returns always true.
References mln::p_priority< P, Q >::run_().
const P mln::p_priority< P, Q >::lowest_priority | ( | ) | const [inline] |
Give the lowest priority.
References mln::internal::site_set_base_< Q::site, p_priority< P, Q > >::is_empty().
std::size_t mln::p_priority< P, Q >::memory_size | ( | ) | const [inline] |
Return the size of this site set in memory.
References mln::p_priority< P, Q >::run_().
unsigned mln::p_priority< P, Q >::nsites | ( | ) | const [inline] |
Give the number of sites.
References mln::p_priority< P, Q >::run_().
Referenced by mln::p_priority< P, Q >::operator()(), and mln::p_priority< P, Q >::set_2_().
const Q & mln::p_priority< P, Q >::operator() | ( | const P & | priority | ) | const [inline] |
Give the queue with the priority priority
.
This method always works: if the priority is not in this set, an empty queue is returned.
References mln::p_priority< P, Q >::exists_priority(), and mln::p_priority< P, Q >::nsites().
void mln::p_priority< P, Q >::pop | ( | ) | [inline] |
Pop (remove) from the queue an element with highest priority.
If several elements have this priority, the least recently inserted is chosen.
References mln::p_priority< P, Q >::highest_priority(), mln::internal::site_set_base_< Q::site, p_priority< P, Q > >::is_empty(), and mln::p_priority< P, Q >::run_().
Referenced by mln::morpho::watershed::impl::generic::flooding(), mln::morpho::watershed::impl::flooding_fastest(), and mln::morpho::meyer_wst().
Q::element mln::p_priority< P, Q >::pop_front | ( | ) | [inline] |
Return an element with highest priority and remove it from the set.
If several elements have this priority, the least recently inserted is chosen.
Referenced by mln::geom::impl::seeds2tiling_roundness(), and mln::morpho::skeleton_constrained().
const util::set< P > & mln::p_priority< P, Q >::priorities | ( | ) | const [inline] |
Give the set of priorities.
References mln::p_priority< P, Q >::run_().
void mln::p_priority< P, Q >::push | ( | const P & | priority, | |
const element & | e | |||
) | [inline] |
Push in the queue with priority
the element e
.
References mln::p_priority< P, Q >::run_().
Referenced by mln::morpho::watershed::impl::generic::flooding(), mln::morpho::watershed::impl::flooding_fastest(), mln::p_priority< P, Q >::insert(), mln::morpho::meyer_wst(), mln::geom::impl::seeds2tiling_roundness(), and mln::morpho::skeleton_constrained().
bool mln::p_priority< P, Q >::run_ | ( | ) | const [inline, protected] |
References mln::implies().
Referenced by mln::p_priority< P, Q >::clear(), mln::p_priority< P, Q >::exists_priority(), mln::p_priority< P, Q >::has(), mln::p_priority< P, Q >::insert(), mln::p_priority< P, Q >::is_valid(), mln::p_priority< P, Q >::memory_size(), mln::p_priority< P, Q >::nsites(), mln::p_priority< P, Q >::p_priority(), mln::p_priority< P, Q >::pop(), mln::p_priority< P, Q >::priorities(), and mln::p_priority< P, Q >::push().
const util::set< P > & mln::p_priority< P, Q >::set_1_ | ( | ) | const [inline] |
const Q & mln::p_priority< P, Q >::set_2_ | ( | const P & | priority | ) | const [inline] |
References mln::p_priority< P, Q >::nsites().
unsigned mln::p_priority< P, Q >::n_ [protected] |
Referenced by mln::p_priority< P, Q >::insert().
util::set<P> mln::p_priority< P, Q >::p_ [protected] |
q_type_ mln::p_priority< P, Q >::q_ [protected] |
Referenced by mln::p_priority< P, Q >::insert().