53 #include <visp/vpConfig.h>
54 #include <visp/vpDebug.h>
58 #ifndef DOXYGEN_SHOULD_SKIP_THIS
68 vpListElement() : prev(NULL), next(NULL), val() {};
69 vpListElement<type> *prev;
70 vpListElement<type> *next;
112 template <
class type>
149 inline void next(
void) ;
151 inline void front(
void) ;
152 inline void end(
void) ;
153 inline bool outside(
void)
const;
155 bool empty(
void)
const;
157 inline type&
value(
void);
158 inline const type&
value(
void)
const;
167 inline void addRight(
const type& el);
168 inline void addLeft(
const type& el);
169 inline void modify(
const type& el);
203 vpListElement<type> *x=
new vpListElement<type>;
204 vpListElement<type> *y=
new vpListElement<type> ;
331 return(cur->prev->val) ;
344 return(cur->next->val) ;
358 return(first->next->val) ;
371 return(last->prev->val) ;
414 return((first->next == last) &&( first == last->prev)) ;
432 return((cur==first)||(cur==last)) ;
447 return((cur->next==first)||(cur->next==last)) ;
463 return((cur->prev==first)||(cur->prev==last)) ;
480 vpListElement<type> *x=
new vpListElement<type>;
489 if (outside()) std::cout <<
"vpList: outside with addRight " << std::endl ;
491 cur->next->prev = x ;
492 x->next = cur->next ;
513 vpListElement<type> *x=
new vpListElement<type>;
523 if (outside()) std::cout <<
"vpList: outside with addLeft " << std::endl ;
526 x->prev = cur->prev ;
527 cur->prev->next = x ;
547 vpListElement<type> *x=
new vpListElement<type>;
556 if (outside()) std::cout <<
"vpList: outside with addRight " << std::endl ;
558 cur->next->prev = x ;
559 x->next = cur->next ;
580 vpListElement<type> *x=
new vpListElement<type>;
590 if (outside()) std::cout <<
"vpList: outside with addLeft " << std::endl ;
593 x->prev = cur->prev ;
594 cur->prev->next = x ;
626 if (cur->prev != first)
628 cur->prev->prev->next = cur;
629 cur->next->prev = cur->prev;
631 vpListElement<type> *nextTmp;
632 vpListElement<type> *prevTmp;
637 cur->next = cur->prev;
638 cur->prev = cur->prev->prev;
641 prevTmp->next = nextTmp;
645 std::cout <<
"vpList: previous element is outside (swapLeft) " << std::endl ;
660 if (cur->next != last)
662 cur->prev->next = cur->next;
663 cur->next->next->prev = cur;
665 vpListElement<type> *nextTmp;
666 vpListElement<type> *prevTmp;
671 cur->next = nextTmp->next;
674 nextTmp->prev = prevTmp;
679 std::cout <<
"vpList: next element is outside (swapRight) " << std::endl ;
718 vpListElement<type> *x ;
720 cur->prev->next = cur->next ;
721 cur->next->prev = cur->prev ;
725 if (x!=NULL)
delete x ;
745 vpListElement<type> *e ;
809 : nb(0), first(NULL), last(NULL), cur(NULL)
824 std::cout<<k<<
" ---> "<<value()<<std::endl ;
828 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
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 swapRight()
Switch the current element with the element on the right.
bool empty(void) const
Test if the list is empty.