Public Types | Public Member Functions | Protected Attributes | Private Types

mln::p_array< P > Class Template Reference
[Sparse types]

Multi-set of sites. More...

#include <p_array.hh>

Inheritance diagram for mln::p_array< P >:
Inheritance graph

List of all members.

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_array< 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.
typedef std::vector< P >::size_type size_type

Public Member Functions

p_array< P > & append (const P &p)
 Append a point p.
p_array< P > & append (const p_array< P > &other)
 Append an array other of points.
void change (const psite &p, const P &new_p)
 Change site p into new_p.
void clear ()
 Clear this set.
bool has (const util::index &i) const
 Test is index i belongs to this site set.
bool has (const psite &p) const
 Test is p belongs to this site set.
std::vector< P > & hook_std_vector_ ()
 Hook to the std::vector.
void insert (const P &p)
 Insert a point p (equivalent as 'append').
bool is_empty () const
 Test if the site set is empty.
bool is_valid () const
 Test this set validity so returns always true.
std::size_t memory_size () const
 Return the size of this site set in memory.
unsigned nsites () const
 Give the number of sites.
P & operator[] (unsigned i)
 Return the i-th site (mutable).
const P & operator[] (const util::index &i) const
 Return the i-th element.
const P & operator[] (unsigned i) const
 Return the i-th site (constant).
 p_array (const std::vector< P > &vect)
 Constructor from a vector vect.
 p_array ()
 Constructor.
void reserve (size_type n)
 Reserve n cells.
const std::vector< P > & std_vector () const
 Return the corresponding std::vector of points.

Protected Attributes

std::vector< P > vect_

Private Types

typedef p_array< P > self_

Detailed Description

template<typename P>
class mln::p_array< P >

Multi-set of sites.

Site set class based on std::vector.


Member Typedef Documentation

template<typename P>
typedef p_indexed_bkd_piter<self_> mln::p_array< P >::bkd_piter

Backward Site_Iterator associated type.

typedef Site_Set<void> mln::Site_Set< p_array< P > >::category [inherited]

Reimplemented from mln::Object< p_array< P > >.

template<typename P>
typedef P mln::p_array< P >::element

Element associated type.

typedef p_array< P > mln::Object< p_array< P > >::exact_t [inherited]
template<typename P>
typedef p_indexed_fwd_piter<self_> mln::p_array< P >::fwd_piter

Forward Site_Iterator associated type.

template<typename P>
typedef P mln::p_array< P >::i_element

Insertion element associated type.

template<typename P>
typedef fwd_piter mln::p_array< P >::piter

Site_Iterator associated type.

template<typename P>
typedef p_indexed_psite<self_> mln::p_array< P >::psite

Psite associated type.

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

Site associated type.

template<typename P>
typedef std::vector<P>::size_type mln::p_array< P >::size_type

Constructor & Destructor Documentation

template<typename P >
mln::p_array< P >::p_array (  )  [inline]

Constructor.

template<typename P>
mln::p_array< P >::p_array ( const std::vector< P > &  vect  )  [inline]

Constructor from a vector vect.


Member Function Documentation

template<typename P>
p_array< P > & mln::p_array< P >::append ( const P &  p  )  [inline]
template<typename P>
p_array< P > & mln::p_array< P >::append ( const p_array< P > &  other  )  [inline]

Append an array other of points.

References mln::p_array< P >::std_vector(), and mln::p_array< P >::vect_.

template<typename P>
void mln::p_array< P >::change ( const psite p,
const P &  new_p 
) [inline]
template<typename P >
void mln::p_array< P >::clear (  )  [inline]
template<typename P >
bool mln::p_array< P >::has ( const psite p  )  const [inline]
template<typename P >
bool mln::p_array< P >::has ( const util::index i  )  const [inline]

Test is index i belongs to this site set.

References mln::p_array< P >::nsites().

template<typename P >
std::vector< P > & mln::p_array< P >::hook_std_vector_ (  )  [inline]
template<typename P>
void mln::p_array< P >::insert ( const P &  p  )  [inline]

Insert a point p (equivalent as 'append').

References mln::p_array< P >::vect_.

Referenced by mln::morpho::tree::data< I, S >::data().

bool mln::internal::site_set_base_< P, p_array< 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::p_array< P >::clear(), mln::registration::icp(), and mln::registration::internal::registration_tests().

template<typename P >
bool mln::p_array< P >::is_valid (  )  const [inline]

Test this set validity so returns always true.

Referenced by mln::registration::internal::registration_tests().

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

Return the size of this site set in memory.

References mln::p_array< P >::nsites().

Referenced by mln::p_line2d::memory_size().

template<typename P >
unsigned mln::p_array< P >::nsites (  )  const [inline]
template<typename P >
P & mln::p_array< P >::operator[] ( unsigned  i  )  [inline]

Return the i-th site (mutable).

References mln::p_array< P >::nsites(), and mln::p_array< P >::vect_.

template<typename P >
const P & mln::p_array< P >::operator[] ( unsigned  i  )  const [inline]

Return the i-th site (constant).

References mln::p_array< P >::nsites(), and mln::p_array< P >::vect_.

template<typename P >
const P & mln::p_array< P >::operator[] ( const util::index i  )  const [inline]

Return the i-th element.

References mln::p_array< P >::has(), and mln::p_array< P >::vect_.

template<typename P >
void mln::p_array< P >::reserve ( size_type  n  )  [inline]

Reserve n cells.

References mln::p_array< P >::vect_.

Referenced by mln::convert::to_p_array().

template<typename P >
const std::vector< P > & mln::p_array< P >::std_vector (  )  const [inline]

Return the corresponding std::vector of points.

References mln::p_array< P >::vect_.

Referenced by mln::p_array< P >::append(), and mln::p_line2d::std_vector().


Member Data Documentation

template<typename P>
std::vector<P> mln::p_array< P >::vect_ [protected]