Scid  4.6.5
Classes | Public Member Functions | Static Public Member Functions | List of all members
NameBase Class Reference

#include <namebase.h>

Public Member Functions

 NameBase ()
 
 ~NameBase ()
 
void Clear ()
 NameBase::clear() - clears file associations and frees memory. More...
 
errorT Create (const char *filename)
 NameBase::Create() - Create an empty NameBase file : the filename (without extension) More...
 
errorT ReadEntireFile (const char *filename)
 NameBase::ReadNameFile() - Reads a NameBase file into memory. More...
 
errorT flush (const Index *idx)
 
void hackedNameFreq ()
 
const char * GetName (nameT nt, idNumberT id) const
 
eloT GetElo (idNumberT id) const
 
errorT AddName (nameT nt, const char *str, idNumberT *idPtr)
 NameBase::AddName() - Returns the idNumberT corresponding to : a valid name type : the name to lookup/add : valid pointer to the idNumberT object where the result will be stored. More...
 
void AddElo (idNumberT id, eloT elo)
 
errorT FindExactName (nameT nt, const char *str, idNumberT *idPtr) const
 
uint GetFirstMatches (nameT nt, const char *str, uint maxMatches, idNumberT *array) const
 
idNumberT GetNumNames (nameT n) const
 
std::vector< uint32_t > generateHashMap (nameT nt) const
 

Static Public Member Functions

static bool IsValidNameType (nameT nt)
 
static nameT NameTypeFromString (const char *str)
 
static const char * Suffix ()
 

Detailed Description

Definition at line 49 of file namebase.h.

Constructor & Destructor Documentation

NameBase::NameBase ( )
inline

Definition at line 83 of file namebase.h.

NameBase::~NameBase ( )
inline

Definition at line 84 of file namebase.h.

Member Function Documentation

void NameBase::AddElo ( idNumberT  id,
eloT  elo 
)
inline

Definition at line 101 of file namebase.h.

errorT NameBase::AddName ( nameT  nt,
const char *  str,
idNumberT idPtr 
)

NameBase::AddName() - Returns the idNumberT corresponding to : a valid name type : the name to lookup/add : valid pointer to the idNumberT object where the result will be stored.

This function ensure that a name is stored inside the NameBase object and return the corresponding idNumberT in . Names are not duplicated inside a NameBase object, multiple calls to AddName() with equal and will result in the same idNumberT. Return OK if successful.

Definition at line 291 of file namebase.cpp.

void NameBase::Clear ( )

NameBase::clear() - clears file associations and frees memory.

Clears file associations and frees memory, leaving the object empty.

Definition at line 38 of file namebase.cpp.

errorT NameBase::Create ( const char *  filename)

NameBase::Create() - Create an empty NameBase file : the filename (without extension)

Create a NameBase file that contains only the header and no names. Return OK if successful.

Definition at line 83 of file namebase.cpp.

errorT NameBase::FindExactName ( nameT  nt,
const char *  str,
idNumberT idPtr 
) const

Definition at line 328 of file namebase.cpp.

errorT NameBase::flush ( const Index idx)
inline

Definition at line 89 of file namebase.h.

std::vector<uint32_t> NameBase::generateHashMap ( nameT  nt) const
inline

Definition at line 109 of file namebase.h.

eloT NameBase::GetElo ( idNumberT  id) const
inline

Definition at line 98 of file namebase.h.

uint NameBase::GetFirstMatches ( nameT  nt,
const char *  str,
uint  maxMatches,
idNumberT array 
) const

Definition at line 347 of file namebase.cpp.

const char* NameBase::GetName ( nameT  nt,
idNumberT  id 
) const
inline

Definition at line 97 of file namebase.h.

idNumberT NameBase::GetNumNames ( nameT  n) const
inline

Definition at line 107 of file namebase.h.

void NameBase::hackedNameFreq ( )
inline

Definition at line 95 of file namebase.h.

static bool NameBase::IsValidNameType ( nameT  nt)
inlinestatic

Definition at line 79 of file namebase.h.

nameT NameBase::NameTypeFromString ( const char *  str)
static

Definition at line 370 of file namebase.cpp.

errorT NameBase::ReadEntireFile ( const char *  filename)

NameBase::ReadNameFile() - Reads a NameBase file into memory.

: the filename (without extension) of the file to be read

A NameBase file starts with an header containing:

  • header_magic (8 bytes): identify the file format
  • unused (4 bytes): obsolete timeStamp
  • number of NAME_PLAYER names stored in the file (3 bytes)
  • number of NAME_EVENT names stored in the file (3 bytes)
  • number of NAME_SITE names stored in the file (3 bytes)
  • number of NAME_ROUND names stored in the file (3 bytes)
  • unused (12 bytes): obsolete max frequency Names are stored using front-coding and each record is composed by:
  • name_id (2-3 bytes): the idx (idNumberT) stored in the Index (.si4) file
  • unused (1-3 bytes): obsolete frequency
  • length (1 byte): the total number of bytes of the name (max 255)
  • prefix (1 byte): the number of bytes in common with the previous name
  • name (0-255 bytes): the part of the name that differs from the previous one. Return OK if successful.

Definition at line 110 of file namebase.cpp.

static const char* NameBase::Suffix ( )
inlinestatic

Definition at line 81 of file namebase.h.


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