![]() |
Shadowrun: Awakened 29 September 2011 - Build 871
|
#include <DS_Map.h>
Inheritance diagram for DataStructures::Map< key_type, data_type, key_comparison_func >:Classes | |
| struct | MapNode |
Public Member Functions | |
| void | Clear (void) |
| bool | Delete (const key_type &key) |
| data_type & | Get (const key_type &key) const |
| unsigned | GetIndexAtKey (const key_type &key) |
| key_type | GetKeyAtIndex (const unsigned int position) const |
| bool | Has (const key_type &key) const |
| Map () | |
| Map (const Map &original_copy) | |
| Map & | operator= (const Map &original_copy) |
| data_type & | operator[] (const unsigned int position) const |
| data_type | Pop (const key_type &key) |
| void | RemoveAtIndex (const unsigned index) |
| void | Set (const key_type &key, const data_type &data) |
| void | SetExisting (const key_type &key, const data_type &data) |
| void | SetNew (const key_type &key, const data_type &data) |
| unsigned | Size (void) const |
| ~Map () | |
Static Public Member Functions | |
| static void | IMPLEMENT_DEFAULT_COMPARISON (void) |
| static int | NodeComparisonFunc (const key_type &a, const MapNode &b) |
Protected Member Functions | |
| bool | HasSavedSearchResult (const key_type &key) const |
| void | SaveLastSearch (const key_type &key, unsigned index) const |
Protected Attributes | |
| unsigned | lastSearchIndex |
| bool | lastSearchIndexValid |
| key_type | lastSearchKey |
| DataStructures::OrderedList < key_type, MapNode,&Map::NodeComparisonFunc > | mapNodeList |
| DataStructures::Map< key_type, data_type, key_comparison_func >::Map | ( | ) |
Definition at line 93 of file DS_Map.h.
{
lastSearchIndexValid=false;
}
| DataStructures::Map< key_type, data_type, key_comparison_func >::~Map | ( | ) |
| DataStructures::Map< key_type, data_type, key_comparison_func >::Map | ( | const Map< key_type, data_type, key_comparison_func > & | original_copy | ) |
Definition at line 105 of file DS_Map.h.
References DataStructures::Map< key_type, data_type, key_comparison_func >::lastSearchIndex, DataStructures::Map< key_type, data_type, key_comparison_func >::lastSearchIndexValid, DataStructures::Map< key_type, data_type, key_comparison_func >::lastSearchKey, and DataStructures::Map< key_type, data_type, key_comparison_func >::mapNodeList.
{
mapNodeList=original_copy.mapNodeList;
lastSearchIndex=original_copy.lastSearchIndex;
lastSearchKey=original_copy.lastSearchKey;
lastSearchIndexValid=original_copy.lastSearchIndexValid;
}
| void DataStructures::Map< key_type, data_type, key_comparison_func >::Clear | ( | void | ) |
Definition at line 273 of file DS_Map.h.
References _FILE_AND_LINE_.
{
lastSearchIndexValid=false;
mapNodeList.Clear(false, _FILE_AND_LINE_);
}
| bool DataStructures::Map< key_type, data_type, key_comparison_func >::Delete | ( | const key_type & | key | ) |
Definition at line 250 of file DS_Map.h.
Referenced by DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GenerateDisjktraMatrix().
{
if (HasSavedSearchResult(key))
{
lastSearchIndexValid=false;
mapNodeList.RemoveAtIndex(lastSearchIndex);
return true;
}
bool objectExists;
unsigned index;
index=mapNodeList.GetIndexFromKey(key, &objectExists);
if (objectExists)
{
lastSearchIndexValid=false;
mapNodeList.RemoveAtIndex(index);
return true;
}
else
return false;
}
| data_type & DataStructures::Map< key_type, data_type, key_comparison_func >::Get | ( | const key_type & | key | ) | const |
Definition at line 124 of file DS_Map.h.
References RakAssert.
Referenced by DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GenerateDisjktraMatrix(), and DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GetSpanningTree().
{
if (HasSavedSearchResult(key))
return mapNodeList[lastSearchIndex].mapNodeData;
bool objectExists;
unsigned index;
index=mapNodeList.GetIndexFromKey(key, &objectExists);
RakAssert(objectExists);
SaveLastSearch(key,index);
return mapNodeList[index].mapNodeData;
}
| unsigned DataStructures::Map< key_type, data_type, key_comparison_func >::GetIndexAtKey | ( | const key_type & | key | ) |
Definition at line 138 of file DS_Map.h.
References RakAssert.
Referenced by DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GenerateDisjktraMatrix().
{
if (HasSavedSearchResult(key))
return lastSearchIndex;
bool objectExists;
unsigned index;
index=mapNodeList.GetIndexFromKey(key, &objectExists);
if (objectExists==false)
{
RakAssert(objectExists);
}
SaveLastSearch(key,index);
return index;
}
| key_type DataStructures::Map< key_type, data_type, key_comparison_func >::GetKeyAtIndex | ( | const unsigned int | position | ) | const |
Definition at line 286 of file DS_Map.h.
Referenced by DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GenerateDisjktraMatrix(), and DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GetSpanningTree().
{
return mapNodeList[position].mapNodeKey;
}
| bool DataStructures::Map< key_type, data_type, key_comparison_func >::Has | ( | const key_type & | key | ) | const |
Definition at line 236 of file DS_Map.h.
Referenced by DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GetSpanningTree().
{
if (HasSavedSearchResult(key))
return true;
bool objectExists;
unsigned index;
index=mapNodeList.GetIndexFromKey(key, &objectExists);
if (objectExists)
SaveLastSearch(key,index);
return objectExists;
}
| bool DataStructures::Map< key_type, data_type, key_comparison_func >::HasSavedSearchResult | ( | const key_type & | key | ) | const [protected] |
| static void DataStructures::Map< key_type, data_type, key_comparison_func >::IMPLEMENT_DEFAULT_COMPARISON | ( | void | ) | [inline, static] |
| static int DataStructures::Map< key_type, data_type, key_comparison_func >::NodeComparisonFunc | ( | const key_type & | a, |
| const MapNode & | b | ||
| ) | [inline, static] |
| Map< key_type, data_type, key_comparison_func > & DataStructures::Map< key_type, data_type, key_comparison_func >::operator= | ( | const Map< key_type, data_type, key_comparison_func > & | original_copy | ) |
Definition at line 114 of file DS_Map.h.
References DataStructures::Map< key_type, data_type, key_comparison_func >::lastSearchIndex, DataStructures::Map< key_type, data_type, key_comparison_func >::lastSearchIndexValid, DataStructures::Map< key_type, data_type, key_comparison_func >::lastSearchKey, and DataStructures::Map< key_type, data_type, key_comparison_func >::mapNodeList.
{
mapNodeList=original_copy.mapNodeList;
lastSearchIndex=original_copy.lastSearchIndex;
lastSearchKey=original_copy.lastSearchKey;
lastSearchIndexValid=original_copy.lastSearchIndexValid;
return *this;
}
| data_type & DataStructures::Map< key_type, data_type, key_comparison_func >::operator[] | ( | const unsigned int | position | ) | const |
Definition at line 280 of file DS_Map.h.
{
return mapNodeList[position].mapNodeData;
}
| data_type DataStructures::Map< key_type, data_type, key_comparison_func >::Pop | ( | const key_type & | key | ) |
Definition at line 162 of file DS_Map.h.
References RakAssert.
{
bool objectExists;
unsigned index;
if (HasSavedSearchResult(key))
index=lastSearchIndex;
else
{
index=mapNodeList.GetIndexFromKey(key, &objectExists);
RakAssert(objectExists);
}
data_type tmp = mapNodeList[index].mapNodeData;
mapNodeList.RemoveAtIndex(index);
lastSearchIndexValid=false;
return tmp;
}
| void DataStructures::Map< key_type, data_type, key_comparison_func >::RemoveAtIndex | ( | const unsigned | index | ) |
Definition at line 155 of file DS_Map.h.
{
mapNodeList.RemoveAtIndex(index);
lastSearchIndexValid=false;
}
| void DataStructures::Map< key_type, data_type, key_comparison_func >::SaveLastSearch | ( | const key_type & | key, |
| unsigned | index | ||
| ) | const [protected] |
| void DataStructures::Map< key_type, data_type, key_comparison_func >::Set | ( | const key_type & | key, |
| const data_type & | data | ||
| ) |
Definition at line 180 of file DS_Map.h.
References _FILE_AND_LINE_.
Referenced by DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GenerateDisjktraMatrix().
{
bool objectExists;
unsigned index;
if (HasSavedSearchResult(key))
{
mapNodeList[lastSearchIndex].mapNodeData=data;
return;
}
index=mapNodeList.GetIndexFromKey(key, &objectExists);
if (objectExists)
{
SaveLastSearch(key,index);
mapNodeList[index].mapNodeData=data;
}
else
{
SaveLastSearch(key,mapNodeList.Insert(key,MapNode(key,data), true, _FILE_AND_LINE_));
}
}
| void DataStructures::Map< key_type, data_type, key_comparison_func >::SetExisting | ( | const key_type & | key, |
| const data_type & | data | ||
| ) |
Definition at line 205 of file DS_Map.h.
References RakAssert.
{
bool objectExists;
unsigned index;
if (HasSavedSearchResult(key))
{
index=lastSearchIndex;
}
else
{
index=mapNodeList.GetIndexFromKey(key, &objectExists);
RakAssert(objectExists);
SaveLastSearch(key,index);
}
mapNodeList[index].mapNodeData=data;
}
| void DataStructures::Map< key_type, data_type, key_comparison_func >::SetNew | ( | const key_type & | key, |
| const data_type & | data | ||
| ) |
Definition at line 225 of file DS_Map.h.
References _FILE_AND_LINE_, and RakAssert.
{
#ifdef _DEBUG
bool objectExists;
mapNodeList.GetIndexFromKey(key, &objectExists);
RakAssert(objectExists==false);
#endif
SaveLastSearch(key,mapNodeList.Insert(key,MapNode(key,data), true, _FILE_AND_LINE_));
}
| unsigned DataStructures::Map< key_type, data_type, key_comparison_func >::Size | ( | void | ) | const |
Definition at line 292 of file DS_Map.h.
Referenced by DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GenerateDisjktraMatrix(), and DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GetSpanningTree().
{
return mapNodeList.Size();
}
unsigned DataStructures::Map< key_type, data_type, key_comparison_func >::lastSearchIndex [protected] |
Definition at line 87 of file DS_Map.h.
Referenced by DataStructures::Map< key_type, data_type, key_comparison_func >::Map(), and DataStructures::Map< key_type, data_type, key_comparison_func >::operator=().
bool DataStructures::Map< key_type, data_type, key_comparison_func >::lastSearchIndexValid [protected] |
Definition at line 89 of file DS_Map.h.
Referenced by DataStructures::Map< key_type, data_type, key_comparison_func >::Map(), and DataStructures::Map< key_type, data_type, key_comparison_func >::operator=().
key_type DataStructures::Map< key_type, data_type, key_comparison_func >::lastSearchKey [protected] |
Definition at line 88 of file DS_Map.h.
Referenced by DataStructures::Map< key_type, data_type, key_comparison_func >::Map(), and DataStructures::Map< key_type, data_type, key_comparison_func >::operator=().
DataStructures::OrderedList< key_type,MapNode,&Map::NodeComparisonFunc > DataStructures::Map< key_type, data_type, key_comparison_func >::mapNodeList [protected] |
Definition at line 82 of file DS_Map.h.
Referenced by DataStructures::Map< key_type, data_type, key_comparison_func >::Map(), and DataStructures::Map< key_type, data_type, key_comparison_func >::operator=().
Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.