49 #include <visp3/core/vpConfig.h>
50 #include <visp3/core/vpDebug.h>
51 #include <visp3/core/vpException.h>
55 #ifndef DOXYGEN_SHOULD_SKIP_THIS
76 vpListElement() : prev(NULL), next(NULL), val() {};
77 vpListElement<type> *prev;
78 vpListElement<type> *next;
117 template <
class type>
154 inline void next(
void) ;
156 inline void front(
void) ;
157 inline void end(
void) ;
158 inline bool outside(
void)
const;
160 bool empty(
void)
const;
162 inline type&
value(
void);
163 inline const type&
value(
void)
const;
172 inline void addRight(
const type& el);
173 inline void addLeft(
const type& el);
174 inline void modify(
const type& el);
208 vpListElement<type> *x=
new vpListElement<type>;
209 vpListElement<type> *y=
new vpListElement<type> ;
336 return(cur->prev->val) ;
349 return(cur->next->val) ;
363 return(first->next->val) ;
376 return(last->prev->val) ;
419 return((first->next == last) &&( first == last->prev)) ;
437 return((cur==first)||(cur==last)) ;
452 return((cur->next==first)||(cur->next==last)) ;
468 return((cur->prev==first)||(cur->prev==last)) ;
485 vpListElement<type> *x=
new vpListElement<type>;
494 if (outside()) std::cout <<
"vpList: outside with addRight " << std::endl ;
496 cur->next->prev = x ;
497 x->next = cur->next ;
518 vpListElement<type> *x=
new vpListElement<type>;
528 if (outside()) std::cout <<
"vpList: outside with addLeft " << std::endl ;
531 x->prev = cur->prev ;
532 cur->prev->next = x ;
552 vpListElement<type> *x=
new vpListElement<type>;
561 if (outside()) std::cout <<
"vpList: outside with addRight " << std::endl ;
563 cur->next->prev = x ;
564 x->next = cur->next ;
585 vpListElement<type> *x=
new vpListElement<type>;
595 if (outside()) std::cout <<
"vpList: outside with addLeft " << std::endl ;
598 x->prev = cur->prev ;
599 cur->prev->next = x ;
631 if (cur->prev != first)
633 cur->prev->prev->next = cur;
634 cur->next->prev = cur->prev;
636 vpListElement<type> *nextTmp;
637 vpListElement<type> *prevTmp;
642 cur->next = cur->prev;
643 cur->prev = cur->prev->prev;
646 prevTmp->next = nextTmp;
650 std::cout <<
"vpList: previous element is outside (swapLeft) " << std::endl ;
665 if (cur->next != last)
667 cur->prev->next = cur->next;
668 cur->next->next->prev = cur;
670 vpListElement<type> *nextTmp;
671 vpListElement<type> *prevTmp;
676 cur->next = nextTmp->next;
679 nextTmp->prev = prevTmp;
684 std::cout <<
"vpList: next element is outside (swapRight) " << std::endl ;
723 vpListElement<type> *x ;
725 cur->prev->next = cur->next ;
726 cur->next->prev = cur->prev ;
730 if (x!=NULL)
delete x ;
750 vpListElement<type> *e ;
814 : nb(0), first(NULL), last(NULL), cur(NULL)
829 std::cout<<k<<
" ---> "<<value()<<std::endl ;
833 std::cout<< std::endl << std::endl ;
vpListElement< type > * last
the last virtualitem in the list
unsigned int nbElements(void)
return the number of element in the list
virtual ~vpList()
vpList destructor
void suppress(void)
suppress the current element
void end(void)
Position the current element on the last element of the list.
bool outside(void) const
Test if the current element is outside the list (on the virtual element)
unsigned int nbElement(void)
return the number of element in the list
Provide simple list management.
vpList()
Basic constructor, initialization, Create an empty list.
void kill()
Destroy the list.
bool previousOutside(void) const
Test if the previous element is outside the list (ie if the current element is the firts one) ...
vpList< type > & operator=(const vpList< type > &l)
Copy constructor const.
void next(void)
position the current element on the next one
type & previousValue(void)
return the value of the previous element
void addLeft(const type &el)
add a new element in the list, at the left of the current one
type & firstValue(void)
return the first element of the list
void modify(const type &el)
Modify the value of the current element.
void front(void)
Position the current element on the first element of the list.
type & value(void)
return the value of the current element
type & nextValue(void)
return the value of the next element
vpListElement< type > * first
! number of items in the List
void addRight(const type &el)
add a new element in the list, at the right of the current one
void swapLeft()
Switch the current element with the element on the left.
vpListElement< type > * cur
the current item in the list
type & lastValue(void)
return the last element of the list
void previous(void)
position the current element on the previous one
void display()
Print (std::cout) all the element of the list.
void operator+=(vpList< type > &l)
Append two lists.
bool nextOutside(void) const
Test if the next element is outside the list (ie if the current element is the last one) ...
void swapRight()
Switch the current element with the element on the right.
bool empty(void) const
Test if the list is empty.