OpenTTD Source
1.11.0-beta2
|
Go to the documentation of this file.
27 static const int BINARY_HEAP_BLOCKSIZE;
29 static const int BINARY_HEAP_BLOCKSIZE_MASK;
31 void Init(uint max_size);
33 bool Push(
void *item,
int priority);
35 bool Delete(
void *item,
int priority);
36 void Clear(
bool free_values);
37 void Free(
bool free_values);
86 void *
Get(uint key1, uint key2)
const;
87 void *
Set(uint key1, uint key2,
void *value);
91 void Clear(
bool free_values);
92 void Delete(
bool free_values);
104 void PrintStatistics()
const;
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.
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 * Set(uint key1, uint key2, void *value)
Sets the value associated with the given key pair to the given value.
void * DeleteValue(uint key1, uint key2)
Deletes the value with the specified key pair from the hash and returns that value.
void * Get(uint key1, uint key2) const
Gets the value associated with the given key pair, or nullptr when it is not present.
void * Pop()
Pops the first element from the queue.
HashNode * FindNode(uint key1, uint key2, HashNode **prev_out) const
Finds the node that that saves this 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.
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 Clear(bool free_values)
Cleans the hash, but keeps the memory allocated.
uint Hash_HashProc(uint key1, uint key2)
Generates a hash code from the given key pair.