diff EditDistance.hpp @ 16:06166d6c083b

Add configuration processing. Cache DB values Add a custom RBTree to save space. Track multiple DB connections properly. More testing. Add ValueExistsException.
author Tom Fredrik Blenning Klaussen <bfg@blenning.no>
date Tue, 28 Aug 2012 18:58:02 +0200
parents a3834af36579
children fda70a362ed5
line wrap: on
line diff
--- a/EditDistance.hpp	Sat Aug 25 01:42:13 2012 +0200
+++ b/EditDistance.hpp	Tue Aug 28 18:58:02 2012 +0200
@@ -2,6 +2,8 @@
 #define EDITDISTANCE_HPP
 
 #include "OrderedPair.hpp"
+#include "DBCache.hpp"
+#include "UniqueString.hpp"
 
 #include <QtCore/QString>
 #include <QtCore/QMap>
@@ -11,14 +13,16 @@
 
 class EditDistance {
 protected:
-  typedef ThreadSafeLookup<OrderedPair<QString>, int> cacheType;
+  //typedef ThreadSafeLookup<OrderedPair<QString>, int> cacheType;
+  typedef DBCache<OrderedPair<UniqueString>, int, true> cacheType;
   //typedef QMap<OrderedPair<QString>, int> cacheType;
   //typedef QHash<OrderedPair<QString>, int> cacheType;
 public:
   static int Compute(QString a, QString b, bool removeDiacritics = false);
   static QString removeDiacritics(QString in);
 
-  static cacheType cache; 
+  //static cacheType cache; 
+  static cacheType* cache;
 };
 
 #endif //EDITDISTANCE_HPP