|
Scid
4.7.0
|
This class sorts games contained into an Index. More...
#include <sortcache.h>
Public Member Functions | |
| ~SortCache () | |
| void | checkForChanges (gamenumT gameId) |
| Notify the object that a game's header data has changed. More... | |
| void | prepareForChanges () |
| Interrupt any asynchronous operation. More... | |
| size_t | select (size_t row_offset, size_t row_count, const HFilter &filter, gamenumT *result) const |
| Retrieve the sorted list of games' ids. More... | |
| size_t | sortedPosition (gamenumT gameId, const HFilter &filter) const |
| Get the sorted position of a game. More... | |
| int | incrRef (int incr) |
Static Public Member Functions | |
| static SortCache * | create (const Index *idx, const NameBase *nb, const char *criteria) |
| Create a new SortCache object, builds the hash table, and asynchronously sorts all the games. More... | |
This class sorts games contained into an Index.
Multiple SortCache objects can be created for a single Index, allowing to simultaneously sort the games by multiple criteria in an independent way.
Definition at line 46 of file sortcache.h.
| SortCache::~SortCache | ( | ) |
Definition at line 110 of file sortcache.cpp.
| void SortCache::checkForChanges | ( | gamenumT | gameId | ) |
Notify the object that a game's header data has changed.
| gameId | the id of the game whose data has been changed. |
Definition at line 238 of file sortcache.cpp.
|
static |
Create a new SortCache object, builds the hash table, and asynchronously sorts all the games.
| idx | valid pointer to an Index object, witch contains the header data of the games to be sorted. |
| nb | valid pointer to the NameBase corresponding to idx. |
| criteria | the list of fields by which games will be ordered. Each field should be followed by '+' to indicate an ascending order or by '-' for a descending order. |
Definition at line 116 of file sortcache.cpp.
|
inline |
Definition at line 144 of file sortcache.h.
|
inline |
Interrupt any asynchronous operation.
This function must be called before modifying the Index or the NameBase associated with the SortCache.
Definition at line 114 of file sortcache.h.
| size_t SortCache::select | ( | size_t | row_offset, |
| size_t | row_count, | ||
| const HFilter & | filter, | ||
| gamenumT * | result | ||
| ) | const |
Retrieve the sorted list of games' ids.
The behavior of this function is similar to the mySQL statement: SELECT gameId FROM idx WHERE filter(gameId) != 0 ORDER BY criteria LIMIT offset, row_count
| row_offset | the offset of the first row to return. The offset of the initial row is 0. | |
| row_count | maximum number of rows to return. | |
| filter | a reference to a valid (!= NULL) HFilter object. Games not included into the filter will be ignored. | |
| [out] | result | valid pointer to an array where the sorted list of games will be stored (should be able to contain at least row_count elements). |
Definition at line 160 of file sortcache.cpp.
Get the sorted position of a game.
| gameId | the id of the game. |
| filter | a reference to a valid (!= NULL) HFilter object. Games not included into the filter will be ignored, and gameId must be included into the filter. |
Definition at line 213 of file sortcache.cpp.
1.8.13