Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  

TransTable< T > Class Template Reference

Transposition table. More...

#include <TransTable.hpp>

List of all members.

Classes

struct  Statistics

Public Member Functions

 TransTable (int bits)
 Creates table with 2^n slots.
 ~TransTable ()
 Destructor.
std::size_t Bits () const
 Returns lg2 of number of entries.
std::size_t Size () const
 Returns the number of slots in the TT.
void Clear ()
 Clears the table.
bool Put (hash_t hash, const T &data)
 Stores data in slot for hash.
bool Get (hash_t hash, T &data)
 Returns true if the slot for hash contains a state with that hash value, data is copied into data if so.
std::string Stats () const
 Returns statistics in string form.

Private Member Functions

 BOOST_CLASS_REQUIRE (T, benzene, TransTableStateConcept)

Private Attributes

int m_bits
std::size_t m_size
std::size_t m_mask
std::vector< T > m_data
std::vector< hash_tm_hash
Statistics m_stats

Detailed Description

template<class T>
class TransTable< T >

Transposition table.

The state class must meet the requirements of TransTableStateConcept.

Definition at line 39 of file TransTable.hpp.


Constructor & Destructor Documentation

template<typename T >
TransTable< T >::TransTable ( int  bits  )  [inline]

Creates table with 2^n slots.

Definition at line 106 of file TransTable.hpp.

References TransTable< T >::Clear().

template<typename T >
TransTable< T >::~TransTable (  )  [inline]

Destructor.

Definition at line 118 of file TransTable.hpp.


Member Function Documentation

template<typename T >
std::size_t TransTable< T >::Bits (  )  const [inline]

Returns lg2 of number of entries.

Definition at line 123 of file TransTable.hpp.

References TransTable< T >::m_bits.

template<class T>
TransTable< T >::BOOST_CLASS_REQUIRE ( ,
benzene  ,
TransTableStateConcept   
) [private]
template<typename T >
void TransTable< T >::Clear (  )  [inline]
template<typename T>
bool TransTable< T >::Get ( hash_t  hash,
T &  data 
) [inline]

Returns true if the slot for hash contains a state with that hash value, data is copied into data if so.

Otherwise, nothing is copied into data.

Definition at line 160 of file TransTable.hpp.

References TransTable< T >::Statistics::hits, TransTable< T >::m_data, TransTable< T >::m_hash, TransTable< T >::m_mask, TransTable< T >::m_stats, and TransTable< T >::Statistics::reads.

Referenced by WolveSearch::GenerateMoves().

template<typename T>
bool TransTable< T >::Put ( hash_t  hash,
const T &  data 
) [inline]

Stores data in slot for hash.

New data overwrites old only if "old.ReplaceWith(new)" is true.

Definition at line 145 of file TransTable.hpp.

References TransTable< T >::m_data, TransTable< T >::m_hash, TransTable< T >::m_mask, TransTable< T >::m_stats, TransTable< T >::Statistics::overwrites, and TransTable< T >::Statistics::writes.

Referenced by WolveSearch::AfterStateSearched().

template<typename T >
std::size_t TransTable< T >::Size (  )  const [inline]

Returns the number of slots in the TT.

Definition at line 129 of file TransTable.hpp.

References TransTable< T >::m_size.

template<typename T >
std::string TransTable< T >::Stats (  )  const [inline]

Member Data Documentation

template<class T>
int TransTable< T >::m_bits [private]

Definition at line 90 of file TransTable.hpp.

Referenced by TransTable< T >::Bits().

template<class T>
std::vector<T> TransTable< T >::m_data [private]
template<class T>
std::vector<hash_t> TransTable< T >::m_hash [private]
template<class T>
std::size_t TransTable< T >::m_mask [private]

Definition at line 94 of file TransTable.hpp.

Referenced by TransTable< T >::Get(), and TransTable< T >::Put().

template<class T>
std::size_t TransTable< T >::m_size [private]

Definition at line 92 of file TransTable.hpp.

Referenced by TransTable< T >::Clear(), and TransTable< T >::Size().

template<class T>
Statistics TransTable< T >::m_stats [private]

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


6 Jan 2011 Doxygen 1.6.3