SLikeNet 0.1.3

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > Class Template Reference

The multilist, representing an abstract data type that generally holds lists. More...

`#include <slikenet/DS_Multilist.h>`

## Public Member Functions

| Multilist ()
| ~Multilist ()
| Multilist (const Multilist &source)
Multilist & | operator= (const Multilist &source)
_DataType & | operator[] (const _IndexType position) const
void | Push (const _DataType &d, const char *file=__FILE__, unsigned int line=__LINE__)
void | Push (const _DataType &d, const _KeyType &key, const char *file=__FILE__, unsigned int line=__LINE__)
_DataType & | Pop (const char *file=__FILE__, unsigned int line=__LINE__)
| Gets or removes and gets an element from the list, according to the same rules as Push(). Ordered list is LIFO for the purposes of Pop and Peek.
_DataType & | Peek (void) const
void | PushOpposite (const _DataType &d, const char *file=__FILE__, unsigned int line=__LINE__)
| Same as Push(), except FIFO and LIFO are reversed. Ordered list still inserts in order.
void | PushOpposite (const _DataType &d, const _KeyType &key, const char *file=__FILE__, unsigned int line=__LINE__)
_DataType & | PopOpposite (const char *file=__FILE__, unsigned int line=__LINE__)
| Same as Pop() and Peek(), except FIFO and LIFO are reversed.
_DataType & | PeekOpposite (void) const
void | InsertAtIndex (const _DataType &d, _IndexType index, const char *file=__FILE__, unsigned int line=__LINE__)
| Stack,Queue: Inserts at index indicated, elements are shifted. Ordered list: Inserts, position is ignored.
void | RemoveAtIndex (_IndexType position, const char *file=__FILE__, unsigned int line=__LINE__)
| Unordered list, removes at index indicated, swaps last element with that element. Otherwise, array is shifted left to overwrite removed element.
bool | RemoveAtKey (_KeyType key, bool assertIfDoesNotExist, const char *file=__FILE__, unsigned int line=__LINE__)
| Find the index of key, and remove at that index.
_IndexType | GetIndexOf (_KeyType key) const
| Finds the index of key. Return -1 if the key is not found.
_IndexType | GetInsertionIndex (_KeyType key) const
| Returns where in the list we should insert the item, to preserve list order. Returns -1 if the item is already in the list.
_DataType | GetPtr (_KeyType key) const
| Finds the index of key. Return 0 if the key is not found. Useful if _DataType is always non-zero pointers.
void | ForEach (void(*func)(_DataType &item, const char *file, unsigned int line), const char *file, unsigned int line)
| Iterate over the list, calling the function pointer on each element.
void | ForEach (void(*func)(_DataType &item))
bool | IsEmpty (void) const
| Returns if the list is empty.
_IndexType | GetSize (void) const
| Returns the number of elements used in the list.
void | Clear (bool deallocateSmallBlocks=true, const char *file=__FILE__, unsigned int line=__LINE__)
| Empties the list. The list is not deallocated if it is small, unless deallocateSmallBlocks is true.
void | ClearPointers (bool deallocateSmallBlocks=true, const char *file=__FILE__, unsigned int line=__LINE__)
| Empties the list, first calling SLNet::OP_Delete on all items.
void | ClearPointer (_KeyType key, const char *file=__FILE__, unsigned int line=__LINE__)
| Empty one item from the list, first calling SLNet::OP_Delete on that item.
void | ReverseList (void)
| Reverses the elements in the list, and flips the sort order returned by GetSortOrder() if IsSorted() returns true at the time the function is called.
void | Reallocate (_IndexType size, const char *file=__FILE__, unsigned int line=__LINE__)
| Reallocates the list to a larger size. If size is smaller than the value returned by GetSize(), the call does nothing.
void | Sort (bool force)
| Sorts the list unless it is an ordered list, in which it does nothing as the list is assumed to already be sorted.
void | TagSorted (void)
| Sets the list to be remembered as sorted.
void | SetSortOrder (bool ascending)
| Defaults to ascending.
bool | GetSortOrder (void) const
| Returns true if ascending.
bool | IsSorted (void) const
| Returns true if the list is currently believed to be in a sorted state.
MultilistType | GetMultilistType (void) const
| Returns what type of list this is.
void | SetMultilistType (MultilistType newType)
| Changes what type of list this is.

## Static Public Member Functions

static void | FindIntersection (Multilist &source1, Multilist &source2, Multilist &intersection, Multilist &uniqueToSource1, Multilist &uniqueToSource2)
| Returns the intersection of two lists. Intersection is items common to both lists.

## Protected Types

