Show
Ignore:
Timestamp:
04/07/07 14:37:43 (2 years ago)
Author:
ug
Message:

Merge -r 246:248 from libkombilo main branch.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • 06/libkombilo-branches/hash_center/search.h

    r243 r249  
    4343 
    4444const char NO_CONT = 255; 
     45 
     46class SnapshotVector : public std::vector<unsigned char> { 
     47  public: 
     48    SnapshotVector(); 
     49    SnapshotVector(char* c, int size); 
     50 
     51    void pb_int(int d); 
     52    void pb_charp(char* c, int size); 
     53    void pb_char(char c); 
     54    void pb_string(std::string s); 
     55    void pb_intp(int* p, int size); 
     56 
     57    int retrieve_int(); 
     58    int* retrieve_intp(); 
     59    char retrieve_char(); 
     60    char* retrieve_charp(); 
     61    std::string retrieve_string(); 
     62 
     63    char* to_charp(); 
     64 
     65  private: 
     66    SnapshotVector::iterator current; 
     67}; 
     68 
    4569 
    4670class PatternError { 
     
    117141    Pattern(int type, int BOARDSIZE, int sX, int sY, char* iPos, char* CONTLABELS = 0); 
    118142    Pattern(const Pattern& p); 
     143    Pattern(SnapshotVector& snv); 
    119144    ~Pattern(); 
    120145    Pattern& operator=(const Pattern& p); 
     
    129154    int operator==(const Pattern& p); 
    130155    std::string printPattern(); 
     156    void to_snv(SnapshotVector& snv); 
    131157 
    132158    static int flipsX(int i, int x, int y, int XX, int YY); 
     
    148174    int lW; // black loses (where cont. is W) 
    149175    Continuation(); 
     176    void from_snv(SnapshotVector& snv); 
     177    void to_snv(SnapshotVector& snv); 
    150178}; 
    151179 
     
    190218    char* label; // this does not really contain the label, but rather the position of the continuation move 
    191219    Hit(ExtendedMoveNumber* POS, char* LABEL); 
     220    Hit(SnapshotVector& snv); // takes a SnapshotVector and reads information produced by Hit::to_snv() 
    192221    ~Hit(); 
    193222    static bool cmp_pts(Hit* a, Hit* b); 
     223    void to_snv(SnapshotVector& snv); 
    194224}; 
    195225 
     
    678708    SearchOptions(); 
    679709    SearchOptions(int FIXEDCOLOR, int NEXTMOVE, int MOVELIMIT=10000); 
     710    SearchOptions(SnapshotVector& snv); 
     711    void to_snv(SnapshotVector& snv); 
    680712}; 
    681713 
     
    690722    GameListEntry(int ID, char WINNER, std::string GAMEINFOSTR); 
    691723    ~GameListEntry(); 
     724 
     725    void hits_from_snv(SnapshotVector& snv); 
    692726}; 
    693727 
     
    754788    int Bwins; 
    755789    int Wwins; 
    756  
     790    Pattern* mrs_pattern; // most recent search pattern 
     791    SearchOptions* searchOptions; 
    757792    // ---------------------------------------------------------------------------- 
    758793    // the following methods provide the user interface 
     
    792827    void deleteTag(int tag, int i = -1) throw(DBError); 
    793828    std::vector<int> getTags(int i, int tag=0) throw(DBError); // note the order of arguments! 
    794      
     829 
    795830    // ------- duplicates --------------------------------------------------------- 
    796831    int find_duplicates(int bs, bool strict=false) throw(DBError); // return number of duplicate array 
     
    800835                                                 // The caller must free the pointer himself 
    801836                                                 // (before calling find_duplicates again). 
     837 
     838    // ------- snapshot, restore -------------------------------------------------- 
     839 
     840    int snapshot() throw(DBError); 
     841    void restore(int handle, bool del) throw(DBError); 
     842    void delete_snapshot(int handle) throw(DBError); 
     843    void delete_all_snapshots() throw(DBError); 
    802844 
    803845    // ------- misc --------------------------------------------------------------- 
     
    847889    int posHA; 
    848890    int SGFtagsSize; 
    849     int sizeX; // keeps track of width of search pattern during search 
    850891    sqlite3* algo_db1; 
    851892    sqlite3* algo_db2;