Changeset 14274 for lang/python
- Timestamp:
- 06/20/08 00:25:01 (5 months ago)
- Location:
- lang/python/incsearch
- Files:
-
- 2 added
- 4 modified
-
include/DocDb.h (modified) (1 diff)
-
incsearch/__init__.py (added)
-
incsearch/incsearch.i (modified) (1 diff)
-
setup.py (added)
-
src/DocDb.cpp (modified) (3 diffs)
-
src/test.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
lang/python/incsearch/include/DocDb.h
r14238 r14274 6 6 #include <vector> 7 7 8 using namespace qdbm;9 10 8 namespace incsearch{ 11 9 12 10 class DocDbWriter{ 13 11 private: 14 Villa villa;12 qdbm::Villa villa; 15 13 public: 16 14 DocDbWriter(const std::string& dbname); 17 15 ~DocDbWriter(); 18 void put(const std::string& word, const std::string& fname, const std::string& name);16 void put(const std::string& word, const std::string& data); 19 17 }; 20 18 21 19 class DocDbReader{ 22 20 private: 23 Villa villa;21 qdbm::Villa villa; 24 22 boost::mutex mtx; 25 23 public: -
lang/python/incsearch/incsearch/incsearch.i
r14238 r14274 1 %module 1 %module db 2 2 3 3 %include "std_vector.i" 4 %include "std_string.i" 4 5 %{ 5 6 #include <vector> 6 #include "ward.h" 7 #include "wardupdator.h" 7 #include <string> 8 #include <boost/thread/thread.hpp> 9 #include <xvilla.h> 10 #include "DocDb.h" 8 11 %} 9 %include " ward.h"12 %include "DocDb.h" 10 13 11 %template(SizeVec) std::vector<std::size_t>; 12 %template(DoubleVec) std::vector<double>; 13 %template(Matrix) std::vector<std::vector<double> >; 14 %template(Histories) std::vector<History>; 14 %template(StringVec) std::vector<std::string>; 15 15 -
lang/python/incsearch/src/DocDb.cpp
r14238 r14274 5 5 6 6 #include "DocDb.h" 7 using namespace qdbm;8 7 9 8 namespace incsearch{ 10 DocDbWriter::DocDbWriter(const std::string& dbname): villa(dbname.c_str(), Villa::OWRITER |Villa::OCREAT)9 DocDbWriter::DocDbWriter(const std::string& dbname): villa(dbname.c_str(), qdbm::Villa::OWRITER | qdbm::Villa::OCREAT) 11 10 {} 12 11 … … 16 15 } 17 16 18 void DocDbWriter::put(const std::string& word, const std::string& fname, const std::string& name){ 19 std::string val = fname+"\t"+name; 20 villa.put(word.c_str(), word.size()+1, val.c_str(), val.size()+1, Villa::DDUP); 17 void DocDbWriter::put(const std::string& word, const std::string& data){ 18 villa.put(word.c_str(), word.size()+1, data.c_str(), data.size()+1, qdbm::Villa::DDUP); 21 19 } 22 20 23 DocDbReader::DocDbReader(const std::string& dbname): villa(dbname.c_str(), Villa::OREADER), mtx()21 DocDbReader::DocDbReader(const std::string& dbname): villa(dbname.c_str(), qdbm::Villa::OREADER), mtx() 24 22 {} 25 23 … … 55 53 villa.curnext(); 56 54 } 57 }catch( Villa_error& e){58 if(e.code() != Villa::ENOITEM) throw e;55 }catch(qdbm::Villa_error& e){ 56 if(e.code() != qdbm::Villa::ENOITEM) throw e; 59 57 } 60 58 } -
lang/python/incsearch/src/test.cpp
r14238 r14274 19 19 {//このスコープでDB作成 20 20 DocDbWriter d("sample"); 21 d.put("ABC", "FF1 ", "NN1");22 d.put("ABD", "FF2 ", "NN2");23 d.put("AB", "FF3 ", "NN3");24 d.put("XYZ", "FF4 ", "NN4");25 d.put("XYX", "FF5 ", "NN5");26 d.put("XAB", "FF6 ", "NN6");21 d.put("ABC", "FF1\tNN1"); 22 d.put("ABD", "FF2\tNN2"); 23 d.put("AB", "FF3\tNN3"); 24 d.put("XYZ", "FF4\tNN4"); 25 d.put("XYX", "FF5\tNN5"); 26 d.put("XAB", "FF6\tNN6"); 27 27 } 28 28
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)