Queue of sites class (based on p_array. More...
#include <p_queue_fast.hh>
Public Types | |
typedef p_indexed_bkd_piter < self_ > | bkd_piter |
Backward Site_Iterator associated type. | |
typedef Site_Set< void > | category |
typedef P | element |
Element associated type. | |
typedef p_queue_fast< P > | exact_t |
typedef p_indexed_fwd_piter < self_ > | fwd_piter |
Forward Site_Iterator associated type. | |
typedef P | i_element |
Insertion element associated type. | |
typedef fwd_piter | piter |
Site_Iterator associated type. | |
typedef p_indexed_psite< self_ > | psite |
Psite associated type. | |
typedef subject< P >::ret | site |
Site associated type. | |
Public Member Functions | |
void | clear () |
Clear the queue. | |
bool | compute_has (const P &p) const |
Test if p belongs to this site set. | |
bool | empty () const |
Test if the queue is empty. | |
const P & | front () const |
Give the front site p of the queue; p is the least recently inserted site. | |
bool | has (const util::index &i) const |
Test if index i belongs to this site set. | |
bool | has (const psite &p) const |
Test if p belongs to this site set. | |
void | insert (const P &p) |
Insert a site p (equivalent as 'push'). | |
bool | is_empty () const |
Test if the site set is empty. | |
bool | is_valid () const |
This set is always valid so it returns true. | |
std::size_t | memory_size () const |
Return the size of this site set in memory. | |
unsigned | nsites () const |
Give the number of sites. | |
const P & | operator[] (unsigned i) const |
Return the i-th site. | |
p_queue_fast () | |
Constructor without argument. | |
void | pop () |
Pop (remove) the front site p from the queue; p is the least recently inserted site. | |
const P & | pop_front () |
Pop (remove) the front site p from the queue; p is the least recently inserted site and give the front site p of the queue; p is the least recently inserted site. | |
void | purge () |
Purge the queue to save (free) some memory. | |
void | push (const P &p) |
Push a site p in the queue. | |
void | reserve (typename p_array< P >::size_type n) |
Reserve n cells. | |
const std::vector< P > & | std_vector () const |
Return the corresponding std::vector of sites. | |
Protected Attributes | |
unsigned | begin_ |
unsigned | end_ |
p_array< P > | q_ |
Private Types | |
typedef p_queue_fast< P > | self_ |
Queue of sites class (based on p_array.
).
This container is efficient; FIXME: explain...
The parameter P
shall be a site or pseudo-site type.
Definition at line 72 of file p_queue_fast.hh.
typedef p_indexed_bkd_piter<self_> mln::p_queue_fast< P >::bkd_piter |
Backward Site_Iterator associated type.
Definition at line 87 of file p_queue_fast.hh.
typedef Site_Set<void> mln::Site_Set< p_queue_fast< P > >::category [inherited] |
Reimplemented from mln::Object< p_queue_fast< P > >.
Definition at line 67 of file mln/core/concept/site_set.hh.
typedef P mln::p_queue_fast< P >::element |
Element associated type.
Definition at line 78 of file p_queue_fast.hh.
typedef p_queue_fast< P > mln::Object< p_queue_fast< P > >::exact_t [inherited] |
typedef p_indexed_fwd_piter<self_> mln::p_queue_fast< P >::fwd_piter |
Forward Site_Iterator associated type.
Definition at line 84 of file p_queue_fast.hh.
typedef P mln::p_queue_fast< P >::i_element |
Insertion element associated type.
Definition at line 121 of file p_queue_fast.hh.
typedef fwd_piter mln::p_queue_fast< P >::piter |
Site_Iterator associated type.
Definition at line 90 of file p_queue_fast.hh.
typedef p_indexed_psite<self_> mln::p_queue_fast< P >::psite |
Psite associated type.
Definition at line 81 of file p_queue_fast.hh.
typedef p_queue_fast<P> mln::p_queue_fast< P >::self_ [private] |
Definition at line 74 of file p_queue_fast.hh.
typedef subject<P>::ret mln::internal::site_set_base_< P, p_queue_fast< P > >::site [inherited] |
Site associated type.
Definition at line 55 of file site_set_base.hh.
mln::p_queue_fast< P >::p_queue_fast | ( | ) | [inline] |
Constructor without argument.
Definition at line 170 of file p_queue_fast.hh.
References mln::p_queue_fast< P >::begin_, and mln::p_queue_fast< P >::end_.
void mln::p_queue_fast< P >::clear | ( | ) | [inline] |
Clear the queue.
Definition at line 297 of file p_queue_fast.hh.
References mln::p_queue_fast< P >::begin_, and mln::p_queue_fast< P >::end_.
Referenced by mln::canvas::impl::generic::distance_geodesic().
bool mln::p_queue_fast< P >::compute_has | ( | const P & | p | ) | const [inline] |
Test if p
belongs to this site set.
Definition at line 222 of file p_queue_fast.hh.
References mln::p_queue_fast< P >::begin_, mln::p_queue_fast< P >::end_, and mln::p_queue_fast< P >::q_.
Referenced by mln::canvas::labeling::impl::generic::blobs().
bool mln::p_queue_fast< P >::empty | ( | ) | const [inline] |
Test if the queue is empty.
Definition at line 250 of file p_queue_fast.hh.
References mln::p_queue_fast< P >::begin_, and mln::p_queue_fast< P >::end_.
const P & mln::p_queue_fast< P >::front | ( | ) | const [inline] |
Give the front site p
of the queue; p
is the least recently inserted site.
Definition at line 277 of file p_queue_fast.hh.
References mln::p_queue_fast< P >::begin_, mln::internal::site_set_base_< P, p_queue_fast< P > >::is_empty(), and mln::p_queue_fast< P >::q_.
Referenced by mln::canvas::labeling::impl::generic::blobs(), and mln::p_queue_fast< P >::pop_front().
bool mln::p_queue_fast< P >::has | ( | const psite & | p | ) | const [inline] |
Test if p
belongs to this site set.
Definition at line 201 of file p_queue_fast.hh.
References mln::p_indexed_psite< S >::index(), mln::p_queue_fast< P >::nsites(), and mln::p_indexed_psite< S >::target_().
bool mln::p_queue_fast< P >::has | ( | const util::index & | i | ) | const [inline] |
Test if index i
belongs to this site set.
Definition at line 214 of file p_queue_fast.hh.
References mln::p_queue_fast< P >::nsites().
void mln::p_queue_fast< P >::insert | ( | const P & | p | ) | [inline] |
Insert a site p
(equivalent as 'push').
Definition at line 314 of file p_queue_fast.hh.
References mln::p_queue_fast< P >::push().
bool mln::internal::site_set_base_< P, p_queue_fast< P > >::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::canvas::labeling::impl::generic::blobs(), mln::canvas::impl::generic::distance_geodesic(), mln::p_queue_fast< P >::front(), mln::influence_zones(), mln::p_queue_fast< P >::pop(), and mln::p_queue_fast< P >::pop_front().
bool mln::p_queue_fast< P >::is_valid | ( | ) | const [inline] |
This set is always valid so it returns true.
Definition at line 233 of file p_queue_fast.hh.
std::size_t mln::p_queue_fast< P >::memory_size | ( | ) | const [inline] |
Return the size of this site set in memory.
Definition at line 330 of file p_queue_fast.hh.
References mln::p_queue_fast< P >::q_.
unsigned mln::p_queue_fast< P >::nsites | ( | ) | const [inline] |
Give the number of sites.
Definition at line 241 of file p_queue_fast.hh.
References mln::p_queue_fast< P >::begin_, and mln::p_queue_fast< P >::end_.
Referenced by mln::p_queue_fast< P >::has(), and mln::p_queue_fast< P >::operator[]().
const P & mln::p_queue_fast< P >::operator[] | ( | unsigned | i | ) | const [inline] |
Return the i-th
site.
Definition at line 305 of file p_queue_fast.hh.
References mln::p_queue_fast< P >::begin_, mln::p_queue_fast< P >::nsites(), and mln::p_queue_fast< P >::q_.
void mln::p_queue_fast< P >::pop | ( | ) | [inline] |
Pop (remove) the front site p
from the queue; p
is the least recently inserted site.
Definition at line 268 of file p_queue_fast.hh.
References mln::p_queue_fast< P >::begin_, and mln::internal::site_set_base_< P, p_queue_fast< P > >::is_empty().
Referenced by mln::canvas::labeling::impl::generic::blobs(), and mln::p_queue_fast< P >::pop_front().
const P & mln::p_queue_fast< P >::pop_front | ( | ) | [inline] |
Pop (remove) the front site p
from the queue; p
is the least recently inserted site and give the front site p
of the queue; p
is the least recently inserted site.
Definition at line 286 of file p_queue_fast.hh.
References mln::p_queue_fast< P >::front(), mln::internal::site_set_base_< P, p_queue_fast< P > >::is_empty(), and mln::p_queue_fast< P >::pop().
Referenced by mln::canvas::impl::generic::distance_geodesic(), and mln::influence_zones().
void mln::p_queue_fast< P >::purge | ( | ) | [inline] |
Purge the queue to save (free) some memory.
Definition at line 187 of file p_queue_fast.hh.
References mln::p_queue_fast< P >::begin_, mln::p_queue_fast< P >::end_, and mln::p_queue_fast< P >::q_.
void mln::p_queue_fast< P >::push | ( | const P & | p | ) | [inline] |
Push a site p
in the queue.
Definition at line 259 of file p_queue_fast.hh.
References mln::p_queue_fast< P >::end_, and mln::p_queue_fast< P >::q_.
Referenced by mln::canvas::labeling::impl::generic::blobs(), mln::canvas::impl::generic::distance_geodesic(), mln::influence_zones(), and mln::p_queue_fast< P >::insert().
void mln::p_queue_fast< P >::reserve | ( | typename p_array< P >::size_type | n | ) | [inline] |
Reserve n
cells.
Definition at line 179 of file p_queue_fast.hh.
References mln::p_queue_fast< P >::q_.
const std::vector< P > & mln::p_queue_fast< P >::std_vector | ( | ) | const [inline] |
Return the corresponding std::vector of sites.
Definition at line 322 of file p_queue_fast.hh.
References mln::p_queue_fast< P >::q_.
unsigned mln::p_queue_fast< P >::begin_ [protected] |
Definition at line 160 of file p_queue_fast.hh.
Referenced by mln::p_queue_fast< P >::clear(), mln::p_queue_fast< P >::compute_has(), mln::p_queue_fast< P >::empty(), mln::p_queue_fast< P >::front(), mln::p_queue_fast< P >::nsites(), mln::p_queue_fast< P >::operator[](), mln::p_queue_fast< P >::p_queue_fast(), mln::p_queue_fast< P >::pop(), and mln::p_queue_fast< P >::purge().
unsigned mln::p_queue_fast< P >::end_ [protected] |
Definition at line 161 of file p_queue_fast.hh.
Referenced by mln::p_queue_fast< P >::clear(), mln::p_queue_fast< P >::compute_has(), mln::p_queue_fast< P >::empty(), mln::p_queue_fast< P >::nsites(), mln::p_queue_fast< P >::p_queue_fast(), mln::p_queue_fast< P >::purge(), and mln::p_queue_fast< P >::push().
p_array<P> mln::p_queue_fast< P >::q_ [protected] |
Definition at line 159 of file p_queue_fast.hh.
Referenced by mln::p_queue_fast< P >::compute_has(), mln::p_queue_fast< P >::front(), mln::p_queue_fast< P >::memory_size(), mln::p_queue_fast< P >::operator[](), mln::p_queue_fast< P >::purge(), mln::p_queue_fast< P >::push(), mln::p_queue_fast< P >::reserve(), and mln::p_queue_fast< P >::std_vector().