ViSP  2.8.0
vpList< type > Class Template Reference

#include <vpList.h>

Public Member Functions

 vpList ()
 
 vpList (const vpList &l)
 
virtual ~vpList ()
 
void next (void)
 
void previous (void)
 
void front (void)
 
void end (void)
 
bool outside (void) const
 
bool empty (void) const
 
type & value (void)
 
const type & value (void) const
 
void suppress (void)
 
void kill ()
 
void display ()
 
void print ()
 
void addRight (const type &el)
 
void addLeft (const type &el)
 
void modify (const type &el)
 
void addRight (type &el)
 
void addLeft (type &el)
 
void swapLeft ()
 
void swapRight ()
 
unsigned int nbElement (void)
 
unsigned int nbElements (void)
 
void operator= (const vpList< type > &l)
 
void operator+= (vpList< type > &l)
 
void operator+= (const type &l)
 
bool nextOutside (void) const
 
bool previousOutside (void) const
 
type & previousValue (void)
 
type & nextValue (void)
 
type & firstValue (void)
 
type & lastValue (void)
 

Public Attributes

unsigned int nb
 
vpListElement< type > * first
 
vpListElement< type > * last
 
vpListElement< type > * cur
 

Detailed Description

template<class type>
class vpList< type >

Provide simple list management.

Author
Eric Marchand (Eric..nosp@m.Marc.nosp@m.hand@.nosp@m.iris.nosp@m.a.fr) Irisa / Inria Rennes
Data structure:
  each object vpListElement contains its own value and
  two pointers to the next element of the list and to the previous one

  A list is mainly a pointer to three of these elements
    - one (cur) points the current element
    - one (first) points to a virtual element located at the
      beginning of the list
    - one (last) points  to a virtual element located at the
      end of the list

    first, last and cur are used internally and are not to be considered
    by "basic" user.

Notation:
  In this documentation we note such a list as
        [*, a, b, c, *]
         f     ^     l
  where
   - the * are the two virtual elements (first (f) and last (l))
   - the ^ denotes the position of the current element

Definition at line 112 of file vpList.h.

Constructor & Destructor Documentation

template<class type >
vpList< type >::vpList ( )

Basic constructor, initialization, Create an empty list.

init() --> [*, *]
See also
init()

Definition at line 225 of file vpList.h.

template<class type >
vpList< type >::vpList ( const vpList< type > &  l)

copy constructor

Parameters
l: the list to copy

Definition at line 808 of file vpList.h.

template<class type >
vpList< type >::~vpList ( )
virtual

vpList destructor

See also
kill()

Definition at line 237 of file vpList.h.

Member Function Documentation

template<class type>
void vpList< type >::addLeft ( const type &  v)
inline

add a new element in the list, at the left of the current one

Warning
the new element becomes the current one
[*, a, b, c, *]  --> addLeft(i) -->   [*, a, i, b, c, *]
       ^                                     ^

Definition at line 513 of file vpList.h.

Referenced by vpDot2::searchDotsInArea(), and vpHistogram::sort().

template<class type>
void vpList< type >::addLeft ( type &  v)
inline

add a new element in the list, at the left of the current one

Warning
the new element becomes the current one
[*, a, b, c, *]  --> addLeft(i) -->   [*, a, i, b, c, *]
       ^                                     ^

Definition at line 580 of file vpList.h.

template<class type>
void vpList< type >::addRight ( type &  v)
inline

add a new element in the list, at the right of the current one

Warning
the new element becomes the current one
[*, a, b, c, *]  --> addRight(i) -->   [*, a, b, i, c, *]
       ^                                         ^

Definition at line 547 of file vpList.h.

template<class type >
void vpList< type >::display ( )

Print (std::cout) all the element of the list.

Definition at line 818 of file vpList.h.

Referenced by vpList< vpBasicFeature * >::print().

template<class type >
bool vpList< type >::empty ( void  ) const

Test if the list is empty.

[*, a, b, c, d, *]  --> empty return false
[*, *]              --> empty return true

Definition at line 414 of file vpList.h.

Referenced by vpServo::computeError(), vpHistogram::getPeaks(), vpHistogram::getValey(), and vpHistogram::sort().

template<class type >
void vpList< type >::end ( void  )
inline

Position the current element on the last element of the list.

[*, a, b, c, d, *]  --> end() --> [*, a, b, c, d, *]
       ^                                         ^

Definition at line 400 of file vpList.h.

Referenced by vpDot2::searchDotsInArea().

template<class type >
type & vpList< type >::firstValue ( void  )

return the first element of the list

 [*, a, b, c, d, *]  --> firstValue() return a

Definition at line 358 of file vpList.h.

template<class type >
type & vpList< type >::lastValue ( void  )

return the last element of the list

 [*, a, b, c, d, *]  --> lastValue() return d

Definition at line 371 of file vpList.h.

template<class type>
void vpList< type >::modify ( const type &  v)
inline

Modify the value of the current element.

