53 #include <visp/vpConfig.h>
54 #include <visp/vpDebug.h>
58 #ifndef DOXYGEN_SHOULD_SKIP_THIS
68 vpListElement<type> *prev;
69 vpListElement<type> *next;
111 template <
class type>
148 inline void next(
void) ;
150 inline void front(
void) ;
151 inline void end(
void) ;
152 inline bool outside(
void)
const;
154 bool empty(
void)
const;
156 inline type&
value(
void);
157 inline const type&
value(
void)
const;
166 inline void addRight(
const type& el);
167 inline void addLeft(
const type& el);
168 inline void modify(
const type& el);
202 vpListElement<type> *x=
new vpListElement<type>;
203 vpListElement<type> *y=
new vpListElement<type> ;
242 if (first != NULL)
delete first ;
243 if (last != NULL)
delete last ;
333 return(cur->prev->val) ;
346 return(cur->next->val) ;
360 return(first->next->val) ;
373 return(last->prev->val) ;
416 return((first->next == last) &&( first == last->prev)) ;
434 return((cur==first)||(cur==last)) ;
449 return((cur->next==first)||(cur->next==last)) ;
465 return((cur->prev==first)||(cur->prev==last)) ;
482 vpListElement<type> *x=
new vpListElement<type>;
491 if (outside()) std::cout <<
"vpList: outside with addRight " << std::endl ;
493 cur->next->prev = x ;
494 x->next = cur->next ;
515 vpListElement<type> *x=
new vpListElement<type>;
525 if (outside()) std::cout <<
"vpList: outside with addLeft " << std::endl ;
528 x->prev = cur->prev ;
529 cur->prev->next = x ;
549 vpListElement<type> *x=
new vpListElement<type>;
558 if (outside()) std::cout <<
"vpList: outside with addRight " << std::endl ;
560 cur->next->prev = x ;
561 x->next = cur->next ;
582 vpListElement<type> *x=
new vpListElement<type>;
592 if (outside()) std::cout <<
"vpList: outside with addLeft " << std::endl ;
595 x->prev = cur->prev ;
596 cur->prev->next = x ;
628 if (cur->prev != first)
630 cur->prev->prev->next = cur;
631 cur->next->prev = cur->prev;
633 vpListElement<type> *nextTmp;
634 vpListElement<type> *prevTmp;
639 cur->next = cur->prev;
640 cur->prev = cur->prev->prev;
643 prevTmp->next = nextTmp;
647 std::cout <<
"vpList: previous element is outside (swapLeft) " << std::endl ;
662 if (cur->next != last)
664 cur->prev->next = cur->next;
665 cur->next->next->prev = cur;
667 vpListElement<type> *nextTmp;
668 vpListElement<type> *prevTmp;
673 cur->next = nextTmp->next;
676 nextTmp->prev = prevTmp;
681 std::cout <<
"vpList: next element is outside (swapRight) " << std::endl ;
720 vpListElement<type> *x ;
722 cur->prev->next = cur->next ;
723 cur->next->prev = cur->prev ;
727 if (x!=NULL)
delete x ;
747 vpListElement<type> *e ;
823 std::cout<<k<<
" ---> "<<value()<<std::endl ;
827 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) ...
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
the first virtual item 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 operator=(const vpList< type > &l)
Copy constructor const.
void swapRight()
Switch the current element with the element on the right.
bool empty(void) const
Test if the list is empty.