enum | { ML_UNSORTED, ML_SORTED_ASCENDING, ML_SORTED_DESCENDING }

## Protected Member Functions

void | ReallocateIfNeeded (const char *file, unsigned int line)
void | DeallocateIfNeeded (const char *file, unsigned int line)
void | ReallocToSize (_IndexType newAllocationSize, const char *file, unsigned int line)
void | ReverseListInternal (void)
void | InsertInOrderedList (const _DataType &d, const _KeyType &key)
_IndexType | GetIndexFromKeyInSortedList (const _KeyType &key, bool *objectExists) const
void | InsertShiftArrayRight (const _DataType &d, _IndexType index)
void | DeleteShiftArrayLeft (_IndexType index)
void | QSortAscending (_IndexType left, _IndexType right)
void | QSortDescending (_IndexType left, _IndexType right)
void | CopySource (const Multilist &source)

## Protected Attributes

_DataType * | data
| An array of user values.
_IndexType | dataSize
| Number of elements in the list.
_IndexType | allocationSize
| Size of array.
_IndexType | queueHead
| Array index for the head of the queue.
_IndexType | queueTail
| Array index for the tail of the queue.
_IndexType | preallocationSize
enum DataStructures::Multilist:: { ... } | sortState
bool | ascendingSort
MultilistType | variableMultilistType

## Detailed Description

### template<const MultilistType _MultilistType, class _DataType, class _KeyType = _DataType, class _IndexType = DefaultIndexType>
class DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >

The multilist, representing an abstract data type that generally holds lists.

Parameters

  [in] | _MultilistType | What type of list this is,

See Also
  MultilistType

Parameters

  [in] | _DataType | What type of data this list holds.
  [in] | _KeyType | If a function takes a key to sort on, what type of key this is. The comparison operator between _DataType and _KeyType must be defined
  [in] | _IndexType | What variable type to use for indices

Definition at line 99 of file DS_Multilist.h.

## Member Enumeration Documentation

template<const MultilistType _MultilistType, class _DataType , class _KeyType = _DataType, class _IndexType = DefaultIndexType>

anonymous enum

protected

Enumerator:

  ML_UNSORTED |
  ML_SORTED_ASCENDING |
  ML_SORTED_DESCENDING |

Definition at line 249 of file DS_Multilist.h.

## Constructor & Destructor Documentation

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >

DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::Multilist | ( |  | ) |

Definition at line 263 of file DS_Multilist.h.

References ML_ORDERED_LIST, ML_UNORDERED_LIST, and ML_VARIABLE_DURING_RUNTIME.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >

DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::~Multilist | ( |  | ) |

Definition at line 287 of file DS_Multilist.h.

References _FILE_AND_LINE_, and SLNet::OP_DELETE_ARRAY().

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >

DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::Multilist | ( | const Multilist< _MultilistType, _DataType, _KeyType, _IndexType > & | source | ) |

Definition at line 294 of file DS_Multilist.h.

## Member Function Documentation

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >

void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::Clear | ( | bool | deallocateSmallBlocks = `true`,
|  | const char * | file = `__FILE__`,
|  | unsigned int | line = `__LINE__`
| ) |  |

Empties the list. The list is not deallocated if it is small, unless deallocateSmallBlocks is true.

Definition at line 784 of file DS_Multilist.h.

References ML_ORDERED_LIST, and SLNet::OP_DELETE_ARRAY().

Referenced by DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::FindIntersection().

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >

void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::ClearPointer | ( | _KeyType | key,
|  | const char * | file = `__FILE__`,
|  | unsigned int | line = `__LINE__`
| ) |  |

Empty one item from the list, first calling SLNet::OP_Delete on that item.

Definition at line 815 of file DS_Multilist.h.

References SLNet::OP_DELETE().

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >

void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::ClearPointers | ( | bool | deallocateSmallBlocks = `true`,
|  | const char * | file = `__FILE__`,
|  | unsigned int | line = `__LINE__`
| ) |  |

Empties the list, first calling SLNet::OP_Delete on all items.

The list is not deallocated if it is small, unless deallocateSmallBlocks is true

Definition at line 806 of file DS_Multilist.h.

References SLNet::OP_DELETE().

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >

void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::CopySource | ( | const Multilist< _MultilistType, _DataType, _KeyType, _IndexType > & | source | ) |

protected

Definition at line 308 of file DS_Multilist.h.

References _FILE_AND_LINE_, DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::ascendingSort, DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::data, DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::GetSize(), DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::preallocationSize, DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::sortState, and DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::variableMultilistType.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >

void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::DeallocateIfNeeded | ( | const char * | file,
|  | unsigned int | line
| ) |  |

