1#ifndef Cpl_Container_DList_h_
2#define Cpl_Container_DList_h_
59 DList( const
char* ignoreThisParameter_usedToCreateAUniqueConstructor ) noexcept;
79 ITEM*
get(
void ) noexcept;
83 void put( ITEM& item ) noexcept;
89 ITEM*
head(
void ) const noexcept;
95 ITEM*
tail(
void ) const noexcept;
104 ITEM*
pop(
void ) noexcept;
108 void push( ITEM& item ) noexcept;
114 ITEM*
top(
void ) const noexcept;
158 bool find( const ITEM& item ) const noexcept;
170 ITEM*
last(
void ) const noexcept;
176 ITEM*
next( ITEM& current ) const noexcept;
203 :m_headPtr( 0 ), m_tailPtr( 0 )
221 while ( (nextPtr=
get()) )
238 ITEM* firstPtr = m_headPtr;
255 ITEM* lastPtr = m_tailPtr;
266 if ( item.insert_(
this ) )
270 item.m_nextPtr_ = m_headPtr;
271 m_headPtr->m_prevPtr_ = &item;
276 m_headPtr = m_tailPtr = &item;
286 if ( item.insert_(
this ) )
290 m_tailPtr->m_nextPtr_ = &item;
291 item.m_prevPtr_ = m_tailPtr;
312 if ( item.isInContainer_(
this ) )
314 ITEM* prvPtr = (ITEM*) item.m_prevPtr_;
315 ITEM* nxtPtr = (ITEM*) item.m_nextPtr_;
318 if ( !(prvPtr->m_nextPtr_=nxtPtr) )
324 nxtPtr->m_prevPtr_ = prvPtr;
329 if ( !(m_headPtr=nxtPtr) )
335 nxtPtr->m_prevPtr_ = 0;
350 if ( item.insert_(
this ) )
352 ITEM* nxtPtr = (ITEM*) (item.m_nextPtr_ = after.m_nextPtr_);
353 item.m_prevPtr_ = &after;
354 after.m_nextPtr_ = &item;
361 nxtPtr->m_prevPtr_ = &item;
369 if ( item.insert_(
this ) )
371 ITEM* prvPtr = (ITEM*) (item.m_prevPtr_ = before.m_prevPtr_);
372 item.m_nextPtr_ = &before;
373 before.m_prevPtr_ = &item;
380 prvPtr->m_nextPtr_ = &item;
388 return item.isInContainer_(
this );
406 return (ITEM*) cur.m_nextPtr_;
412 return (ITEM*) cur.m_prevPtr_;
This template class implements a Doubly linked list which maintains the ordering imposed on it by the...
Definition DList.h:29
ITEM * head(void) const noexcept
Return a pointer to the first item in the list.
Definition DList.h:434
bool remove(ITEM &item) noexcept
Remove specified ITEM element from the list.
Definition DList.h:310
ITEM * first(void) const noexcept
Return a pointer to the first item in the list.
Definition DList.h:392
void insertAfter(ITEM &after, ITEM &item) noexcept
Insert the "item" ITEM into the list behind the "after" ITEM element.
Definition DList.h:348
ITEM * previous(ITEM ¤t) const noexcept
Return a pointer to the item before the item "current".
Definition DList.h:410
ITEM * get(void) noexcept
Removes the first item in the list.
Definition DList.h:236
void move(DList< ITEM > &dst)
Moves the content of the this List to the specified List.
Definition DList.h:214
ITEM * getFirst(void) noexcept
Removes the first item in the list.
Definition DList.h:247
ITEM * last(void) const noexcept
Return a pointer to the last item in the list.
Definition DList.h:398
void insertBefore(ITEM &before, ITEM &item) noexcept
Insert the "item" ITEM into the list ahead of the "before" ITEM element.
Definition DList.h:367
void putFirst(ITEM &item) noexcept
Adds the item as the first item in the list.
Definition DList.h:264
ITEM * top(void) const noexcept
Return a pointer to the top ITEM item in the stack.
Definition DList.h:428
void clearTheList()
Empties the list.
Definition DList.h:228
DList() noexcept
Public constructor initializes head and tail pointers.
Definition DList.h:202
void put(ITEM &item) noexcept
Adds the item as the last item in the list.
Definition DList.h:284
void putLast(ITEM &item) noexcept
Adds the item as the last item in the list.
Definition DList.h:304
ITEM * getLast(void) noexcept
Removes the last item in the list.
Definition DList.h:253
bool find(const ITEM &item) const noexcept
Returns true of the specified item/pointer is already in the list, else false.
Definition DList.h:386
ITEM * pop(void) noexcept
Removes the top element from stack and return a pointer to it as a result.
Definition DList.h:422
ITEM * next(ITEM ¤t) const noexcept
Return a pointer to the item after the item "current".
Definition DList.h:404
void push(ITEM &item) noexcept
Adds the ITEM item to top of the stack.
Definition DList.h:416
ITEM * tail(void) const noexcept
Return a pointer to the last item in the list.
Definition DList.h:440
static void remove_(Item *itemPtr) noexcept
Helper method to do the proper 'clean-up' for the multiple-containers-error-trap when removing an ite...
The 'Cpl' namespace is the root name space for the Colony.
Definition Api16.h:20