Go to the documentation of this file.00001
00002 #ifndef PairMatchMulti_h_
00003 #define PairMatchMulti_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 #include <vcl_cstdlib.h>
00028 #include <vcl_iosfwd.h>
00029 #include "PairMatchMultiIterator.h"
00030
00031 template <class T> class vbl_sparse_array_2d;
00032
00033 class PairMatchSet;
00034
00035 class PairMatchMulti
00036 {
00037
00038 vcl_multimap_uint_uint matches12_;
00039 vbl_sparse_array_2d<double> *scores_;
00040 public:
00041 friend class PairMatchMultiIterator;
00042
00043
00044
00045 PairMatchMulti();
00046 PairMatchMulti(vcl_istream& s);
00047 PairMatchMulti(const PairMatchMulti& that);
00048 ~PairMatchMulti();
00049
00050 PairMatchMulti& operator=(const PairMatchMulti& that);
00051
00052
00053
00054
00055 void add_match(int i1, int i2) {
00056 matches12_.insert(i1, i2);
00057 }
00058
00059 bool contains(int i1, int i2) const;
00060
00061
00062 void add_match(int i1, int i2, double score);
00063
00064 double get_score(int i1, int i2) const;
00065 void set_score(int i1, int i2, double score);
00066
00067
00068 void clear() {
00069 matches12_.erase(matches12_.begin(), matches12_.end());
00070 }
00071
00072 int size() const { return matches12_.size(); }
00073
00074
00075 int count() const { return matches12_.size(); }
00076
00077
00078 unsigned count_matches_12(int i1) const { return matches12_.count(i1); }
00079
00080
00081
00082
00083
00084
00085
00086
00087 PairMatchMultiIterator get_match_12(int i1)
00088 {
00089 return PairMatchMultiIterator(matches12_.lower_bound(i1), matches12_.upper_bound(i1));
00090 }
00091
00092
00093
00094
00095 PairMatchMultiIterator get_match_21(int) { vcl_abort(); return iter(); }
00096
00097
00098 PairMatchMultiIterator iter() {
00099 return PairMatchMultiIterator(matches12_.begin(), matches12_.end());
00100 }
00101
00102
00103 bool is_superset(PairMatchSet& unique_set);
00104
00105
00106 bool operator==(PairMatchMulti const& that) const {
00107 return this == &that;
00108 }
00109
00110 bool load(char const* filename);
00111 bool read_ascii(vcl_istream& s);
00112 };
00113
00114 vcl_ostream& operator<< (vcl_ostream&, const PairMatchMulti&);
00115 vcl_istream& operator>> (vcl_istream&, PairMatchMulti&);
00116
00117 #endif // PairMatchMulti_h_