Skip to content

v0.2.54..v0.2.55 changeset ProbabilityOfMatch.cpp

Garret Voltz edited this page Aug 14, 2020 · 1 revision
diff --git a/hoot-core/src/main/cpp/hoot/core/algorithms/ProbabilityOfMatch.cpp b/hoot-core/src/main/cpp/hoot/core/algorithms/ProbabilityOfMatch.cpp
index fa997ee..c0c1f82 100644
--- a/hoot-core/src/main/cpp/hoot/core/algorithms/ProbabilityOfMatch.cpp
+++ b/hoot-core/src/main/cpp/hoot/core/algorithms/ProbabilityOfMatch.cpp
@@ -22,7 +22,7 @@
  * This will properly maintain the copyright information. DigitalGlobe
  * copyrights will be updated automatically.
  *
- * @copyright Copyright (C) 2015, 2016, 2017, 2018, 2019 DigitalGlobe (http://www.digitalglobe.com/)
+ * @copyright Copyright (C) 2015, 2016, 2017, 2018, 2019, 2020 DigitalGlobe (http://www.digitalglobe.com/)
  */
 
 #include "ProbabilityOfMatch.h"
@@ -57,8 +57,6 @@ using namespace Tgs;
 namespace hoot
 {
 
-std::shared_ptr<ProbabilityOfMatch> ProbabilityOfMatch::_theInstance;
-
 ProbabilityOfMatch::ProbabilityOfMatch()
 {
   _parallelExp = ConfigOptions().getMatchParallelExponent();
@@ -137,14 +135,12 @@ double ProbabilityOfMatch::distanceScore(const ConstOsmMapPtr& map, const ConstW
 
 ProbabilityOfMatch& ProbabilityOfMatch::getInstance()
 {
-  if (!_theInstance.get())
-  {
-    _theInstance.reset(new ProbabilityOfMatch());
-  }
-  return *_theInstance;
+  //  Local static singleton instance
+  static ProbabilityOfMatch instance;
+  return instance;
 }
 
-double ProbabilityOfMatch::lengthScore(const ConstOsmMapPtr &map, const ConstWayPtr& w1,
+double ProbabilityOfMatch::lengthScore(const ConstOsmMapPtr& map, const ConstWayPtr& w1,
   const ConstWayPtr &w2)
 {
   Meters l1 = ElementConverter(map).convertToLineString(w1)->getLength();
@@ -184,8 +180,7 @@ double ProbabilityOfMatch::expertProbability(const ConstOsmMapPtr& map, const Co
   return ds * ps * as * zs * ls;
 }
 
-double ProbabilityOfMatch::zipperScore(const ConstWayPtr& w1,
-                                       const ConstWayPtr& w2)
+double ProbabilityOfMatch::zipperScore(const ConstWayPtr& w1, const ConstWayPtr& w2)
 {
   double result = 1.0;
 
Clone this wiki locally