protected

Definition at line 1172 of file DS_Multilist.h.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >

void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::DeleteShiftArrayLeft | ( | _IndexType | index | ) |

protected

Definition at line 1314 of file DS_Multilist.h.

References ML_QUEUE, and RakAssert.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >

void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::FindIntersection | ( | Multilist< _MultilistType, _DataType, _KeyType, _IndexType > & | source1,
|  | Multilist< _MultilistType, _DataType, _KeyType, _IndexType > & | source2,
|  | Multilist< _MultilistType, _DataType, _KeyType, _IndexType > & | intersection,
|  | Multilist< _MultilistType, _DataType, _KeyType, _IndexType > & | uniqueToSource1,
|  | Multilist< _MultilistType, _DataType, _KeyType, _IndexType > & | uniqueToSource2
| ) |  |

static

Returns the intersection of two lists. Intersection is items common to both lists.

Definition at line 1102 of file DS_Multilist.h.

References _FILE_AND_LINE_, DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::Clear(), DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::GetSize(), DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::Push(), DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::SetSortOrder(), and DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::Sort().

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >

void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::ForEach | ( | void(*)(_DataType &item, const char *file, unsigned int line) | func,
|  | const char * | file,
|  | unsigned int | line
| ) |  |

Iterate over the list, calling the function pointer on each element.

Definition at line 756 of file DS_Multilist.h.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >

void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::ForEach | ( | void(*)(_DataType &item) | func | ) |

Definition at line 764 of file DS_Multilist.h.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >

_IndexType DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::GetIndexFromKeyInSortedList | ( | const _KeyType & | key,
|  | bool * | objectExists
| ) |  | const

protected

Definition at line 1249 of file DS_Multilist.h.

References RakAssert.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >

_IndexType DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::GetIndexOf | ( | _KeyType | key | ) | const

Finds the index of key. Return -1 if the key is not found.

Definition at line 679 of file DS_Multilist.h.

References ML_QUEUE, ML_STACK, ML_UNORDERED_LIST, and RakAssert.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >

_IndexType DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::GetInsertionIndex | ( | _KeyType | key | ) | const

Returns where in the list we should insert the item, to preserve list order. Returns -1 if the item is already in the list.

Definition at line 713 of file DS_Multilist.h.

References ML_QUEUE, ML_STACK, ML_UNORDERED_LIST, and RakAssert.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >

MultilistType DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::GetMultilistType | ( | void |  | ) | const

Returns what type of list this is.

Definition at line 995 of file DS_Multilist.h.

References ML_VARIABLE_DURING_RUNTIME.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >

_DataType DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::GetPtr | ( | _KeyType | key | ) | const

Finds the index of key. Return 0 if the key is not found. Useful if _DataType is always non-zero pointers.

Definition at line 747 of file DS_Multilist.h.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >

_IndexType DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::GetSize | ( | void |  | ) | const

Returns the number of elements used in the list.

Definition at line 778 of file DS_Multilist.h.

Referenced by DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::CopySource(), and DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::FindIntersection().

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >

bool DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::GetSortOrder | ( | void |  | ) | const

Returns true if ascending.

Definition at line 983 of file DS_Multilist.h.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >

void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::InsertAtIndex | ( | const _DataType & | d,
|  | _IndexType | index,
|  | const char * | file = `__FILE__`,
|  | unsigned int | line = `__LINE__`
| ) |  |

Stack,Queue: Inserts at index indicated, elements are shifted. Ordered list: Inserts, position is ignored.

Definition at line 545 of file DS_Multilist.h.

References ML_ORDERED_LIST, ML_STACK, and ML_UNORDERED_LIST.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >

void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::InsertInOrderedList | ( | const _DataType & | d,
|  | const _KeyType & | key
| ) |  |

protected

Definition at line 1220 of file DS_Multilist.h.

References ML_ORDERED_LIST, and RakAssert.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >

void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::InsertShiftArrayRight | ( | const _DataType & | d,
|  | _IndexType | index
| ) |  |

protected

Definition at line 1298 of file DS_Multilist.h.

References ML_QUEUE, and RakAssert.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >

bool DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::IsEmpty | ( | void |  | ) | const

Returns if the list is empty.

Definition at line 772 of file DS_Multilist.h.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >

bool DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::IsSorted | ( | void |  | ) | const

Returns true if the list is currently believed to be in a sorted state.

Doesn't actually check for sortedness, just if Sort() was recently called, or MultilistType is ML_ORDERED_LIST

Definition at line 989 of file DS_Multilist.h.

References ML_ORDERED_LIST.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >

