COIN-OR::LEMON - Graph Library

Changeset 448:9d9990909fc8 in lemon-main


Ignore:
Timestamp:
12/12/08 22:18:41 (16 years ago)
Author:
Peter Kovacs <kpeter@…>
Branch:
default
Phase:
public
Message:

Add missing const keywords (+ remove misleading ones) (#67)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/adaptors.h

    r447 r448  
    7575
    7676    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 {
    7878      return _digraph->findArc(u, v, prev);
    7979    }
     
    8282    Arc addArc(const Node& u, const Node& v) { return _digraph->addArc(u, v); }
    8383
    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(); }
    8888
    8989    int id(const Node& n) const { return _digraph->id(n); }
     
    206206
    207207    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 {
    209210      return _graph->findArc(u, v, prev);
    210211    }
    211212
    212213    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 {
    214216      return _graph->findEdge(u, v, prev);
    215217    }
     
    337339    typedef FindArcTagIndicator<Digraph> FindArcTag;
    338340    Arc findArc(const Node& u, const Node& v,
    339                 const Arc& prev = INVALID) {
     341                const Arc& prev = INVALID) const {
    340342      return Parent::findArc(v, u, prev);
    341343    }
     
    476478    typedef FindArcTagIndicator<Digraph> FindArcTag;
    477479    Arc findArc(const Node& source, const Node& target,
    478                 const Arc& prev = INVALID) {
     480                const Arc& prev = INVALID) const {
    479481      if (!(*_node_filter)[source] || !(*_node_filter)[target]) {
    480482        return INVALID;
     
    619621    typedef FindArcTagIndicator<Digraph> FindArcTag;
    620622    Arc findArc(const Node& source, const Node& target,
    621                 const Arc& prev = INVALID) {
     623                const Arc& prev = INVALID) const {
    622624      if (!(*_node_filter)[source] || !(*_node_filter)[target]) {
    623625        return INVALID;
     
    945947    typedef FindArcTagIndicator<Graph> FindArcTag;
    946948    Arc findArc(const Node& u, const Node& v,
    947                 const Arc& prev = INVALID) {
     949                const Arc& prev = INVALID) const {
    948950      if (!(*_node_filter_map)[u] || !(*_node_filter_map)[v]) {
    949951        return INVALID;
     
    958960    typedef FindEdgeTagIndicator<Graph> FindEdgeTag;
    959961    Edge findEdge(const Node& u, const Node& v,
    960                   const Edge& prev = INVALID) {
     962                  const Edge& prev = INVALID) const {
    961963      if (!(*_node_filter_map)[u] || !(*_node_filter_map)[v]) {
    962964        return INVALID;
     
    11441146    typedef FindArcTagIndicator<Graph> FindArcTag;
    11451147    Arc findArc(const Node& u, const Node& v,
    1146                 const Arc& prev = INVALID) {
     1148                const Arc& prev = INVALID) const {
    11471149      Arc arc = Parent::findArc(u, v, prev);
    11481150      while (arc != INVALID && !(*_edge_filter_map)[arc]) {
     
    11541156    typedef FindEdgeTagIndicator<Graph> FindEdgeTag;
    11551157    Edge findEdge(const Node& u, const Node& v,
    1156                   const Edge& prev = INVALID) {
     1158                  const Edge& prev = INVALID) const {
    11571159      Edge edge = Parent::findEdge(u, v, prev);
    11581160      while (edge != INVALID && !(*_edge_filter_map)[edge]) {
     
    22442246    typedef FindEdgeTagIndicator<Graph> FindArcTag;
    22452247    Arc findArc(const Node& u, const Node& v,
    2246                 const Arc& prev = INVALID) {
     2248                const Arc& prev = INVALID) const {
    22472249      Arc arc = prev;
    22482250      bool d = arc == INVALID ? true : (*_direction)[arc];
     
    30983100  template <typename _Digraph>
    30993101  class SplitNodes
    3100     : public DigraphAdaptorExtender<SplitNodesBase<_Digraph> > {
     3102    : public DigraphAdaptorExtender<SplitNodesBase<const _Digraph> > {
    31013103  public:
    31023104    typedef _Digraph Digraph;
    3103     typedef DigraphAdaptorExtender<SplitNodesBase<Digraph> > Parent;
     3105    typedef DigraphAdaptorExtender<SplitNodesBase<const Digraph> > Parent;
    31043106
    31053107    typedef typename Digraph::Node DigraphNode;
     
    31123114    ///
    31133115    /// Constructor of the adaptor.
    3114     SplitNodes(Digraph& g) {
     3116    SplitNodes(const Digraph& g) {
    31153117      Parent::setDigraph(g);
    31163118    }
Note: See TracChangeset for help on using the changeset viewer.