COIN-OR::LEMON - Graph Library

Changeset 877:141f9c0db4a3 in lemon-1.2 for lemon/bits


Ignore:
Timestamp:
03/06/10 15:35:12 (14 years ago)
Author:
Alpar Juttner <alpar@…>
Branch:
default
Children:
878:f802439d2b58, 880:38213abd2911, 909:f112c18bc304
Phase:
public
Message:

Unify the sources (#339)

Location:
lemon/bits
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • lemon/bits/array_map.h

    r617 r877  
    33 * This file is a part of LEMON, a generic C++ optimization library.
    44 *
    5  * Copyright (C) 2003-2009
     5 * Copyright (C) 2003-2010
    66 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    77 * (Egervary Research Group on Combinatorial Optimization, EGRES).
     
    7171
    7272  private:
    73  
     73
    7474    // The MapBase of the Map which imlements the core regisitry function.
    7575    typedef typename Notifier::ObserverBase Parent;
  • lemon/bits/default_map.h

    r627 r877  
    33 * This file is a part of LEMON, a generic C++ optimization library.
    44 *
    5  * Copyright (C) 2003-2009
     5 * Copyright (C) 2003-2010
    66 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    77 * (Egervary Research Group on Combinatorial Optimization, EGRES).
     
    158158  public:
    159159    typedef DefaultMap<_Graph, _Item, _Value> Map;
    160    
     160
    161161    typedef typename Parent::GraphType GraphType;
    162162    typedef typename Parent::Value Value;
  • lemon/bits/edge_set_extender.h

    r685 r877  
    1 /* -*- C++ -*-
     1/* -*- mode: C++; indent-tabs-mode: nil; -*-
    22 *
    3  * This file is a part of LEMON, a generic C++ optimization library
     3 * This file is a part of LEMON, a generic C++ optimization library.
    44 *
    5  * Copyright (C) 2003-2008
     5 * Copyright (C) 2003-2010
    66 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    77 * (Egervary Research Group on Combinatorial Optimization, EGRES).
     
    6464    Node oppositeNode(const Node &n, const Arc &e) const {
    6565      if (n == Parent::source(e))
    66         return Parent::target(e);
     66        return Parent::target(e);
    6767      else if(n==Parent::target(e))
    68         return Parent::source(e);
     68        return Parent::source(e);
    6969      else
    70         return INVALID;
     70        return INVALID;
    7171    }
    7272
     
    9292    // Iterable extensions
    9393
    94     class NodeIt : public Node { 
     94    class NodeIt : public Node {
    9595      const Digraph* digraph;
    9696    public:
     
    101101
    102102      explicit NodeIt(const Digraph& _graph) : digraph(&_graph) {
    103         _graph.first(static_cast<Node&>(*this));
    104       }
    105 
    106       NodeIt(const Digraph& _graph, const Node& node) 
    107         : Node(node), digraph(&_graph) {}
    108 
    109       NodeIt& operator++() { 
    110         digraph->next(*this);
    111         return *this;
    112       }
    113 
    114     };
    115 
    116 
    117     class ArcIt : public Arc { 
     103        _graph.first(static_cast<Node&>(*this));
     104      }
     105
     106      NodeIt(const Digraph& _graph, const Node& node)
     107        : Node(node), digraph(&_graph) {}
     108
     109      NodeIt& operator++() {
     110        digraph->next(*this);
     111        return *this;
     112      }
     113
     114    };
     115
     116
     117    class ArcIt : public Arc {
    118118      const Digraph* digraph;
    119119    public:
     
    124124
    125125      explicit ArcIt(const Digraph& _graph) : digraph(&_graph) {
    126         _graph.first(static_cast<Arc&>(*this));
    127       }
    128 
    129       ArcIt(const Digraph& _graph, const Arc& e) : 
    130         Arc(e), digraph(&_graph) { }
    131 
    132       ArcIt& operator++() { 
    133         digraph->next(*this);
    134         return *this;
    135       }
    136 
    137     };
    138 
    139 
    140     class OutArcIt : public Arc { 
     126        _graph.first(static_cast<Arc&>(*this));
     127      }
     128
     129      ArcIt(const Digraph& _graph, const Arc& e) :
     130        Arc(e), digraph(&_graph) { }
     131
     132      ArcIt& operator++() {
     133        digraph->next(*this);
     134        return *this;
     135      }
     136
     137    };
     138
     139
     140    class OutArcIt : public Arc {
    141141      const Digraph* digraph;
    142142    public:
     
    146146      OutArcIt(Invalid i) : Arc(i) { }
    147147
    148       OutArcIt(const Digraph& _graph, const Node& node) 
    149         : digraph(&_graph) {
    150         _graph.firstOut(*this, node);
    151       }
    152 
    153       OutArcIt(const Digraph& _graph, const Arc& arc) 
    154         : Arc(arc), digraph(&_graph) {}
    155 
    156       OutArcIt& operator++() { 
    157         digraph->nextOut(*this);
    158         return *this;
    159       }
    160 
    161     };
    162 
    163 
    164     class InArcIt : public Arc { 
     148      OutArcIt(const Digraph& _graph, const Node& node)
     149        : digraph(&_graph) {
     150        _graph.firstOut(*this, node);
     151      }
     152
     153      OutArcIt(const Digraph& _graph, const Arc& arc)
     154        : Arc(arc), digraph(&_graph) {}
     155
     156      OutArcIt& operator++() {
     157        digraph->nextOut(*this);
     158        return *this;
     159      }
     160
     161    };
     162
     163
     164    class InArcIt : public Arc {
    165165      const Digraph* digraph;
    166166    public:
     
    170170      InArcIt(Invalid i) : Arc(i) { }
    171171
    172       InArcIt(const Digraph& _graph, const Node& node) 
    173         : digraph(&_graph) {
    174         _graph.firstIn(*this, node);
    175       }
    176 
    177       InArcIt(const Digraph& _graph, const Arc& arc) : 
    178         Arc(arc), digraph(&_graph) {}
    179 
    180       InArcIt& operator++() { 
    181         digraph->nextIn(*this);
    182         return *this;
     172      InArcIt(const Digraph& _graph, const Node& node)
     173        : digraph(&_graph) {
     174        _graph.firstIn(*this, node);
     175      }
     176
     177      InArcIt(const Digraph& _graph, const Arc& arc) :
     178        Arc(arc), digraph(&_graph) {}
     179
     180      InArcIt& operator++() {
     181        digraph->nextIn(*this);
     182        return *this;
    183183      }
    184184
     
    216216
    217217    // Mappable extension
    218    
     218
    219219    template <typename _Value>
    220     class ArcMap 
     220    class ArcMap
    221221      : public MapExtender<DefaultMap<Digraph, Arc, _Value> > {
    222222      typedef MapExtender<DefaultMap<Digraph, Arc, _Value> > Parent;
    223223
    224224    public:
    225       explicit ArcMap(const Digraph& _g) 
    226         : Parent(_g) {}
    227       ArcMap(const Digraph& _g, const _Value& _v) 
    228         : Parent(_g, _v) {}
     225      explicit ArcMap(const Digraph& _g)
     226        : Parent(_g) {}
     227      ArcMap(const Digraph& _g, const _Value& _v)
     228        : Parent(_g, _v) {}
    229229
    230230      ArcMap& operator=(const ArcMap& cmap) {
    231         return operator=<ArcMap>(cmap);
     231        return operator=<ArcMap>(cmap);
    232232      }
    233233
     
    235235      ArcMap& operator=(const CMap& cmap) {
    236236        Parent::operator=(cmap);
    237         return *this;
     237        return *this;
    238238      }
    239239
     
    248248      return arc;
    249249    }
    250    
     250
    251251    void clear() {
    252252      notifier(Arc()).clear();
     
    311311    Node oppositeNode(const Node &n, const Edge &e) const {
    312312      if( n == Parent::u(e))
    313         return Parent::v(e);
     313        return Parent::v(e);
    314314      else if( n == Parent::v(e))
    315         return Parent::u(e);
     315        return Parent::u(e);
    316316      else
    317         return INVALID;
     317        return INVALID;
    318318    }
    319319
     
    339339
    340340    using Parent::notifier;
    341    
     341
    342342    ArcNotifier& notifier(Arc) const {
    343343      return arc_notifier;
     
    349349
    350350
    351     class NodeIt : public Node { 
     351    class NodeIt : public Node {
    352352      const Graph* graph;
    353353    public:
     
    358358
    359359      explicit NodeIt(const Graph& _graph) : graph(&_graph) {
    360         _graph.first(static_cast<Node&>(*this));
    361       }
    362 
    363       NodeIt(const Graph& _graph, const Node& node) 
    364         : Node(node), graph(&_graph) {}
    365 
    366       NodeIt& operator++() { 
    367         graph->next(*this);
    368         return *this;
    369       }
    370 
    371     };
    372 
    373 
    374     class ArcIt : public Arc { 
     360        _graph.first(static_cast<Node&>(*this));
     361      }
     362
     363      NodeIt(const Graph& _graph, const Node& node)
     364        : Node(node), graph(&_graph) {}
     365
     366      NodeIt& operator++() {
     367        graph->next(*this);
     368        return *this;
     369      }
     370
     371    };
     372
     373
     374    class ArcIt : public Arc {
    375375      const Graph* graph;
    376376    public:
     
    381381
    382382      explicit ArcIt(const Graph& _graph) : graph(&_graph) {
    383         _graph.first(static_cast<Arc&>(*this));
    384       }
    385 
    386       ArcIt(const Graph& _graph, const Arc& e) : 
    387         Arc(e), graph(&_graph) { }
    388 
    389       ArcIt& operator++() { 
    390         graph->next(*this);
    391         return *this;
    392       }
    393 
    394     };
    395 
    396 
    397     class OutArcIt : public Arc { 
     383        _graph.first(static_cast<Arc&>(*this));
     384      }
     385
     386      ArcIt(const Graph& _graph, const Arc& e) :
     387        Arc(e), graph(&_graph) { }
     388
     389      ArcIt& operator++() {
     390        graph->next(*this);
     391        return *this;
     392      }
     393
     394    };
     395
     396
     397    class OutArcIt : public Arc {
    398398      const Graph* graph;
    399399    public:
     
    403403      OutArcIt(Invalid i) : Arc(i) { }
    404404
    405       OutArcIt(const Graph& _graph, const Node& node) 
    406         : graph(&_graph) {
    407         _graph.firstOut(*this, node);
    408       }
    409 
    410       OutArcIt(const Graph& _graph, const Arc& arc) 
    411         : Arc(arc), graph(&_graph) {}
    412 
    413       OutArcIt& operator++() { 
    414         graph->nextOut(*this);
    415         return *this;
    416       }
    417 
    418     };
    419 
    420 
    421     class InArcIt : public Arc { 
     405      OutArcIt(const Graph& _graph, const Node& node)
     406        : graph(&_graph) {
     407        _graph.firstOut(*this, node);
     408      }
     409
     410      OutArcIt(const Graph& _graph, const Arc& arc)
     411        : Arc(arc), graph(&_graph) {}
     412
     413      OutArcIt& operator++() {
     414        graph->nextOut(*this);
     415        return *this;
     416      }
     417
     418    };
     419
     420
     421    class InArcIt : public Arc {
    422422      const Graph* graph;
    423423    public:
     
    427427      InArcIt(Invalid i) : Arc(i) { }
    428428
    429       InArcIt(const Graph& _graph, const Node& node) 
    430         : graph(&_graph) {
    431         _graph.firstIn(*this, node);
    432       }
    433 
    434       InArcIt(const Graph& _graph, const Arc& arc) : 
    435         Arc(arc), graph(&_graph) {}
    436 
    437       InArcIt& operator++() { 
    438         graph->nextIn(*this);
    439         return *this;
    440       }
    441 
    442     };
    443 
    444 
    445     class EdgeIt : public Parent::Edge { 
     429      InArcIt(const Graph& _graph, const Node& node)
     430        : graph(&_graph) {
     431        _graph.firstIn(*this, node);
     432      }
     433
     434      InArcIt(const Graph& _graph, const Arc& arc) :
     435        Arc(arc), graph(&_graph) {}
     436
     437      InArcIt& operator++() {
     438        graph->nextIn(*this);
     439        return *this;
     440      }
     441
     442    };
     443
     444
     445    class EdgeIt : public Parent::Edge {
    446446      const Graph* graph;
    447447    public:
     
    452452
    453453      explicit EdgeIt(const Graph& _graph) : graph(&_graph) {
    454         _graph.first(static_cast<Edge&>(*this));
    455       }
    456 
    457       EdgeIt(const Graph& _graph, const Edge& e) : 
    458         Edge(e), graph(&_graph) { }
    459 
    460       EdgeIt& operator++() { 
    461         graph->next(*this);
    462         return *this;
     454        _graph.first(static_cast<Edge&>(*this));
     455      }
     456
     457      EdgeIt(const Graph& _graph, const Edge& e) :
     458        Edge(e), graph(&_graph) { }
     459
     460      EdgeIt& operator++() {
     461        graph->next(*this);
     462        return *this;
    463463      }
    464464
     
    476476
    477477      IncEdgeIt(const Graph& _graph, const Node &n) : graph(&_graph) {
    478         _graph.firstInc(*this, direction, n);
     478        _graph.firstInc(*this, direction, n);
    479479      }
    480480
    481481      IncEdgeIt(const Graph& _graph, const Edge &ue, const Node &n)
    482         : graph(&_graph), Edge(ue) {
    483         direction = (_graph.source(ue) == n);
     482        : graph(&_graph), Edge(ue) {
     483        direction = (_graph.source(ue) == n);
    484484      }
    485485
    486486      IncEdgeIt& operator++() {
    487         graph->nextInc(*this, direction);
    488         return *this;
     487        graph->nextInc(*this, direction);
     488        return *this;
    489489      }
    490490    };
     
    533533
    534534    template <typename _Value>
    535     class ArcMap 
     535    class ArcMap
    536536      : public MapExtender<DefaultMap<Graph, Arc, _Value> > {
    537537      typedef MapExtender<DefaultMap<Graph, Arc, _Value> > Parent;
    538538
    539539    public:
    540       explicit ArcMap(const Graph& _g) 
    541         : Parent(_g) {}
    542       ArcMap(const Graph& _g, const _Value& _v) 
    543         : Parent(_g, _v) {}
     540      explicit ArcMap(const Graph& _g)
     541        : Parent(_g) {}
     542      ArcMap(const Graph& _g, const _Value& _v)
     543        : Parent(_g, _v) {}
    544544
    545545      ArcMap& operator=(const ArcMap& cmap) {
    546         return operator=<ArcMap>(cmap);
     546        return operator=<ArcMap>(cmap);
    547547      }
    548548
     
    550550      ArcMap& operator=(const CMap& cmap) {
    551551        Parent::operator=(cmap);
    552         return *this;
     552        return *this;
    553553      }
    554554
     
    557557
    558558    template <typename _Value>
    559     class EdgeMap 
     559    class EdgeMap
    560560      : public MapExtender<DefaultMap<Graph, Edge, _Value> > {
    561561      typedef MapExtender<DefaultMap<Graph, Edge, _Value> > Parent;
    562562
    563563    public:
    564       explicit EdgeMap(const Graph& _g) 
    565         : Parent(_g) {}
    566 
    567       EdgeMap(const Graph& _g, const _Value& _v) 
    568         : Parent(_g, _v) {}
     564      explicit EdgeMap(const Graph& _g)
     565        : Parent(_g) {}
     566
     567      EdgeMap(const Graph& _g, const _Value& _v)
     568        : Parent(_g, _v) {}
    569569
    570570      EdgeMap& operator=(const EdgeMap& cmap) {
    571         return operator=<EdgeMap>(cmap);
     571        return operator=<EdgeMap>(cmap);
    572572      }
    573573
     
    575575      EdgeMap& operator=(const CMap& cmap) {
    576576        Parent::operator=(cmap);
    577         return *this;
     577        return *this;
    578578      }
    579579
     
    592592      return edge;
    593593    }
    594    
     594
    595595    void clear() {
    596596      notifier(Arc()).clear();
     
    618618      arc_notifier.clear();
    619619    }
    620    
     620
    621621  };
    622622
  • lemon/bits/solver_bits.h

    r519 r877  
    33 * This file is a part of LEMON, a generic C++ optimization library.
    44 *
    5  * Copyright (C) 2003-2008
     5 * Copyright (C) 2003-2010
    66 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    77 * (Egervary Research Group on Combinatorial Optimization, EGRES).
  • lemon/bits/windows.cc

    r483 r877  
    33 * This file is a part of LEMON, a generic C++ optimization library.
    44 *
    5  * Copyright (C) 2003-2009
     5 * Copyright (C) 2003-2010
    66 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    77 * (Egervary Research Group on Combinatorial Optimization, EGRES).
     
    9797      GetSystemTime(&time);
    9898      char buf1[11], buf2[9], buf3[5];
    99           if (GetDateFormat(MY_LOCALE, 0, &time,
     99          if (GetDateFormat(MY_LOCALE, 0, &time,
    100100                        ("ddd MMM dd"), buf1, 11) &&
    101101          GetTimeFormat(MY_LOCALE, 0, &time,
Note: See TracChangeset for help on using the changeset viewer.