Changeset 248 for 06/libkombilo/search.h
- Timestamp:
- 04/07/07 00:25:03 (1 year ago)
- Files:
-
- 06/libkombilo/search.h (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
06/libkombilo/search.h
r239 r248 42 42 43 43 const char NO_CONT = 255; 44 45 class SnapshotVector : public std::vector<unsigned char> { 46 public: 47 SnapshotVector(); 48 SnapshotVector(char* c, int size); 49 50 void pb_int(int d); 51 void pb_charp(char* c, int size); 52 void pb_char(char c); 53 void pb_string(std::string s); 54 void pb_intp(int* p, int size); 55 56 int retrieve_int(); 57 int* retrieve_intp(); 58 char retrieve_char(); 59 char* retrieve_charp(); 60 std::string retrieve_string(); 61 62 char* to_charp(); 63 64 private: 65 SnapshotVector::iterator current; 66 }; 67 44 68 45 69 class PatternError { … … 113 137 Pattern(int type, int BOARDSIZE, int sX, int sY, char* iPos, char* CONTLABELS = 0); 114 138 Pattern(const Pattern& p); 139 Pattern(SnapshotVector& snv); 115 140 ~Pattern(); 116 141 Pattern& operator=(const Pattern& p); … … 123 148 int operator==(const Pattern& p); 124 149 std::string printPattern(); 150 void to_snv(SnapshotVector& snv); 125 151 126 152 static int flipsX(int i, int x, int y, int XX, int YY); … … 141 167 int lW; // black loses (where cont. is W) 142 168 Continuation(); 169 void from_snv(SnapshotVector& snv); 170 void to_snv(SnapshotVector& snv); 143 171 }; 144 172 … … 179 207 char* label; // this does not really contain the label, but rather the position of the continuation move 180 208 Hit(ExtendedMoveNumber* POS, char* LABEL); 209 Hit(SnapshotVector& snv); // takes a SnapshotVector and reads information produced by Hit::to_snv() 181 210 ~Hit(); 182 211 static bool cmp_pts(Hit* a, Hit* b); 212 void to_snv(SnapshotVector& snv); 183 213 }; 184 214 … … 564 594 SearchOptions(); 565 595 SearchOptions(int FIXEDCOLOR, int NEXTMOVE, int MOVELIMIT=10000); 596 SearchOptions(SnapshotVector& snv); 597 void to_snv(SnapshotVector& snv); 566 598 }; 567 599 … … 576 608 GameListEntry(int ID, char WINNER, std::string GAMEINFOSTR); 577 609 ~GameListEntry(); 610 611 void hits_from_snv(SnapshotVector& snv); 578 612 }; 579 613 … … 596 630 const int OMIT_DUPLICATES = 4; 597 631 const int OMIT_GAMES_WITH_SGF_ERRORS = 8; 598 const int INDEX_OUT_OF_RANGE = 16;599 632 600 633 // process return values … … 612 645 const int IS_DUPLICATE = 4; 613 646 const int NOT_INSERTED_INTO_DB = 8; 647 const int INDEX_OUT_OF_RANGE = 16; 614 648 615 649 … … 640 674 int Bwins; 641 675 int Wwins; 642 676 Pattern* mrs_pattern; // most recent search pattern 677 SearchOptions* searchOptions; 643 678 // ---------------------------------------------------------------------------- 644 679 // the following methods provide the user interface … … 678 713 void deleteTag(int tag, int i = -1) throw(DBError); 679 714 std::vector<int> getTags(int i, int tag=0) throw(DBError); // note the order of arguments! 680 715 681 716 // ------- duplicates --------------------------------------------------------- 682 717 int find_duplicates(int bs, bool strict=false) throw(DBError); // return number of duplicate array … … 686 721 // The caller must free the pointer himself 687 722 // (before calling find_duplicates again). 723 724 // ------- snapshot, restore -------------------------------------------------- 725 726 int snapshot() throw(DBError); 727 void restore(int handle, bool del) throw(DBError); 728 void delete_snapshot(int handle) throw(DBError); 729 void delete_all_snapshots() throw(DBError); 688 730 689 731 // ------- misc --------------------------------------------------------------- … … 733 775 int posHA; 734 776 int SGFtagsSize; 735 int sizeX; // keeps track of width of search pattern during search736 777 sqlite3* algo_db1; 737 778 sqlite3* algo_db2;