[*, a, b, c, *]  --> modify(i) -->   [*, a, i, c, *]
       ^                                    ^

Definition at line 612 of file vpList.h.

template<class type >
unsigned int vpList< type >::nbElement ( void  )
inline

return the number of element in the list

Definition at line 252 of file vpList.h.

template<class type >
unsigned int vpList< type >::nbElements ( void  )
inline
template<class type >
bool vpList< type >::nextOutside ( void  ) const

Test if the next element is outside the list (ie if the current element is the last one)

[*, a, b, c, d, *]  --> nextOutside return true
             ^

Definition at line 447 of file vpList.h.

Referenced by vpHistogram::sort().

template<class type >
type & vpList< type >::nextValue ( void  )

return the value of the next element

[*, a, b, c, d, *]  --> nextValue() return c
       ^

Definition at line 344 of file vpList.h.

template<class type>
void vpList< type >::operator+= ( vpList< type > &  l)
inline

Append two lists.

[*, a, b, *] += [*, c, d, *] --> [*, a, b, c, d, *]
                                              ^

Definition at line 772 of file vpList.h.

References vpList< type >::front(), vpList< type >::next(), vpList< type >::outside(), and vpList< type >::value().

template<class type>
void vpList< type >::operator+= ( const type &  l)
inline

Append an element to a list.

[*, a, b, *] += c --> [*, a, b, c, *]
                                ^

Definition at line 795 of file vpList.h.

template<class type>
void vpList< type >::operator= ( const vpList< type > &  l)

Copy constructor const.

Parameters
l: the list to copy

Definition at line 744 of file vpList.h.

References vpList< type >::first, vpList< type >::last, and vpList< type >::nb.

template<class type >
bool vpList< type >::outside ( void  ) const
inline

Test if the current element is outside the list (on the virtual element)

[*, a, b, c, d, *]  --> outside return false
       ^
[*, a, b, c, d, *]  --> outside return true
 ^      or      ^

Definition at line 431 of file vpList.h.

Referenced by vpServo::computeError(), vpServoDisplay::display(), vpWireFrameSimulator::displayTrajectory(), vpServo::getDimension(), vpNurbs::globalCurveApprox(), vpNurbs::globalCurveInterp(), vpWireFrameSimulator::initScene(), vpMeNurbs::initTracking(), vpServo::kill(), vpKeyPointSurf::matchPoint(), vpList< type >::operator+=(), vpServo::print(), vpDot2::searchDotsInArea(), and vpHistogram::sort().

template<class type >
void vpList< type >::previous ( void  )
inline

position the current element on the previous one

[*, a, b, c, d, *] --> previous() -->   [*, a, b, c, d, *]
       ^                                ^

Definition at line 289 of file vpList.h.

template<class type >
bool vpList< type >::previousOutside ( void  ) const

Test if the previous element is outside the list (ie if the current element is the firts one)

[*, a, b, c, d, *]  --> nextOutside return true
    ^

Definition at line 463 of file vpList.h.

template<class type >
type & vpList< type >::previousValue ( void  )

return the value of the previous element

[*, a, b, c, *]  --> previousValue() return a
       ^

Definition at line 331 of file vpList.h.

template<class type>
void vpList< type >::print ( )
inline

Definition at line 163 of file vpList.h.

template<class type >
void vpList< type >::suppress ( void  )

suppress the current element

Warning
new current element is on the next one
[*, a, b, c, d, *] --> suppress -->  [*, a, c, d, *]
       ^                                    ^

Definition at line 718 of file vpList.h.

template<class type >
void vpList< type >::swapLeft ( )
inline

Switch the current element with the element on the left.

[*, a, b, c, *]  --> swapLeft -->   [*, b, a, c, *]
       ^                                  ^

Definition at line 626 of file vpList.h.

template<class type >
void vpList< type >::swapRight ( )
inline

Switch the current element with the element on the right.

[*, a, b, c, *]  --> swapRight -->   [*, a, c, b, *]
       ^                                         ^

Definition at line 660 of file vpList.h.

template<class type >
const type & vpList< type >::value ( void  ) const
inline

return the value of the current element using a const ref.

[*, a, b, c, *]  --> value() return b
       ^

Definition at line 317 of file vpList.h.

Member Data Documentation

template<class type>
vpListElement<type>* vpList< type >::cur

the current item in the list

      [*, a, b, c, *]
             ^

Definition at line 142 of file vpList.h.

template<class type>
vpListElement<type>* vpList< type >::first

the first virtual item in the list

      [*, a, b, c, *]
       f

Definition at line 126 of file vpList.h.

Referenced by vpList< type >::operator=().

template<class type>
vpListElement<type>* vpList< type >::last

the last virtualitem in the list

      [*, a, b, c, *]
                   l

Definition at line 134 of file vpList.h.

Referenced by vpList< type >::operator=().

template<class type>
unsigned int vpList< type >::nb

Definition at line 118 of file vpList.h.

Referenced by vpKeyPointSurf::matchPoint(), and vpList< type >::operator=().