MAK RTIspy API Documentation for HLA 1.3
Public Member Functions | Protected Member Functions | Protected Attributes
DtSortedList Class Reference

A DtSortedList is a list of elements of arbitrary type. More...

+ Inheritance diagram for DtSortedList:
+ Collaboration diagram for DtSortedList:

List of all members.

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.
DtSortedListoperator= (const DtSortedList &orig)
 Assignment operator.
virtual void setSortOrder (DtSortOrder sortOrderValue)
 Set/Get sort order.
virtual DtSortOrder sortOrder () const
virtual DtSortedListItemfirst () const
 Return first and last item on the list.
virtual DtSortedListItemlast () 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 DtSortedListItemadd (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 DtSortedListItemitemLookup (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 DtSortedListItemnewItem (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

DtSortedListItemmyFirst
DtSortedListItemmyLast
unsigned myCount
DtSortOrder mySortOrder

Detailed Description

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:

 for (DtSortedListItem* item = list.first(); item; item = item->next())
 {
    void* dataElement = item->data();
 }

Constructor & Destructor Documentation

Constructor.

Destructor - does NOT free memory of data associated with the items.

It only frees the items.

References myFirst, DtSortedListItem::myNext, and NULL.

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.


Member Function Documentation

DtSortedListItem * DtSortedList::add ( void *  data) [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=().

void DtSortedList::addToList ( DtSortedListItem item,
DtSortedListItem before 
) [protected, virtual]

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().

bool DtSortedList::compareItems ( const DtSortedListItem firstItem,
const DtSortedListItem secondItem 
) const [inline, virtual]

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().

unsigned DtSortedList::count ( ) const [inline]

Returns the number of elements in the list.

References myCount.

DtSortedListItem * DtSortedList::first ( ) const [inline, virtual]
void DtSortedList::insertAfter ( DtSortedListItem item,
DtSortedListItem positionItem 
) [protected, virtual]

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().

void DtSortedList::insertBefore ( DtSortedListItem item,
DtSortedListItem positionItem 
) [protected, virtual]

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().

DtSortedListItem * DtSortedList::itemLookup ( void *  data) const [virtual]

Returns the DtSortedListItem envelope object containing the indicated data element.

References DtSortedListItem::data(), myFirst, and DtSortedListItem::myNext.

DtSortedListItem * DtSortedList::last ( ) const [inline, virtual]
DtSortedListItem * DtSortedList::newItem ( void *  data) [protected, virtual]

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().

void * DtSortedList::remove ( DtSortedListItem item) [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().

void DtSortedList::removeAll ( ) [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=().

void DtSortedList::removeFromList ( DtSortedListItem item) [protected, virtual]

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().

void DtSortedList::reposition ( DtSortedListItem item) [protected, virtual]

An item's data for sorting has changed. Reposition it within the list.

References compareItems(), DtSortedListItem::next(), DtSortedListItem::prev(), repositionBackward(), and repositionForward().

void DtSortedList::repositionBackward ( DtSortedListItem item,
DtSortedListItem positionItem 
) [protected, virtual]

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().

void DtSortedList::repositionForward ( DtSortedListItem item,
DtSortedListItem positionItem 
) [protected, virtual]

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().

void DtSortedList::reverseSortOrder ( ) [virtual]

Reverses sort order of list.

References addToList(), DtSortOrderAscending, DtSortOrderDescending, first(), last(), and mySortOrder.

Referenced by setSortOrder().

void DtSortedList::setSortOrder ( DtSortOrder  sortOrderValue) [virtual]

Set/Get sort order.

Changing the sort order will result in a reordering of the list elements.

References mySortOrder, and reverseSortOrder().

DtSortOrder DtSortedList::sortOrder ( ) const [inline, virtual]

References mySortOrder.


Member Data Documentation

unsigned DtSortedList::myCount [protected]

The documentation for this class was generated from the following files:

Document ID: Generated on Thu Jun 14 14:15:04 EDT 2012 from SVN revision 116116
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)