mln::p_priority< P, Q > Class Template Reference
[Queue based]

Priority queue. More...

#include <p_priority.hh>

Inheritance diagram for mln::p_priority< P, Q >:

Inheritance graph

List of all members.

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 E 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, elementi_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< P >::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_

Related Functions

(Note that these are not member functions.)

template<typename Sl, typename Sr>
p_set< typename Sl::site > diff (const Site_Set< Sl > &lhs, const Site_Set< Sr > &rhs)
 Set theoretic difference of lhs and rhs.
template<typename Sl, typename Sr>
p_set< typename Sl::site > inter (const Site_Set< Sl > &lhs, const Site_Set< Sr > &rhs)
 Intersection between a couple of point sets.
template<typename Sl, typename Sr>
bool operator< (const Site_Set< Sl > &lhs, const Site_Set< Sr > &rhs)
 Strict inclusion test between site sets lhs and rhs.
template<typename S>
std::ostream & operator<< (std::ostream &ostr, const Site_Set< S > &set)
 Print a site set set into the output stream ostr.
template<typename Sl, typename Sr>
bool operator<= (const Site_Set< Sl > &lhs, const Site_Set< Sr > &rhs)
 Inclusion test between site sets lhs and rhs.
template<typename Sl, typename Sr>
bool operator== (const Site_Set< Sl > &lhs, const Site_Set< Sr > &rhs)
 Equality test between site sets lhs and rhs.
template<typename Sl, typename Sr>
p_set< typename Sl::site > sym_diff (const Site_Set< Sl > &lhs, const Site_Set< Sr > &rhs)
 Set theoretic symmetrical difference of lhs and rhs.
template<typename Sl, typename Sr>
p_set< typename Sl::site > uni (const Site_Set< Sl > &lhs, const Site_Set< Sr > &rhs)
 Union of a couple of point sets.
template<typename S>
p_set< typename S::site > unique (const Site_Set< S > &s)
 Give the unique set of s.


Detailed Description

template<typename P, typename Q>
class mln::p_priority< P, Q >

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>).

Definition at line 76 of file p_priority.hh.


Member Typedef Documentation

template<typename P, typename Q>
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.

Definition at line 98 of file p_priority.hh.

template<typename E>
typedef Site_Set<void> mln::Site_Set< E >::category [inherited]

Reimplemented from mln::Object< E >.

Definition at line 67 of file mln/core/concept/site_set.hh.

template<typename P, typename Q>
typedef Q ::element mln::p_priority< P, Q >::element

Element associated type.

Definition at line 84 of file p_priority.hh.

template<typename E>
typedef E mln::Object< E >::exact_t [inherited]

Definition at line 172 of file object.hh.

template<typename P, typename Q>
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.

Definition at line 93 of file p_priority.hh.

template<typename P, typename Q>
typedef std::pair<P, element> mln::p_priority< P, Q >::i_element

Insertion element associated type.

Definition at line 121 of file p_priority.hh.

template<typename P, typename Q>
typedef fwd_piter mln::p_priority< P, Q >::piter

Site_Iterator associated type.

Definition at line 101 of file p_priority.hh.

template<typename P, typename Q>
typedef p_double_psite<self_, Q> mln::p_priority< P, Q >::psite

Psite associated type.

Definition at line 88 of file p_priority.hh.

template<typename P, typename Q>
typedef std::map<P, Q, util::ord<P> > mln::p_priority< P, Q >::q_type_ [protected]

Definition at line 181 of file p_priority.hh.

template<typename P, typename Q>
typedef p_priority<P,Q> mln::p_priority< P, Q >::self_ [private]

Definition at line 80 of file p_priority.hh.

template<typename P, typename E>
typedef subject<P>::ret mln::internal::site_set_base_< P, E >::site [inherited]

Site associated type.

Reimplemented in mln::p_centered< W >.

Definition at line 55 of file site_set_base.hh.


Constructor & Destructor Documentation

template<typename P, typename Q>
mln::p_priority< P, Q >::p_priority (  )  [inline]

Constructor.

Definition at line 202 of file p_priority.hh.

References mln::p_priority< P, Q >::run_().


Member Function Documentation

template<typename P, typename Q>
void mln::p_priority< P, Q >::clear (  )  [inline]

Clear the queue.

Definition at line 316 of file p_priority.hh.

