Fix compilation with Visual Studio 2005.
1 /* -*- mode: C++; indent-tabs-mode: nil; -*-
3 * This file is a part of LEMON, a generic C++ optimization library.
5 * Copyright (C) 2003-2008
6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7 * (Egervary Research Group on Combinatorial Optimization, EGRES).
9 * Permission to use, modify and distribute this software is granted
10 * provided that this copyright notice appears in all copies. For
11 * precise terms see the accompanying LICENSE file.
13 * This software is provided "AS IS" with no warranty of any kind,
14 * express or implied, and with no claim as to its suitability for any
21 ///\brief Classes for representing paths in digraphs.
24 #ifndef LEMON_CONCEPT_PATH_H
25 #define LEMON_CONCEPT_PATH_H
27 #include <lemon/core.h>
28 #include <lemon/concept_check.h>
33 /// \addtogroup concept
36 /// \brief A skeleton structure for representing directed paths in
39 /// A skeleton structure for representing directed paths in a
41 /// \tparam _Digraph The digraph type in which the path is.
43 /// In a sense, the path can be treated as a list of arcs. The
44 /// lemon path type stores just this list. As a consequence it
45 /// cannot enumerate the nodes in the path and the zero length
46 /// paths cannot store the source.
48 template <typename _Digraph>
52 /// Type of the underlying digraph.
53 typedef _Digraph Digraph;
54 /// Arc type of the underlying digraph.
55 typedef typename Digraph::Arc Arc;
59 /// \brief Default constructor
62 /// \brief Template constructor
63 template <typename CPath>
64 Path(const CPath& cpath) {}
66 /// \brief Template assigment
67 template <typename CPath>
68 Path& operator=(const CPath& cpath) {
69 ignore_unused_variable_warning(cpath);
73 /// Length of the path ie. the number of arcs in the path.
74 int length() const { return 0;}
76 /// Returns whether the path is empty.
77 bool empty() const { return true;}
79 /// Resets the path to an empty path.
82 /// \brief LEMON style iterator for path arcs
84 /// This class is used to iterate on the arcs of the paths.
87 /// Default constructor
89 /// Invalid constructor
91 /// Constructor for first arc
92 ArcIt(const Path &) {}
95 operator Arc() const { return INVALID; }
98 ArcIt& operator++() {return *this;}
100 /// Comparison operator
101 bool operator==(const ArcIt&) const {return true;}
102 /// Comparison operator
103 bool operator!=(const ArcIt&) const {return true;}
104 /// Comparison operator
105 bool operator<(const ArcIt&) const {return false;}
109 template <typename _Path>
120 typename _Path::ArcIt id, ii(INVALID), i(p);
123 typename Digraph::Arc ed = i;
129 ignore_unused_variable_warning(l);
130 ignore_unused_variable_warning(pp);
131 ignore_unused_variable_warning(e);
132 ignore_unused_variable_warning(id);
133 ignore_unused_variable_warning(ii);
134 ignore_unused_variable_warning(ed);
140 namespace _path_bits {
142 template <typename _Digraph, typename _Path, typename RevPathTag = void>
143 struct PathDumperConstraints {
148 typename _Path::ArcIt id, i(p);
151 typename _Digraph::Arc ed = i;
156 ignore_unused_variable_warning(l);
157 ignore_unused_variable_warning(e);
158 ignore_unused_variable_warning(id);
159 ignore_unused_variable_warning(ed);
164 template <typename _Digraph, typename _Path>
165 struct PathDumperConstraints<
167 typename enable_if<typename _Path::RevPathTag, void>::type
173 typename _Path::RevArcIt id, i(p);
176 typename _Digraph::Arc ed = i;
181 ignore_unused_variable_warning(l);
182 ignore_unused_variable_warning(e);
183 ignore_unused_variable_warning(id);
184 ignore_unused_variable_warning(ed);
192 /// \brief A skeleton structure for path dumpers.
194 /// A skeleton structure for path dumpers. The path dumpers are
195 /// the generalization of the paths. The path dumpers can
196 /// enumerate the arcs of the path wheter in forward or in
197 /// backward order. In most time these classes are not used
198 /// directly rather it used to assign a dumped class to a real
201 /// The main purpose of this concept is that the shortest path
202 /// algorithms can enumerate easily the arcs in reverse order.
203 /// If we would like to give back a real path from these
204 /// algorithms then we should create a temporarly path object. In
205 /// LEMON such algorithms gives back a path dumper what can
206 /// assigned to a real path and the dumpers can be implemented as
207 /// an adaptor class to the predecessor map.
209 /// \tparam _Digraph The digraph type in which the path is.
211 /// The paths can be constructed from any path type by a
212 /// template constructor or a template assignment operator.
214 template <typename _Digraph>
218 /// Type of the underlying digraph.
219 typedef _Digraph Digraph;
220 /// Arc type of the underlying digraph.
221 typedef typename Digraph::Arc Arc;
223 /// Length of the path ie. the number of arcs in the path.
224 int length() const { return 0;}
226 /// Returns whether the path is empty.
227 bool empty() const { return true;}
229 /// \brief Forward or reverse dumping
231 /// If the RevPathTag is defined and true then reverse dumping
232 /// is provided in the path dumper. In this case instead of the
233 /// ArcIt the RevArcIt iterator should be implemented in the
235 typedef False RevPathTag;
237 /// \brief LEMON style iterator for path arcs
239 /// This class is used to iterate on the arcs of the paths.
242 /// Default constructor
244 /// Invalid constructor
246 /// Constructor for first arc
247 ArcIt(const PathDumper&) {}
249 /// Conversion to Arc
250 operator Arc() const { return INVALID; }
253 ArcIt& operator++() {return *this;}
255 /// Comparison operator
256 bool operator==(const ArcIt&) const {return true;}
257 /// Comparison operator
258 bool operator!=(const ArcIt&) const {return true;}
259 /// Comparison operator
260 bool operator<(const ArcIt&) const {return false;}
264 /// \brief LEMON style iterator for path arcs
266 /// This class is used to iterate on the arcs of the paths in
267 /// reverse direction.
270 /// Default constructor
272 /// Invalid constructor
274 /// Constructor for first arc
275 RevArcIt(const PathDumper &) {}
277 /// Conversion to Arc
278 operator Arc() const { return INVALID; }
281 RevArcIt& operator++() {return *this;}
283 /// Comparison operator
284 bool operator==(const RevArcIt&) const {return true;}
285 /// Comparison operator
286 bool operator!=(const RevArcIt&) const {return true;}
287 /// Comparison operator
288 bool operator<(const RevArcIt&) const {return false;}
292 template <typename _Path>
295 function_requires<_path_bits::
296 PathDumperConstraints<Digraph, _Path> >();
308 #endif // LEMON_CONCEPT_PATH_H