Generated on Wed Apr 29 2015 11:51:40 for GGL-4.1.2 by doxygen 1.8.3.1
MR_Storing.hh
Go to the documentation of this file.
1 #ifndef SGM_MR_STORING_HH_
2 #define SGM_MR_STORING_HH_
3 
4 #include "sgm/Match_Reporter.hh"
5 
6 
7 namespace sgm {
8 
9  /*! @brief Stores each match in an STL container
10  *
11  * A sgm::Match_Reporter implementation that stores each match mapping
12  * within a provided STL container.
13  *
14  * STL_PUSHBACK_CONTAINER should allow for "push_back(Match)".
15  *
16  * @author Martin Mann (c) 2009 http://www.bioinf.uni-freiburg.de/~mmann/
17  */
18  template <class STL_PUSHBACK_CONTAINER>
19  class MR_StoringT: public Match_Reporter {
20 
21  public:
22 
23  typedef STL_PUSHBACK_CONTAINER Storage;
24 
25  protected:
26 
27  //! where to store the matches in using its "push_back" method
29 
30  public:
31 
32  //! Construction
33  //! @param storage the STL_PUSHBACK_CONTAINER to write to
34  MR_StoringT( STL_PUSHBACK_CONTAINER & storage );
35 
36  virtual
37  ~MR_StoringT();
38 
39  //! Adds the match to the STL container without further processing.
40  //! @param pattern the pattern graph that was searched for
41  //! @param target the graph the pattern was found within
42  //! @param match contains the indices of the matched pattern nodes in
43  //! the target graph. match[i] corresponds to the mapping of the ith
44  //! vertex in the pattern graph.
45  virtual
46  void
47  reportHit ( const Pattern_Interface & pattern,
48  const Graph_Interface & target,
49  const Match & match );
50 
51  };
52 
53  //! Template wrapper for default values
55 
56 } // namespace sgm
57 
58  // IMPLEMENTATION OF MR_StoringT
59 
60 namespace sgm {
61 
62  template <class STL_PUSHBACK_CONTAINER>
63  inline
65  ::MR_StoringT( STL_PUSHBACK_CONTAINER & storage_ )
66  : storage(storage_)
67  {}
68 
69  template <class STL_PUSHBACK_CONTAINER>
70  inline
73  {}
74 
75  template <class STL_PUSHBACK_CONTAINER>
76  inline
77  void
79  ::reportHit ( const Pattern_Interface & pattern,
80  const Graph_Interface & target,
81  const Match & match )
82  {
83  // store match
84  storage.push_back(match);
85  }
86 
87 }
88 
89 
90 #include <set>
91 
92 namespace sgm {
93 
94  //! A sgm::Match_Reporter implementation that stores each match mapping
95  //! within a provided STL container.
96  //!
97  //! STL_INSERT_CONTAINER should allow for "push_back(Match)".
98  //!
99  //! @author Martin Mann (c) 2009 http://www.bioinf.uni-freiburg.de/~mmann/
100  //!
101  template <class STL_INSERT_CONTAINER>
103 
104  public:
105 
106  typedef STL_INSERT_CONTAINER Storage;
107 
108  protected:
109 
110  //! where to store the matches in using its "push_back" method
112 
113  public:
114 
115  //! Construction
116  //! @param storage the STL_INSERT_CONTAINER to write to
117  MR_StoringInsertT( STL_INSERT_CONTAINER & storage );
118 
119  virtual
121 
122  //! Adds the match to the STL container without further processing.
123  //! @param pattern the pattern graph that was searched for
124  //! @param target the graph the pattern was found within
125  //! @param match contains the indices of the matched pattern nodes in
126  //! the target graph. match[i] corresponds to the mapping of the ith
127  //! vertex in the pattern graph.
128  virtual
129  void
130  reportHit ( const Pattern_Interface & pattern,
131  const Graph_Interface & target,
132  const Match & match );
133 
134  };
135 
136  //! Template wrapper for default values
138 
139 } // namespace sgm
140 
141  // IMPLEMENTATION OF MR_StoringInsertT
142 
143 namespace sgm {
144 
145  template <class STL_INSERT_CONTAINER>
146  inline
148  ::MR_StoringInsertT( STL_INSERT_CONTAINER & storage_ )
149  : storage(storage_)
150  {}
151 
152  template <class STL_INSERT_CONTAINER>
153  inline
156  {}
157 
158  template <class STL_INSERT_CONTAINER>
159  inline
160  void
162  ::reportHit ( const Pattern_Interface & pattern,
163  const Graph_Interface & target,
164  const Match & match )
165  {
166  // store match
167  storage.insert(match);
168  }
169 
170 }
171 
172 #endif /* SGM_MR_STORING_HH_ */
173