COIN-OR::LEMON - Graph Library

Changeset 732:33cbc0635e92 in lemon-0.x for src/hugo/skeletons/maps.h


Ignore:
Timestamp:
07/22/04 21:59:18 (20 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@988
Message:

Skeletons have been simplified.
"Optional features" have been deleted.
Map skeletons have been renamed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/hugo/skeletons/maps.h

    r539 r732  
    1313    /// Readable map concept
    1414    template<typename K, typename T>
    15     class ReadableMap
     15    class ReadMap
    1616    {
    1717    public:
     
    2424      ValueType operator[](const KeyType &k) const {return ValueType();}
    2525
    26       /// Copy contsructor. (optional)
    27       ReadableMap(const ReadableMap&) {}
    28       /// Assignment operator. (optional)
    29       ReadableMap& operator=(const ReadableMap&) {return *this;}
    30 
    31       ReadableMap() {}
     26      ///Default constructor
     27      ReadMap() {}
    3228    };
    3329
     
    3531    /// Writable map concept
    3632    template<typename K, typename T>
    37     class WritableMap
     33    class WriteMap
    3834    {
    3935    public:
     
    4642      void set(const KeyType &k,const ValueType &t) {}
    4743
    48       WritableMap() {}
     44      ///Default constructor
     45      WriteMap() {}
    4946    };
    5047
    5148    ///Read/Writeable map concept
    5249    template<typename K, typename T>
    53     class ReadWritableMap : public ReadableMap<K,T>,
    54                             public WritableMap<K,T>
     50    class ReadWriteMap : public ReadMap<K,T>,
     51                            public WriteMap<K,T>
    5552    {
    5653    public:
     
    6562      void set(const KeyType &k,const ValueType &t) {}
    6663
    67       /// Copy contsructor. (optional)
    68       ReadWritableMap(const ReadWritableMap&) {}
    69       /// Assignment operator. (optional)
    70       ReadWritableMap& operator=(const ReadWritableMap&) {return *this;}
    71 
    72       /// Facility to define a map with an other value type (optional)
    73       template<typename T1>
    74       struct rebind {
    75         /// The type of a map with the given value type
    76         typedef ReadWritableMap<K,T1> other;
    77       };
    78       /// @brief Constructor that copies all keys from the other map and
    79       /// assigns to them a default value (optional)
    80       template<typename T1>
    81       ReadWritableMap(const ReadWritableMap<K,T1> &map, const ValueType &v) {}
    82 
    83       ReadWritableMap() {}
     64      ///Default constructor
     65      ReadWriteMap() {}
    8466    };
    8567 
     
    8769    ///Dereferable map concept
    8870    template<typename K, typename T>
    89     class DereferableMap : public ReadWritableMap<K,T>
     71    class ReferenceMap : public ReadWriteMap<K,T>
    9072    {
    9173    public:
     
    9476      /// Map's value type. (The type of objects associated with the keys).
    9577      typedef T ValueType;
    96       /// Map's reference type. (Reference to an object associated with a key)
     78
     79    protected:
     80      ValueType tmp;
     81    public:
    9782      typedef ValueType& ReferenceType;
    9883      /// Map's const reference type.
     
    10085
    10186      ///Returns a reference to the value associated to a key.
    102       ReferenceType operator[](const KeyType &i);
     87      ReferenceType operator[](const KeyType &i) { return tmp; }
    10388      ///Returns a const reference to the value associated to a key.
    104       ConstReferenceType operator[](const KeyType &i) const;
     89      ConstReferenceType operator[](const KeyType &i) const
     90      { return tmp; }
    10591      /// Sets the value associated with a key.
    10692      void set(const KeyType &k,const ValueType &t) { operator[](k)=t; }
    10793
    108       /// Copy contsructor. (optional)
    109       DereferableMap(const DereferableMap&) {}
    110       /// Assignment operator. (optional)
    111       DereferableMap& operator=(const DereferableMap&) {return *this;}
    112 
    113       /// Facility to define a map with an other value type (optional)
    114       template<typename T1>
    115       struct rebind {
    116         /// The type of a map with the given value type
    117         typedef DereferableMap<K,T1> other;
    118       };
    119       /// @brief Constructor that copies all keys from the other map and
    120       /// assigns to them a default value (optional)
    121       template<typename T1>
    122       DereferableMap(const DereferableMap<K,T1> &map, const ValueType &v) {}
    123 
    124       DereferableMap() {}
     94      ///Default constructor
     95      ReferenceMap() {}
    12596    };
    126 
    127 
    128   }
    129 }
     97  } //namespace skeleton
     98} //namespace hugo
    13099#endif // HUGO_MAPSKELETON_H
Note: See TracChangeset for help on using the changeset viewer.