|
OpenTTD Source
14.0-beta1
|
Go to the documentation of this file.
13 #include "../../tile_type.h"
14 #include "../../track_type.h"
30 static const int BINARY_HEAP_BLOCKSIZE;
32 static const int BINARY_HEAP_BLOCKSIZE_MASK;
34 void Init(uint max_size);
36 bool Push(
void *item,
int priority);
38 bool Delete(
void *item,
int priority);
39 void Clear(
bool free_values);
40 void Free(
bool free_values);
94 void Clear(
bool free_values);
95 void Delete(
bool free_values);
107 void PrintStatistics()
const;
HashNode * FindNode(TileIndex tile, Trackdir dir, HashNode **prev_out) const
Finds the node that that saves this key pair.
void Clear(bool free_values)
Clears the queue, by removing all values from it.
void Delete(bool free_values)
Deletes the hash and cleans up.
bool Delete(void *item, int priority)
Deletes the item from the queue.
void * Set(TileIndex tile, Trackdir dir, void *value)
Sets the value associated with the given key pair to the given value.
BinaryHeapNode & GetElement(uint i)
Get an element from the #elements.
uint blocks
The amount of blocks for which space is reserved in elements.
uint GetSize() const
Gets the current size of the hash.
void Init(Hash_HashProc *hash, uint num_buckets)
Builds a new hash in an existing struct.
void * Pop()
Pops the first element from the queue.
void * DeleteValue(TileIndex tile, Trackdir dir)
Deletes the value with the specified key pair from the hash and returns that value.
uint Hash_HashProc(TileIndex tile, Trackdir dir)
Generates a hash code from the given key pair.
static const int BINARY_HEAP_BLOCKSIZE_BITS
The number of elements that will be malloc'd at a time.
void Free(bool free_values)
Frees the queue, by reclaiming all memory allocated by it.
Trackdir
Enumeration for tracks and directions.
bool Push(void *item, int priority)
Pushes an element into the queue, at the appropriate place for the queue.
void Init(uint max_size)
Initializes a binary heap and allocates internal memory for maximum of max_size elements.
void * Get(TileIndex tile, Trackdir dir) const
Gets the value associated with the given key pair, or nullptr when it is not present.
void Clear(bool free_values)
Cleans the hash, but keeps the memory allocated.