$extrastylesheet
Olena  User documentation 2.1
An Image Processing Platform
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
mln::p_priority< P, Q > Class Template Reference

#include <mln/core/site_set/p_priority.hh>

Public Member Functions

 p_priority ()
void clear ()
bool exists_priority (const P &priority) const
const Q::element & front () const
bool has (const psite &) const
const P highest_priority () const
void insert (const i_element &p_e)
void insert (const p_priority< P, Q > &other)
bool is_empty () const
bool is_valid () const
const P lowest_priority () const
std::size_t memory_size () const
unsigned nsites () const
const Q & operator() (const P &priority) const
void pop ()
Q::element pop_front ()
const util::set< P > & priorities () const
void push (const P &priority, const element &e)

Protected Member Functions

bool run_ () const

Protected Attributes

unsigned n_
util::set< P > p_
q_type_ q_

Public Types

typedef p_double_piter< self_,
mln_fwd_eiter(util::set< P >
), typename Q::bkd_piter > 
bkd_piter
typedef Site_Set< void > category
typedef Q::element element
typedef p_priority< P, Q > exact_t
typedef p_double_piter< self_,
mln_bkd_eiter(util::set< P >
), typename Q::fwd_piter > 
fwd_piter
typedef std::pair< P, elementi_element
typedef fwd_piter piter
typedef p_double_psite< self_, Q > psite
typedef subject< Q::site >::ret site

Protected Types

typedef std::map< P, Q,
util::ord< P > > 
q_type_

Related Functions

(Note that these are not member functions.)

template<typename P , typename Q >
std::ostream & operator<< (std::ostream &ostr, const p_priority< P, Q > &pq)

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 77 of file p_priority.hh.

Constructor & Destructor Documentation

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

Constructor.

Member Function Documentation

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

Clear the queue.

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

Test if the priority exists.

template<typename P , typename Q >
const Q ::element& mln::p_priority< P, Q >::front ( ) const

Give an element with highest priority.

If several elements have this priority, the least recently inserted is chosen.

Precondition
! is_empty()
template<typename P , typename Q >
bool mln::p_priority< P, Q >::has ( const psite ) const

Test is the psite p belongs to this site set.

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

Give the highest priority.

Precondition
! is_empty()
template<typename P , typename Q >
void mln::p_priority< P, Q >::insert ( const i_element p_e)

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

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

Insert elements from another priority queue.

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.

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

Test this set validity so returns always true.

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

Give the lowest priority.

Precondition
! is_empty()
template<typename P , typename Q >
std::size_t mln::p_priority< P, Q >::memory_size ( ) const

Return the size of this site set in memory.

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

Give the number of sites.

template<typename P , typename Q >
const Q& mln::p_priority< P, Q >::operator() ( const P &  priority) const

Give the queue with the priority priority.

This method always works: if the priority is not in this set, an empty queue is returned.

template<typename P , typename Q >
void mln::p_priority< P, Q >::pop ( )

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()
template<typename P , typename Q >
Q ::element mln::p_priority< P, Q >::pop_front ( )

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()
template<typename P , typename Q >
const util::set<P>& mln::p_priority< P, Q >::priorities ( ) const

Give the set of priorities.

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

Push in the queue with priority the element e.

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

Friends And Related Function Documentation

template<typename P , typename Q >
std::ostream & operator<< ( std::ostream &  ostr,
const p_priority< P, Q > &  pq 
)
related

Member Data Documentation

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

Definition at line 187 of file p_priority.hh.

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

Definition at line 185 of file p_priority.hh.

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

Definition at line 186 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 99 of file p_priority.hh.

typedef Site_Set<void> mln::Site_Set< p_priority< P, Q > >::category
inherited

Definition at line 74 of file 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 85 of file p_priority.hh.

typedef p_priority< P, Q > mln::Object< p_priority< P, Q > >::exact_t
inherited

Definition at line 105 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 94 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 122 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 102 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 89 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 183 of file p_priority.hh.

typedef subject<Q::site >::ret mln::internal::site_set_base_< Q::site , p_priority< P, Q > >::site
inherited

Site associated type.

Definition at line 58 of file site_set_base.hh.