Scid  4.7.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Functions
DBasePool Namespace Reference

Functions

void init ()
 init() - initialize the pool of databases. More...
 
void closeAll ()
 closeAll() - close all the databases in the pool. More...
 
int find (const char *filename)
 find() - search for a database. More...
 
scidBaseTgetBase (int baseHandle)
 getBase() - get a database from the pool. More...
 
int getClipBase ()
 getClipBase() - return the handle of the clipbase More...
 
scidBaseTgetFreeSlot ()
 getFreeSlot() - search for a free database slot. More...
 
std::vector< int > getHandles ()
 getHandles() - get the handles of opened databases. More...
 
int switchCurrent (scidBaseT *dbase=0)
 switchCurrent() - DEPRECATED. More...
 

Function Documentation

◆ closeAll()

void DBasePool::closeAll ( )

closeAll() - close all the databases in the pool.

Call this function just once before ending the program. This function close all the managed databases ensuring that resources are released and changes are flushed to disks.

Definition at line 46 of file dbasepool.cpp.

◆ find()

int DBasePool::find ( const char *  filename)

find() - search for a database.

Parameters
filenamethe filename of the wanted database. Database in native Scid format do not use extension ("example"). Other databases require file extension ("example.pgn").
Returns
  • the handle of the database corresponding to filename.
  • 0 if not found.

Definition at line 51 of file dbasepool.cpp.

◆ getBase()

scidBaseT * DBasePool::getBase ( int  baseHandle)

getBase() - get a database from the pool.

Parameters
baseHandlethe handle of the wanted database.
Returns
  • the handle of the database corresponding to filename.
  • a pointer to the scidBaseT object corresponding to baseHandle.
  • 0 (nullptr) if baseHandle is invalid.

Definition at line 59 of file dbasepool.cpp.

◆ getClipBase()

int DBasePool::getClipBase ( )

getClipBase() - return the handle of the clipbase

The clipbase is a special memory database that is always open and valid.

Returns
  • the handle of the database corresponding to filename.
  • the handle of the clipbase.

Definition at line 65 of file dbasepool.cpp.

◆ getFreeSlot()

scidBaseT * DBasePool::getFreeSlot ( )

getFreeSlot() - search for a free database slot.

Returns
  • the handle of the database corresponding to filename.
  • a pointer to an available scidBaseT object.
  • 0 (nullptr) if there are no free slots.

Definition at line 69 of file dbasepool.cpp.

◆ getHandles()

std::vector< int > DBasePool::getHandles ( )

getHandles() - get the handles of opened databases.

Returns
  • the handle of the database corresponding to filename.
  • a std::vector containing the handles of opened databases.

Definition at line 76 of file dbasepool.cpp.

◆ init()

void DBasePool::init ( )

init() - initialize the pool of databases.

Call this function just once at the beginning of the program.

Definition at line 37 of file dbasepool.cpp.

◆ switchCurrent()

int DBasePool::switchCurrent ( scidBaseT dbase = 0)

switchCurrent() - DEPRECATED.

Parameters
dbasea pointer to the new "current" database. If 0 the function just return the "current" database handle.

Some legacy code assume that exist only one database. The hack to use that code is to make a database the "current" one.

Returns
  • the handle of the database corresponding to filename.
  • the handle of the new "current" database.

Definition at line 84 of file dbasepool.cpp.