RakNet  4.0
Classes | Namespaces | Macros | Enumerations | Functions
DS_Multilist.h File Reference
#include "RakAssert.h"
#include <string.h>
#include "Export.h"
#include "RakMemoryOverride.h"
#include "NativeTypes.h"

Classes

class  DataStructures::MLKeyRef< templateType >
 
class  DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
 The multilist, representing an abstract data type that generally holds lists. More...
 

Namespaces

namespace  DataStructures
 

Macros

#define DEFINE_MULTILIST_PTR_TO_MEMBER_COMPARISONS(_CLASS_NAME_, _KEY_TYPE_, _MEMBER_VARIABLE_NAME_)
 

Enumerations

enum  MultilistType {
  ML_UNORDERED_LIST, ML_STACK, ML_QUEUE, ML_ORDERED_LIST,
  ML_VARIABLE_DURING_RUNTIME
}
 What algorithm to use to store the data for the Multilist. More...
 

Functions

template<class templateType >
void DataStructures::DeletePtr_RakNet (templateType &ptr, const char *file, unsigned int line)
 
template<class templateType >
void DataStructures::DeletePtr (templateType &ptr)
 

Macro Definition Documentation

#define DEFINE_MULTILIST_PTR_TO_MEMBER_COMPARISONS (   _CLASS_NAME_,
  _KEY_TYPE_,
  _MEMBER_VARIABLE_NAME_ 
)
Value:
bool operator<( const DataStructures::MLKeyRef<_KEY_TYPE_> &inputKey, const _CLASS_NAME_ *cls ) {return inputKey.Get() < cls->_MEMBER_VARIABLE_NAME_;} \
bool operator>( const DataStructures::MLKeyRef<_KEY_TYPE_> &inputKey, const _CLASS_NAME_ *cls ) {return inputKey.Get() > cls->_MEMBER_VARIABLE_NAME_;} \
bool operator==( const DataStructures::MLKeyRef<_KEY_TYPE_> &inputKey, const _CLASS_NAME_ *cls ) {return inputKey.Get() == cls->_MEMBER_VARIABLE_NAME_;}

For the Multilist, when _DataType != _KeyType, you must define the comparison operators between the key and the data This is non-trivial due to the need to use MLKeyRef in case the type held is a pointer to a structure or class and the key type is not a class For convenience, this macro will implement the comparison operators under the following conditions

  1. _DataType is a pointer to a class or structure
  2. The key is a member variable of _DataType

Enumeration Type Documentation

What algorithm to use to store the data for the Multilist.

Enumerator:
ML_UNORDERED_LIST 

Removing from the middle of the list will swap the end of the list rather than shift the elements. Push and Pop operate on the tail.

ML_STACK 

A normal list, with the list order preserved. Push and Pop operate on the tail.

ML_QUEUE 

A queue. Push and Pop operate on the head.

ML_ORDERED_LIST 

A list that is always kept in order. Elements must be unique, and compare against each other consistently using <, ==, and >

ML_VARIABLE_DURING_RUNTIME 

A list whose type can change at runtime.