References mln::p_priority< P, Q >::run_().

template<typename P, typename Q>
bool mln::p_priority< P, Q >::exists_priority ( const P &  priority  )  const [inline]

Test if the priority exists.

Definition at line 366 of file p_priority.hh.

References mln::p_priority< P, Q >::run_().

Referenced by mln::p_priority< P, Q >::operator()().

template<typename P, typename Q>
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.

Precondition:
! is_empty()

Definition at line 294 of file p_priority.hh.

References mln::p_priority< P, Q >::highest_priority(), and mln::internal::site_set_base_< P, E >::is_empty().

Referenced by mln::morpho::watershed::impl::generic::flooding(), mln::morpho::watershed::impl::flooding_fastest(), mln::morpho::meyer_wst(), mln::p_priority< P, Q >::pop_front(), and mln::morpho::watershed::topological().

template<typename P, typename Q>
bool mln::p_priority< P, Q >::has ( const psite  )  const [inline]

Test is the psite p belongs to this site set.

Definition at line 211 of file p_priority.hh.

References mln::p_priority< P, Q >::run_().

template<typename P, typename Q>
const P mln::p_priority< P, Q >::highest_priority (  )  const [inline]

Give the highest priority.

Precondition:
! is_empty()

Definition at line 375 of file p_priority.hh.

References mln::internal::site_set_base_< P, E >::is_empty().

Referenced by mln::p_priority< P, Q >::front(), and mln::p_priority< P, Q >::pop().

template<typename P, typename Q>
void mln::p_priority< P, Q >::insert ( const p_priority< P, Q > &  other  )  [inline]

Insert elements from another priority queue.

Definition at line 259 of file p_priority.hh.

References mln::p_priority< P, Q >::n_, mln::p_priority< P, Q >::q_, and mln::p_priority< P, Q >::run_().

template<typename P, typename Q>
void mln::p_priority< P, Q >::insert ( const i_element p_e  )  [inline]

Insert a pair p_e (priority p, element e).

Definition at line 251 of file p_priority.hh.

References mln::p_priority< P, Q >::push().

template<typename P, typename E>
bool mln::internal::site_set_base_< P, E >::is_empty (  )  const [inline, inherited]

template<typename P, typename Q>
bool mln::p_priority< P, Q >::is_valid (  )  const [inline]

Test this set validity so returns always true.

Definition at line 221 of file p_priority.hh.

References mln::p_priority< P, Q >::run_().

template<typename P, typename Q>
const P mln::p_priority< P, Q >::lowest_priority (  )  const [inline]

Give the lowest priority.

Precondition:
! is_empty()

Definition at line 384 of file p_priority.hh.

References mln::internal::site_set_base_< P, E >::is_empty().

template<typename P, typename Q>
std::size_t mln::p_priority< P, Q >::memory_size (  )  const [inline]

Return the size of this site set in memory.

Definition at line 328 of file p_priority.hh.

References mln::p_priority< P, Q >::run_().

template<typename P, typename Q>
unsigned mln::p_priority< P, Q >::nsites (  )  const [inline]

Give the number of sites.

Definition at line 230 of file p_priority.hh.

References mln::p_priority< P, Q >::run_().

Referenced by mln::p_priority< P, Q >::operator()(), and mln::p_priority< P, Q >::set_2_().

template<typename P, typename Q>
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.

Definition at line 341 of file p_priority.hh.

References mln::p_priority< P, Q >::exists_priority(), and mln::p_priority< P, Q >::nsites().

template<typename P, typename Q>
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.

Precondition:
! is_empty()

Definition at line 277 of file p_priority.hh.

References mln::p_priority< P, Q >::highest_priority(), mln::internal::site_set_base_< P, E >::is_empty(), and mln::p_priority< P, Q >::run_().

Referenced by mln::morpho::watershed::impl::generic::flooding(), mln::morpho::watershed::impl::flooding_fastest(), mln::morpho::meyer_wst(), mln::p_priority< P, Q >::pop_front(), and mln::morpho::watershed::topological().

template<typename P, typename Q>
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.

Precondition:
! is_empty()

Definition at line 304 of file p_priority.hh.

References mln::p_priority< P, Q >::front(), mln::internal::site_set_base_< P, E >::is_empty(), and mln::p_priority< P, Q >::pop().

