diff options
Diffstat (limited to 'meowpp/gra/FeaturePointsMatch_K_Match.h')
-rw-r--r-- | meowpp/gra/FeaturePointsMatch_K_Match.h | 38 |
1 files changed, 17 insertions, 21 deletions
diff --git a/meowpp/gra/FeaturePointsMatch_K_Match.h b/meowpp/gra/FeaturePointsMatch_K_Match.h index ca47d27..f1fff12 100644 --- a/meowpp/gra/FeaturePointsMatch_K_Match.h +++ b/meowpp/gra/FeaturePointsMatch_K_Match.h @@ -1,13 +1,10 @@ #ifndef gra_FeaturePointsMatch_K_Match_H__ #define gra_FeaturePointsMatch_K_Match_H__ -#include "../dsa/VP_Tree.h" - #include "FeaturePointsMatch.h" #include "../Self.h" - - +#include "../dsa/VP_Tree.h" #include "../oo/ObjBase.h" #include <cstdlib> @@ -19,20 +16,20 @@ class FeaturePointsMatch_K_Match: public FeaturePointsMatch<Scalar, Description> { # define FPMKM FeaturePointsMatch_K_Match public: - typedef std::vector<FeaturePoint<Scalar, Description> > FeaturePoints; + typedef std::vector<FeaturePoint<Scalar, Description> > FeaturePoints ; typedef std::vector<FeaturePoints > FeaturePointss; private: struct Node { - size_t id_; - size_t index_; - FeaturePointss const* ptr_; + size_t id_; + size_t index_; + FeaturePointss const* ptr_; Node() { } Node(Node const& nd) { - id_ = nd.id_; + id_ = nd. id_; index_ = nd.index_; - ptr_ = nd.ptr_; + ptr_ = nd. ptr_; } Node(size_t id, size_t index, FeaturePointss const* ptr) { id_ = id; @@ -48,30 +45,30 @@ private: return (*ptr_)[id_][index_][id]; } }; + struct Myself { size_t k_; Myself() { k_ = 1; } - ~Myself() { + Myself(size_t k): k_(k) { } - Myself& copyFrom(Myself const& m) { - k_ = m.k_; - return *this; + Myself(Myself const& m): k_(m.k_) { + } + ~Myself() { } }; Self<Myself> const self; public: - FPMKM(): self(true) { + FPMKM(): self() { } - FPMKM(FPMKM const& m): self(false) { + FPMKM(FPMKM const& m): self(m.self, Self<Myself>::COPY_FROM) { self().copyFrom(m.self); } - FPMKM(size_t k): self(true) { - self()->k_ = k; + FPMKM(size_t k): self(Myself(k)) { } ~FPMKM() { @@ -175,8 +172,7 @@ public: } char const* ctype() const { - static char const* ptr = typeid(*this).name(); - return ptr; + return typeid(*this).name(); } std::string type() const { @@ -185,6 +181,6 @@ public: # undef FPMKM }; -} +} // meow #endif // gra_FeaturePointsMatch_K_Match_H__ |