0
5
0
| 1 | 1 |
/* -*- mode: C++; indent-tabs-mode: nil; -*- |
| 2 | 2 |
* |
| 3 | 3 |
* This file is a part of LEMON, a generic C++ optimization library. |
| 4 | 4 |
* |
| 5 | 5 |
* Copyright (C) 2003-2009 |
| 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_ADAPTOR_EXTENDER_H |
| 20 | 20 |
#define LEMON_BITS_GRAPH_ADAPTOR_EXTENDER_H |
| 21 | 21 |
|
| 22 | 22 |
#include <lemon/core.h> |
| 23 | 23 |
#include <lemon/error.h> |
| 24 | 24 |
|
| 25 |
#include <lemon/bits/default_map.h> |
|
| 26 |
|
|
| 27 | 25 |
namespace lemon {
|
| 28 | 26 |
|
| 29 | 27 |
template <typename _Digraph> |
| 30 | 28 |
class DigraphAdaptorExtender : public _Digraph {
|
| 31 | 29 |
public: |
| 32 | 30 |
|
| 33 | 31 |
typedef _Digraph Parent; |
| 34 | 32 |
typedef _Digraph Digraph; |
| 35 | 33 |
typedef DigraphAdaptorExtender Adaptor; |
| 36 | 34 |
|
| 37 | 35 |
// Base extensions |
| 38 | 36 |
|
| 39 | 37 |
typedef typename Parent::Node Node; |
| 40 | 38 |
typedef typename Parent::Arc Arc; |
| 41 | 39 |
|
| 42 | 40 |
int maxId(Node) const {
|
| 43 | 41 |
return Parent::maxNodeId(); |
| 44 | 42 |
} |
| 45 | 43 |
|
| 46 | 44 |
int maxId(Arc) const {
|
| 47 | 45 |
return Parent::maxArcId(); |
| 48 | 46 |
} |
| 49 | 47 |
|
| 50 | 48 |
Node fromId(int id, Node) const {
|
| 51 | 49 |
return Parent::nodeFromId(id); |
| 52 | 50 |
} |
| 53 | 51 |
|
| 54 | 52 |
Arc fromId(int id, Arc) const {
|
| 55 | 53 |
return Parent::arcFromId(id); |
| 56 | 54 |
} |
| 57 | 55 |
|
| 58 | 56 |
Node oppositeNode(const Node &n, const Arc &e) const {
|
| 59 | 57 |
if (n == Parent::source(e)) |
| 60 | 58 |
return Parent::target(e); |
| 61 | 59 |
else if(n==Parent::target(e)) |
| 62 | 60 |
return Parent::source(e); |
| 63 | 61 |
else |
| 64 | 62 |
return INVALID; |
| 65 | 63 |
} |
| 66 | 64 |
|
| 67 | 65 |
class NodeIt : public Node {
|
| 68 | 66 |
const Adaptor* _adaptor; |
| 69 | 67 |
public: |
| 70 | 68 |
|
| 71 | 69 |
NodeIt() {}
|
| 72 | 70 |
|
| 73 | 71 |
NodeIt(Invalid i) : Node(i) { }
|
| 74 | 72 |
| ... | ... |
@@ -2,96 +2,98 @@ |
| 2 | 2 |
* |
| 3 | 3 |
* This file is a part of LEMON, a generic C++ optimization library. |
| 4 | 4 |
* |
| 5 | 5 |
* Copyright (C) 2003-2009 |
| 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_MAP_EXTENDER_H |
| 20 | 20 |
#define LEMON_BITS_MAP_EXTENDER_H |
| 21 | 21 |
|
| 22 | 22 |
#include <iterator> |
| 23 | 23 |
|
| 24 | 24 |
#include <lemon/bits/traits.h> |
| 25 | 25 |
|
| 26 | 26 |
#include <lemon/concept_check.h> |
| 27 | 27 |
#include <lemon/concepts/maps.h> |
| 28 | 28 |
|
| 29 | 29 |
//\file |
| 30 | 30 |
//\brief Extenders for iterable maps. |
| 31 | 31 |
|
| 32 | 32 |
namespace lemon {
|
| 33 | 33 |
|
| 34 | 34 |
// \ingroup graphbits |
| 35 | 35 |
// |
| 36 | 36 |
// \brief Extender for maps |
| 37 | 37 |
template <typename _Map> |
| 38 | 38 |
class MapExtender : public _Map {
|
| 39 | 39 |
public: |
| 40 | 40 |
|
| 41 | 41 |
typedef _Map Parent; |
| 42 | 42 |
typedef MapExtender Map; |
| 43 | 43 |
|
| 44 | 44 |
|
| 45 | 45 |
typedef typename Parent::Graph Graph; |
| 46 | 46 |
typedef typename Parent::Key Item; |
| 47 | 47 |
|
| 48 | 48 |
typedef typename Parent::Key Key; |
| 49 | 49 |
typedef typename Parent::Value Value; |
| 50 |
typedef typename Parent::Reference Reference; |
|
| 51 |
typedef typename Parent::ConstReference ConstReference; |
|
| 50 | 52 |
|
| 51 | 53 |
class MapIt; |
| 52 | 54 |
class ConstMapIt; |
| 53 | 55 |
|
| 54 | 56 |
friend class MapIt; |
| 55 | 57 |
friend class ConstMapIt; |
| 56 | 58 |
|
| 57 | 59 |
public: |
| 58 | 60 |
|
| 59 | 61 |
MapExtender(const Graph& graph) |
| 60 | 62 |
: Parent(graph) {}
|
| 61 | 63 |
|
| 62 | 64 |
MapExtender(const Graph& graph, const Value& value) |
| 63 | 65 |
: Parent(graph, value) {}
|
| 64 | 66 |
|
| 65 | 67 |
private: |
| 66 | 68 |
MapExtender& operator=(const MapExtender& cmap) {
|
| 67 | 69 |
return operator=<MapExtender>(cmap); |
| 68 | 70 |
} |
| 69 | 71 |
|
| 70 | 72 |
template <typename CMap> |
| 71 | 73 |
MapExtender& operator=(const CMap& cmap) {
|
| 72 | 74 |
Parent::operator=(cmap); |
| 73 | 75 |
return *this; |
| 74 | 76 |
} |
| 75 | 77 |
|
| 76 | 78 |
public: |
| 77 | 79 |
class MapIt : public Item {
|
| 78 | 80 |
public: |
| 79 | 81 |
|
| 80 | 82 |
typedef Item Parent; |
| 81 | 83 |
typedef typename Map::Value Value; |
| 82 | 84 |
|
| 83 | 85 |
MapIt() {}
|
| 84 | 86 |
|
| 85 | 87 |
MapIt(Invalid i) : Parent(i) { }
|
| 86 | 88 |
|
| 87 | 89 |
explicit MapIt(Map& _map) : map(_map) {
|
| 88 | 90 |
map.notifier()->first(*this); |
| 89 | 91 |
} |
| 90 | 92 |
|
| 91 | 93 |
MapIt(const Map& _map, const Item& item) |
| 92 | 94 |
: Parent(item), map(_map) {}
|
| 93 | 95 |
|
| 94 | 96 |
MapIt& operator++() {
|
| 95 | 97 |
map.notifier()->next(*this); |
| 96 | 98 |
return *this; |
| 97 | 99 |
} |
| ... | ... |
@@ -142,96 +144,98 @@ |
| 142 | 144 |
|
| 143 | 145 |
protected: |
| 144 | 146 |
const Map& map; |
| 145 | 147 |
}; |
| 146 | 148 |
|
| 147 | 149 |
class ItemIt : public Item {
|
| 148 | 150 |
public: |
| 149 | 151 |
|
| 150 | 152 |
typedef Item Parent; |
| 151 | 153 |
|
| 152 | 154 |
ItemIt() {}
|
| 153 | 155 |
|
| 154 | 156 |
ItemIt(Invalid i) : Parent(i) { }
|
| 155 | 157 |
|
| 156 | 158 |
explicit ItemIt(Map& _map) : map(_map) {
|
| 157 | 159 |
map.notifier()->first(*this); |
| 158 | 160 |
} |
| 159 | 161 |
|
| 160 | 162 |
ItemIt(const Map& _map, const Item& item) |
| 161 | 163 |
: Parent(item), map(_map) {}
|
| 162 | 164 |
|
| 163 | 165 |
ItemIt& operator++() {
|
| 164 | 166 |
map.notifier()->next(*this); |
| 165 | 167 |
return *this; |
| 166 | 168 |
} |
| 167 | 169 |
|
| 168 | 170 |
protected: |
| 169 | 171 |
const Map& map; |
| 170 | 172 |
|
| 171 | 173 |
}; |
| 172 | 174 |
}; |
| 173 | 175 |
|
| 174 | 176 |
// \ingroup graphbits |
| 175 | 177 |
// |
| 176 | 178 |
// \brief Extender for maps which use a subset of the items. |
| 177 | 179 |
template <typename _Graph, typename _Map> |
| 178 | 180 |
class SubMapExtender : public _Map {
|
| 179 | 181 |
public: |
| 180 | 182 |
|
| 181 | 183 |
typedef _Map Parent; |
| 182 | 184 |
typedef SubMapExtender Map; |
| 183 | 185 |
|
| 184 | 186 |
typedef _Graph Graph; |
| 185 | 187 |
|
| 186 | 188 |
typedef typename Parent::Key Item; |
| 187 | 189 |
|
| 188 | 190 |
typedef typename Parent::Key Key; |
| 189 | 191 |
typedef typename Parent::Value Value; |
| 192 |
typedef typename Parent::Reference Reference; |
|
| 193 |
typedef typename Parent::ConstReference ConstReference; |
|
| 190 | 194 |
|
| 191 | 195 |
class MapIt; |
| 192 | 196 |
class ConstMapIt; |
| 193 | 197 |
|
| 194 | 198 |
friend class MapIt; |
| 195 | 199 |
friend class ConstMapIt; |
| 196 | 200 |
|
| 197 | 201 |
public: |
| 198 | 202 |
|
| 199 | 203 |
SubMapExtender(const Graph& _graph) |
| 200 | 204 |
: Parent(_graph), graph(_graph) {}
|
| 201 | 205 |
|
| 202 | 206 |
SubMapExtender(const Graph& _graph, const Value& _value) |
| 203 | 207 |
: Parent(_graph, _value), graph(_graph) {}
|
| 204 | 208 |
|
| 205 | 209 |
private: |
| 206 | 210 |
SubMapExtender& operator=(const SubMapExtender& cmap) {
|
| 207 | 211 |
return operator=<MapExtender>(cmap); |
| 208 | 212 |
} |
| 209 | 213 |
|
| 210 | 214 |
template <typename CMap> |
| 211 | 215 |
SubMapExtender& operator=(const CMap& cmap) {
|
| 212 | 216 |
checkConcept<concepts::ReadMap<Key, Value>, CMap>(); |
| 213 | 217 |
Item it; |
| 214 | 218 |
for (graph.first(it); it != INVALID; graph.next(it)) {
|
| 215 | 219 |
Parent::set(it, cmap[it]); |
| 216 | 220 |
} |
| 217 | 221 |
return *this; |
| 218 | 222 |
} |
| 219 | 223 |
|
| 220 | 224 |
public: |
| 221 | 225 |
class MapIt : public Item {
|
| 222 | 226 |
public: |
| 223 | 227 |
|
| 224 | 228 |
typedef Item Parent; |
| 225 | 229 |
typedef typename Map::Value Value; |
| 226 | 230 |
|
| 227 | 231 |
MapIt() {}
|
| 228 | 232 |
|
| 229 | 233 |
MapIt(Invalid i) : Parent(i) { }
|
| 230 | 234 |
|
| 231 | 235 |
explicit MapIt(Map& _map) : map(_map) {
|
| 232 | 236 |
map.graph.first(*this); |
| 233 | 237 |
} |
| 234 | 238 |
|
| 235 | 239 |
MapIt(const Map& _map, const Item& item) |
| 236 | 240 |
: Parent(item), map(_map) {}
|
| 237 | 241 |
| ... | ... |
@@ -376,112 +376,113 @@ |
| 376 | 376 |
void next(Arc&) const {}
|
| 377 | 377 |
|
| 378 | 378 |
|
| 379 | 379 |
void firstIn(Arc&, const Node&) const {}
|
| 380 | 380 |
void nextIn(Arc&) const {}
|
| 381 | 381 |
|
| 382 | 382 |
void firstOut(Arc&, const Node&) const {}
|
| 383 | 383 |
void nextOut(Arc&) const {}
|
| 384 | 384 |
|
| 385 | 385 |
// The second parameter is dummy. |
| 386 | 386 |
Node fromId(int, Node) const { return INVALID; }
|
| 387 | 387 |
// The second parameter is dummy. |
| 388 | 388 |
Arc fromId(int, Arc) const { return INVALID; }
|
| 389 | 389 |
|
| 390 | 390 |
// Dummy parameter. |
| 391 | 391 |
int maxId(Node) const { return -1; }
|
| 392 | 392 |
// Dummy parameter. |
| 393 | 393 |
int maxId(Arc) const { return -1; }
|
| 394 | 394 |
|
| 395 | 395 |
/// \brief The base node of the iterator. |
| 396 | 396 |
/// |
| 397 | 397 |
/// Gives back the base node of the iterator. |
| 398 | 398 |
/// It is always the target of the pointed arc. |
| 399 | 399 |
Node baseNode(const InArcIt&) const { return INVALID; }
|
| 400 | 400 |
|
| 401 | 401 |
/// \brief The running node of the iterator. |
| 402 | 402 |
/// |
| 403 | 403 |
/// Gives back the running node of the iterator. |
| 404 | 404 |
/// It is always the source of the pointed arc. |
| 405 | 405 |
Node runningNode(const InArcIt&) const { return INVALID; }
|
| 406 | 406 |
|
| 407 | 407 |
/// \brief The base node of the iterator. |
| 408 | 408 |
/// |
| 409 | 409 |
/// Gives back the base node of the iterator. |
| 410 | 410 |
/// It is always the source of the pointed arc. |
| 411 | 411 |
Node baseNode(const OutArcIt&) const { return INVALID; }
|
| 412 | 412 |
|
| 413 | 413 |
/// \brief The running node of the iterator. |
| 414 | 414 |
/// |
| 415 | 415 |
/// Gives back the running node of the iterator. |
| 416 | 416 |
/// It is always the target of the pointed arc. |
| 417 | 417 |
Node runningNode(const OutArcIt&) const { return INVALID; }
|
| 418 | 418 |
|
| 419 | 419 |
/// \brief The opposite node on the given arc. |
| 420 | 420 |
/// |
| 421 | 421 |
/// Gives back the opposite node on the given arc. |
| 422 | 422 |
Node oppositeNode(const Node&, const Arc&) const { return INVALID; }
|
| 423 | 423 |
|
| 424 |
/// \brief |
|
| 424 |
/// \brief Reference map of the nodes to type \c T. |
|
| 425 | 425 |
/// |
| 426 |
/// ReadWrite map of the nodes to type \c T. |
|
| 427 |
/// \sa Reference |
|
| 426 |
/// Reference map of the nodes to type \c T. |
|
| 428 | 427 |
template<class T> |
| 429 |
class NodeMap : public |
|
| 428 |
class NodeMap : public ReferenceMap<Node, T, T&, const T&> {
|
|
| 430 | 429 |
public: |
| 431 | 430 |
|
| 432 | 431 |
///\e |
| 433 | 432 |
NodeMap(const Digraph&) { }
|
| 434 | 433 |
///\e |
| 435 | 434 |
NodeMap(const Digraph&, T) { }
|
| 436 | 435 |
|
| 437 | 436 |
private: |
| 438 | 437 |
///Copy constructor |
| 439 |
NodeMap(const NodeMap& nm) : |
|
| 438 |
NodeMap(const NodeMap& nm) : |
|
| 439 |
ReferenceMap<Node, T, T&, const T&>(nm) { }
|
|
| 440 | 440 |
///Assignment operator |
| 441 | 441 |
template <typename CMap> |
| 442 | 442 |
NodeMap& operator=(const CMap&) {
|
| 443 | 443 |
checkConcept<ReadMap<Node, T>, CMap>(); |
| 444 | 444 |
return *this; |
| 445 | 445 |
} |
| 446 | 446 |
}; |
| 447 | 447 |
|
| 448 |
/// \brief |
|
| 448 |
/// \brief Reference map of the arcs to type \c T. |
|
| 449 | 449 |
/// |
| 450 | 450 |
/// Reference map of the arcs to type \c T. |
| 451 |
/// \sa Reference |
|
| 452 | 451 |
template<class T> |
| 453 |
class ArcMap : public |
|
| 452 |
class ArcMap : public ReferenceMap<Arc, T, T&, const T&> {
|
|
| 454 | 453 |
public: |
| 455 | 454 |
|
| 456 | 455 |
///\e |
| 457 | 456 |
ArcMap(const Digraph&) { }
|
| 458 | 457 |
///\e |
| 459 | 458 |
ArcMap(const Digraph&, T) { }
|
| 460 | 459 |
private: |
| 461 | 460 |
///Copy constructor |
| 462 |
ArcMap(const ArcMap& em) : |
|
| 461 |
ArcMap(const ArcMap& em) : |
|
| 462 |
ReferenceMap<Arc, T, T&, const T&>(em) { }
|
|
| 463 | 463 |
///Assignment operator |
| 464 | 464 |
template <typename CMap> |
| 465 | 465 |
ArcMap& operator=(const CMap&) {
|
| 466 | 466 |
checkConcept<ReadMap<Arc, T>, CMap>(); |
| 467 | 467 |
return *this; |
| 468 | 468 |
} |
| 469 | 469 |
}; |
| 470 | 470 |
|
| 471 | 471 |
template <typename _Digraph> |
| 472 | 472 |
struct Constraints {
|
| 473 | 473 |
void constraints() {
|
| 474 |
checkConcept<BaseDigraphComponent, _Digraph>(); |
|
| 474 | 475 |
checkConcept<IterableDigraphComponent<>, _Digraph>(); |
| 475 | 476 |
checkConcept<IDableDigraphComponent<>, _Digraph>(); |
| 476 | 477 |
checkConcept<MappableDigraphComponent<>, _Digraph>(); |
| 477 | 478 |
} |
| 478 | 479 |
}; |
| 479 | 480 |
|
| 480 | 481 |
}; |
| 481 | 482 |
|
| 482 | 483 |
} //namespace concepts |
| 483 | 484 |
} //namespace lemon |
| 484 | 485 |
|
| 485 | 486 |
|
| 486 | 487 |
|
| 487 | 488 |
#endif |
| ... | ... |
@@ -452,161 +452,161 @@ |
| 452 | 452 |
/// Its usage is quite simple, for example you can count the number |
| 453 | 453 |
/// of outgoing arcs of a node \c n |
| 454 | 454 |
/// in graph \c g of type \c Graph as follows. |
| 455 | 455 |
///\code |
| 456 | 456 |
/// int count=0; |
| 457 | 457 |
/// for(Graph::InArcIt e(g, n); e!=INVALID; ++e) ++count; |
| 458 | 458 |
///\endcode |
| 459 | 459 |
|
| 460 | 460 |
class InArcIt : public Arc {
|
| 461 | 461 |
public: |
| 462 | 462 |
/// Default constructor |
| 463 | 463 |
|
| 464 | 464 |
/// @warning The default constructor sets the iterator |
| 465 | 465 |
/// to an undefined value. |
| 466 | 466 |
InArcIt() { }
|
| 467 | 467 |
/// Copy constructor. |
| 468 | 468 |
|
| 469 | 469 |
/// Copy constructor. |
| 470 | 470 |
/// |
| 471 | 471 |
InArcIt(const InArcIt& e) : Arc(e) { }
|
| 472 | 472 |
/// Initialize the iterator to be invalid. |
| 473 | 473 |
|
| 474 | 474 |
/// Initialize the iterator to be invalid. |
| 475 | 475 |
/// |
| 476 | 476 |
InArcIt(Invalid) { }
|
| 477 | 477 |
/// This constructor sets the iterator to first incoming arc. |
| 478 | 478 |
|
| 479 | 479 |
/// This constructor set the iterator to the first incoming arc of |
| 480 | 480 |
/// the node. |
| 481 | 481 |
///@param n the node |
| 482 | 482 |
///@param g the graph |
| 483 | 483 |
InArcIt(const Graph& g, const Node& n) {
|
| 484 | 484 |
ignore_unused_variable_warning(n); |
| 485 | 485 |
ignore_unused_variable_warning(g); |
| 486 | 486 |
} |
| 487 | 487 |
/// Arc -> InArcIt conversion |
| 488 | 488 |
|
| 489 | 489 |
/// Sets the iterator to the value of the trivial iterator \c e. |
| 490 | 490 |
/// This feature necessitates that each time we |
| 491 | 491 |
/// iterate the arc-set, the iteration order is the same. |
| 492 | 492 |
InArcIt(const Graph&, const Arc&) { }
|
| 493 | 493 |
/// Next incoming arc |
| 494 | 494 |
|
| 495 | 495 |
/// Assign the iterator to the next inarc of the corresponding node. |
| 496 | 496 |
/// |
| 497 | 497 |
InArcIt& operator++() { return *this; }
|
| 498 | 498 |
}; |
| 499 | 499 |
|
| 500 |
/// \brief |
|
| 500 |
/// \brief Reference map of the nodes to type \c T. |
|
| 501 | 501 |
/// |
| 502 |
/// ReadWrite map of the nodes to type \c T. |
|
| 503 |
/// \sa Reference |
|
| 502 |
/// Reference map of the nodes to type \c T. |
|
| 504 | 503 |
template<class T> |
| 505 |
class NodeMap : public |
|
| 504 |
class NodeMap : public ReferenceMap<Node, T, T&, const T&> |
|
| 506 | 505 |
{
|
| 507 | 506 |
public: |
| 508 | 507 |
|
| 509 | 508 |
///\e |
| 510 | 509 |
NodeMap(const Graph&) { }
|
| 511 | 510 |
///\e |
| 512 | 511 |
NodeMap(const Graph&, T) { }
|
| 513 | 512 |
|
| 514 | 513 |
private: |
| 515 | 514 |
///Copy constructor |
| 516 |
NodeMap(const NodeMap& nm) : |
|
| 515 |
NodeMap(const NodeMap& nm) : |
|
| 516 |
ReferenceMap<Node, T, T&, const T&>(nm) { }
|
|
| 517 | 517 |
///Assignment operator |
| 518 | 518 |
template <typename CMap> |
| 519 | 519 |
NodeMap& operator=(const CMap&) {
|
| 520 | 520 |
checkConcept<ReadMap<Node, T>, CMap>(); |
| 521 | 521 |
return *this; |
| 522 | 522 |
} |
| 523 | 523 |
}; |
| 524 | 524 |
|
| 525 |
/// \brief |
|
| 525 |
/// \brief Reference map of the arcs to type \c T. |
|
| 526 | 526 |
/// |
| 527 |
/// Reference map of the directed arcs to type \c T. |
|
| 528 |
/// \sa Reference |
|
| 527 |
/// Reference map of the arcs to type \c T. |
|
| 529 | 528 |
template<class T> |
| 530 |
class ArcMap : public |
|
| 529 |
class ArcMap : public ReferenceMap<Arc, T, T&, const T&> |
|
| 531 | 530 |
{
|
| 532 | 531 |
public: |
| 533 | 532 |
|
| 534 | 533 |
///\e |
| 535 | 534 |
ArcMap(const Graph&) { }
|
| 536 | 535 |
///\e |
| 537 | 536 |
ArcMap(const Graph&, T) { }
|
| 538 | 537 |
private: |
| 539 | 538 |
///Copy constructor |
| 540 |
ArcMap(const ArcMap& em) : |
|
| 539 |
ArcMap(const ArcMap& em) : |
|
| 540 |
ReferenceMap<Arc, T, T&, const T&>(em) { }
|
|
| 541 | 541 |
///Assignment operator |
| 542 | 542 |
template <typename CMap> |
| 543 | 543 |
ArcMap& operator=(const CMap&) {
|
| 544 | 544 |
checkConcept<ReadMap<Arc, T>, CMap>(); |
| 545 | 545 |
return *this; |
| 546 | 546 |
} |
| 547 | 547 |
}; |
| 548 | 548 |
|
| 549 |
/// |
|
| 549 |
/// Reference map of the edges to type \c T. |
|
| 550 | 550 |
|
| 551 |
/// Reference map of the arcs to type \c T. |
|
| 552 |
/// \sa Reference |
|
| 551 |
/// Reference map of the edges to type \c T. |
|
| 553 | 552 |
template<class T> |
| 554 |
class EdgeMap : public |
|
| 553 |
class EdgeMap : public ReferenceMap<Edge, T, T&, const T&> |
|
| 555 | 554 |
{
|
| 556 | 555 |
public: |
| 557 | 556 |
|
| 558 | 557 |
///\e |
| 559 | 558 |
EdgeMap(const Graph&) { }
|
| 560 | 559 |
///\e |
| 561 | 560 |
EdgeMap(const Graph&, T) { }
|
| 562 | 561 |
private: |
| 563 | 562 |
///Copy constructor |
| 564 |
EdgeMap(const EdgeMap& em) : |
|
| 563 |
EdgeMap(const EdgeMap& em) : |
|
| 564 |
ReferenceMap<Edge, T, T&, const T&>(em) {}
|
|
| 565 | 565 |
///Assignment operator |
| 566 | 566 |
template <typename CMap> |
| 567 | 567 |
EdgeMap& operator=(const CMap&) {
|
| 568 | 568 |
checkConcept<ReadMap<Edge, T>, CMap>(); |
| 569 | 569 |
return *this; |
| 570 | 570 |
} |
| 571 | 571 |
}; |
| 572 | 572 |
|
| 573 | 573 |
/// \brief Direct the given edge. |
| 574 | 574 |
/// |
| 575 | 575 |
/// Direct the given edge. The returned arc source |
| 576 | 576 |
/// will be the given node. |
| 577 | 577 |
Arc direct(const Edge&, const Node&) const {
|
| 578 | 578 |
return INVALID; |
| 579 | 579 |
} |
| 580 | 580 |
|
| 581 | 581 |
/// \brief Direct the given edge. |
| 582 | 582 |
/// |
| 583 | 583 |
/// Direct the given edge. The returned arc |
| 584 | 584 |
/// represents the given edge and the direction comes |
| 585 | 585 |
/// from the bool parameter. The source of the edge and |
| 586 | 586 |
/// the directed arc is the same when the given bool is true. |
| 587 | 587 |
Arc direct(const Edge&, bool) const {
|
| 588 | 588 |
return INVALID; |
| 589 | 589 |
} |
| 590 | 590 |
|
| 591 | 591 |
/// \brief Returns true if the arc has default orientation. |
| 592 | 592 |
/// |
| 593 | 593 |
/// Returns whether the given directed arc is same orientation as |
| 594 | 594 |
/// the corresponding edge's default orientation. |
| 595 | 595 |
bool direction(Arc) const { return true; }
|
| 596 | 596 |
|
| 597 | 597 |
/// \brief Returns the opposite directed arc. |
| 598 | 598 |
/// |
| 599 | 599 |
/// Returns the opposite directed arc. |
| 600 | 600 |
Arc oppositeArc(Arc) const { return INVALID; }
|
| 601 | 601 |
|
| 602 | 602 |
/// \brief Opposite node on an arc |
| 603 | 603 |
/// |
| 604 | 604 |
/// \return The opposite of the given node on the given edge. |
| 605 | 605 |
Node oppositeNode(Node, Edge) const { return INVALID; }
|
| 606 | 606 |
|
| 607 | 607 |
/// \brief First node of the edge. |
| 608 | 608 |
/// |
| 609 | 609 |
/// \return The first node of the given edge. |
| 610 | 610 |
/// |
| 611 | 611 |
/// Naturally edges don't have direction and thus |
| 612 | 612 |
/// don't have source and target node. However we use \c u() and \c v() |
| ... | ... |
@@ -703,61 +703,62 @@ |
| 703 | 703 |
// Dummy parameter. |
| 704 | 704 |
int maxId(Arc) const { return -1; }
|
| 705 | 705 |
|
| 706 | 706 |
/// \brief Base node of the iterator |
| 707 | 707 |
/// |
| 708 | 708 |
/// Returns the base node (the source in this case) of the iterator |
| 709 | 709 |
Node baseNode(OutArcIt e) const {
|
| 710 | 710 |
return source(e); |
| 711 | 711 |
} |
| 712 | 712 |
/// \brief Running node of the iterator |
| 713 | 713 |
/// |
| 714 | 714 |
/// Returns the running node (the target in this case) of the |
| 715 | 715 |
/// iterator |
| 716 | 716 |
Node runningNode(OutArcIt e) const {
|
| 717 | 717 |
return target(e); |
| 718 | 718 |
} |
| 719 | 719 |
|
| 720 | 720 |
/// \brief Base node of the iterator |
| 721 | 721 |
/// |
| 722 | 722 |
/// Returns the base node (the target in this case) of the iterator |
| 723 | 723 |
Node baseNode(InArcIt e) const {
|
| 724 | 724 |
return target(e); |
| 725 | 725 |
} |
| 726 | 726 |
/// \brief Running node of the iterator |
| 727 | 727 |
/// |
| 728 | 728 |
/// Returns the running node (the source in this case) of the |
| 729 | 729 |
/// iterator |
| 730 | 730 |
Node runningNode(InArcIt e) const {
|
| 731 | 731 |
return source(e); |
| 732 | 732 |
} |
| 733 | 733 |
|
| 734 | 734 |
/// \brief Base node of the iterator |
| 735 | 735 |
/// |
| 736 | 736 |
/// Returns the base node of the iterator |
| 737 | 737 |
Node baseNode(IncEdgeIt) const {
|
| 738 | 738 |
return INVALID; |
| 739 | 739 |
} |
| 740 | 740 |
|
| 741 | 741 |
/// \brief Running node of the iterator |
| 742 | 742 |
/// |
| 743 | 743 |
/// Returns the running node of the iterator |
| 744 | 744 |
Node runningNode(IncEdgeIt) const {
|
| 745 | 745 |
return INVALID; |
| 746 | 746 |
} |
| 747 | 747 |
|
| 748 | 748 |
template <typename _Graph> |
| 749 | 749 |
struct Constraints {
|
| 750 | 750 |
void constraints() {
|
| 751 |
checkConcept<BaseGraphComponent, _Graph>(); |
|
| 751 | 752 |
checkConcept<IterableGraphComponent<>, _Graph>(); |
| 752 | 753 |
checkConcept<IDableGraphComponent<>, _Graph>(); |
| 753 | 754 |
checkConcept<MappableGraphComponent<>, _Graph>(); |
| 754 | 755 |
} |
| 755 | 756 |
}; |
| 756 | 757 |
|
| 757 | 758 |
}; |
| 758 | 759 |
|
| 759 | 760 |
} |
| 760 | 761 |
|
| 761 | 762 |
} |
| 762 | 763 |
|
| 763 | 764 |
#endif |
| ... | ... |
@@ -943,218 +943,229 @@ |
| 943 | 943 |
}; |
| 944 | 944 |
|
| 945 | 945 |
/// \brief Skeleton class for alterable undirected graphs. |
| 946 | 946 |
/// |
| 947 | 947 |
/// This class describes the interface of alterable undirected |
| 948 | 948 |
/// graphs. It extends \ref AlterableDigraphComponent with the alteration |
| 949 | 949 |
/// notifier interface of undirected graphs. It implements |
| 950 | 950 |
/// an observer-notifier pattern for the edges. More |
| 951 | 951 |
/// obsevers can be registered into the notifier and whenever an |
| 952 | 952 |
/// alteration occured in the graph all the observers will be |
| 953 | 953 |
/// notified about it. |
| 954 | 954 |
template <typename BAS = BaseGraphComponent> |
| 955 | 955 |
class AlterableGraphComponent : public AlterableDigraphComponent<BAS> {
|
| 956 | 956 |
public: |
| 957 | 957 |
|
| 958 | 958 |
typedef BAS Base; |
| 959 | 959 |
typedef typename Base::Edge Edge; |
| 960 | 960 |
|
| 961 | 961 |
|
| 962 | 962 |
/// Edge alteration notifier class. |
| 963 | 963 |
typedef AlterationNotifier<AlterableGraphComponent, Edge> |
| 964 | 964 |
EdgeNotifier; |
| 965 | 965 |
|
| 966 | 966 |
/// \brief Return the edge alteration notifier. |
| 967 | 967 |
/// |
| 968 | 968 |
/// This function gives back the edge alteration notifier. |
| 969 | 969 |
EdgeNotifier& notifier(Edge) const {
|
| 970 | 970 |
return EdgeNotifier(); |
| 971 | 971 |
} |
| 972 | 972 |
|
| 973 | 973 |
template <typename _Graph> |
| 974 | 974 |
struct Constraints {
|
| 975 | 975 |
void constraints() {
|
| 976 | 976 |
checkConcept<AlterableDigraphComponent<Base>, _Graph>(); |
| 977 | 977 |
typename _Graph::EdgeNotifier& uen |
| 978 | 978 |
= graph.notifier(typename _Graph::Edge()); |
| 979 | 979 |
ignore_unused_variable_warning(uen); |
| 980 | 980 |
} |
| 981 | 981 |
|
| 982 | 982 |
const _Graph& graph; |
| 983 | 983 |
}; |
| 984 | 984 |
}; |
| 985 | 985 |
|
| 986 | 986 |
/// \brief Concept class for standard graph maps. |
| 987 | 987 |
/// |
| 988 | 988 |
/// This class describes the concept of standard graph maps, i.e. |
| 989 | 989 |
/// the \c NodeMap, \c ArcMap and \c EdgeMap subtypes of digraph and |
| 990 | 990 |
/// graph types, which can be used for associating data to graph items. |
| 991 |
/// The standard graph maps must conform to the ReferenceMap concept. |
|
| 991 | 992 |
template <typename GR, typename K, typename V> |
| 992 |
class GraphMap : public |
|
| 993 |
class GraphMap : public ReferenceMap<K, V, V&, const V&> {
|
|
| 993 | 994 |
public: |
| 994 | 995 |
|
| 995 | 996 |
typedef ReadWriteMap<K, V> Parent; |
| 996 | 997 |
|
| 997 | 998 |
/// The graph type of the map. |
| 998 | 999 |
typedef GR Graph; |
| 999 | 1000 |
/// The key type of the map. |
| 1000 | 1001 |
typedef K Key; |
| 1001 | 1002 |
/// The value type of the map. |
| 1002 | 1003 |
typedef V Value; |
| 1004 |
/// The reference type of the map. |
|
| 1005 |
typedef Value& Reference; |
|
| 1006 |
/// The const reference type of the map. |
|
| 1007 |
typedef const Value& ConstReference; |
|
| 1008 |
|
|
| 1009 |
// The reference map tag. |
|
| 1010 |
typedef True ReferenceMapTag; |
|
| 1003 | 1011 |
|
| 1004 | 1012 |
/// \brief Construct a new map. |
| 1005 | 1013 |
/// |
| 1006 | 1014 |
/// Construct a new map for the graph. |
| 1007 | 1015 |
explicit GraphMap(const Graph&) {}
|
| 1008 | 1016 |
/// \brief Construct a new map with default value. |
| 1009 | 1017 |
/// |
| 1010 | 1018 |
/// Construct a new map for the graph and initalize the values. |
| 1011 | 1019 |
GraphMap(const Graph&, const Value&) {}
|
| 1012 | 1020 |
|
| 1013 | 1021 |
private: |
| 1014 | 1022 |
/// \brief Copy constructor. |
| 1015 | 1023 |
/// |
| 1016 | 1024 |
/// Copy Constructor. |
| 1017 | 1025 |
GraphMap(const GraphMap&) : Parent() {}
|
| 1018 | 1026 |
|
| 1019 | 1027 |
/// \brief Assignment operator. |
| 1020 | 1028 |
/// |
| 1021 | 1029 |
/// Assignment operator. It does not mofify the underlying graph, |
| 1022 | 1030 |
/// it just iterates on the current item set and set the map |
| 1023 | 1031 |
/// with the value returned by the assigned map. |
| 1024 | 1032 |
template <typename CMap> |
| 1025 | 1033 |
GraphMap& operator=(const CMap&) {
|
| 1026 | 1034 |
checkConcept<ReadMap<Key, Value>, CMap>(); |
| 1027 | 1035 |
return *this; |
| 1028 | 1036 |
} |
| 1029 | 1037 |
|
| 1030 | 1038 |
public: |
| 1031 | 1039 |
template<typename _Map> |
| 1032 | 1040 |
struct Constraints {
|
| 1033 | 1041 |
void constraints() {
|
| 1034 |
checkConcept |
|
| 1042 |
checkConcept |
|
| 1043 |
<ReferenceMap<Key, Value, Value&, const Value&>, _Map>(); |
|
| 1035 | 1044 |
_Map m1(g); |
| 1036 | 1045 |
_Map m2(g,t); |
| 1037 | 1046 |
|
| 1038 | 1047 |
// Copy constructor |
| 1039 | 1048 |
// _Map m3(m); |
| 1040 | 1049 |
|
| 1041 | 1050 |
// Assignment operator |
| 1042 | 1051 |
// ReadMap<Key, Value> cmap; |
| 1043 | 1052 |
// m3 = cmap; |
| 1044 | 1053 |
|
| 1045 | 1054 |
ignore_unused_variable_warning(m1); |
| 1046 | 1055 |
ignore_unused_variable_warning(m2); |
| 1047 | 1056 |
// ignore_unused_variable_warning(m3); |
| 1048 | 1057 |
} |
| 1049 | 1058 |
|
| 1050 | 1059 |
const _Map &m; |
| 1051 | 1060 |
const Graph &g; |
| 1052 | 1061 |
const typename GraphMap::Value &t; |
| 1053 | 1062 |
}; |
| 1054 | 1063 |
|
| 1055 | 1064 |
}; |
| 1056 | 1065 |
|
| 1057 | 1066 |
/// \brief Skeleton class for mappable directed graphs. |
| 1058 | 1067 |
/// |
| 1059 | 1068 |
/// This class describes the interface of mappable directed graphs. |
| 1060 | 1069 |
/// It extends \ref BaseDigraphComponent with the standard digraph |
| 1061 | 1070 |
/// map classes, namely \c NodeMap and \c ArcMap. |
| 1062 | 1071 |
/// This concept is part of the Digraph concept. |
| 1063 | 1072 |
template <typename BAS = BaseDigraphComponent> |
| 1064 | 1073 |
class MappableDigraphComponent : public BAS {
|
| 1065 | 1074 |
public: |
| 1066 | 1075 |
|
| 1067 | 1076 |
typedef BAS Base; |
| 1068 | 1077 |
typedef typename Base::Node Node; |
| 1069 | 1078 |
typedef typename Base::Arc Arc; |
| 1070 | 1079 |
|
| 1071 | 1080 |
typedef MappableDigraphComponent Digraph; |
| 1072 | 1081 |
|
| 1073 | 1082 |
/// \brief Standard graph map for the nodes. |
| 1074 | 1083 |
/// |
| 1075 | 1084 |
/// Standard graph map for the nodes. |
| 1085 |
/// It conforms to the ReferenceMap concept. |
|
| 1076 | 1086 |
template <typename V> |
| 1077 | 1087 |
class NodeMap : public GraphMap<MappableDigraphComponent, Node, V> {
|
| 1078 | 1088 |
public: |
| 1079 | 1089 |
typedef GraphMap<MappableDigraphComponent, Node, V> Parent; |
| 1080 | 1090 |
|
| 1081 | 1091 |
/// \brief Construct a new map. |
| 1082 | 1092 |
/// |
| 1083 | 1093 |
/// Construct a new map for the digraph. |
| 1084 | 1094 |
explicit NodeMap(const MappableDigraphComponent& digraph) |
| 1085 | 1095 |
: Parent(digraph) {}
|
| 1086 | 1096 |
|
| 1087 | 1097 |
/// \brief Construct a new map with default value. |
| 1088 | 1098 |
/// |
| 1089 | 1099 |
/// Construct a new map for the digraph and initalize the values. |
| 1090 | 1100 |
NodeMap(const MappableDigraphComponent& digraph, const V& value) |
| 1091 | 1101 |
: Parent(digraph, value) {}
|
| 1092 | 1102 |
|
| 1093 | 1103 |
private: |
| 1094 | 1104 |
/// \brief Copy constructor. |
| 1095 | 1105 |
/// |
| 1096 | 1106 |
/// Copy Constructor. |
| 1097 | 1107 |
NodeMap(const NodeMap& nm) : Parent(nm) {}
|
| 1098 | 1108 |
|
| 1099 | 1109 |
/// \brief Assignment operator. |
| 1100 | 1110 |
/// |
| 1101 | 1111 |
/// Assignment operator. |
| 1102 | 1112 |
template <typename CMap> |
| 1103 | 1113 |
NodeMap& operator=(const CMap&) {
|
| 1104 | 1114 |
checkConcept<ReadMap<Node, V>, CMap>(); |
| 1105 | 1115 |
return *this; |
| 1106 | 1116 |
} |
| 1107 | 1117 |
|
| 1108 | 1118 |
}; |
| 1109 | 1119 |
|
| 1110 | 1120 |
/// \brief Standard graph map for the arcs. |
| 1111 | 1121 |
/// |
| 1112 | 1122 |
/// Standard graph map for the arcs. |
| 1123 |
/// It conforms to the ReferenceMap concept. |
|
| 1113 | 1124 |
template <typename V> |
| 1114 | 1125 |
class ArcMap : public GraphMap<MappableDigraphComponent, Arc, V> {
|
| 1115 | 1126 |
public: |
| 1116 | 1127 |
typedef GraphMap<MappableDigraphComponent, Arc, V> Parent; |
| 1117 | 1128 |
|
| 1118 | 1129 |
/// \brief Construct a new map. |
| 1119 | 1130 |
/// |
| 1120 | 1131 |
/// Construct a new map for the digraph. |
| 1121 | 1132 |
explicit ArcMap(const MappableDigraphComponent& digraph) |
| 1122 | 1133 |
: Parent(digraph) {}
|
| 1123 | 1134 |
|
| 1124 | 1135 |
/// \brief Construct a new map with default value. |
| 1125 | 1136 |
/// |
| 1126 | 1137 |
/// Construct a new map for the digraph and initalize the values. |
| 1127 | 1138 |
ArcMap(const MappableDigraphComponent& digraph, const V& value) |
| 1128 | 1139 |
: Parent(digraph, value) {}
|
| 1129 | 1140 |
|
| 1130 | 1141 |
private: |
| 1131 | 1142 |
/// \brief Copy constructor. |
| 1132 | 1143 |
/// |
| 1133 | 1144 |
/// Copy Constructor. |
| 1134 | 1145 |
ArcMap(const ArcMap& nm) : Parent(nm) {}
|
| 1135 | 1146 |
|
| 1136 | 1147 |
/// \brief Assignment operator. |
| 1137 | 1148 |
/// |
| 1138 | 1149 |
/// Assignment operator. |
| 1139 | 1150 |
template <typename CMap> |
| 1140 | 1151 |
ArcMap& operator=(const CMap&) {
|
| 1141 | 1152 |
checkConcept<ReadMap<Arc, V>, CMap>(); |
| 1142 | 1153 |
return *this; |
| 1143 | 1154 |
} |
| 1144 | 1155 |
|
| 1145 | 1156 |
}; |
| 1146 | 1157 |
|
| 1147 | 1158 |
|
| 1148 | 1159 |
template <typename _Digraph> |
| 1149 | 1160 |
struct Constraints {
|
| 1150 | 1161 |
|
| 1151 | 1162 |
struct Dummy {
|
| 1152 | 1163 |
int value; |
| 1153 | 1164 |
Dummy() : value(0) {}
|
| 1154 | 1165 |
Dummy(int _v) : value(_v) {}
|
| 1155 | 1166 |
}; |
| 1156 | 1167 |
|
| 1157 | 1168 |
void constraints() {
|
| 1158 | 1169 |
checkConcept<Base, _Digraph>(); |
| 1159 | 1170 |
{ // int map test
|
| 1160 | 1171 |
typedef typename _Digraph::template NodeMap<int> IntNodeMap; |
| ... | ... |
@@ -1162,96 +1173,97 @@ |
| 1162 | 1173 |
IntNodeMap >(); |
| 1163 | 1174 |
} { // bool map test
|
| 1164 | 1175 |
typedef typename _Digraph::template NodeMap<bool> BoolNodeMap; |
| 1165 | 1176 |
checkConcept<GraphMap<_Digraph, typename _Digraph::Node, bool>, |
| 1166 | 1177 |
BoolNodeMap >(); |
| 1167 | 1178 |
} { // Dummy map test
|
| 1168 | 1179 |
typedef typename _Digraph::template NodeMap<Dummy> DummyNodeMap; |
| 1169 | 1180 |
checkConcept<GraphMap<_Digraph, typename _Digraph::Node, Dummy>, |
| 1170 | 1181 |
DummyNodeMap >(); |
| 1171 | 1182 |
} |
| 1172 | 1183 |
|
| 1173 | 1184 |
{ // int map test
|
| 1174 | 1185 |
typedef typename _Digraph::template ArcMap<int> IntArcMap; |
| 1175 | 1186 |
checkConcept<GraphMap<_Digraph, typename _Digraph::Arc, int>, |
| 1176 | 1187 |
IntArcMap >(); |
| 1177 | 1188 |
} { // bool map test
|
| 1178 | 1189 |
typedef typename _Digraph::template ArcMap<bool> BoolArcMap; |
| 1179 | 1190 |
checkConcept<GraphMap<_Digraph, typename _Digraph::Arc, bool>, |
| 1180 | 1191 |
BoolArcMap >(); |
| 1181 | 1192 |
} { // Dummy map test
|
| 1182 | 1193 |
typedef typename _Digraph::template ArcMap<Dummy> DummyArcMap; |
| 1183 | 1194 |
checkConcept<GraphMap<_Digraph, typename _Digraph::Arc, Dummy>, |
| 1184 | 1195 |
DummyArcMap >(); |
| 1185 | 1196 |
} |
| 1186 | 1197 |
} |
| 1187 | 1198 |
|
| 1188 | 1199 |
const _Digraph& digraph; |
| 1189 | 1200 |
}; |
| 1190 | 1201 |
}; |
| 1191 | 1202 |
|
| 1192 | 1203 |
/// \brief Skeleton class for mappable undirected graphs. |
| 1193 | 1204 |
/// |
| 1194 | 1205 |
/// This class describes the interface of mappable undirected graphs. |
| 1195 | 1206 |
/// It extends \ref MappableDigraphComponent with the standard graph |
| 1196 | 1207 |
/// map class for edges (\c EdgeMap). |
| 1197 | 1208 |
/// This concept is part of the Graph concept. |
| 1198 | 1209 |
template <typename BAS = BaseGraphComponent> |
| 1199 | 1210 |
class MappableGraphComponent : public MappableDigraphComponent<BAS> {
|
| 1200 | 1211 |
public: |
| 1201 | 1212 |
|
| 1202 | 1213 |
typedef BAS Base; |
| 1203 | 1214 |
typedef typename Base::Edge Edge; |
| 1204 | 1215 |
|
| 1205 | 1216 |
typedef MappableGraphComponent Graph; |
| 1206 | 1217 |
|
| 1207 | 1218 |
/// \brief Standard graph map for the edges. |
| 1208 | 1219 |
/// |
| 1209 | 1220 |
/// Standard graph map for the edges. |
| 1221 |
/// It conforms to the ReferenceMap concept. |
|
| 1210 | 1222 |
template <typename V> |
| 1211 | 1223 |
class EdgeMap : public GraphMap<MappableGraphComponent, Edge, V> {
|
| 1212 | 1224 |
public: |
| 1213 | 1225 |
typedef GraphMap<MappableGraphComponent, Edge, V> Parent; |
| 1214 | 1226 |
|
| 1215 | 1227 |
/// \brief Construct a new map. |
| 1216 | 1228 |
/// |
| 1217 | 1229 |
/// Construct a new map for the graph. |
| 1218 | 1230 |
explicit EdgeMap(const MappableGraphComponent& graph) |
| 1219 | 1231 |
: Parent(graph) {}
|
| 1220 | 1232 |
|
| 1221 | 1233 |
/// \brief Construct a new map with default value. |
| 1222 | 1234 |
/// |
| 1223 | 1235 |
/// Construct a new map for the graph and initalize the values. |
| 1224 | 1236 |
EdgeMap(const MappableGraphComponent& graph, const V& value) |
| 1225 | 1237 |
: Parent(graph, value) {}
|
| 1226 | 1238 |
|
| 1227 | 1239 |
private: |
| 1228 | 1240 |
/// \brief Copy constructor. |
| 1229 | 1241 |
/// |
| 1230 | 1242 |
/// Copy Constructor. |
| 1231 | 1243 |
EdgeMap(const EdgeMap& nm) : Parent(nm) {}
|
| 1232 | 1244 |
|
| 1233 | 1245 |
/// \brief Assignment operator. |
| 1234 | 1246 |
/// |
| 1235 | 1247 |
/// Assignment operator. |
| 1236 | 1248 |
template <typename CMap> |
| 1237 | 1249 |
EdgeMap& operator=(const CMap&) {
|
| 1238 | 1250 |
checkConcept<ReadMap<Edge, V>, CMap>(); |
| 1239 | 1251 |
return *this; |
| 1240 | 1252 |
} |
| 1241 | 1253 |
|
| 1242 | 1254 |
}; |
| 1243 | 1255 |
|
| 1244 | 1256 |
|
| 1245 | 1257 |
template <typename _Graph> |
| 1246 | 1258 |
struct Constraints {
|
| 1247 | 1259 |
|
| 1248 | 1260 |
struct Dummy {
|
| 1249 | 1261 |
int value; |
| 1250 | 1262 |
Dummy() : value(0) {}
|
| 1251 | 1263 |
Dummy(int _v) : value(_v) {}
|
| 1252 | 1264 |
}; |
| 1253 | 1265 |
|
| 1254 | 1266 |
void constraints() {
|
| 1255 | 1267 |
checkConcept<MappableDigraphComponent<Base>, _Graph>(); |
| 1256 | 1268 |
|
| 1257 | 1269 |
{ // int map test
|
0 comments (0 inline)