OpenTTD Source  20241121-master-g67a0fccfad
NodeList< Titem, Thash_bits_open, Thash_bits_closed > Class Template Reference

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 ()
 return number of open nodes
 
int ClosedCount ()
 return number of closed nodes
 
int TotalCount ()
 return the total number of nodes.
 
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 m_open and m_open_queue)
 
Titem * GetBestOpenNode ()
 return the best open node
 
Titem * PopBestOpenNode ()
 remove and return the best open node
 
Titem * FindOpenNode (const Key &key)
 return the open node specified by a key or nullptr if not found
 
Titem & PopOpenNode (const Key &key)
 remove and return the open node specified by a key
 
void InsertClosedNode (Titem &item)
 close node
 
Titem * FindClosedNode (const Key &key)
 return the closed node specified by a key or nullptr if not found
 
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.
 

Detailed Description

template<class Titem, int Thash_bits_open, int Thash_bits_closed>
class NodeList< Titem, Thash_bits_open, Thash_bits_closed >

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.


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