Assignment Search Framework
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Pages
NodeTable< node_t > Class Template Reference

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...
 

Detailed Description

template<class node_t>
class NodeTable< node_t >

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.

Todo:
Change the NodeKeyHash so that we can check the state if the hash function isn't injective.

Constructor & Destructor Documentation

template<class node_t >
NodeTable< node_t >::NodeTable ( )
inline

The constructor for the node table. Does nothing.

template<class node_t >
NodeTable< node_t >::~NodeTable ( )
inlinevirtual

Destructor for the node table. Does nothing.

Member Function Documentation

template<class node_t>
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.

Parameters
new_nodeThe new node to store.
hash_valueThe hash value to associate the node with.
Returns
The ID of the added node.
template<class node_t >
void NodeTable< node_t >::clear ( )

Clears the node table.

template<class node_t >
node_t & NodeTable< node_t >::getNode ( NodeID  node_id)

Returns a reference to the node with the given id.

Does not check if no such node exists.

Parameters
node_idThe id of the node to return.
Returns
A reference to the node to return.
template<class node_t >
const node_t & NodeTable< node_t >::getNode ( NodeID  node_id) const
template<class node_t >
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.

Parameters
hash_valueThe hash value searching for.
idThe id of the node is set if it is found.
Returns
If there is already a node associated with the given hash value.
template<class node_t >
node_t & NodeTable< node_t >::operator[] ( NodeID  node_id)

Returns a reference to the node with the given id.

Does not check if no such node exists.

Parameters
node_idThe id of the node to return.
Returns
A refernce to the node with the given id.
template<class node_t >
const node_t & NodeTable< node_t >::operator[] ( NodeID  node_id) const
template<class node_t >
std::size_t NodeTable< node_t >::size ( ) const
inline

Returns the number of nodes in the node table.

Returns
Numb

Member Data Documentation

template<class node_t>
NodeMap NodeTable< node_t >::node_map
protected

The map used to determine if a hash value is already associated with a node.

template<class node_t>
std::vector<node_t> NodeTable< node_t >::nodes
protected

A list of the nodes being stored.


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