Multilist< _MultilistType, _DataType, _KeyType, _IndexType > & DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::operator= | ( | const Multilist< _MultilistType, _DataType, _KeyType, _IndexType > & | source | ) |

Definition at line 300 of file DS_Multilist.h.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >

_DataType & DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::operator[] | ( | const _IndexType | position | ) | const

Definition at line 333 of file DS_Multilist.h.

References ML_QUEUE, and RakAssert.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >

_DataType & DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::Peek | ( | void |  | ) | const

Definition at line 425 of file DS_Multilist.h.

References ML_ORDERED_LIST, ML_QUEUE, ML_STACK, ML_UNORDERED_LIST, and RakAssert.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >

_DataType & DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::PeekOpposite | ( | void |  | ) | const

Definition at line 524 of file DS_Multilist.h.

References ML_ORDERED_LIST, ML_QUEUE, ML_STACK, ML_UNORDERED_LIST, and RakAssert.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >

_DataType & DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::Pop | ( | const char * | file = `__FILE__`,
|  | unsigned int | line = `__LINE__`
| ) |  |

Gets or removes and gets an element from the list, according to the same rules as Push(). Ordered list is LIFO for the purposes of Pop and Peek.

Definition at line 400 of file DS_Multilist.h.

References ML_ORDERED_LIST, ML_QUEUE, ML_STACK, ML_UNORDERED_LIST, and RakAssert.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >

_DataType & DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::PopOpposite | ( | const char * | file = `__FILE__`,
|  | unsigned int | line = `__LINE__`
| ) |  |

Same as Pop() and Peek(), except FIFO and LIFO are reversed.

Definition at line 492 of file DS_Multilist.h.

References ML_ORDERED_LIST, ML_QUEUE, ML_STACK, ML_UNORDERED_LIST, and RakAssert.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >

void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::Push | ( | const _DataType & | d,
|  | const char * | file = `__FILE__`,
|  | unsigned int | line = `__LINE__`
| ) |  |

Unordered list, stack is LIFO QUEUE is FIFO Ordered list is inserted in order

Definition at line 349 of file DS_Multilist.h.

Referenced by DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::FindIntersection().

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >

void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::Push | ( | const _DataType & | d,
|  | const _KeyType & | key,
|  | const char * | file = `__FILE__`,
|  | unsigned int | line = `__LINE__`
| ) |  |

Definition at line 355 of file DS_Multilist.h.

References ML_ORDERED_LIST, ML_QUEUE, ML_STACK, ML_UNORDERED_LIST, and RakAssert.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >

void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::PushOpposite | ( | const _DataType & | d,
|  | const char * | file = `__FILE__`,
|  | unsigned int | line = `__LINE__`
| ) |  |

Same as Push(), except FIFO and LIFO are reversed. Ordered list still inserts in order.

Definition at line 440 of file DS_Multilist.h.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >

void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::PushOpposite | ( | const _DataType & | d,
|  | const _KeyType & | key,
|  | const char * | file = `__FILE__`,
|  | unsigned int | line = `__LINE__`
| ) |  |

Definition at line 446 of file DS_Multilist.h.

References ML_ORDERED_LIST, ML_QUEUE, ML_STACK, ML_UNORDERED_LIST, and RakAssert.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >

void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::QSortAscending | ( | _IndexType | left,
|  | _IndexType | right
| ) |  |

protected

Definition at line 874 of file DS_Multilist.h.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >

void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::QSortDescending | ( | _IndexType | left,
|  | _IndexType | right
| ) |  |

protected

Definition at line 922 of file DS_Multilist.h.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >

void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::Reallocate | ( | _IndexType | size,
|  | const char * | file = `__FILE__`,
|  | unsigned int | line = `__LINE__`
| ) |  |

Reallocates the list to a larger size. If size is smaller than the value returned by GetSize(), the call does nothing.

Definition at line 836 of file DS_Multilist.h.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >

void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::ReallocateIfNeeded | ( | const char * | file,
|  | unsigned int | line
| ) |  |

protected

Definition at line 1150 of file DS_Multilist.h.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >

void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::ReallocToSize | ( | _IndexType | newAllocationSize,
|  | const char * | file,
|  | unsigned int | line
| ) |  |

protected

Definition at line 1187 of file DS_Multilist.h.

References ML_QUEUE, and SLNet::OP_DELETE_ARRAY().

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >

void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::RemoveAtIndex | ( | _IndexType | position,
|  | const char * | file = `__FILE__`,
|  | unsigned int | line = `__LINE__`
| ) |  |

Unordered list, removes at index indicated, swaps last element with that element. Otherwise, array is shifted left to overwrite removed element.

