Visual Servoing Platform version 3.7.0
Loading...
Searching...
No Matches
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)
vpList< type > & 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.

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 108 of file vpList.h.

Constructor & Destructor Documentation

◆ vpList() [1/2]

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

Basic constructor, initialization, Create an empty list.

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

Definition at line 214 of file vpList.h.

References cur, first, last, and nb.

Referenced by operator+=(), operator=(), and vpList().

◆ vpList() [2/2]

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

copy constructor

Parameters
l: the list to copy

Definition at line 687 of file vpList.h.

References cur, first, last, nb, and vpList().

◆ ~vpList()

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

vpList destructor

See also
kill()

Definition at line 219 of file vpList.h.

References first, kill(), and last.

Member Function Documentation

◆ addLeft() [1/2]

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 421 of file vpList.h.

References cur, empty(), last, nb, and outside().

◆ addLeft() [2/2]

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 484 of file vpList.h.

References cur, empty(), last, nb, and outside().

◆ addRight() [1/2]

template<class type>
void vpList< type >::addRight ( const 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 390 of file vpList.h.

References cur, empty(), first, nb, and outside().

Referenced by operator+=(), operator+=(), and operator=().

◆ addRight() [2/2]

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 453 of file vpList.h.

References cur, empty(), first, nb, and outside().

◆ display()

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

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

Definition at line 696 of file vpList.h.

References front(), next(), outside(), and value().

Referenced by print().

◆ empty()

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 337 of file vpList.h.

References first, and last.

Referenced by addLeft(), addLeft(), addRight(), addRight(), and kill().

◆ end()

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 327 of file vpList.h.

References cur, and last.

Referenced by operator+=(), and operator+=().

◆ firstValue()

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 300 of file vpList.h.

References first.

◆ front()

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

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

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

Definition at line 317 of file vpList.h.

References cur, and first.

Referenced by display(), vpNurbs::globalCurveApprox(), vpNurbs::globalCurveInterp(), kill(), operator+=(), and operator=().

◆ kill()

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

Destroy the list.

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

Definition at line 586 of file vpList.h.

References empty(), front(), and suppress().

Referenced by operator=(), and ~vpList().

◆ lastValue()

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 307 of file vpList.h.

References last.

◆ modify()

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 514 of file vpList.h.

References cur.

◆ nbElement()

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

return the number of element in the list

Definition at line 230 of file vpList.h.

References nb.

◆ nbElements()

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

return the number of element in the list

Definition at line 235 of file vpList.h.

References nb.

◆ next()

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

position the current element on the next one

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

Definition at line 244 of file vpList.h.

References cur.

Referenced by display(), vpNurbs::globalCurveApprox(), vpNurbs::globalCurveInterp(), and operator+=().

◆ nextOutside()

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 361 of file vpList.h.

References cur, first, and last.

◆ nextValue()

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 292 of file vpList.h.

References cur.

◆ operator+=() [1/2]

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 676 of file vpList.h.

References addRight(), and end().

◆ operator+=() [2/2]

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 655 of file vpList.h.

References addRight(), end(), front(), next(), outside(), value(), and vpList().

◆ operator=()

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

Copy constructor const.

Parameters
l: the list to copy

Definition at line 627 of file vpList.h.

References addRight(), cur, first, front(), kill(), last, nb, and vpList().

◆ outside()

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 350 of file vpList.h.

References cur, first, and last.

Referenced by addLeft(), addLeft(), addRight(), addRight(), display(), vpNurbs::globalCurveApprox(), vpNurbs::globalCurveInterp(), and operator+=().

◆ previous()

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 253 of file vpList.h.

References cur.

◆ previousOutside()

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 375 of file vpList.h.

References cur, first, and last.

◆ previousValue()

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

return the value of the previous element

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

Definition at line 283 of file vpList.h.

References cur.

◆ print()

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

Definition at line 159 of file vpList.h.

References display().

◆ suppress()

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 605 of file vpList.h.

References cur, and nb.

Referenced by kill().

◆ swapLeft()

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 524 of file vpList.h.

References cur, and first.

◆ swapRight()

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 555 of file vpList.h.

References cur, and last.

◆ value() [1/2]

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

return the value of the current element

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

Definition at line 263 of file vpList.h.

References cur.

Referenced by display(), vpNurbs::globalCurveApprox(), vpNurbs::globalCurveInterp(), and operator+=().

◆ value() [2/2]

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 273 of file vpList.h.

References cur.

Member Data Documentation

◆ cur

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

◆ first

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

! number of items in the List

the first virtual item in the list

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

Definition at line 122 of file vpList.h.

Referenced by addRight(), addRight(), empty(), firstValue(), front(), nextOutside(), operator=(), outside(), previousOutside(), swapLeft(), vpList(), vpList(), and ~vpList().

◆ last

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

the last virtualitem in the list

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

Definition at line 130 of file vpList.h.

Referenced by addLeft(), addLeft(), empty(), end(), lastValue(), nextOutside(), operator=(), outside(), previousOutside(), swapRight(), vpList(), vpList(), and ~vpList().

◆ nb

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