Referenced by mln::geom::impl::seeds2tiling_roundness(), and mln::morpho::skeleton_constrained().

template<typename P, typename Q>
const util::set< P > & mln::p_priority< P, Q >::priorities (  )  const [inline]

Give the set of priorities.

Definition at line 357 of file p_priority.hh.

References mln::p_priority< P, Q >::run_().

template<typename P, typename Q>
void mln::p_priority< P, Q >::push ( const P &  priority,
const element e 
) [inline]

template<typename P, typename Q>
bool mln::p_priority< P, Q >::run_ (  )  const [inline, protected]

template<typename P, typename Q>
const util::set< P > & mln::p_priority< P, Q >::set_1_ (  )  const [inline]

Definition at line 393 of file p_priority.hh.

template<typename P, typename Q>
const Q & mln::p_priority< P, Q >::set_2_ ( const P &  priority  )  const [inline]

Definition at line 401 of file p_priority.hh.

References mln::p_priority< P, Q >::nsites().


Friends And Related Function Documentation

template<typename Sl, typename Sr>
p_set< typename Sl::site > diff ( const Site_Set< Sl > &  lhs,
const Site_Set< Sr > &  rhs 
) [related, inherited]

Set theoretic difference of lhs and rhs.

Definition at line 66 of file set/diff.hh.

template<typename Sl, typename Sr>
p_set< typename Sl::site > inter ( const Site_Set< Sl > &  lhs,
const Site_Set< Sr > &  rhs 
) [related, inherited]

Intersection between a couple of point sets.

Definition at line 62 of file set/inter.hh.

template<typename Sl, typename Sr>
bool operator< ( const Site_Set< Sl > &  lhs,
const Site_Set< Sr > &  rhs 
) [related, inherited]

Strict inclusion test between site sets lhs and rhs.

Parameters:
[in] lhs A site set (strictly included?).
[in] rhs Another site set (includer?).

Definition at line 479 of file operators.hh.

template<typename S>
std::ostream & operator<< ( std::ostream &  ostr,
const Site_Set< S > &  set 
) [related, inherited]

Print a site set set into the output stream ostr.

Parameters:
[in,out] ostr An output stream.
[in] set A site set.
Returns:
The modified output stream ostr.

Definition at line 505 of file operators.hh.

template<typename Sl, typename Sr>
bool operator<= ( const Site_Set< Sl > &  lhs,
const Site_Set< Sr > &  rhs 
) [related, inherited]

Inclusion test between site sets lhs and rhs.

Parameters:
[in] lhs A site set (included?).
[in] rhs Another site set (includer?).

Definition at line 491 of file operators.hh.

template<typename Sl, typename Sr>
bool operator== ( const Site_Set< Sl > &  lhs,
const Site_Set< Sr > &  rhs 
) [related, inherited]

Equality test between site sets lhs and rhs.

Parameters:
[in] lhs A site set.
[in] rhs Another site set.

Definition at line 467 of file operators.hh.

template<typename Sl, typename Sr>
p_set< typename Sl::site > sym_diff ( const Site_Set< Sl > &  lhs,
const Site_Set< Sr > &  rhs 
) [related, inherited]

Set theoretic symmetrical difference of lhs and rhs.

Definition at line 65 of file sym_diff.hh.

template<typename Sl, typename Sr>
p_set< typename Sl::site > uni ( const Site_Set< Sl > &  lhs,
const Site_Set< Sr > &  rhs 
) [related, inherited]

Union of a couple of point sets.

Definition at line 61 of file uni.hh.

template<typename S>
p_set< typename S::site > unique ( const Site_Set< S > &  s  )  [related, inherited]

Give the unique set of s.

Definition at line 61 of file unique.hh.


Member Data Documentation

template<typename P, typename Q>
unsigned mln::p_priority< P, Q >::n_ [protected]

Definition at line 185 of file p_priority.hh.

Referenced by mln::p_priority< P, Q >::insert().

template<typename P, typename Q>
util::set<P> mln::p_priority< P, Q >::p_ [protected]

Definition at line 183 of file p_priority.hh.

template<typename P, typename Q>
q_type_ mln::p_priority< P, Q >::q_ [protected]

Definition at line 184 of file p_priority.hh.

Referenced by mln::p_priority< P, Q >::insert().


Generated on Sun Apr 25 01:56:38 2010 for Milena (Olena) by  doxygen 1.5.6