MAK RTIspy API Documentation for HLA Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | 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:

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

DtSortedList::DtSortedList ( DtSortOrder  sortOrderVal = DtSortOrderAscending)

Constructor.

virtual DtSortedList::~DtSortedList ( )
virtual

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

It only frees the items.

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.

Member Function Documentation

virtual 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 DtRtiMsgQueue.

virtual void DtSortedList::addToList ( DtSortedListItem item,
DtSortedListItem before 
)
protectedvirtual

Add first item to the list before second.

If second item is NULL, item is added to end of list.

bool DtSortedList::compareItems ( const DtSortedListItem firstItem,
const DtSortedListItem secondItem 
) const
inlinevirtual

Compare the two items based on sort order and return true if first comes first in order to second.

References DtSortOrderAscending, and mySortOrder.

unsigned DtSortedList::count ( ) const
inline

Returns the number of elements in the list.

References myCount.

DtSortedListItem * DtSortedList::first ( ) const
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.

virtual void DtSortedList::insertAfter ( DtSortedListItem item,
DtSortedListItem positionItem 
)
protectedvirtual

Insert the first item after the second.

If second item is NULL, first item is placed at end of list.

virtual void DtSortedList::insertBefore ( DtSortedListItem item,
DtSortedListItem positionItem 
)
protectedvirtual

Insert the first item before the second.

If second item is NULL, first item is placed at beginning of list.

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

Returns the DtSortedListItem envelope object containing the indicated data element.

DtSortedListItem * DtSortedList::last ( ) const
inlinevirtual

References myLast.

virtual DtSortedListItem* DtSortedList::newItem ( void *  data)
protectedvirtual

Create a new sorted list item envelope for the data to be inserted into the list.

Reimplemented in DtRtiMsgQueue.

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.

virtual void DtSortedList::printData ( DtSortOrder  order = DtSortOrderAscending)
virtual

Print the list.

virtual 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.

virtual 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.

virtual void DtSortedList::removeFromList ( DtSortedListItem item)
protectedvirtual

Remove item from the list. Does NOT delete the data contained in item.

virtual void DtSortedList::reposition ( DtSortedListItem item)
protectedvirtual

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

virtual void DtSortedList::repositionBackward ( DtSortedListItem item,
DtSortedListItem positionItem 
)
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()

virtual void DtSortedList::repositionForward ( DtSortedListItem item,
DtSortedListItem positionItem 
)
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()

virtual void DtSortedList::reverseSortOrder ( )
virtual

Reverses sort order of list.

virtual void DtSortedList::setSortOrder ( DtSortOrder  sortOrderValue)
virtual

Set/Get sort order.

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

DtSortOrder DtSortedList::sortOrder ( ) const
inlinevirtual

References mySortOrder.

Member Data Documentation

unsigned DtSortedList::myCount
protected

Referenced by count().

DtSortedListItem* DtSortedList::myFirst
protected

Referenced by first().

DtSortedListItem* DtSortedList::myLast
protected

Referenced by last().

DtSortOrder DtSortedList::mySortOrder
protected

Referenced by compareItems(), and sortOrder().


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

Document ID: Generated on Mon Mar 21 09:41:37 EDT 2016 from SVN revision 163228
Copyright © 2005-2015 VT MÄK Inc. All Rights Reserved (www.mak.com)