Go to the documentation of this file.00001
00002 #ifndef TripleMatchSet_h_
00003 #define TripleMatchSet_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #include <mvl/MatchSet.h>
00034 #include <mvl/PairMatchSet.h>
00035 #include <vcl_cstdlib.h>
00036 #include <vcl_iosfwd.h>
00037
00038 class TripleMatchSet : public MatchSet
00039 {
00040 protected:
00041 TripleMatchSet(PairMatchSet* match12, PairMatchSet* match23);
00042 public:
00043 TripleMatchSet(int i1_max, int i2_max, int i3_max);
00044 ~TripleMatchSet();
00045
00046 void clear_matches();
00047 void clear_nontriplets();
00048 int count() const;
00049
00050 bool add_match(int i, int ii, int iii);
00051 bool delete_match(int i1, int i2, int i3);
00052 bool contains(int i1, int i2, int i3);
00053
00054 bool get_1(int i1, int* i1out, int* i2out, int* i3out) const;
00055 bool get_2(int i2, int* i1out, int* i2out, int* i3out) const;
00056 bool get_3(int i3, int* i1out, int* i2out, int* i3out) const;
00057
00058 int get_match_12(int i1) const;
00059 int get_match_23(int i2) const;
00060 int get_match_31(int i3) const;
00061 int get_match_21(int i2) const;
00062 int get_match_32(int i3) const;
00063 int get_match_13(int i1) const;
00064
00065 int get_match_123(int i1, int i2) const;
00066
00067 void set(PairMatchSet* match12, PairMatchSet* match23);
00068 void set_from_pairwise_matches(const PairMatchSet& matches12, const PairMatchSet& matches23);
00069
00070 void write_ascii(vcl_ostream& s) const;
00071 bool read_ascii(vcl_istream& s);
00072
00073 void update_feature_match_data();
00074 int size() const;
00075 bool get_match(int at, int* i1, int* i2, int* i3) const { return get_1(at, i1, i2, i3); }
00076
00077
00078 class iterator
00079 {
00080 public:
00081
00082 iterator(const TripleMatchSet& ccc, bool full_only = true);
00083 iterator& operator=(const TripleMatchSet& ccc);
00084
00085 int get_i1() const { return i1; }
00086
00087 int get_i2() const { return i2; }
00088
00089 int get_i3() const { return i3; }
00090 bool next();
00091 iterator& operator ++ () { next(); return *this; }
00092 bool isfull() const;
00093 operator bool () const;
00094 private:
00095 iterator operator ++ (int ) { vcl_abort(); return *this; }
00096
00097 protected:
00098 const TripleMatchSet* c_;
00099 int match_index_;
00100 int i1, i2, i3;
00101 bool full_only_;
00102 };
00103 iterator begin() const { return iterator(*this, true); }
00104
00105
00106
00107 protected:
00108 PairMatchSet *match12_;
00109 PairMatchSet *match23_;
00110 };
00111
00112 vcl_istream& operator >> (vcl_istream& s, TripleMatchSet& ccc);
00113 vcl_ostream& operator << (vcl_ostream& s, const TripleMatchSet& ccc);
00114
00115 #endif // TripleMatchSet_h_