![]() |
MAK RTIspy API Documentation for HLA 1516
|
A DtSortedList is a list of elements of arbitrary type. More...
Inheritance diagram for DtSortedList:
Collaboration diagram for DtSortedList:Public Member Functions | |
| DtSortedList (DtSortOrder sortOrderVal=DtSortOrderAscending) | |
| Constructor. | |
| virtual | ~DtSortedList () |
| Destructor - does NOT free memory of data associated with the items. | |
| DtSortedList (const DtSortedList &orig) | |
| Copy constructor. | |
| DtSortedList & | operator= (const DtSortedList &orig) |
| Assignment operator. | |
| virtual void | setSortOrder (DtSortOrder sortOrderValue) |
| Set/Get sort order. | |
| virtual DtSortOrder | sortOrder () const |
| virtual DtSortedListItem * | first () const |
| Return first and last item on the list. | |
| virtual DtSortedListItem * | last () const |
| unsigned | count () const |
| Returns the number of elements in the list. | |
| virtual bool | compareItems (const DtSortedListItem &firstItem, const DtSortedListItem &secondItem) const |
| Compare the two items based on sort order and return true if first comes first in order to second. | |
| virtual DtSortedListItem * | add (void *data) |
| Add element to the list in sorted order. | |
| virtual void * | remove (DtSortedListItem *item) |
| Remove an element from the list. | |
| virtual void | removeAll () |
| Calls remove for all elements in the list. | |
| virtual DtSortedListItem * | itemLookup (void *data) const |
| Returns the DtSortedListItem envelope object containing the indicated data element. | |
| virtual void | reverseSortOrder () |
| Reverses sort order of list. | |
| virtual void | printData (DtSortOrder order=DtSortOrderAscending) |
| Print the list. | |
Protected Member Functions | |
| virtual DtSortedListItem * | newItem (void *data) |
| Create a new sorted list item envelope for the data to be inserted into the list. | |
| virtual void | addToList (DtSortedListItem *item, DtSortedListItem *before) |
| Add first item to the list before second. | |
| virtual void | removeFromList (DtSortedListItem *item) |
| Remove item from the list. Does NOT delete the data contained in item. | |
| virtual void | reposition (DtSortedListItem *item) |
| An item's data for sorting has changed. Reposition it within the list. | |
| virtual void | repositionForward (DtSortedListItem *item, DtSortedListItem *positionItem) |
| An item's data for sorting has changed. | |
| virtual void | repositionBackward (DtSortedListItem *item, DtSortedListItem *positionItem) |
| An item's data for sorting has changed. | |
| virtual void | insertBefore (DtSortedListItem *item, DtSortedListItem *positionItem) |
| Insert the first item before the second. | |
| virtual void | insertAfter (DtSortedListItem *item, DtSortedListItem *positionItem) |
| Insert the first item after the second. | |
Protected Attributes | |
| DtSortedListItem * | myFirst |
| DtSortedListItem * | myLast |
| unsigned | myCount |
| DtSortOrder | mySortOrder |
A DtSortedList is a list of elements of arbitrary type.
Data elements are added to, and extracted from a DtSortedList as void*. DtSortedList encloses each element in a DtSortedListItem object. You can iterate through the elements in a DtSortedList like this Example:
| DtSortedList::DtSortedList | ( | DtSortOrder | sortOrderVal = DtSortOrderAscending | ) |
Constructor.
|
virtual |
Destructor - does NOT free memory of data associated with the items.
It only frees the items.
References myFirst, DtSortedListItem::myNext, and NULL.
| DtSortedList::DtSortedList | ( | const DtSortedList & | orig | ) |
Copy constructor.
Shallow copy. Copies the pointers you've added to the list, but not the items that are pointed to.
References add(), DtSortedListItem::data(), first(), DtSortedListItem::next(), and NULL.
|
virtual |
Add element to the list in sorted order.
Returns the DtSortedListItem envelope object that contains the new element.
Reimplemented in DtRetractInfoList, and DtRtiMsgQueue.
References addToList(), compareItems(), first(), newItem(), and DtSortedListItem::next().
Referenced by DtRetractInfoList::add(), DtSortedList(), and operator=().
|
protectedvirtual |
Add first item to the list before second.
If second item is NULL, item is added to end of list.
References myCount, myFirst, myLast, DtSortedListItem::myNext, DtSortedListItem::myPrev, and NULL.
Referenced by add(), and reverseSortOrder().
|
inlinevirtual |
Compare the two items based on sort order and return true if first comes first in order to second.
References DtSortOrderAscending, and mySortOrder.
Referenced by add(), reposition(), repositionBackward(), and repositionForward().
|
inline |
Returns the number of elements in the list.
References myCount.
|
inlinevirtual |
Return first and last item on the list.
DtSortedListItem is an envelope for your data. The data can be obtained using DtSortedListItem::data().
References myFirst.
Referenced by add(), DtRtiMsgQueue::deleteAll(), DtRtiMsgQueue::deleteMsgs(), DtSortedList(), DtRetractInfoList::firstRetractItem(), operator=(), DtRtiMsgQueue::peekNextTsoMsg(), removeAll(), DtRtiMsgQueue::removeMsg(), DtRtiMsgQueue::removeNextTsoMsg(), reverseSortOrder(), and DtRetractInfoList::~DtRetractInfoList().
|
protectedvirtual |
Insert the first item after the second.
If second item is NULL, first item is placed at end of list.
References myCount, myFirst, myLast, DtSortedListItem::myNext, DtSortedListItem::myPrev, and NULL.
Referenced by repositionBackward(), and repositionForward().
|
protectedvirtual |
Insert the first item before the second.
If second item is NULL, first item is placed at beginning of list.
References myCount, myFirst, myLast, DtSortedListItem::myNext, DtSortedListItem::myPrev, and NULL.
Referenced by repositionBackward(), and repositionForward().
|
virtual |
Returns the DtSortedListItem envelope object containing the indicated data element.
References DtSortedListItem::data(), myFirst, and DtSortedListItem::myNext.
|
inlinevirtual |
References myLast.
Referenced by DtRetractInfoList::lastRetractItem(), and reverseSortOrder().
|
protectedvirtual |
Create a new sorted list item envelope for the data to be inserted into the list.
Reimplemented in DtRetractInfoList, and DtRtiMsgQueue.
Referenced by add().
| DtSortedList & DtSortedList::operator= | ( | const DtSortedList & | orig | ) |
Assignment operator.
Shallow copy. Copies the pointers you've added to the list, but not the items that are pointed to. Old list items are removed from the list, and the elements they contain are not deleted.
References add(), DtSortedListItem::data(), first(), mySortOrder, DtSortedListItem::next(), NULL, and removeAll().
|
virtual |
Print the list.
References DtSortOrderAscending, myFirst, myLast, mySortOrder, DtSortedListItem::next(), DtSortedListItem::prev(), and DtSortedListItem::printData().
|
virtual |
Remove an element from the list.
Item is the envelope containing the data element you would like to remove. Note: remove does not free memory of data associated with the item. It only frees the item. The data is returned to the caller for deletion if required.
Reimplemented in DtRetractInfoList.
References DtSortedListItem::myData, NULL, and removeFromList().
|
virtual |
Calls remove for all elements in the list.
It does NOT delete the data in the list. Merely removes the data from the list.
Reimplemented in DtRetractInfoList.
References first(), DtSortedListItem::next(), and NULL.
Referenced by operator=().
|
protectedvirtual |
Remove item from the list. Does NOT delete the data contained in item.
References myCount, myFirst, myLast, DtSortedListItem::myNext, and DtSortedListItem::myPrev.
Referenced by remove(), repositionBackward(), and repositionForward().
|
protectedvirtual |
An item's data for sorting has changed. Reposition it within the list.
References compareItems(), DtSortedListItem::next(), DtSortedListItem::prev(), repositionBackward(), and repositionForward().
|
protectedvirtual |
An item's data for sorting has changed.
Reposition it backward within the list relative to position of the second item. If the second item is NULL, start at last()
References compareItems(), insertAfter(), insertBefore(), DtSortedListItem::prev(), and removeFromList().
Referenced by reposition().
|
protectedvirtual |
An item's data for sorting has changed.
Reposition it forward within the list relative to position of the second item. If the second item is NULL, start at first()
References compareItems(), insertAfter(), insertBefore(), DtSortedListItem::next(), and removeFromList().
Referenced by reposition().
|
virtual |
Reverses sort order of list.
References addToList(), DtSortOrderAscending, DtSortOrderDescending, first(), last(), and mySortOrder.
Referenced by setSortOrder().
|
virtual |
Set/Get sort order.
Changing the sort order will result in a reordering of the list elements.
References mySortOrder, and reverseSortOrder().
|
inlinevirtual |
References mySortOrder.
|
protected |
Referenced by addToList(), count(), insertAfter(), insertBefore(), and removeFromList().
|
protected |
Referenced by addToList(), first(), insertAfter(), insertBefore(), itemLookup(), printData(), removeFromList(), and ~DtSortedList().
|
protected |
Referenced by addToList(), insertAfter(), insertBefore(), last(), printData(), and removeFromList().
|
protected |
Referenced by compareItems(), operator=(), printData(), reverseSortOrder(), setSortOrder(), and sortOrder().