|
OpenTTD Source 20260421-master-gc2fbc6fdeb
|
Hash table based node list multi-container class. More...
#include <nodelist.hpp>
Public Types | |
| using | Item = Titem |
| using | Key = typename Titem::Key |
Public Member Functions | |
| NodeList () | |
| default constructor | |
| int | OpenCount () |
| Get open node count. | |
| int | ClosedCount () |
| Get closed node count. | |
| int | TotalCount () |
| Get the total node count. | |
| Titem & | CreateNewNode () |
| Allocate new data item from items. | |
| void | FoundBestNode (Titem &item) |
| Notify the nodelist that we don't want to discard the given node. | |
| void | InsertOpenNode (Titem &item) |
| Insert given item as open node (into open_nodes and open_queue). | |
| Titem * | GetBestOpenNode () |
| Get the open node at the begin of the open queue. | |
| Titem * | PopBestOpenNode () |
| Remove and return the best open node. | |
| Titem * | FindOpenNode (const Key &key) |
| Find an open node by key. | |
| Titem & | PopOpenNode (const Key &key) |
| Find and remove an open node by key. | |
| void | InsertClosedNode (Titem &item) |
| Insert the given item into the closed nodes set. | |
| Titem * | FindClosedNode (const Key &key) |
| Find a closed node by its key. | |
| Titem & | ItemAt (int index) |
| Get a particular item. | |
| template<class D> | |
| void | Dump (D &dmp) const |
| Helper for creating output of this array. | |
Protected Attributes | |
| std::deque< Titem > | items |
| Storage of the nodes. | |
| HashTable< Titem, Thash_bits_open > | open_nodes |
| Hash table of pointers to open nodes. | |
| HashTable< Titem, Thash_bits_closed > | closed_nodes |
| Hash table of pointers to closed nodes. | |
| CBinaryHeapT< Titem > | open_queue |
| Priority queue of pointers to open nodes. | |
| Titem * | new_node |
| New node under construction. | |
Hash table based node list multi-container class.
Implements open list, closed list and priority queue for A-star pathfinder.
Definition at line 21 of file nodelist.hpp.
| using NodeList< Titem, Thash_bits_open, Thash_bits_closed >::Item = Titem |
Definition at line 23 of file nodelist.hpp.
| using NodeList< Titem, Thash_bits_open, Thash_bits_closed >::Key = typename Titem::Key |
Definition at line 24 of file nodelist.hpp.
|
inline |
default constructor
Definition at line 35 of file nodelist.hpp.
|
inline |
Get closed node count.
Definition at line 53 of file nodelist.hpp.
Referenced by CYapfBaseT< Types >::FindPath().
|
inline |
Allocate new data item from items.
Definition at line 71 of file nodelist.hpp.
Referenced by CYapfBaseT< Types >::CreateNewNode().
|
inline |
Helper for creating output of this array.
| dmp | The data to dump. |
Definition at line 188 of file nodelist.hpp.
|
inline |
Find a closed node by its key.
| key | The key to look for. |
nullptr if not found. Definition at line 168 of file nodelist.hpp.
Referenced by CYapfBaseT< Types >::AddNewNode().
|
inline |
Find an open node by key.
| key | The key to look for. |
nullptr if not found. Definition at line 135 of file nodelist.hpp.
Referenced by CYapfBaseT< Types >::AddNewNode(), and CYapfBaseT< Types >::AddStartupNode().
|
inline |
Notify the nodelist that we don't want to discard the given node.
| item | The new best node. |
Definition at line 81 of file nodelist.hpp.
|
inline |
Get the open node at the begin of the open queue.
nullptr when there isn't any. Definition at line 108 of file nodelist.hpp.
Referenced by CYapfBaseT< Types >::FindPath().
|
inline |
Insert the given item into the closed nodes set.
| item | The item to add. |
Definition at line 157 of file nodelist.hpp.
Referenced by CYapfBaseT< Types >::FindPath().
|
inline |
Insert given item as open node (into open_nodes and open_queue).
| item | The node to add. |
Definition at line 94 of file nodelist.hpp.
Referenced by CYapfBaseT< Types >::AddNewNode(), and CYapfBaseT< Types >::AddStartupNode().
|
inline |
Get a particular item.
| index | The index of the item. |
Definition at line 178 of file nodelist.hpp.
|
inline |
Get open node count.
Definition at line 44 of file nodelist.hpp.
Referenced by CYapfBaseT< Types >::FindPath().
|
inline |
Remove and return the best open node.
nullptr when there isn't any. Definition at line 120 of file nodelist.hpp.
|
inline |
Find and remove an open node by key.
| key | The key to look for. |
Definition at line 145 of file nodelist.hpp.
Referenced by CYapfBaseT< Types >::AddNewNode(), and CYapfBaseT< Types >::FindPath().
|
inline |
Get the total node count.
Definition at line 62 of file nodelist.hpp.
|
protected |
Hash table of pointers to closed nodes.
Definition at line 29 of file nodelist.hpp.
|
protected |
Storage of the nodes.
Definition at line 27 of file nodelist.hpp.
|
protected |
New node under construction.
Definition at line 31 of file nodelist.hpp.
|
protected |
Hash table of pointers to open nodes.
Definition at line 28 of file nodelist.hpp.
|
protected |
Priority queue of pointers to open nodes.
Definition at line 30 of file nodelist.hpp.