Generated on Wed Apr 29 2015 11:51:40 for GGL-4.1.2 by doxygen 1.8.3.1
GS_STL.hh
Go to the documentation of this file.
1 #ifndef GGL_GS_STL_HH_
2 #define GGL_GS_STL_HH_
3 
4 #include "ggl/Graph.hh"
5 
6 #include "ggl/Graph_Storage.hh"
7 
8 #include <vector>
9 
10 namespace ggl {
11 
12 #define GGL_GS_STL_PUSHALLT_TEMPLATE \
13  template < class STL_CONTAINER >
14 
15 #define GGL_GS_STL_PUSHALLT_TYPE \
16  GS_STL_pushAllT < STL_CONTAINER >
17 
18  /*! @brief Graph storage within STL push-back container
19  *
20  * A ggl::Graph_Storage implementation that pushs each added graph
21  * to the end of a provided STL container using its "push_back" method.
22  *
23  * @tparam STL_CONTAINER a push-back STL container for Graph objects.
24  *
25  * @author Martin Mann (c) 2008 http://www.bioinf.uni-freiburg.de/~mmann/
26  */
27  template < class STL_CONTAINER = typename std::vector< Graph > >
29  {
30  public:
31 
32  //! type of STL container of graphs this graph storage uses
33  typedef STL_CONTAINER storage_type;
34 
35  protected:
36 
37  //! the STL container to write the graphs to
38  STL_CONTAINER & storage;
39 
40  public:
41 
42  //! Construction
43  //! @param storage the STL container to write the graphs to
44  GS_STL_pushAllT( STL_CONTAINER & storage );
45 
46  //! destruction
47  virtual
49 
50 
51  //! Adds the given graph to the internal STL container.
52  //! @param graph the Graph object to add.
53  virtual
54  void
55  add( const Graph & graph );
56  };
57 
58 ////////////////////////////////////////////////////////////////////////////////
59 ////////////////////////////////////////////////////////////////////////////////
60 
61  //! Wrapper typedef around the default parameters of GS_STL_pushAllT<..>
63 
64 ////////////////////////////////////////////////////////////////////////////////
65 ////////////////////////////////////////////////////////////////////////////////
66 
67 } // namespace ggl
68 
69 
70 namespace ggl {
71 
72 #define GGL_GS_STL_PUSHALLPT_TEMPLATE \
73  template < class STL_CONTAINER >
74 
75 #define GGL_GS_STL_PUSHALLPT_TYPE \
76  GS_STL_pushAllPT < STL_CONTAINER >
77 
78 
79  /*!
80  * @brief Stores new graph pointers in STL push-back container.
81  *
82  * A ggl::Graph_Storage implementation that pushs a 'new' allocated
83  * copy of each added graph
84  * to the end of a provided STL container using its "push_back" method.
85  *
86  * @tparam STL_CONTAINER a push-back STL container for Graph pointer.
87  *
88  * @author Martin Mann (c) 2008 http://www.bioinf.uni-freiburg.de/~mmann/
89  */
90  template < class STL_CONTAINER = typename std::vector< Graph* > >
92  {
93  public:
94 
95  //! type of STL container of graphs this graph storage uses
96  typedef STL_CONTAINER storage_type;
97 
98  protected:
99 
100  STL_CONTAINER & storage;
101 
102  public:
103 
104  //! Construction
105  //! @param storage the STL container to write the graphs to
106  GS_STL_pushAllPT( STL_CONTAINER & storage );
107 
108  //! destruction
109  virtual
111 
112 
113  //! Adds the given graph to the internal STL container.
114  //! @param graph the Graph object to add.
115  virtual
116  void
117  add( const Graph & graph );
118  };
119 
120 ////////////////////////////////////////////////////////////////////////////////
121 ////////////////////////////////////////////////////////////////////////////////
122 
123  //! Wrapper typedef around the default parameters of GS_STL_pushAllPT<..>
125 
126 ////////////////////////////////////////////////////////////////////////////////
127 ////////////////////////////////////////////////////////////////////////////////
128 
129 } // namespace ggl
130 
131 
132 #include "sgm/GraphMatching.hh"
133 
134 namespace ggl {
135 
136 #define GGL_GS_STL_PUSHUNIQUET_TEMPLATE \
137  template < class STL_CONTAINER >
138 
139 #define GGL_GS_STL_PUSHUNIQUET_TYPE \
140  GS_STL_pushUniqueT < STL_CONTAINER >
141 
142 
143  /*!
144  * @brief Unique storage of graphs in STL push-back container
145  *
146  * A ggl::Graph_Storage implementation that pushs the added graph
147  * to the end of a provided STL container !!! ONLY if it is not only
148  * present in the container !!!, using its "push_back" method.
149  *
150  * The check is done using the provided sgm::GraphMatching object.
151  * Thus the more elements are in the container the more tests have to be
152  * done which results in slower runtimes!
153  *
154  * @tparam STL_CONTAINER a push-back STL container for Graph objects.
155  *
156  * @author Martin Mann (c) 2008 http://www.bioinf.uni-freiburg.de/~mmann/
157  */
158  template < class STL_CONTAINER = typename std::vector< Graph > >
160  {
161  public:
162 
163  //! type of STL container of graphs this graph storage uses
164  typedef STL_CONTAINER storage_type;
165 
166  protected:
167 
168  //! the STL container to write the graphs to
169  STL_CONTAINER & storage;
170 
171  //! the graph matcher used to decide if the added
172  //! graph is already present in the storage
174 
175  //! the wildcard to use for the matching
176  const std::string * wildcard;
177 
178  public:
179 
180  //! Construction
181  //! @param storage the STL container to write the graphs to
182  //! @param matcher the graph matcher used to decide if the added
183  //! graph is already present in the storage
184  GS_STL_pushUniqueT( STL_CONTAINER & storage
186 
187  //! Construction
188  //! @param storage the STL container to write the graphs to
189  //! @param matcher the graph matcher used to decide if the added
190  //! graph is already present in the storage
191  //! @param wildcard the wildcard to use for the matching.
192  GS_STL_pushUniqueT( STL_CONTAINER & storage
194  , const std::string& wildcard );
195 
196  //! Copy construction
197  //! @param toCopy the object to make this a copy of
199 
200  //! destruction
201  virtual
203 
204 
205  //! Adds the given graph to the internal STL container.
206  //! @param graph the Graph object to add.
207  virtual
208  void
209  add( const Graph & graph );
210  };
211 
212 ////////////////////////////////////////////////////////////////////////////////
213 ////////////////////////////////////////////////////////////////////////////////
214 
215  //! Wrapper typedef around the default parameters of GS_STL_pushUniqueT<..>
217 
218 ////////////////////////////////////////////////////////////////////////////////
219 ////////////////////////////////////////////////////////////////////////////////
220 
221 } // namespace ggl
222 
223 
224 #include "sgm/GraphMatching.hh"
225 
226 namespace ggl {
227 
228 #define GGL_GS_STL_PUSHUNIQUEPT_TEMPLATE \
229  template < class STL_CONTAINER >
230 
231 #define GGL_GS_STL_PUSHUNIQUEPT_TYPE \
232  GS_STL_pushUniquePT < STL_CONTAINER >
233 
234 
235  /*!
236  * @brief Unique storage of new graph pointers in STL push-back container
237  *
238  * A ggl::Graph_Storage implementation that pushs the a 'new' allocated
239  * copy of the added graph
240  * to the end of a provided STL container !!! ONLY if it is not only
241  * present in the container !!!, using its "push_back" method.
242  *
243  * The check is done using the provided sgm::GraphMatching object.
244  * Thus the more elements are in the container the more tests have to be
245  * done which results in slower runtimes!
246  *
247  * @tparam STL_CONTAINER a push-back STL container for Graph pointer.
248  *
249  * @author Martin Mann (c) 2008 http://www.bioinf.uni-freiburg.de/~mmann/
250  */
251  template < class STL_CONTAINER = typename std::vector< Graph* > >
253  {
254  public:
255 
256  //! type of STL container of graphs this graph storage uses
257  typedef STL_CONTAINER storage_type;
258 
259  protected:
260 
261  //! the STL container to write the graphs to
262  STL_CONTAINER & storage;
263 
264  //! the graph matcher used to decide if the added
265  //! graph is already present in the storage
267 
268  //! the wildcard to use for the matching
269  const std::string * wildcard;
270 
271  public:
272 
273  //! Construction
274  //! @param storage the STL container to write the graphs to
275  //! @param matcher the graph matcher used to decide if the added
276  //! graph is already present in the storage
277  GS_STL_pushUniquePT( STL_CONTAINER & storage
279 
280  //! Construction
281  //! @param storage the STL container to write the graphs to
282  //! @param matcher the graph matcher used to decide if the added
283  //! graph is already present in the storage
284  //! @param wildcard the wildcard to use for the matching.
285  GS_STL_pushUniquePT( STL_CONTAINER & storage
287  , const std::string& wildcard );
288 
289  //! Copy construction
290  //! @param toCopy the object to make this a copy of
292 
293  //! destruction
294  virtual
296 
297 
298  //! Adds the given graph to the internal STL container.
299  //! @param graph the Graph object to add.
300  virtual
301  void
302  add( const Graph & graph );
303  };
304 
305 ////////////////////////////////////////////////////////////////////////////////
306 ////////////////////////////////////////////////////////////////////////////////
307 
308  //! Wrapper typedef around the default parameters of GS_STL_pushUniquePT<..>
310 
311 ////////////////////////////////////////////////////////////////////////////////
312 ////////////////////////////////////////////////////////////////////////////////
313 
314 } // namespace ggl
315 
316  // include implementation
317 #include "ggl/GS_STL.icc"
318 
319 #endif /*GS_STL_HH_*/