COIN-OR::LEMON - Graph Library

Ignore:
Timestamp:
07/13/08 20:51:02 (16 years ago)
Author:
Alpar Juttner <alpar@…>
Branch:
default
Phase:
public
Message:

Apply unify-sources.sh to the source tree

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/bits/map_extender.h

    r107 r209  
    1 /* -*- C++ -*-
    2  *
    3  * This file is a part of LEMON, a generic C++ optimization library
     1/* -*- mode: C++; indent-tabs-mode: nil; -*-
     2 *
     3 * This file is a part of LEMON, a generic C++ optimization library.
    44 *
    55 * Copyright (C) 2003-2008
     
    3333
    3434  /// \ingroup graphbits
    35   /// 
     35  ///
    3636  /// \brief Extender for maps
    3737  template <typename _Map>
     
    5757  public:
    5858
    59     MapExtender(const Graph& graph) 
     59    MapExtender(const Graph& graph)
    6060      : Parent(graph) {}
    6161
    62     MapExtender(const Graph& graph, const Value& value) 
     62    MapExtender(const Graph& graph, const Value& value)
    6363      : Parent(graph, value) {}
    6464
     
    7171      Parent::operator=(cmap);
    7272      return *this;
    73     } 
     73    }
    7474
    7575    class MapIt : public Item {
    7676    public:
    77      
     77
    7878      typedef Item Parent;
    7979      typedef typename Map::Value Value;
    80      
     80
    8181      MapIt() {}
    8282
     
    8787      }
    8888
    89       MapIt(const Map& _map, const Item& item) 
    90         : Parent(item), map(_map) {}
    91 
    92       MapIt& operator++() { 
    93         map.notifier()->next(*this);
    94         return *this;
    95       }
    96      
     89      MapIt(const Map& _map, const Item& item)
     90        : Parent(item), map(_map) {}
     91
     92      MapIt& operator++() {
     93        map.notifier()->next(*this);
     94        return *this;
     95      }
     96
    9797      typename MapTraits<Map>::ConstReturnValue operator*() const {
    98         return map[*this];
     98        return map[*this];
    9999      }
    100100
    101101      typename MapTraits<Map>::ReturnValue operator*() {
    102         return map[*this];
    103       }
    104      
     102        return map[*this];
     103      }
     104
    105105      void set(const Value& value) {
    106         map.set(*this, value);
    107       }
    108      
     106        map.set(*this, value);
     107      }
     108
    109109    protected:
    110110      Map& map;
    111      
     111
    112112    };
    113113
     
    118118
    119119      typedef typename Map::Value Value;
    120      
     120
    121121      ConstMapIt() {}
    122122
     
    127127      }
    128128
    129       ConstMapIt(const Map& _map, const Item& item) 
    130         : Parent(item), map(_map) {}
    131 
    132       ConstMapIt& operator++() { 
    133         map.notifier()->next(*this);
    134         return *this;
     129      ConstMapIt(const Map& _map, const Item& item)
     130        : Parent(item), map(_map) {}
     131
     132      ConstMapIt& operator++() {
     133        map.notifier()->next(*this);
     134        return *this;
    135135      }
    136136
    137137      typename MapTraits<Map>::ConstReturnValue operator*() const {
    138         return map[*this];
     138        return map[*this];
    139139      }
    140140
     
    145145    class ItemIt : public Item {
    146146    public:
    147      
    148       typedef Item Parent;
    149      
     147
     148      typedef Item Parent;
     149
    150150      ItemIt() {}
    151151
     
    156156      }
    157157
    158       ItemIt(const Map& _map, const Item& item) 
    159         : Parent(item), map(_map) {}
    160 
    161       ItemIt& operator++() { 
    162         map.notifier()->next(*this);
    163         return *this;
     158      ItemIt(const Map& _map, const Item& item)
     159        : Parent(item), map(_map) {}
     160
     161      ItemIt& operator++() {
     162        map.notifier()->next(*this);
     163        return *this;
    164164      }
    165165
    166166    protected:
    167167      const Map& map;
    168      
     168
    169169    };
    170170  };
    171171
    172172  /// \ingroup graphbits
    173   /// 
     173  ///
    174174  /// \brief Extender for maps which use a subset of the items.
    175175  template <typename _Graph, typename _Map>
     
    195195  public:
    196196
    197     SubMapExtender(const Graph& _graph) 
     197    SubMapExtender(const Graph& _graph)
    198198      : Parent(_graph), graph(_graph) {}
    199199
    200     SubMapExtender(const Graph& _graph, const Value& _value) 
     200    SubMapExtender(const Graph& _graph, const Value& _value)
    201201      : Parent(_graph, _value), graph(_graph) {}
    202202
     
    213213      }
    214214      return *this;
    215     } 
     215    }
    216216
    217217    class MapIt : public Item {
    218218    public:
    219      
     219
    220220      typedef Item Parent;
    221221      typedef typename Map::Value Value;
    222      
     222
    223223      MapIt() {}
    224224
     
    229229      }
    230230
    231       MapIt(const Map& _map, const Item& item) 
    232         : Parent(item), map(_map) {}
    233 
    234       MapIt& operator++() { 
    235         map.graph.next(*this);
    236         return *this;
    237       }
    238      
     231      MapIt(const Map& _map, const Item& item)
     232        : Parent(item), map(_map) {}
     233
     234      MapIt& operator++() {
     235        map.graph.next(*this);
     236        return *this;
     237      }
     238
    239239      typename MapTraits<Map>::ConstReturnValue operator*() const {
    240         return map[*this];
     240        return map[*this];
    241241      }
    242242
    243243      typename MapTraits<Map>::ReturnValue operator*() {
    244         return map[*this];
    245       }
    246      
     244        return map[*this];
     245      }
     246
    247247      void set(const Value& value) {
    248         map.set(*this, value);
    249       }
    250      
     248        map.set(*this, value);
     249      }
     250
    251251    protected:
    252252      Map& map;
    253      
     253
    254254    };
    255255
     
    260260
    261261      typedef typename Map::Value Value;
    262      
     262
    263263      ConstMapIt() {}
    264264
     
    269269      }
    270270
    271       ConstMapIt(const Map& _map, const Item& item) 
    272         : Parent(item), map(_map) {}
    273 
    274       ConstMapIt& operator++() { 
    275         map.graph.next(*this);
    276         return *this;
     271      ConstMapIt(const Map& _map, const Item& item)
     272        : Parent(item), map(_map) {}
     273
     274      ConstMapIt& operator++() {
     275        map.graph.next(*this);
     276        return *this;
    277277      }
    278278
    279279      typename MapTraits<Map>::ConstReturnValue operator*() const {
    280         return map[*this];
     280        return map[*this];
    281281      }
    282282
     
    287287    class ItemIt : public Item {
    288288    public:
    289      
    290       typedef Item Parent;
    291      
     289
     290      typedef Item Parent;
     291
    292292      ItemIt() {}
    293293
     
    298298      }
    299299
    300       ItemIt(const Map& _map, const Item& item) 
    301         : Parent(item), map(_map) {}
    302 
    303       ItemIt& operator++() { 
    304         map.graph.next(*this);
    305         return *this;
     300      ItemIt(const Map& _map, const Item& item)
     301        : Parent(item), map(_map) {}
     302
     303      ItemIt& operator++() {
     304        map.graph.next(*this);
     305        return *this;
    306306      }
    307307
    308308    protected:
    309309      const Map& map;
    310      
    311     };
    312    
     310
     311    };
     312
    313313  private:
    314314
    315315    const Graph& graph;
    316    
     316
    317317  };
    318318
Note: See TracChangeset for help on using the changeset viewer.