gravatar
deba@inf.elte.hu
deba@inf.elte.hu
Fix missing semicolon in GRAPH_TYPEDEFS (ticket #89)
0 1 0
default
1 file changed with 1 insertions and 1 deletions:
↑ Collapse diff ↑
Ignore white space 256 line context
... ...
@@ -39,257 +39,257 @@
39 39

	
40 40
namespace lemon {
41 41

	
42 42
  /// \addtogroup gutils
43 43
  /// @{
44 44

	
45 45
  namespace _graph_utils_bits {
46 46
    template <typename Graph>
47 47
    struct Node { typedef typename Graph::Node type; };
48 48

	
49 49
    template <typename Graph>
50 50
    struct NodeIt { typedef typename Graph::NodeIt type; };
51 51

	
52 52
    template <typename Graph>
53 53
    struct Arc { typedef typename Graph::Arc type; };
54 54

	
55 55
    template <typename Graph>
56 56
    struct ArcIt { typedef typename Graph::ArcIt type; };
57 57

	
58 58
    template <typename Graph>
59 59
    struct Edge { typedef typename Graph::Edge type; };
60 60

	
61 61
    template <typename Graph>
62 62
    struct EdgeIt { typedef typename Graph::EdgeIt type; };
63 63

	
64 64
    template <typename Graph>
65 65
    struct OutArcIt { typedef typename Graph::OutArcIt type; };
66 66

	
67 67
    template <typename Graph>
68 68
    struct InArcIt { typedef typename Graph::InArcIt type; };
69 69

	
70 70
    template <typename Graph>
71 71
    struct IncEdgeIt { typedef typename Graph::IncEdgeIt type; };
72 72

	
73 73
    template <typename Graph>
74 74
    struct BoolNodeMap { 
75 75
      typedef typename Graph::template NodeMap<bool> type; 
76 76
    };
77 77

	
78 78
    template <typename Graph>
79 79
    struct IntNodeMap { 
80 80
      typedef typename Graph::template NodeMap<int> type; 
81 81
    };
82 82

	
83 83
    template <typename Graph>
84 84
    struct DoubleNodeMap { 
85 85
      typedef typename Graph::template NodeMap<double> type; 
86 86
    };
87 87

	
88 88
    template <typename Graph>
89 89
    struct BoolArcMap { 
90 90
      typedef typename Graph::template ArcMap<bool> type; 
91 91
    };
92 92

	
93 93
    template <typename Graph>
94 94
    struct IntArcMap { 
95 95
      typedef typename Graph::template ArcMap<int> type; 
96 96
    };
97 97

	
98 98
    template <typename Graph>
99 99
    struct DoubleArcMap { 
100 100
      typedef typename Graph::template ArcMap<double> type; 
101 101
    };
102 102

	
103 103
    template <typename Graph>
104 104
    struct BoolEdgeMap { 
105 105
      typedef typename Graph::template EdgeMap<bool> type; 
106 106
    };
107 107

	
108 108
    template <typename Graph>
109 109
    struct IntEdgeMap { 
110 110
      typedef typename Graph::template EdgeMap<int> type; 
111 111
    };
112 112

	
113 113
    template <typename Graph>
114 114
    struct DoubleEdgeMap { 
115 115
      typedef typename Graph::template EdgeMap<double> type; 
116 116
    };
117 117

	
118 118
    
119 119
  }
120 120

	
121 121
  ///Creates convenience typedefs for the digraph types and iterators
122 122

	
123 123
  ///This \c \#define creates convenience typedefs for the following types
124 124
  ///of \c Digraph: \c Node,  \c NodeIt, \c Arc, \c ArcIt, \c InArcIt,
125 125
  ///\c OutArcIt, \c BoolNodeMap, \c IntNodeMap, \c DoubleNodeMap, 
126 126
  ///\c BoolArcMap, \c IntArcMap, \c DoubleArcMap. 
127 127
#define DIGRAPH_TYPEDEFS(Digraph)					\
128 128
  typedef typename ::lemon::_graph_utils_bits::				\
129 129
  Node<Digraph>::type Node;						\
130 130
  typedef typename ::lemon::_graph_utils_bits::				\
131 131
  NodeIt<Digraph>::type	NodeIt;						\
132 132
  typedef typename ::lemon::_graph_utils_bits::				\
133 133
  Arc<Digraph>::type Arc;						\
134 134
  typedef typename ::lemon::_graph_utils_bits::				\
135 135
  ArcIt<Digraph>::type ArcIt;						\
136 136
  typedef typename ::lemon::_graph_utils_bits::				\
137 137
  OutArcIt<Digraph>::type OutArcIt;					\
138 138
  typedef typename ::lemon::_graph_utils_bits::				\
139 139
  InArcIt<Digraph>::type InArcIt;					\
140 140
  typedef typename ::lemon::_graph_utils_bits::				\
141 141
  BoolNodeMap<Digraph>::type BoolNodeMap;				\
142 142
  typedef typename ::lemon::_graph_utils_bits::				\
143 143
  IntNodeMap<Digraph>::type IntNodeMap;					\
144 144
  typedef typename ::lemon::_graph_utils_bits::				\
145 145
  DoubleNodeMap<Digraph>::type DoubleNodeMap;				\
146 146
  typedef typename ::lemon::_graph_utils_bits::				\
147 147
  BoolArcMap<Digraph>::type BoolArcMap;					\
148 148
  typedef typename ::lemon::_graph_utils_bits::				\
149 149
  IntArcMap<Digraph>::type IntArcMap;					\
150 150
  typedef typename ::lemon::_graph_utils_bits::				\
151 151
  DoubleArcMap<Digraph>::type DoubleArcMap
152 152

	
153 153

	
154 154
  ///Creates convenience typedefs for the graph types and iterators
155 155

	
156 156
  ///This \c \#define creates the same convenience typedefs as defined
157 157
  ///by \ref DIGRAPH_TYPEDEFS(Graph) and six more, namely it creates
158 158
  ///\c Edge, \c EdgeIt, \c IncEdgeIt, \c BoolEdgeMap, \c IntEdgeMap,
159 159
  ///\c DoubleEdgeMap.
160 160
#define GRAPH_TYPEDEFS(Graph)						\
161 161
  DIGRAPH_TYPEDEFS(Graph);						\
162 162
  typedef typename ::lemon::_graph_utils_bits::				\
163 163
  Edge<Graph>::type Edge;						\
164 164
  typedef typename ::lemon::_graph_utils_bits::				\
165 165
  EdgeIt<Graph>::type EdgeIt;						\
166 166
  typedef typename ::lemon::_graph_utils_bits::				\
167
  IncEdgeIt<Graph>::type IncEdgeIt					\
167
  IncEdgeIt<Graph>::type IncEdgeIt;					\
168 168
  typedef typename ::lemon::_graph_utils_bits::				\
169 169
  BoolEdgeMap<Graph>::type BoolEdgeMap;					\
170 170
  typedef typename ::lemon::_graph_utils_bits::				\
171 171
  IntEdgeMap<Graph>::type IntEdgeMap;					\
172 172
  typedef typename ::lemon::_graph_utils_bits::				\
173 173
  DoubleEdgeMap<Graph>::type DoubleEdgeMap
174 174

	
175 175

	
176 176
  /// \brief Function to count the items in the graph.
177 177
  ///
178 178
  /// This function counts the items (nodes, arcs etc) in the graph.
179 179
  /// The complexity of the function is O(n) because
180 180
  /// it iterates on all of the items.
181 181
  template <typename Graph, typename Item>
182 182
  inline int countItems(const Graph& g) {
183 183
    typedef typename ItemSetTraits<Graph, Item>::ItemIt ItemIt;
184 184
    int num = 0;
185 185
    for (ItemIt it(g); it != INVALID; ++it) {
186 186
      ++num;
187 187
    }
188 188
    return num;
189 189
  }
190 190

	
191 191
  // Node counting:
192 192

	
193 193
  namespace _graph_utils_bits {
194 194
    
195 195
    template <typename Graph, typename Enable = void>
196 196
    struct CountNodesSelector {
197 197
      static int count(const Graph &g) {
198 198
        return countItems<Graph, typename Graph::Node>(g);
199 199
      }
200 200
    };
201 201

	
202 202
    template <typename Graph>
203 203
    struct CountNodesSelector<
204 204
      Graph, typename 
205 205
      enable_if<typename Graph::NodeNumTag, void>::type> 
206 206
    {
207 207
      static int count(const Graph &g) {
208 208
        return g.nodeNum();
209 209
      }
210 210
    };    
211 211
  }
212 212

	
213 213
  /// \brief Function to count the nodes in the graph.
214 214
  ///
215 215
  /// This function counts the nodes in the graph.
216 216
  /// The complexity of the function is O(n) but for some
217 217
  /// graph structures it is specialized to run in O(1).
218 218
  ///
219 219
  /// If the graph contains a \e nodeNum() member function and a 
220 220
  /// \e NodeNumTag tag then this function calls directly the member
221 221
  /// function to query the cardinality of the node set.
222 222
  template <typename Graph>
223 223
  inline int countNodes(const Graph& g) {
224 224
    return _graph_utils_bits::CountNodesSelector<Graph>::count(g);
225 225
  }
226 226

	
227 227
  // Arc counting:
228 228

	
229 229
  namespace _graph_utils_bits {
230 230
    
231 231
    template <typename Graph, typename Enable = void>
232 232
    struct CountArcsSelector {
233 233
      static int count(const Graph &g) {
234 234
        return countItems<Graph, typename Graph::Arc>(g);
235 235
      }
236 236
    };
237 237

	
238 238
    template <typename Graph>
239 239
    struct CountArcsSelector<
240 240
      Graph, 
241 241
      typename enable_if<typename Graph::ArcNumTag, void>::type> 
242 242
    {
243 243
      static int count(const Graph &g) {
244 244
        return g.arcNum();
245 245
      }
246 246
    };    
247 247
  }
248 248

	
249 249
  /// \brief Function to count the arcs in the graph.
250 250
  ///
251 251
  /// This function counts the arcs in the graph.
252 252
  /// The complexity of the function is O(e) but for some
253 253
  /// graph structures it is specialized to run in O(1).
254 254
  ///
255 255
  /// If the graph contains a \e arcNum() member function and a 
256 256
  /// \e EdgeNumTag tag then this function calls directly the member
257 257
  /// function to query the cardinality of the arc set.
258 258
  template <typename Graph>
259 259
  inline int countArcs(const Graph& g) {
260 260
    return _graph_utils_bits::CountArcsSelector<Graph>::count(g);
261 261
  }
262 262

	
263 263
  // Edge counting:
264 264
  namespace _graph_utils_bits {
265 265
    
266 266
    template <typename Graph, typename Enable = void>
267 267
    struct CountEdgesSelector {
268 268
      static int count(const Graph &g) {
269 269
        return countItems<Graph, typename Graph::Edge>(g);
270 270
      }
271 271
    };
272 272

	
273 273
    template <typename Graph>
274 274
    struct CountEdgesSelector<
275 275
      Graph, 
276 276
      typename enable_if<typename Graph::EdgeNumTag, void>::type> 
277 277
    {
278 278
      static int count(const Graph &g) {
279 279
        return g.edgeNum();
280 280
      }
281 281
    };    
282 282
  }
283 283

	
284 284
  /// \brief Function to count the edges in the graph.
285 285
  ///
286 286
  /// This function counts the edges in the graph.
287 287
  /// The complexity of the function is O(m) but for some
288 288
  /// graph structures it is specialized to run in O(1).
289 289
  ///
290 290
  /// If the graph contains a \e edgeNum() member function and a 
291 291
  /// \e EdgeNumTag tag then this function calls directly the member
292 292
  /// function to query the cardinality of the edge set.
293 293
  template <typename Graph>
294 294
  inline int countEdges(const Graph& g) {
295 295
    return _graph_utils_bits::CountEdgesSelector<Graph>::count(g);
0 comments (0 inline)