Generated on Wed Apr 29 2015 11:51:40 for GGL-4.1.2 by doxygen 1.8.3.1
MR_Counting.hh
Go to the documentation of this file.
1 #ifndef SGM_MR_COUNTING_HH_
2 #define SGM_MR_COUNTING_HH_
3 
4 #include "sgm/Match_Reporter.hh"
5 
6 
7 namespace sgm {
8 
9  /*! @brief Counts matches
10  *
11  * A sgm::Match_Reporter implementation that only counts the number of
12  * reported matches.
13  *
14  * @author Martin Mann (c) 2008 http://www.bioinf.uni-freiburg.de/~mmann/
15  */
16  class MR_Counting : public Match_Reporter {
17 
18  protected:
19 
20  //! the number of matches reported so far
22 
23  public:
24 
25  //! Construction
26  MR_Counting( );
27 
28  virtual
29  ~MR_Counting();
30 
31  //! Increases the internal counter, nothing else.
32  //! @param pattern the pattern graph that was searched for
33  //! @param target the graph the pattern was found within
34  //! @param match contains the indices of the matched pattern nodes in
35  //! the target graph. match[i] corresponds to the mapping of the ith
36  //! vertex in the pattern graph.
37  virtual
38  void
39  reportHit ( const Pattern_Interface & pattern,
40  const Graph_Interface & target,
41  const Match & match );
42 
43  //! Resets the number of matches reported so far to 0.
44  void
45  resetHits ( void );
46 
47  //! Access to the number of reported matches so far
48  //! @return number of matches
49  size_t
50  getHits( void ) const;
51 
52  };
53 
54 } // namespace sgm
55 
56  // IMPLEMENTATION OF MR_Counting
57 
58 namespace sgm {
59 
60  inline
63  : numberOfMatches(0)
64  {}
65 
66  inline
69  {}
70 
71  inline
72  void
74  ::reportHit ( const Pattern_Interface & pattern,
75  const Graph_Interface & target,
76  const Match & match )
77  {
78  numberOfMatches++;
79  }
80 
81  inline
82  void
84  ::resetHits ( void )
85  {
86  numberOfMatches = 0;
87  }
88 
89  inline
90  size_t
92  ::getHits ( void ) const
93  {
94  return numberOfMatches;
95  }
96 
97 }
98 
99 #endif /*MR_COUNTING_HH_*/