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 | List of all members
DataStructures::List< list_type > Class Template Reference

Array based implementation of a list. More...

`#include <slikenet/DS_List.h>`

## Public Member Functions

| List ()
| Default constructor.
| ~List ()
| List (const List &original_copy)
| Copy constructor.
List & | operator= (const List &original_copy)
| Assign one list to another.
list_type & | operator[] (const unsigned int position) const
| Access an element by its index in the array.
list_type & | Get (const unsigned int position) const
| Access an element by its index in the array.
void | Push (const list_type &input, const char *file, unsigned int line)
| Push an element at the end of the stack.
list_type & | Pop (void)
| Pop an element from the end of the stack.
void | Insert (const list_type &input, const unsigned int position, const char *file, unsigned int line)
| Insert an element at position position in the list.
void | Insert (const list_type &input, const char *file, unsigned int line)
| Insert at the end of the list.
void | Replace (const list_type &input, const list_type filler, const unsigned int position, const char *file, unsigned int line)
| Replace the value at position by input.
void | Replace (const list_type &input)
| Replace the last element of the list by input.
void | RemoveAtIndex (const unsigned int position)
| Delete the element at position position.
void | RemoveAtIndexFast (const unsigned int position)
| Delete the element at position position.
void | RemoveFromEnd (const unsigned num=1)
| Delete the element at the end of the list.
unsigned int | GetIndexOf (const list_type &input) const
| Returns the index of the specified item or MAX_UNSIGNED_LONG if not found.
unsigned int | Size (void) const
void | Clear (bool doNotDeallocateSmallBlocks, const char *file, unsigned int line)
| Clear the list.
void | Preallocate (unsigned countNeeded, const char *file, unsigned int line)
| Preallocate the list, so it needs fewer reallocations at runtime.
void | Compress (const char *file, unsigned int line)
| Frees overallocated members, to use the minimum memory necessary.

## Detailed Description

### template<class list_type>
class DataStructures::List< list_type >

Array based implementation of a list.

Note
  ONLY USE THIS FOR SHALLOW COPIES. I don't bother with operator= to improve performance.

Definition at line 41 of file DS_List.h.

## Constructor & Destructor Documentation

template<class list_type >

DataStructures::List< list_type >::List | ( |  | ) |

Default constructor.

Definition at line 141 of file DS_List.h.

template<class list_type >

DataStructures::List< list_type >::~List | ( |  | ) |

Definition at line 149 of file DS_List.h.

References _FILE_AND_LINE_, and SLNet::OP_DELETE_ARRAY().

template<class list_type >

DataStructures::List< list_type >::List | ( | const List< list_type > & | original_copy | ) |

Copy constructor.

Parameters

  [in] | original_copy | The list to duplicate

Definition at line 157 of file DS_List.h.

References _FILE_AND_LINE_.

## Member Function Documentation

template<class list_type >

void DataStructures::List< list_type >::Clear | ( | bool | doNotDeallocateSmallBlocks,
|  | const char * | file,
|  | unsigned int | line
| ) |  |

Clear the list.

Definition at line 456 of file DS_List.h.

References SLNet::OP_DELETE_ARRAY().

Referenced by DataStructures::Table::Clear(), SLNet::RakPeer::ClearBanList(), SLNet::RakPeer::DerefAllSockets(), SLNet::RakString::FreeMemoryNoMutex(), DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::GetAsList(), GridSectorizer::GetEntries(), DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GetShortestPath(), SLNet::RakPeer::GetSocket(), SLNet::RakPeer::GetSockets(), SLNet::RakPeer::GetStatisticsList(), SLNet::RakPeer::GetSystemList(), VariadicSQLParser::GetTypeMappingIndices(), SLNet::RakPeer::ReleaseSockets(), SLNet::RakPeer::RemoveFromSecurityExceptionList(), SLNet::VariableDeltaSerializer::RemoveRemoteSystemVariableHistory(), and SLNet::RakPeer::RunUpdateCycle().

template<class list_type >

void DataStructures::List< list_type >::Compress | ( | const char * | file,
|  | unsigned int | line
| ) |  |

Frees overallocated members, to use the minimum memory necessary.

Attention
  This is a slow operation

Definition at line 471 of file DS_List.h.

References SLNet::OP_DELETE_ARRAY(), and return.

template<class list_type >

list_type & DataStructures::List< list_type >::Get | ( | const unsigned int | position | ) | const

inline

Access an element by its index in the array.

Parameters

  [in] | position | The index into the array.

Returns
  The element at position position.

Definition at line 226 of file DS_List.h.

Referenced by DataStructures::Table::GetCellValueByIndex().

template<class list_type>

unsigned int DataStructures::List< list_type >::GetIndexOf | ( | const list_type & | input | ) | const

