All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Types | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
osl::record::CheckDuplicate Class Reference

Container of moves to check duplicated games. More...

#include <checkDuplicate.h>

Collaboration diagram for osl::record::CheckDuplicate:
Collaboration graph
[legend]

Public Types

enum  DUPLICATE_RESULT { NO_DUPLICATE = 0, HASH_DUPLICATE = 1, MOVES_DUPLICATE = 2 }
 Result type of checking duplicates. More...
 

Public Member Functions

 CheckDuplicate ()
 Constructor. More...
 
DUPLICATE_RESULT regist (const vector< Move > &moves)
 Insert a key if the key is new. More...
 
void print (std::ostream &out) const
 Output the result. More...
 
size_t getRegists () const
 Return a couter of registings (trials) More...
 
size_t getDuplicatedHash () const
 Return a counter of duplicated ending states. More...
 
size_t getDuplicatedMoves () const
 Return a counter of duplicated moves. More...
 

Static Public Member Functions

static std::pair< HashKey,
PathEncoding
getLastState (const vector< Move > &moves)
 

Private Types

typedef hash_map< HashKey,
vector< PathEncoding > > 
keymap_t
 

Private Member Functions

DUPLICATE_RESULT regist (const HashKey &key, const PathEncoding &moves)
 Insert a key if the key is new. More...
 

Private Attributes

keymap_t keys
 container of moves More...
 
size_t regist_counter
 couter for registing (trials) More...
 
size_t duplicated_hash_counter
 counter for hash matches with different moves More...
 
size_t duplicated_moves_counter
 counter for exact matches of moves More...
 

Detailed Description

Container of moves to check duplicated games.

Definition at line 20 of file checkDuplicate.h.

Member Typedef Documentation

typedef hash_map<HashKey, vector<PathEncoding> > osl::record::CheckDuplicate::keymap_t
private

Definition at line 22 of file checkDuplicate.h.

Member Enumeration Documentation

Result type of checking duplicates.

Enumerator
NO_DUPLICATE 
HASH_DUPLICATE 
MOVES_DUPLICATE 

Definition at line 38 of file checkDuplicate.h.

Constructor & Destructor Documentation

osl::record::CheckDuplicate::CheckDuplicate ( )
inline

Constructor.

Definition at line 48 of file checkDuplicate.h.

Member Function Documentation

size_t osl::record::CheckDuplicate::getDuplicatedHash ( ) const
inline

Return a counter of duplicated ending states.

The moves may or may not match.

Definition at line 80 of file checkDuplicate.h.

References duplicated_hash_counter.

size_t osl::record::CheckDuplicate::getDuplicatedMoves ( ) const
inline

Return a counter of duplicated moves.

The moves are exactly same.

Definition at line 86 of file checkDuplicate.h.

References duplicated_moves_counter.

std::pair< osl::HashKey, osl::PathEncoding > osl::record::CheckDuplicate::getLastState ( const vector< Move > &  moves)
static

Definition at line 8 of file checkDuplicate.cc.

References osl::BLACK, and osl::PathEncoding::pushMove().

size_t osl::record::CheckDuplicate::getRegists ( ) const
inline

Return a couter of registings (trials)

Definition at line 73 of file checkDuplicate.h.

References regist_counter.

void osl::record::CheckDuplicate::print ( std::ostream &  out) const

Output the result.

Definition at line 62 of file checkDuplicate.cc.

Referenced by main().

osl::record::CheckDuplicate::DUPLICATE_RESULT osl::record::CheckDuplicate::regist ( const vector< Move > &  moves)

Insert a key if the key is new.

The key is the last state of the moves.

Parameters
moves
Returns
false if (i) the key is new or (ii) duplicated with different moves; true if the moves are exactly found in this container.

Definition at line 23 of file checkDuplicate.cc.

Referenced by process(), readFile(), and run().

osl::record::CheckDuplicate::DUPLICATE_RESULT osl::record::CheckDuplicate::regist ( const HashKey &  key,
const PathEncoding moves 
)
private

Insert a key if the key is new.

Parameters
keya hash key of the last state of the moves
moves
Returns
false if (i) the key is new or (ii) duplicated with different moves; true if the moves are exactly found in this container.

Definition at line 30 of file checkDuplicate.cc.

References osl::find(), and moves.

Member Data Documentation

size_t osl::record::CheckDuplicate::duplicated_hash_counter
private

counter for hash matches with different moves

Definition at line 28 of file checkDuplicate.h.

Referenced by getDuplicatedHash().

size_t osl::record::CheckDuplicate::duplicated_moves_counter
private

counter for exact matches of moves

Definition at line 30 of file checkDuplicate.h.

Referenced by getDuplicatedMoves().

keymap_t osl::record::CheckDuplicate::keys
private

container of moves

Definition at line 24 of file checkDuplicate.h.

size_t osl::record::CheckDuplicate::regist_counter
private

couter for registing (trials)

Definition at line 26 of file checkDuplicate.h.

Referenced by getRegists().


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