1 | 1 |
/* -*- C++ -*- |
2 | 2 |
* |
3 | 3 |
* This file is a part of LEMON, a generic C++ optimization library |
4 | 4 |
* |
5 | 5 |
* Copyright (C) 2003-2007 |
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
7 | 7 |
* (Egervary Research Group on Combinatorial Optimization, EGRES). |
8 | 8 |
* |
9 | 9 |
* Permission to use, modify and distribute this software is granted |
10 | 10 |
* provided that this copyright notice appears in all copies. For |
11 | 11 |
* precise terms see the accompanying LICENSE file. |
12 | 12 |
* |
13 | 13 |
* This software is provided "AS IS" with no warranty of any kind, |
14 | 14 |
* express or implied, and with no claim as to its suitability for any |
15 | 15 |
* purpose. |
16 | 16 |
* |
17 | 17 |
*/ |
18 | 18 |
|
19 | 19 |
#ifndef LEMON_BITS_GRAPH_EXTENDER_H |
20 | 20 |
#define LEMON_BITS_GRAPH_EXTENDER_H |
21 | 21 |
|
22 | 22 |
#include <lemon/bits/invalid.h> |
23 |
#include <lemon/bits/utility.h> |
|
23 | 24 |
|
24 | 25 |
#include <lemon/bits/map_extender.h> |
25 | 26 |
#include <lemon/bits/default_map.h> |
26 | 27 |
|
27 | 28 |
#include <lemon/concept_check.h> |
28 | 29 |
#include <lemon/concepts/maps.h> |
29 | 30 |
|
30 | 31 |
///\ingroup graphbits |
31 | 32 |
///\file |
32 | 33 |
///\brief Extenders for the digraph types |
33 | 34 |
namespace lemon { |
34 | 35 |
|
35 | 36 |
/// \ingroup graphbits |
36 | 37 |
/// |
37 | 38 |
/// \brief Extender for the Digraphs |
38 | 39 |
template <typename Base> |
39 | 40 |
class DigraphExtender : public Base { |
40 | 41 |
public: |
41 | 42 |
|
42 | 43 |
typedef Base Parent; |
43 | 44 |
typedef DigraphExtender Digraph; |
44 | 45 |
|
45 | 46 |
// Base extensions |
46 | 47 |
|
... | ... |
@@ -312,48 +313,50 @@ |
312 | 313 |
} |
313 | 314 |
|
314 | 315 |
DigraphExtender() { |
315 | 316 |
node_notifier.setContainer(*this); |
316 | 317 |
arc_notifier.setContainer(*this); |
317 | 318 |
} |
318 | 319 |
|
319 | 320 |
|
320 | 321 |
~DigraphExtender() { |
321 | 322 |
arc_notifier.clear(); |
322 | 323 |
node_notifier.clear(); |
323 | 324 |
} |
324 | 325 |
}; |
325 | 326 |
|
326 | 327 |
/// \ingroup graphbits |
327 | 328 |
/// |
328 | 329 |
/// \brief Extender for the Graphs |
329 | 330 |
template <typename Base> |
330 | 331 |
class GraphExtender : public Base { |
331 | 332 |
public: |
332 | 333 |
|
333 | 334 |
typedef Base Parent; |
334 | 335 |
typedef GraphExtender Digraph; |
335 | 336 |
|
337 |
typedef True UndirectedTag; |
|
338 |
|
|
336 | 339 |
typedef typename Parent::Node Node; |
337 | 340 |
typedef typename Parent::Arc Arc; |
338 | 341 |
typedef typename Parent::Edge Edge; |
339 | 342 |
|
340 | 343 |
// Graph extension |
341 | 344 |
|
342 | 345 |
int maxId(Node) const { |
343 | 346 |
return Parent::maxNodeId(); |
344 | 347 |
} |
345 | 348 |
|
346 | 349 |
int maxId(Arc) const { |
347 | 350 |
return Parent::maxArcId(); |
348 | 351 |
} |
349 | 352 |
|
350 | 353 |
int maxId(Edge) const { |
351 | 354 |
return Parent::maxEdgeId(); |
352 | 355 |
} |
353 | 356 |
|
354 | 357 |
Node fromId(int id, Node) const { |
355 | 358 |
return Parent::nodeFromId(id); |
356 | 359 |
} |
357 | 360 |
|
358 | 361 |
Arc fromId(int id, Arc) const { |
359 | 362 |
return Parent::arcFromId(id); |
0 comments (0 inline)