48 #include <visp3/core/vpConfig.h> 49 #include <visp3/core/vpDebug.h> 50 #include <visp3/core/vpException.h> 54 #ifndef DOXYGEN_SHOULD_SKIP_THIS 60 template <
class type>
class vpListElement
75 vpListElement() : prev(NULL), next(NULL), val(){};
76 vpListElement<type> *prev;
77 vpListElement<type> *next;
149 inline void next(
void);
150 inline void previous(
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;
166 inline void addRight(
const type &el);
167 inline void addLeft(
const type &el);
168 inline void modify(
const type &el);
169 inline void addRight(type &el);
170 inline void addLeft(type &el);
171 inline void swapLeft();
172 inline void swapRight();
173 inline unsigned int nbElement(
void);
174 inline unsigned int nbElements(
void);
178 inline void operator+=(
const type &l);
181 bool nextOutside(
void)
const;
182 bool previousOutside(
void)
const;
184 type &previousValue(
void);
185 type &nextValue(
void);
186 type &firstValue(
void);
187 type &lastValue(
void);
197 vpListElement<type> *x =
new vpListElement<type>;
198 vpListElement<type> *y =
new vpListElement<type>;
398 vpListElement<type> *x =
new vpListElement<type>;
405 std::cout <<
"vpList: outside with addRight " << std::endl;
427 vpListElement<type> *x =
new vpListElement<type>;
435 std::cout <<
"vpList: outside with addLeft " << std::endl;
457 vpListElement<type> *x =
new vpListElement<type>;
464 std::cout <<
"vpList: outside with addRight " << std::endl;
486 vpListElement<type> *x =
new vpListElement<type>;
494 std::cout <<
"vpList: outside with addLeft " << std::endl;
525 cur->prev->prev->next =
cur;
526 cur->next->prev =
cur->prev;
528 vpListElement<type> *nextTmp;
529 vpListElement<type> *prevTmp;
535 cur->prev =
cur->prev->prev;
538 prevTmp->next = nextTmp;
540 std::cout <<
"vpList: previous element is outside (swapLeft) " << std::endl;
555 cur->prev->next =
cur->next;
556 cur->next->next->prev =
cur;
558 vpListElement<type> *nextTmp;
559 vpListElement<type> *prevTmp;
564 cur->next = nextTmp->next;
567 nextTmp->prev = prevTmp;
570 std::cout <<
"vpList: next element is outside (swapRight) " << std::endl;
603 vpListElement<type> *x;
605 cur->prev->next =
cur->next;
606 cur->next->prev =
cur->prev;
625 vpListElement<type> *e;
630 while (e != l.
last) {
696 std::cout << k <<
" ---> " <<
value() << std::endl;
700 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.
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.
vpList< type > & operator=(const vpList< type > &l)
Copy constructor const.
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
bool empty(void) const
Test if the list is empty.
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
bool nextOutside(void) const
Test if the next element is outside the list (ie if the current element is the last 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 outside(void) const
Test if the current element is outside the list (on the virtual element)
void swapRight()
Switch the current element with the element on the right.