Assignment Search Framework
|
Public Member Functions | |
NodeTable () | |
virtual | ~NodeTable () |
bool | isNodeStored (StateHash hash_value, NodeID &id) const |
NodeID | addNewSearchNode (node_t new_node, StateHash hash_value) |
void | clear () |
std::size_t | size () const |
node_t & | getNode (NodeID node_id) |
const node_t & | getNode (NodeID node_id) const |
node_t & | operator[] (NodeID node_id) |
const node_t & | operator[] (NodeID node_id) const |
Protected Attributes | |
std::vector< node_t > | nodes |
A list of the nodes being stored. More... | |
NodeMap | node_map |
The map used to determine if a hash value is already associated with a node. More... | |
A table of search nodes that maintains a hash map that can be used to tell if items are already held in the table.
The node type is a a template type, and so can be anything. It uses the given hash value to determine if the item is already there. The ID of a node is the location in the table.
The constructor for the node table. Does nothing.
Destructor for the node table. Does nothing.
NodeID NodeTable< node_t >::addNewSearchNode | ( | node_t | new_node, |
StateHash | hash_value | ||
) |
Adds the given search node to the node table.
Assumes the hash value is not already associated with a node.
new_node | The new node to store. |
hash_value | The hash value to associate the node with. |
void NodeTable< node_t >::clear | ( | ) |
Clears the node table.
Returns a reference to the node with the given id.
Does not check if no such node exists.
node_id | The id of the node to return. |
bool NodeTable< node_t >::isNodeStored | ( | StateHash | hash_value, |
NodeID & | id | ||
) | const |
Returns whether the node with the given hash value is already stored.
The ID is set to the stored node id if it is already stored.
hash_value | The hash value searching for. |
id | The id of the node is set if it is found. |
Returns a reference to the node with the given id.
Does not check if no such node exists.
node_id | The id of the node to return. |
|
inline |
Returns the number of nodes in the node table.
|
protected |
The map used to determine if a hash value is already associated with a node.
|
protected |
A list of the nodes being stored.