COIN-OR::LEMON - Graph Library

Changes in / [51:90201bb15a8d:50:a34c58ff6e40] in lemon-main


Ignore:
Location:
lemon
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • lemon/concepts/maps.h

    r51 r39  
    4949      /// Returns the value associated with a key.
    5050
    51       /// Returns the value associated with a key.
    5251      /// \bug Value shouldn't need to be default constructible.
    5352      ///
     
    115114    };
    116115
    117     /// Read/writable map concept
     116    /// Read/Writable map concept
    118117   
    119118    /// Read/writable map concept.
     
    148147    /// Dereferable map concept.
    149148    ///
    150     /// \todo Rethink this concept.
    151149    template<typename K, typename T, typename R, typename CR>
    152150    class ReferenceMap : public ReadWriteMap<K,T>
     
    168166    public:
    169167
    170       ///Returns a reference to the value associated with a key.
     168      ///Returns a reference to the value associated to a key.
    171169      Reference operator[](const Key &) { return tmp; }
    172       ///Returns a const reference to the value associated with a key.
     170      ///Returns a const reference to the value associated to a key.
    173171      ConstReference operator[](const Key &) const { return tmp; }
    174172      /// Sets the value associated with a key.
    175173      void set(const Key &k,const Value &t) { operator[](k)=t; }
    176174
     175      /// \todo Rethink this concept.
    177176      template<typename _ReferenceMap>
    178177      struct ReferenceMapConcept {
  • lemon/maps.h

    r51 r44  
    8282  /// Constant map.
    8383
    84   /// This is a \ref concepts::ReadMap "readable" map which assigns a
    85   /// specified value to each key.
    86   /// In other aspects it is equivalent to \c NullMap.
     84  /// This is a readable map which assigns a specified value to each key.
     85  /// In other aspects it is equivalent to the \c NullMap.
    8786  template<typename K, typename T>
    8887  class ConstMap : public MapBase<K, T> {
     
    135134  /// Constant map with inlined constant value.
    136135
    137   /// This is a \ref concepts::ReadMap "readable" map which assigns a
    138   /// specified value to each key.
    139   /// In other aspects it is equivalent to \c NullMap.
     136  /// This is a readable map which assigns a specified value to each key.
     137  /// In other aspects it is equivalent to the \c NullMap.
    140138  template<typename K, typename V, V v>
    141139  class ConstMap<K, Const<V, v> > : public MapBase<K, V> {
     
    152150  };
    153151
    154   ///Returns a \c ConstMap class with inlined value
     152  ///Returns a \c ConstMap class
    155153
    156154  ///This function just returns a \c ConstMap class with inlined value.
     
    161159  }
    162160
    163   ///Map based on \c std::map
     161  ///Map based on std::map
    164162
    165163  ///This is essentially a wrapper for \c std::map with addition that
    166164  ///you can specify a default value different from \c Value().
    167   ///It meets the \ref concepts::ReferenceMap "ReferenceMap" concept.
    168165  template <typename K, typename T, typename Compare = std::less<K> >
    169   class StdMap : public MapBase<K, T> {
     166  class StdMap {
    170167    template <typename K1, typename T1, typename C1>
    171168    friend class StdMap;
    172169  public:
    173170
    174     typedef MapBase<K, T> Parent;
     171    typedef True ReferenceMapTag;
    175172    ///Key type
    176     typedef typename Parent::Key Key;
     173    typedef K Key;
    177174    ///Value type
    178     typedef typename Parent::Value Value;
     175    typedef T Value;
    179176    ///Reference Type
    180177    typedef T& Reference;
    181178    ///Const reference type
    182179    typedef const T& ConstReference;
    183 
    184     typedef True ReferenceMapTag;
    185180
    186181  private:
     
    194189    /// Constructor with specified default value
    195190    StdMap(const T& value = T()) : _value(value) {}
    196     /// \brief Constructs the map from an appropriate \c std::map, and
    197     /// explicitly specifies a default value.
     191    /// \brief Constructs the map from an appropriate std::map, and explicitly
     192    /// specifies a default value.
    198193    template <typename T1, typename Comp1>
    199194    StdMap(const std::map<Key, T1, Comp1> &map, const T& value = T())
    200195      : _map(map.begin(), map.end()), _value(value) {}
    201196   
    202     /// \brief Constructs a map from an other \ref StdMap.
     197    /// \brief Constructs a map from an other StdMap.
    203198    template<typename T1, typename Comp1>
    204199    StdMap(const StdMap<Key, T1, Comp1> &c)
     
    245240
    246241  };
    247  
    248   ///Returns a \c StdMap class
    249 
    250   ///This function just returns a \c StdMap class with specified
    251   ///default value.
    252   ///\relates StdMap
    253   template<typename K, typename V, typename Compare = std::less<K> >
    254   inline StdMap<K, V, Compare> stdMap(const V& value = V()) {
    255     return StdMap<K, V, Compare>(value);
    256   }
    257 
    258   ///Returns a \c StdMap class created from an appropriate std::map
    259 
    260   ///This function just returns a \c StdMap class created from an
    261   ///appropriate std::map.
    262   ///\relates StdMap
    263   template<typename K, typename V, typename Compare = std::less<K> >
    264   inline StdMap<K, V, Compare> stdMap( const std::map<K, V, Compare> &map,
    265                                        const V& value = V() ) {
    266     return StdMap<K, V, Compare>(map, value);
    267   }
    268242
    269243  /// \brief Map for storing values for keys from the range <tt>[0..size-1]</tt>
    270244  ///
    271   /// This map has the <tt>[0..size-1]</tt> keyset and the values
     245  /// The current map has the <tt>[0..size-1]</tt> keyset and the values
    272246  /// are stored in a \c std::vector<T>  container. It can be used with
    273247  /// some data structures, for example \c UnionFind, \c BinHeap, when
    274   /// the used items are small integer numbers.
    275   /// This map meets the \ref concepts::ReferenceMap "ReferenceMap" concept.
     248  /// the used items are small integer numbers.
    276249  ///
    277250  /// \todo Revise its name
    278251  template <typename T>
    279   class IntegerMap : public MapBase<int, T> {
     252  class IntegerMap {
    280253
    281254    template <typename T1>
     
    284257  public:
    285258
    286     typedef MapBase<int, T> Parent;
    287     ///\e
    288     typedef typename Parent::Key Key;
    289     ///\e
    290     typedef typename Parent::Value Value;
     259    typedef True ReferenceMapTag;
     260    ///\e
     261    typedef int Key;
     262    ///\e
     263    typedef T Value;
    291264    ///\e
    292265    typedef T& Reference;
    293266    ///\e
    294267    typedef const T& ConstReference;
    295 
    296     typedef True ReferenceMapTag;
    297268
    298269  private:
     
    306277    IntegerMap(int size = 0, const T& value = T()) : _vector(size, value) {}
    307278
    308     /// \brief Constructs the map from an appropriate \c std::vector.
     279    /// \brief Constructs the map from an appropriate std::vector.
    309280    template <typename T1>
    310281    IntegerMap(const std::vector<T1>& vector)
    311282      : _vector(vector.begin(), vector.end()) {}
    312283   
    313     /// \brief Constructs a map from an other \ref IntegerMap.
     284    /// \brief Constructs a map from an other IntegerMap.
    314285    template <typename T1>
    315286    IntegerMap(const IntegerMap<T1> &c)
     
    343314
    344315  };
    345  
    346   ///Returns an \c IntegerMap class
    347 
    348   ///This function just returns an \c IntegerMap class.
    349   ///\relates IntegerMap
    350   template<typename T>
    351   inline IntegerMap<T> integerMap(int size = 0, const T& value = T()) {
    352     return IntegerMap<T>(size, value);
    353   }
    354316
    355317  /// @}
     
    388350  ///the default conversion.
    389351  ///
    390   ///This \ref concepts::ReadMap "read only map"
     352  ///This \c concepts::ReadMap "read only map"
    391353  ///converts the \c Value of a map to type \c T.
    392354  ///Its \c Key is inherited from \c M.
     
    405367    ConvertMap(const M &_m) : m(_m) {};
    406368
    407     ///\e
     369    /// \brief The subscript operator.
     370    ///
     371    /// The subscript operator.
    408372    Value operator[](const Key& k) const {return m[k];}
    409373  };
     
    442406    Value operator[](Key k) const {return m[k];}
    443407  };
    444  
    445   ///Returns a \c SimpleMap class
    446 
    447   ///This function just returns a \c SimpleMap class.
    448   ///\relates SimpleMap
    449   template<typename M>
    450   inline SimpleMap<M> simpleMap(const M &m) {
    451     return SimpleMap<M>(m);
    452   }
    453408
    454409  ///Simple writable wrapping of a map
    455410
    456   ///This \ref concepts::ReadWriteMap "read-write map" returns the simple
     411  ///This \ref concepts::WriteMap "write map" returns the simple
    457412  ///wrapping of the given map. Sometimes the reference maps cannot be
    458413  ///combined with simple read-write maps. This map adaptor wraps the
     
    479434  };
    480435
    481   ///Returns a \c SimpleWriteMap class
    482 
    483   ///This function just returns a \c SimpleWriteMap class.
    484   ///\relates SimpleWriteMap
    485   template<typename M>
    486   inline SimpleWriteMap<M> simpleWriteMap(M &m) {
    487     return SimpleWriteMap<M>(m);
    488   }
    489 
    490436  ///Sum of two maps
    491437
    492   ///This \ref concepts::ReadMap "read only map" returns the sum of the two
     438  ///This \c concepts::ReadMap "read only map" returns the sum of the two
    493439  ///given maps.
    494440  ///Its \c Key and \c Value are inherited from \c M1.
    495   ///The \c Key and \c Value of \c M2 must be convertible to those of \c M1.
     441  ///The \c Key and \c Value of M2 must be convertible to those of \c M1.
    496442  template<typename M1, typename M2>
    497443  class AddMap : public MapBase<typename M1::Key, typename M1::Value> {
     
    513459
    514460  ///This function just returns an \c AddMap class.
    515   ///\todo Extend the documentation: how to call these type of functions?
     461  ///\todo How to call these type of functions?
    516462  ///
    517463  ///\relates AddMap
     
    523469  ///Shift a map with a constant.
    524470
    525   ///This \ref concepts::ReadMap "read only map" returns the sum of the
     471  ///This \c concepts::ReadMap "read only map" returns the sum of the
    526472  ///given map and a constant value.
    527473  ///Its \c Key and \c Value are inherited from \c M.
     
    559505  ///Shift a map with a constant (ReadWrite version).
    560506
    561   ///This \ref concepts::ReadWriteMap "read-write map" returns the sum of the
     507  ///This \c concepts::ReadWriteMap "read-write map" returns the sum of the
    562508  ///given map and a constant value. It makes also possible to write the map.
    563509  ///Its \c Key and \c Value are inherited from \c M.
     
    605551  ///Difference of two maps
    606552
    607   ///This \ref concepts::ReadMap "read only map" returns the difference
     553  ///This \c concepts::ReadMap "read only map" returns the difference
    608554  ///of the values of the two given maps.
    609555  ///Its \c Key and \c Value are inherited from \c M1.
     
    638584  ///Product of two maps
    639585
    640   ///This \ref concepts::ReadMap "read only map" returns the product of the
     586  ///This \c concepts::ReadMap "read only map" returns the product of the
    641587  ///values of the two given maps.
    642588  ///Its \c Key and \c Value are inherited from \c M1.
     
    668614  ///Scales a map with a constant.
    669615
    670   ///This \ref concepts::ReadMap "read only map" returns the value of the
     616  ///This \c concepts::ReadMap "read only map" returns the value of the
    671617  ///given map multiplied from the left side with a constant value.
    672618  ///Its \c Key and \c Value are inherited from \c M.
     
    704650  ///Scales a map with a constant (ReadWrite version).
    705651
    706   ///This \ref concepts::ReadWriteMap "read-write map" returns the value of the
     652  ///This \c concepts::ReadWriteMap "read-write map" returns the value of the
    707653  ///given map multiplied from the left side with a constant value. It can
    708654  ///also be used as write map if the \c / operator is defined between
     
    752698  ///Quotient of two maps
    753699
    754   ///This \ref concepts::ReadMap "read only map" returns the quotient of the
     700  ///This \c concepts::ReadMap "read only map" returns the quotient of the
    755701  ///values of the two given maps.
    756702  ///Its \c Key and \c Value are inherited from \c M1.
     
    782728  ///Composition of two maps
    783729
    784   ///This \ref concepts::ReadMap "read only map" returns the composition of
     730  ///This \c concepts::ReadMap "read only map" returns the composition of
    785731  ///two given maps.
    786732  ///That is to say, if \c m1 is of type \c M1 and \c m2 is of \c M2,
     
    833779  ///Combine of two maps using an STL (binary) functor.
    834780  ///
    835   ///This \ref concepts::ReadMap "read only map" takes two maps and a
     781  ///This \c concepts::ReadMap "read only map" takes two maps and a
    836782  ///binary functor and returns the composition of the two
    837783  ///given maps unsing the functor.
     
    906852  ///Negative value of a map
    907853
    908   ///This \ref concepts::ReadMap "read only map" returns the negative
     854  ///This \c concepts::ReadMap "read only map" returns the negative
    909855  ///value of the value returned by the given map.
    910856  ///Its \c Key and \c Value are inherited from \c M.
     
    928874  ///Negative value of a map (ReadWrite version)
    929875
    930   ///This \ref concepts::ReadWriteMap "read-write map" returns the negative
     876  ///This \c concepts::ReadWriteMap "read-write map" returns the negative
    931877  ///value of the value returned by the given map.
    932878  ///Its \c Key and \c Value are inherited from \c M.
     
    970916  ///Absolute value of a map
    971917
    972   ///This \ref concepts::ReadMap "read only map" returns the absolute value
     918  ///This \c concepts::ReadMap "read only map" returns the absolute value
    973919  ///of the value returned by the given map.
    974920  ///Its \c Key and \c Value are inherited from \c M.
     
    1004950  ///Converts an STL style functor to a map
    1005951
    1006   ///This \ref concepts::ReadMap "read only map" returns the value
     952  ///This \c concepts::ReadMap "read only map" returns the value
    1007953  ///of a given functor.
    1008954  ///
     
    1010956  ///\c Key and \c Value.
    1011957  ///In most cases they have to be given explicitly because a
    1012   ///functor typically does not provide \c argument_type and
    1013   ///\c result_type typedefs.
     958  ///functor typically does not provide such typedefs.
    1014959  ///
    1015960  ///Parameter \c F is the type of the used functor.
     
    1036981  ///This function just returns a \c FunctorMap class.
    1037982  ///
    1038   ///This function is specialized for adaptable binary function
    1039   ///classes and C++ functions.
    1040   ///
     983  ///It is specialized for adaptable function classes and
     984  ///C++ functions.
    1041985  ///\relates FunctorMap
    1042986  template<typename K, typename V, typename F> inline
     
    10611005
    10621006  ///This class Converts a map to an STL style (unary) functor.
    1063   ///That is it provides an <tt>operator()</tt> to read its values.
     1007  ///that is it provides an <tt>operator()</tt> to read its values.
    10641008  ///
    10651009  ///For the sake of convenience it also works as
    1066   ///a ususal \ref concepts::ReadMap "readable map",
     1010  ///a ususal \c concepts::ReadMap "readable map",
    10671011  ///i.e. <tt>operator[]</tt> and the \c Key and \c Value typedefs also exist.
    10681012  ///
     
    10961040  }
    10971041
    1098   ///Just readable version of \ref ForkWriteMap
    1099 
    1100   ///This map has two \ref concepts::ReadMap "readable map"
     1042  ///Applies all map setting operations to two maps
     1043
     1044  ///This map has two \c concepts::ReadMap "readable map"
    11011045  ///parameters and each read request will be passed just to the
    1102   ///first map. This class is the just readable map type of \c ForkWriteMap.
     1046  ///first map. This class is the just readable map type of the ForkWriteMap.
    11031047  ///
    11041048  ///The \c Key and \c Value are inherited from \c M1.
    1105   ///The \c Key and \c Value of \c M2 must be convertible from those of \c M1.
     1049  ///The \c Key and \c Value of M2 must be convertible from those of \c M1.
    11061050  ///
    11071051  ///\sa ForkWriteMap
     
    11261070  ///Applies all map setting operations to two maps
    11271071
    1128   ///This map has two \ref concepts::WriteMap "writable map"
     1072  ///This map has two \c concepts::WriteMap "writable map"
    11291073  ///parameters and each write request will be passed to both of them.
    1130   ///If \c M1 is also \ref concepts::ReadMap "readable",
     1074  ///If \c M1 is also \c concepts::ReadMap "readable",
    11311075  ///then the read operations will return the
    11321076  ///corresponding values of \c M1.
    11331077  ///
    11341078  ///The \c Key and \c Value are inherited from \c M1.
    1135   ///The \c Key and \c Value of \c M2 must be convertible from those of \c M1.
     1079  ///The \c Key and \c Value of M2 must be convertible from those of \c M1.
    11361080  ///
    11371081  ///\sa ForkMap
     
    11771121  ///Logical 'not' of a map
    11781122 
    1179   ///This bool \ref concepts::ReadMap "read only map" returns the
     1123  ///This bool \c concepts::ReadMap "read only map" returns the
    11801124  ///logical negation of the value returned by the given map.
    1181   ///Its \c Key is inherited from \c M, its \c Value is \c bool.
     1125  ///Its \c Key is inherited from \c M, its Value is \c bool.
    11821126  ///
    11831127  ///\sa NotWriteMap
     
    11981142  ///Logical 'not' of a map (ReadWrie version)
    11991143 
    1200   ///This bool \ref concepts::ReadWriteMap "read-write map" returns the
     1144  ///This bool \c concepts::ReadWriteMap "read-write map" returns the
    12011145  ///logical negation of the value returned by the given map. When it is set,
    12021146  ///the opposite value is set to the original map.
    1203   ///Its \c Key is inherited from \c M, its \c Value is \c bool.
     1147  ///Its \c Key is inherited from \c M, its Value is \c bool.
    12041148  ///
    12051149  ///\sa NotMap
     
    12661210  /// \brief Writable bool map for logging each \c true assigned element
    12671211  ///
    1268   /// A \ref concepts::ReadWriteMap "read-write" bool map for logging
    1269   /// each \c true assigned element, i.e it copies all the keys set
    1270   /// to \c true to the given iterator.
     1212  /// Writable bool map for logging each \c true assigned element, i.e it
     1213  /// copies all the keys set to \c true to the given iterator.
    12711214  ///
    12721215  /// \note The container of the iterator should contain space
    12731216  /// for each element.
    12741217  ///
    1275   /// The following example shows how you can write the edges found by
    1276   /// the \ref Prim algorithm directly to the standard output.
     1218  /// The following example shows how you can write the edges found by the Prim
     1219  /// algorithm directly
     1220  /// to the standard output.
    12771221  ///\code
    12781222  /// typedef IdMap<Graph, Edge> EdgeIdMap;
Note: See TracChangeset for help on using the changeset viewer.