Returns the index of the specified item or MAX_UNSIGNED_LONG if not found.

Parameters

  [in] | input | The element to check for

Returns
  The index or position of input in the list.

Return values

  MAX_UNSIGNED_LONG | The object is not in the list
  [Integer] | The index of the element in the list

Definition at line 440 of file DS_List.h.

References MAX_UNSIGNED_LONG.

Referenced by SLNet::RakPeer::AttachPlugin(), SLNet::RakPeer::DetachPlugin(), SLNet::TableSerializer::SerializeColumns(), and SLNet::TableSerializer::SerializeRow().

template<class list_type>

void DataStructures::List< list_type >::Insert | ( | const list_type & | input,
|  | const unsigned int | position,
|  | const char * | file,
|  | unsigned int | line
| ) |  |

Insert an element at position position in the list.

Parameters

  [in] | input | The new element.
  [in] | position | The position of the new element.

Definition at line 248 of file DS_List.h.

References SLNet::OP_DELETE_ARRAY(), and RakAssert.

Referenced by DataStructures::Table::AddColumn(), GridSectorizer::AddEntry(), DataStructures::Table::AddRow(), DataStructures::Table::AddRowColumns(), SLNet::RakPeer::AddToBanList(), SLNet::RakPeer::AddToSecurityExceptionList(), SLNet::RakString::Allocate(), SLNet::RakPeer::AttachPlugin(), ExtendRows(), SLNet::RakString::Free(), GridSectorizer::GetEntries(), DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GetShortestPath(), DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GetSpanningTree(), VariadicSQLParser::GetTypeMappingIndices(), DataStructures::Tree< TreeType >::LevelOrderTraversal(), operator+(), DataStructures::Table::QueryTable(), and DataStructures::Table::SortTable().

template<class list_type>

void DataStructures::List< list_type >::Insert | ( | const list_type & | input,
|  | const char * | file,
|  | unsigned int | line
| ) |  |

Insert at the end of the list.

Parameters

  [in] | input | The new element.

Definition at line 299 of file DS_List.h.

References SLNet::OP_DELETE_ARRAY().

template<class list_type >

List< list_type > & DataStructures::List< list_type >::operator= | ( | const List< list_type > & | original_copy | ) |

Assign one list to another.

Definition at line 181 of file DS_List.h.

References _FILE_AND_LINE_.

template<class list_type >

list_type & DataStructures::List< list_type >::operator[] | ( | const unsigned int | position | ) | const

inline

Access an element by its index in the array.

Parameters

  [in] | position | The index into the array.

Returns
  The element at position position.

Definition at line 213 of file DS_List.h.

References RakAssert.

template<class list_type >

list_type & DataStructures::List< list_type >::Pop | ( | void |  | ) |

inline

Pop an element from the end of the stack.

Precondition
  Size()>0

Returns
  The element at the end.

Definition at line 238 of file DS_List.h.

References RakAssert.

template<class list_type >

void DataStructures::List< list_type >::Preallocate | ( | unsigned | countNeeded,
|  | const char * | file,
|  | unsigned int | line
| ) |  |

Preallocate the list, so it needs fewer reallocations at runtime.

Definition at line 494 of file DS_List.h.

References SLNet::OP_DELETE_ARRAY().

template<class list_type>

void DataStructures::List< list_type >::Push | ( | const list_type & | input,
|  | const char * | file,
|  | unsigned int | line
| ) |  |

Push an element at the end of the stack.

Parameters

  [in] | input | The new element.

Definition at line 232 of file DS_List.h.

Referenced by DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::GetAsList(), SLNet::RakPeer::GetStatisticsList(), SLNet::RakPeer::GetSystemList(), SLNet::ReliabilityLayer::HandleSocketReceiveFromConnectedPlayer(), SLNet::RakPeer::RunUpdateCycle(), SLNet::RakPeer::Startup(), SLNet::VariableDeltaSerializer::StartVariableHistoryWrite(), and SLNet::VariableListDeltaTracker::WriteVar().

template<class list_type >

void DataStructures::List< list_type >::RemoveAtIndex | ( | const unsigned int | position | ) |

Delete the element at position position.

Parameters

  [in] | position | The index of the element to delete

Definition at line 393 of file DS_List.h.

References RakAssert.

Referenced by SLNet::RakString::Allocate(), SLNet::RakPeer::IsBanned(), operator+(), DataStructures::Table::RemoveColumn(), SLNet::RakPeer::RemoveFromBanList(), and SLNet::RakPeer::RemoveFromSecurityExceptionList().

template<class list_type >

void DataStructures::List< list_type >::RemoveAtIndexFast | ( | const unsigned int | position | ) |

Delete the element at position position.

