COIN-OR::LEMON - Graph Library

Changeset 1719:674182524bd9 in lemon-0.x


Ignore:
Timestamp:
10/14/05 12:48:34 (18 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2246
Message:

Traits moved to own file
Tag for reference maps
Possibility to handle proper the return type
of the operator[]() const -- value or reference

Location:
lemon
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • lemon/bits/array_map.h

    r1703 r1719  
    4949    typedef _Item Item;
    5050  public:
    51     typedef True AdaptibleTag;
    52                
    5351    /// The graph type of the maps.
    5452    typedef _Graph Graph;
     53    /// The reference map tag.
     54    typedef True ReferenceMapTag;
     55
    5556    /// The key type of the maps.
    5657    typedef _Item Key;
     58    /// The value type of the map.
     59    typedef _Value Value;
     60    /// The const reference type of the map.
     61    typedef const _Value& ConstReference;
     62    /// The reference type of the map.
     63    typedef _Value& Reference;
     64
     65    typedef const Value ConstValue;
     66    typedef Value* Pointer;
     67    typedef const Value* ConstPointer;
    5768
    5869    typedef AlterationNotifier<_Item> Registry;
     
    6172    typedef typename Registry::ObserverBase Parent;
    6273               
    63     /// The value type of the map.
    64     typedef _Value Value;
    6574
    6675
     
    7180  public:
    7281
    73     /// \brief Graph and Registry initialized map constructor.
    74     ///
    75     /// Graph and Registry initialized map constructor.
     82    /// \brief Graph initialized map constructor.
     83    ///
     84    /// Graph initialized map constructor.
    7685    ArrayMap(const Graph& _g) : graph(&_g) {
    7786      Item it;
  • lemon/bits/map_iterator.h

    r1587 r1719  
    105105    typedef typename Parent::ItemIt ItemIt;
    106106
    107     typedef typename ReferenceMapTraits<_Map>::Value MapValue;
    108     typedef typename ReferenceMapTraits<_Map>::Reference MapReference;
     107    typedef typename _Map::Value MapValue;
     108    typedef typename _Map::Reference MapReference;
    109109   
    110110  public:
     
    195195    typedef typename Parent::ItemIt ItemIt;
    196196
    197     typedef typename ReferenceMapTraits<_Map>::Value MapValue;
    198     typedef typename ReferenceMapTraits<_Map>::ConstReference
    199     MapReference;
     197    typedef typename _Map::Value MapValue;
     198    typedef typename _Map::ConstReference MapReference;
    200199   
    201200  public:
     
    354353
    355354    /// The value type of the iterator.
    356     typedef typename ReferenceMapTraits<Map>::Value MapValue;
     355    typedef typename Map::Value MapValue;
    357356    /// The reference type of the iterator.
    358     typedef typename ReferenceMapTraits<Map>::Reference MapReference;
     357    typedef typename Map::Reference MapReference;
    359358    /// The pointer type of the iterator.
    360     typedef typename ReferenceMapTraits<Map>::Pointer MapPointer;
     359    typedef typename Map::Pointer MapPointer;
    361360
    362361  public:
     
    434433
    435434    /// The value type of the iterator.
    436     typedef typename ReferenceMapTraits<Map>::Value MapValue;
     435    typedef typename Map::Value MapValue;
    437436    /// The reference type of the iterator.
    438     typedef typename ReferenceMapTraits<Map>::ConstReference MapReference;
     437    typedef typename Map::ConstReference MapReference;
    439438    /// The pointer type of the iterator.
    440     typedef typename ReferenceMapTraits<Map>::ConstPointer MapPointer;
     439    typedef typename Map::ConstPointer MapPointer;
    441440
    442441  public:
  • lemon/bits/static_map.h

    r1703 r1719  
    6363    };
    6464
    65     typedef True AdaptibleTag;
     65  private:
    6666               
     67    typedef std::vector<_Value> Container;     
     68
     69  public:
     70
    6771    /// The graph type of the map.
    6872    typedef _Graph Graph;
     73    /// The reference map tag.
     74    typedef True ReferenceMapTag;
     75
    6976    /// The key type of the map.
    7077    typedef _Item Key;
    71     /// The id map type of the map.
    72     typedef AlterationNotifier<_Item> Registry;
    7378    /// The value type of the map.
    7479    typedef _Value Value;
     80    /// The const reference type of the map.
     81    typedef typename Container::const_reference ConstReference;
     82    /// The reference type of the map.
     83    typedef typename Container::reference Reference;
     84
     85    typedef const Value ConstValue;
     86    typedef Value* Pointer;
     87    typedef const Value* ConstPointer;
     88
     89    typedef AlterationNotifier<_Item> Registry;
    7590
    7691    /// The map type.
     
    7893    /// The base class of the map.
    7994    typedef typename Registry::ObserverBase Parent;
    80 
    81   private:
    82                
    83     typedef std::vector<Value> Container;       
    84 
    85   public:
    8695
    8796    /// \brief Constructor to attach the new map into the registry.
     
    141150
    142151  public:
    143 
    144     typedef typename Container::reference Reference;
    145     typedef typename Container::pointer Pointer;
    146     typedef const Value ConstValue;
    147     typedef typename Container::const_reference ConstReference;
    148     typedef typename Container::const_pointer ConstPointer;
    149152
    150153    /// \brief The subcript operator.
  • lemon/bits/vector_map.h

    r1703 r1719  
    5656    >
    5757  class VectorMap : public AlterationNotifier<_Item>::ObserverBase {
     58  private:
     59               
     60    /// The container type of the map.
     61    typedef std::vector<_Value> Container;     
     62
    5863  public:
    5964
    60     typedef True AdaptibleTag;
    61                
    6265    /// The graph type of the map.
    6366    typedef _Graph Graph;
     67    /// The reference map tag.
     68    typedef True ReferenceMapTag;
     69
    6470    /// The key type of the map.
    6571    typedef _Item Key;
    66     /// The id map type of the map.
    67     typedef AlterationNotifier<_Item> Registry;
    6872    /// The value type of the map.
    6973    typedef _Value Value;
     74    /// The const reference type of the map.
     75    typedef typename Container::const_reference ConstReference;
     76    /// The reference type of the map.
     77    typedef typename Container::reference Reference;
     78
     79    typedef const Value ConstValue;
     80    typedef Value* Pointer;
     81    typedef const Value* ConstPointer;
     82
     83    typedef AlterationNotifier<_Item> Registry;
    7084
    7185    /// The map type.
     
    7387    /// The base class of the map.
    7488    typedef typename Registry::ObserverBase Parent;
    75 
    76   private:
    77                
    78     /// The container type of the map.
    79     typedef std::vector<Value> Container;       
    80 
    81   public:
    8289
    8390    /// The reference type of the map;
  • lemon/concept/maps.h

    r1435 r1719  
    1818#define LEMON_CONCEPT_MAPS_H
    1919
     20#include <lemon/utility.h>
    2021#include <lemon/concept_check.h>
    2122
     
    9899        Key& key;
    99100        typename _WriteMap::Key& own_key;
    100         WriteMap& m;
     101        _WriteMap& m;
    101102
    102103      };
     
    123124        void constraints() {
    124125          checkConcept<ReadMap<K, T>, _ReadWriteMap >();
    125           checkConcept<ReadMap<K, T>, _ReadWriteMap >();
     126          checkConcept<WriteMap<K, T>, _ReadWriteMap >();
    126127        }
    127128      };
     
    134135    {
    135136    public:
     137      /// Tag for reference maps.
     138      typedef True ReferenceMapTag;
    136139      /// Map's key type.
    137140      typedef K Key;   
     
    177180        Value& val;
    178181        Reference& ref;
    179         ReferenceMap& m;
     182        _ReferenceMap& m;
    180183      };
    181184    };
Note: See TracChangeset for help on using the changeset viewer.