Index[0] returns the same as Pop() for a queue. Same as PopOpposite() for the list and ordered list

Definition at line 612 of file DS_Multilist.h.

References ML_ORDERED_LIST, ML_QUEUE, ML_STACK, ML_UNORDERED_LIST, and RakAssert.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >

bool DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::RemoveAtKey | ( | _KeyType | key,
|  | bool | assertIfDoesNotExist,
|  | const char * | file = `__FILE__`,
|  | unsigned int | line = `__LINE__`
| ) |  |

Find the index of key, and remove at that index.

Definition at line 666 of file DS_Multilist.h.

References RakAssert.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >

void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::ReverseList | ( | void |  | ) |

Reverses the elements in the list, and flips the sort order returned by GetSortOrder() if IsSorted() returns true at the time the function is called.

Definition at line 827 of file DS_Multilist.h.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >

void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::ReverseListInternal | ( | void |  | ) |

protected

Definition at line 1207 of file DS_Multilist.h.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >

void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::SetMultilistType | ( | MultilistType | newType | ) |

Changes what type of list this is.

Precondition
  Template must be defined with ML_VARIABLE_DURING_RUNTIME for this to do anything

Parameters

  [in] | mlType | Any value of the enum MultilistType, except ML_VARIABLE_DURING_RUNTIME

Definition at line 1006 of file DS_Multilist.h.

References _FILE_AND_LINE_, ML_ORDERED_LIST, ML_QUEUE, ML_STACK, ML_UNORDERED_LIST, ML_VARIABLE_DURING_RUNTIME, and RakAssert.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >

void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::SetSortOrder | ( | bool | ascending | ) |

Defaults to ascending.

Used by Sort(), and by ML_ORDERED_LIST

Definition at line 970 of file DS_Multilist.h.

Referenced by DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::FindIntersection().

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >

void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::Sort | ( | bool | force | ) |

Sorts the list unless it is an ordered list, in which it does nothing as the list is assumed to already be sorted.

However, if force is true, it will also resort the ordered list, useful if the comparison operator between _KeyType and _DataType would now return different results Once the list is sorted, further operations to lookup by key will be log2(n) until the list is modified

Definition at line 848 of file DS_Multilist.h.

Referenced by DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::FindIntersection().

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >

void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::TagSorted | ( | void |  | ) |

Sets the list to be remembered as sorted.

Optimization if the source is sorted already

Definition at line 865 of file DS_Multilist.h.

## Member Data Documentation

template<const MultilistType _MultilistType, class _DataType , class _KeyType = _DataType, class _IndexType = DefaultIndexType>

_IndexType DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::allocationSize

protected

Size of array.

Definition at line 237 of file DS_Multilist.h.

template<const MultilistType _MultilistType, class _DataType , class _KeyType = _DataType, class _IndexType = DefaultIndexType>

bool DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::ascendingSort

protected

Definition at line 256 of file DS_Multilist.h.

Referenced by DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::CopySource().

template<const MultilistType _MultilistType, class _DataType , class _KeyType = _DataType, class _IndexType = DefaultIndexType>

_DataType* DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::data

protected

An array of user values.

Definition at line 231 of file DS_Multilist.h.

Referenced by DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::CopySource().

template<const MultilistType _MultilistType, class _DataType , class _KeyType = _DataType, class _IndexType = DefaultIndexType>

_IndexType DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::dataSize

protected

Number of elements in the list.

Definition at line 234 of file DS_Multilist.h.

template<const MultilistType _MultilistType, class _DataType , class _KeyType = _DataType, class _IndexType = DefaultIndexType>

_IndexType DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::preallocationSize

protected

How many bytes the user chose to preallocate Won't automatically deallocate below this

Definition at line 247 of file DS_Multilist.h.

Referenced by DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::CopySource().

template<const MultilistType _MultilistType, class _DataType , class _KeyType = _DataType, class _IndexType = DefaultIndexType>

_IndexType DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::queueHead

protected

Array index for the head of the queue.

Definition at line 240 of file DS_Multilist.h.

template<const MultilistType _MultilistType, class _DataType , class _KeyType = _DataType, class _IndexType = DefaultIndexType>

_IndexType DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::queueTail

protected

Array index for the tail of the queue.

Definition at line 243 of file DS_Multilist.h.

enum { ... } DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::sortState

Referenced by DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::CopySource().

template<const MultilistType _MultilistType, class _DataType , class _KeyType = _DataType, class _IndexType = DefaultIndexType>

MultilistType DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::variableMultilistType

protected

Definition at line 259 of file DS_Multilist.h.

Referenced by DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::CopySource().

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

- Source/include/slikenet/DS_Multilist.h