Note
  - swaps middle with end of list, only use if list order does not matter

Parameters

  [in] | position | The index of the element to delete

Definition at line 416 of file DS_List.h.

References RakAssert.

Referenced by SLNet::VariableDeltaSerializer::RemoveRemoteSystemVariableHistory().

template<class list_type >

void DataStructures::List< list_type >::RemoveFromEnd | ( | const unsigned | num = `1` | ) |

inline

Delete the element at the end of the list.

Definition at line 430 of file DS_List.h.

References RakAssert.

Referenced by SLNet::RakPeer::DetachPlugin().

template<class list_type>

void DataStructures::List< list_type >::Replace | ( | const list_type & | input,
|  | const list_type | filler,
|  | const unsigned int | position,
|  | const char * | file,
|  | unsigned int | line
| ) |  |

inline

Replace the value at position by input.

If the size of the list is less than position, it increase the capacity of the list and fill slot with filler.

Parameters

  [in] | input | The element to replace at position position.
  [in] | filler | The element use to fill new allocated capacity.
  [in] | position | The position of input in the list.

Definition at line 338 of file DS_List.h.

References SLNet::OP_DELETE_ARRAY(), and RakAssert.

template<class list_type>

void DataStructures::List< list_type >::Replace | ( | const list_type & | input | ) |

inline

Replace the last element of the list by input.

Parameters

  [in] | input | The element used to replace the last element.

Definition at line 386 of file DS_List.h.

template<class list_type >

unsigned int DataStructures::List< list_type >::Size | ( | void |  | ) | const

inline

Returns
  The number of elements in the list

Definition at line 450 of file DS_List.h.

Referenced by DataStructures::Table::AddColumn(), DataStructures::Table::AddRow(), DataStructures::Table::AddRowColumns(), SLNet::RakPeer::AddToBanList(), SLNet::RakString::Allocate(), SLNet::RakPeer::CallPluginCallbacks(), SLNet::RakPeer::ClearBanList(), DataStructures::Table::ColumnIndex(), DataStructures::Table::ColumnName(), SLNet::RakPeer::Connect(), DataStructures::Table::DeleteRow(), SLNet::RakPeer::DerefAllSockets(), SLNet::RakPeer::DetachPlugin(), VariadicSQLParser::ExtractArguments(), SLNet::VariableListDeltaTracker::FlagDirtyFromBitArray(), VariadicSQLParser::FreeArguments(), SLNet::RakString::FreeMemoryNoMutex(), FreeRow(), DataStructures::Table::GetColumnCount(), DataStructures::Table::GetColumnType(), SLNet::RakPeer::GetConnectionList(), GridSectorizer::GetEntries(), SLNet::RakPeer::GetMyBoundAddress(), SLNet::RakPeer::GetRakNetSocketFromUserConnectionSocketIndex(), SLNet::VariableDeltaSerializer::GetRemoteSystemHistoryListIndex(), SLNet::RakPeer::GetSocket(), DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GetSpanningTree(), SLNet::VariableDeltaSerializer::GetVarsWrittenPerRemoteSystemListIndex(), SLNet::ReliabilityLayer::HandleSocketReceiveFromConnectedPlayer(), SLNet::RakPeer::IsBanned(), SLNet::RakPeer::IsInSecurityExceptionList(), SLNet::VariableListDeltaTracker::IsPastEndOfList(), DataStructures::Tree< TreeType >::LevelOrderTraversal(), SLNet::RakPeer::NumberOfConnections(), operator+(), SLNet::RakPeer::Ping(), DataStructures::Table::PrintColumnHeaders(), DataStructures::Table::PrintRow(), SLNet::ProcessOfflineNetworkPacket(), SLNet::RakPeer::PushBackPacket(), DataStructures::Table::QueryRow(), DataStructures::Table::QueryTable(), SLNet::RakPeer::Receive(), DataStructures::Table::RemoveColumn(), SLNet::RakPeer::RemoveFromBanList(), SLNet::RakPeer::RemoveFromSecurityExceptionList(), SLNet::VariableDeltaSerializer::RemoveRemoteSystemVariableHistory(), SLNet::RakPeer::RunUpdateCycle(), SLNet::RakPeer::SendOutOfBand(), SLNet::RakPeer::SendTTL(), SLNet::TableSerializer::SerializeColumns(), SLNet::TableSerializer::SerializeRow(), SLNet::RakPeer::Shutdown(), DataStructures::Table::SortTable(), SLNet::RakPeer::Startup(), SLNet::ReliabilityLayer::Update(), SLNet::VariableListDeltaTracker::WriteVar(), and SLNet::VariableListDeltaTracker::~VariableListDeltaTracker().

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

- Source/include/slikenet/DS_List.h