gravatar
kpeter (Peter Kovacs)
kpeter@inf.elte.hu
Add missing const keywords (+ remove misleading ones) (#67)
0 1 0
default
1 file changed with 20 insertions and 18 deletions:
↑ Collapse diff ↑
Ignore white space 24 line context
... ...
@@ -65,35 +65,35 @@
65 65
    void nextOut(Arc& i) const { _digraph->nextOut(i); }
66 66

	
67 67
    Node source(const Arc& a) const { return _digraph->source(a); }
68 68
    Node target(const Arc& a) const { return _digraph->target(a); }
69 69

	
70 70
    typedef NodeNumTagIndicator<Digraph> NodeNumTag;
71 71
    int nodeNum() const { return _digraph->nodeNum(); }
72 72

	
73 73
    typedef ArcNumTagIndicator<Digraph> ArcNumTag;
74 74
    int arcNum() const { return _digraph->arcNum(); }
75 75

	
76 76
    typedef FindArcTagIndicator<Digraph> FindArcTag;
77
    Arc findArc(const Node& u, const Node& v, const Arc& prev = INVALID) {
77
    Arc findArc(const Node& u, const Node& v, const Arc& prev = INVALID) const {
78 78
      return _digraph->findArc(u, v, prev);
79 79
    }
80 80

	
81 81
    Node addNode() { return _digraph->addNode(); }
82 82
    Arc addArc(const Node& u, const Node& v) { return _digraph->addArc(u, v); }
83 83

	
84
    void erase(const Node& n) const { _digraph->erase(n); }
85
    void erase(const Arc& a) const { _digraph->erase(a); }
86

	
87
    void clear() const { _digraph->clear(); }
84
    void erase(const Node& n) { _digraph->erase(n); }
85
    void erase(const Arc& a) { _digraph->erase(a); }
86

	
87
    void clear() { _digraph->clear(); }
88 88

	
89 89
    int id(const Node& n) const { return _digraph->id(n); }
90 90
    int id(const Arc& a) const { return _digraph->id(a); }
91 91

	
92 92
    Node nodeFromId(int ix) const { return _digraph->nodeFromId(ix); }
93 93
    Arc arcFromId(int ix) const { return _digraph->arcFromId(ix); }
94 94

	
95 95
    int maxNodeId() const { return _digraph->maxNodeId(); }
96 96
    int maxArcId() const { return _digraph->maxArcId(); }
97 97

	
98 98
    typedef typename ItemSetTraits<Digraph, Node>::ItemNotifier NodeNotifier;
99 99
    NodeNotifier& notifier(Node) const { return _digraph->notifier(Node()); }
... ...
@@ -196,30 +196,32 @@
196 196
    Node target(const Arc& a) const { return _graph->target(a); }
197 197

	
198 198
    typedef NodeNumTagIndicator<Graph> NodeNumTag;
199 199
    int nodeNum() const { return _graph->nodeNum(); }
200 200

	
201 201
    typedef ArcNumTagIndicator<Graph> ArcNumTag;
202 202
    int arcNum() const { return _graph->arcNum(); }
203 203

	
204 204
    typedef EdgeNumTagIndicator<Graph> EdgeNumTag;
205 205
    int edgeNum() const { return _graph->edgeNum(); }
206 206

	
207 207
    typedef FindArcTagIndicator<Graph> FindArcTag;
208
    Arc findArc(const Node& u, const Node& v, const Arc& prev = INVALID) {
208
    Arc findArc(const Node& u, const Node& v,
209
                const Arc& prev = INVALID) const {
209 210
      return _graph->findArc(u, v, prev);
210 211
    }
211 212

	
212 213
    typedef FindEdgeTagIndicator<Graph> FindEdgeTag;
213
    Edge findEdge(const Node& u, const Node& v, const Edge& prev = INVALID) {
214
    Edge findEdge(const Node& u, const Node& v,
215
                  const Edge& prev = INVALID) const {
214 216
      return _graph->findEdge(u, v, prev);
215 217
    }
216 218

	
217 219
    Node addNode() { return _graph->addNode(); }
218 220
    Edge addEdge(const Node& u, const Node& v) { return _graph->addEdge(u, v); }
219 221

	
220 222
    void erase(const Node& i) { _graph->erase(i); }
221 223
    void erase(const Edge& i) { _graph->erase(i); }
222 224

	
223 225
    void clear() { _graph->clear(); }
224 226

	
225 227
    bool direction(const Arc& a) const { return _graph->direction(a); }
... ...
@@ -327,25 +329,25 @@
327 329
    void firstOut(Arc& a, const Node& n ) const { Parent::firstIn(a, n); }
328 330

	
329 331
    void nextIn(Arc& a) const { Parent::nextOut(a); }
330 332
    void nextOut(Arc& a) const { Parent::nextIn(a); }
331 333

	
332 334
    Node source(const Arc& a) const { return Parent::target(a); }
333 335
    Node target(const Arc& a) const { return Parent::source(a); }
334 336

	
335 337
    Arc addArc(const Node& u, const Node& v) { return Parent::addArc(v, u); }
336 338

	
337 339
    typedef FindArcTagIndicator<Digraph> FindArcTag;
338 340
    Arc findArc(const Node& u, const Node& v,
339
                const Arc& prev = INVALID) {
341
                const Arc& prev = INVALID) const {
340 342
      return Parent::findArc(v, u, prev);
341 343
    }
342 344

	
343 345
  };
344 346

	
345 347
  /// \ingroup graph_adaptors
346 348
  ///
347 349
  /// \brief A digraph adaptor which reverses the orientation of the arcs.
348 350
  ///
349 351
  /// ReverseDigraph reverses the arcs in the adapted digraph. The
350 352
  /// SubDigraph is conform to the \ref concepts::Digraph
351 353
  /// "Digraph concept".
... ...
@@ -466,25 +468,25 @@
466 468

	
467 469
    void unHide(const Node& n) const { _node_filter->set(n, true); }
468 470
    void unHide(const Arc& a) const { _arc_filter->set(a, true); }
469 471

	
470 472
    bool hidden(const Node& n) const { return !(*_node_filter)[n]; }
471 473
    bool hidden(const Arc& a) const { return !(*_arc_filter)[a]; }
472 474

	
473 475
    typedef False NodeNumTag;
474 476
    typedef False ArcNumTag;
475 477

	
476 478
    typedef FindArcTagIndicator<Digraph> FindArcTag;
477 479
    Arc findArc(const Node& source, const Node& target,
478
                const Arc& prev = INVALID) {
480
                const Arc& prev = INVALID) const {
479 481
      if (!(*_node_filter)[source] || !(*_node_filter)[target]) {
480 482
        return INVALID;
481 483
      }
482 484
      Arc arc = Parent::findArc(source, target, prev);
483 485
      while (arc != INVALID && !(*_arc_filter)[arc]) {
484 486
        arc = Parent::findArc(source, target, arc);
485 487
      }
486 488
      return arc;
487 489
    }
488 490

	
489 491
    template <typename _Value>
490 492
    class NodeMap : public SubMapExtender<Adaptor,
... ...
@@ -609,25 +611,25 @@
609 611

	
610 612
    void unHide(const Node& n) const { _node_filter->set(n, true); }
611 613
    void unHide(const Arc& e) const { _arc_filter->set(e, true); }
612 614

	
613 615
    bool hidden(const Node& n) const { return !(*_node_filter)[n]; }
614 616
    bool hidden(const Arc& e) const { return !(*_arc_filter)[e]; }
615 617

	
616 618
    typedef False NodeNumTag;
617 619
    typedef False ArcNumTag;
618 620

	
619 621
    typedef FindArcTagIndicator<Digraph> FindArcTag;
620 622
    Arc findArc(const Node& source, const Node& target,
621
                const Arc& prev = INVALID) {
623
                const Arc& prev = INVALID) const {
622 624
      if (!(*_node_filter)[source] || !(*_node_filter)[target]) {
623 625
        return INVALID;
624 626
      }
625 627
      Arc arc = Parent::findArc(source, target, prev);
626 628
      while (arc != INVALID && !(*_arc_filter)[arc]) {
627 629
        arc = Parent::findArc(source, target, arc);
628 630
      }
629 631
      return arc;
630 632
    }
631 633

	
632 634
    template <typename _Value>
633 635
    class NodeMap : public SubMapExtender<Adaptor,
... ...
@@ -935,38 +937,38 @@
935 937
    void unHide(const Node& n) const { _node_filter_map->set(n, true); }
936 938
    void unHide(const Edge& e) const { _edge_filter_map->set(e, true); }
937 939

	
938 940
    bool hidden(const Node& n) const { return !(*_node_filter_map)[n]; }
939 941
    bool hidden(const Edge& e) const { return !(*_edge_filter_map)[e]; }
940 942

	
941 943
    typedef False NodeNumTag;
942 944
    typedef False ArcNumTag;
943 945
    typedef False EdgeNumTag;
944 946

	
945 947
    typedef FindArcTagIndicator<Graph> FindArcTag;
946 948
    Arc findArc(const Node& u, const Node& v,
947
                const Arc& prev = INVALID) {
949
                const Arc& prev = INVALID) const {
948 950
      if (!(*_node_filter_map)[u] || !(*_node_filter_map)[v]) {
949 951
        return INVALID;
950 952
      }
951 953
      Arc arc = Parent::findArc(u, v, prev);
952 954
      while (arc != INVALID && !(*_edge_filter_map)[arc]) {
953 955
        arc = Parent::findArc(u, v, arc);
954 956
      }
955 957
      return arc;
956 958
    }
957 959

	
958 960
    typedef FindEdgeTagIndicator<Graph> FindEdgeTag;
959 961
    Edge findEdge(const Node& u, const Node& v,
960
                  const Edge& prev = INVALID) {
962
                  const Edge& prev = INVALID) const {
961 963
      if (!(*_node_filter_map)[u] || !(*_node_filter_map)[v]) {
962 964
        return INVALID;
963 965
      }
964 966
      Edge edge = Parent::findEdge(u, v, prev);
965 967
      while (edge != INVALID && !(*_edge_filter_map)[edge]) {
966 968
        edge = Parent::findEdge(u, v, edge);
967 969
      }
968 970
      return edge;
969 971
    }
970 972

	
971 973
    template <typename _Value>
972 974
    class NodeMap : public SubMapExtender<Adaptor,
... ...
@@ -1134,35 +1136,35 @@
1134 1136
    void unHide(const Node& n) const { _node_filter_map->set(n, true); }
1135 1137
    void unHide(const Edge& e) const { _edge_filter_map->set(e, true); }
1136 1138

	
1137 1139
    bool hidden(const Node& n) const { return !(*_node_filter_map)[n]; }
1138 1140
    bool hidden(const Edge& e) const { return !(*_edge_filter_map)[e]; }
1139 1141

	
1140 1142
    typedef False NodeNumTag;
1141 1143
    typedef False ArcNumTag;
1142 1144
    typedef False EdgeNumTag;
1143 1145

	
1144 1146
    typedef FindArcTagIndicator<Graph> FindArcTag;
1145 1147
    Arc findArc(const Node& u, const Node& v,
1146
                const Arc& prev = INVALID) {
1148
                const Arc& prev = INVALID) const {
1147 1149
      Arc arc = Parent::findArc(u, v, prev);
1148 1150
      while (arc != INVALID && !(*_edge_filter_map)[arc]) {
1149 1151
        arc = Parent::findArc(u, v, arc);
1150 1152
      }
1151 1153
      return arc;
1152 1154
    }
1153 1155

	
1154 1156
    typedef FindEdgeTagIndicator<Graph> FindEdgeTag;
1155 1157
    Edge findEdge(const Node& u, const Node& v,
1156
                  const Edge& prev = INVALID) {
1158
                  const Edge& prev = INVALID) const {
1157 1159
      Edge edge = Parent::findEdge(u, v, prev);
1158 1160
      while (edge != INVALID && !(*_edge_filter_map)[edge]) {
1159 1161
        edge = Parent::findEdge(u, v, edge);
1160 1162
      }
1161 1163
      return edge;
1162 1164
    }
1163 1165

	
1164 1166
    template <typename _Value>
1165 1167
    class NodeMap : public SubMapExtender<Adaptor,
1166 1168
      typename Parent::template NodeMap<_Value> > {
1167 1169
    public:
1168 1170
      typedef _Value Value;
... ...
@@ -2234,25 +2236,25 @@
2234 2236
    Node target(const Arc& e) const {
2235 2237
      return (*_direction)[e] ? _graph->v(e) : _graph->u(e);
2236 2238
    }
2237 2239

	
2238 2240
    typedef NodeNumTagIndicator<Graph> NodeNumTag;
2239 2241
    int nodeNum() const { return _graph->nodeNum(); }
2240 2242

	
2241 2243
    typedef EdgeNumTagIndicator<Graph> ArcNumTag;
2242 2244
    int arcNum() const { return _graph->edgeNum(); }
2243 2245

	
2244 2246
    typedef FindEdgeTagIndicator<Graph> FindArcTag;
2245 2247
    Arc findArc(const Node& u, const Node& v,
2246
                const Arc& prev = INVALID) {
2248
                const Arc& prev = INVALID) const {
2247 2249
      Arc arc = prev;
2248 2250
      bool d = arc == INVALID ? true : (*_direction)[arc];
2249 2251
      if (d) {
2250 2252
        arc = _graph->findEdge(u, v, arc);
2251 2253
        while (arc != INVALID && !(*_direction)[arc]) {
2252 2254
          _graph->findEdge(u, v, arc);
2253 2255
        }
2254 2256
        if (arc != INVALID) return arc;
2255 2257
      }
2256 2258
      _graph->findEdge(v, u, arc);
2257 2259
      while (arc != INVALID && (*_direction)[arc]) {
2258 2260
        _graph->findEdge(u, v, arc);
... ...
@@ -3088,39 +3090,39 @@
3088 3090
  /// the original digraph an additional arc which connects
3089 3091
  /// \f$ (u_{in}, u_{out}) \f$.
3090 3092
  ///
3091 3093
  /// The aim of this class is to run algorithm with node costs if the
3092 3094
  /// algorithm can use directly just arc costs. In this case we should use
3093 3095
  /// a \c SplitNodes and set the node cost of the graph to the
3094 3096
  /// bind arc in the adapted graph.
3095 3097
  ///
3096 3098
  /// \tparam _Digraph It must be conform to the \ref concepts::Digraph
3097 3099
  /// "Digraph concept". The type can be specified to be const.
3098 3100
  template <typename _Digraph>
3099 3101
  class SplitNodes
3100
    : public DigraphAdaptorExtender<SplitNodesBase<_Digraph> > {
3102
    : public DigraphAdaptorExtender<SplitNodesBase<const _Digraph> > {
3101 3103
  public:
3102 3104
    typedef _Digraph Digraph;
3103
    typedef DigraphAdaptorExtender<SplitNodesBase<Digraph> > Parent;
3105
    typedef DigraphAdaptorExtender<SplitNodesBase<const Digraph> > Parent;
3104 3106

	
3105 3107
    typedef typename Digraph::Node DigraphNode;
3106 3108
    typedef typename Digraph::Arc DigraphArc;
3107 3109

	
3108 3110
    typedef typename Parent::Node Node;
3109 3111
    typedef typename Parent::Arc Arc;
3110 3112

	
3111 3113
    /// \brief Constructor of the adaptor.
3112 3114
    ///
3113 3115
    /// Constructor of the adaptor.
3114
    SplitNodes(Digraph& g) {
3116
    SplitNodes(const Digraph& g) {
3115 3117
      Parent::setDigraph(g);
3116 3118
    }
3117 3119

	
3118 3120
    /// \brief Returns true when the node is in-node.
3119 3121
    ///
3120 3122
    /// Returns true when the node is in-node.
3121 3123
    static bool inNode(const Node& n) {
3122 3124
      return Parent::inNode(n);
3123 3125
    }
3124 3126

	
3125 3127
    /// \brief Returns true when the node is out-node.
3126 3128
    ///
0 comments (0 inline)