COIN-OR::LEMON - Graph Library

Changeset 2564:3250756f5add in lemon-0.x for lemon/maps.h


Ignore:
Timestamp:
02/05/08 13:41:05 (16 years ago)
Author:
Peter Kovacs
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@3445
Message:

Several doc improvements and fixes in maps.h and concepts/maps.h.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/maps.h

    r2553 r2564  
    4545  class MapBase {
    4646  public:
    47     ///\e
     47    /// The key type of the map.
    4848    typedef K Key;
    49     ///\e
     49    /// The value type of the map. (The type of objects associated with the keys).
    5050    typedef T Value;
    5151  };
     
    5353  /// Null map. (a.k.a. DoNothingMap)
    5454
    55   /// If you have to provide a map only for its type definitions,
    56   /// or if you have to provide a writable map, but
    57   /// data written to it will sent to <tt>/dev/null</tt>...
     55  /// This map can be used if you have to provide a map only for
     56  /// its type definitions, or if you have to provide a writable map,
     57  /// but data written to it is not required (i.e. it will be sent to
     58  /// <tt>/dev/null</tt>).
    5859  template<typename K, typename T>
    5960  class NullMap : public MapBase<K, T> {
     
    6970  };
    7071
     72  ///Returns a \c NullMap class
     73
     74  ///This function just returns a \c NullMap class.
     75  ///\relates NullMap
    7176  template <typename K, typename V>
    7277  NullMap<K, V> nullMap() {
     
    7782  /// Constant map.
    7883
    79   /// This is a readable map which assigns a specified value to each key.
    80   /// In other aspects it is equivalent to the \c NullMap.
     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.
    8187  template<typename K, typename T>
    8288  class ConstMap : public MapBase<K, T> {
     
    9197    /// Default constructor
    9298
     99    /// Default constructor.
    93100    /// The value of the map will be uninitialized.
    94101    /// (More exactly it will be default constructed.)
    95102    ConstMap() {}
    96     ///\e
    97 
    98     /// \param _v The initial value of the map.
    99     ///
     103   
     104    /// Constructor with specified initial value
     105
     106    /// Constructor with specified initial value.
     107    /// \param _v is the initial value of the map.
    100108    ConstMap(const T &_v) : v(_v) {}
    101109   
     
    132140  /// Constant map with inlined constant value.
    133141
    134   /// This is a readable map which assigns a specified value to each key.
    135   /// In other aspects it is equivalent to the \c NullMap.
     142  /// This is a \ref concepts::ReadMap "readable" map which assigns a
     143  /// specified value to each key.
     144  /// In other aspects it is equivalent to \c NullMap.
    136145  template<typename K, typename V, V v>
    137146  class ConstMap<K, Const<V, v> > : public MapBase<K, V> {
     
    148157  };
    149158
    150   ///Returns a \c ConstMap class
     159  ///Returns a \c ConstMap class with inlined value
    151160
    152161  ///This function just returns a \c ConstMap class with inlined value.
     
    157166  }
    158167
    159   ///Map based on std::map
    160 
    161   ///This is essentially a wrapper for \c std::map. With addition that
     168  ///Map based on \c std::map
     169
     170  ///This is essentially a wrapper for \c std::map with addition that
    162171  ///you can specify a default value different from \c Value() .
     172  ///It meets the \ref concepts::ReferenceMap "ReferenceMap" concept.
    163173  template <typename K, typename T, typename Compare = std::less<K> >
    164   class StdMap {
     174  class StdMap : public MapBase<K, T> {
    165175    template <typename K1, typename T1, typename C1>
    166176    friend class StdMap;
    167177  public:
    168178
     179    typedef MapBase<K, T> Parent;
     180    ///Key type
     181    typedef typename Parent::Key Key;
     182    ///Value type
     183    typedef typename Parent::Value Value;
     184    ///Reference Type
     185    typedef T& Reference;
     186    ///Const reference type
     187    typedef const T& ConstReference;
     188
    169189    typedef True ReferenceMapTag;
    170     ///\e
    171     typedef K Key;
    172     ///\e
    173     typedef T Value;
    174     ///\e
    175     typedef T& Reference;
    176     ///\e
    177     typedef const T& ConstReference;
    178190
    179191  private:
     
    187199    /// Constructor with specified default value
    188200    StdMap(const T& value = T()) : _value(value) {}
    189     /// \brief Constructs the map from an appropriate std::map, and explicitly
    190     /// specifies a default value.
     201    /// \brief Constructs the map from an appropriate \c std::map, and
     202    /// explicitly specifies a default value.
    191203    template <typename T1, typename Comp1>
    192204    StdMap(const std::map<Key, T1, Comp1> &map, const T& value = T())
    193205      : _map(map.begin(), map.end()), _value(value) {}
    194206   
    195     /// \brief Constructs a map from an other StdMap.
     207    /// \brief Constructs a map from an other \ref StdMap.
    196208    template<typename T1, typename Comp1>
    197209    StdMap(const StdMap<Key, T1, Comp1> &c)
     
    243255  };
    244256
    245   /// \brief Map for storing values for the range \c [0..size-1] range keys
    246   ///
    247   /// The current map has the \c [0..size-1] keyset and the values
     257  ///Returns a \c StdMap class
     258
     259  ///This function just returns a \c StdMap class with specified
     260  ///default value.
     261  ///\relates StdMap
     262  template<typename K, typename V, typename Compare>
     263  inline StdMap<K, V, Compare> stdMap(const V& value = V()) {
     264    return StdMap<K, V, Compare>(value);
     265  }
     266 
     267  template<typename K, typename V>
     268  inline StdMap<K, V, std::less<K> > stdMap(const V& value = V()) {
     269    return StdMap<K, V, std::less<K> >(value);
     270  }
     271 
     272  ///Returns a \c StdMap class created from an appropriate \c std::map
     273
     274  ///This function just returns a \c StdMap class created from an
     275  ///appropriate \c std::map.
     276  ///\relates StdMap
     277  template<typename K, typename V, typename Compare>
     278  inline StdMap<K, V, Compare> stdMap( const std::map<K, V, Compare> &map,
     279                                       const V& value = V() ) {
     280    return StdMap<K, V, Compare>(map, value);
     281  }
     282
     283  /// \brief Map for storing values for keys from the range <tt>[0..size-1]</tt>
     284  ///
     285  /// This map has the <tt>[0..size-1]</tt> keyset and the values
    248286  /// are stored in a \c std::vector<T>  container. It can be used with
    249287  /// some data structures, for example \c UnionFind, \c BinHeap, when
    250288  /// the used items are small integer numbers.
    251289  template <typename T>
    252   class IntegerMap {
     290  class IntegerMap : public MapBase<int, T> {
    253291
    254292    template <typename T1>
     
    257295  public:
    258296
     297    typedef MapBase<int, T> Parent;
     298    ///\e
     299    typedef typename Parent::Key Key;
     300    ///\e
     301    typedef typename Parent::Value Value;
     302    ///\e
     303    typedef T& Reference;
     304    ///\e
     305    typedef const T& ConstReference;
     306
    259307    typedef True ReferenceMapTag;
    260     ///\e
    261     typedef int Key;
    262     ///\e
    263     typedef T Value;
    264     ///\e
    265     typedef T& Reference;
    266     ///\e
    267     typedef const T& ConstReference;
    268308
    269309  private:
     
    277317    IntegerMap(int size = 0, const T& value = T()) : _vector(size, value) {}
    278318
    279     /// \brief Constructs the map from an appropriate std::vector.
     319    /// \brief Constructs the map from an appropriate \c std::vector.
    280320    template <typename T1>
    281321    IntegerMap(const std::vector<T1>& vector)
    282322      : _vector(vector.begin(), vector.end()) {}
    283323   
    284     /// \brief Constructs a map from an other IntegerMap.
     324    /// \brief Constructs a map from an other \ref IntegerMap.
    285325    template <typename T1>
    286326    IntegerMap(const IntegerMap<T1> &c)
     
    315355  };
    316356
     357  ///Returns an \c IntegerMap class
     358
     359  ///This function just returns an \c IntegerMap class.
     360  ///\relates IntegerMap
     361  template<typename T>
     362  inline IntegerMap<T> integerMap(int size = 0, const T& value = T()) {
     363    return IntegerMap<T>(size, value);
     364  }
     365
    317366  /// @}
    318367
     
    320369  /// @{
    321370
    322   /// \brief Identity mapping.
    323   ///
    324   /// This mapping gives back the given key as value without any
     371  /// \brief Identity map.
     372  ///
     373  /// This map gives back the given key as value without any
    325374  /// modification.
    326375  template <typename T>
     
    347396 
    348397
    349   ///Convert the \c Value of a map to another type.
    350 
    351   ///This \c concepts::ReadMap "read only map"
    352   ///converts the \c Value of a maps to type \c T.
     398  ///\brief Convert the \c Value of a map to another type using
     399  ///the default conversion.
     400  ///
     401  ///This \ref concepts::ReadMap "read only map"
     402  ///converts the \c Value of a map to type \c T.
    353403  ///Its \c Key is inherited from \c M.
    354404  template <typename M, typename T>
     
    366416    ConvertMap(const M &_m) : m(_m) {};
    367417
    368     /// \brief The subscript operator.
    369     ///
    370     /// The subscript operator.
    371     /// \param k The key
    372     /// \return The target of the edge
     418    ///\e
    373419    Value operator[](const Key& k) const {return m[k];}
    374420  };
    375421 
    376   ///Returns an \c ConvertMap class
    377 
    378   ///This function just returns an \c ConvertMap class.
     422  ///Returns a \c ConvertMap class
     423
     424  ///This function just returns a \c ConvertMap class.
    379425  ///\relates ConvertMap
    380426  template<typename T, typename M>
     
    383429  }
    384430
    385   ///Simple wrapping of the map
    386 
    387   ///This \c concepts::ReadMap "read only map" returns the simple
     431  ///Simple wrapping of a map
     432
     433  ///This \ref concepts::ReadMap "read only map" returns the simple
    388434  ///wrapping of the given map. Sometimes the reference maps cannot be
    389435  ///combined with simple read maps. This map adaptor wraps the given
    390436  ///map to simple read map.
     437  ///
     438  ///\sa SimpleWriteMap
     439  ///
     440  /// \todo Revise the misleading name
    391441  template<typename M>
    392442  class SimpleMap : public MapBase<typename M::Key, typename M::Value> {
     
    404454  };
    405455
    406   ///Simple writeable wrapping of the map
    407 
    408   ///This \c concepts::ReadMap "read only map" returns the simple
     456  ///Returns a \c SimpleMap class
     457
     458  ///This function just returns a \c SimpleMap class.
     459  ///\relates SimpleMap
     460  template<typename M>
     461  inline SimpleMap<M> simpleMap(const M &m) {
     462    return SimpleMap<M>(m);
     463  }
     464
     465  ///Simple writable wrapping of a map
     466
     467  ///This \ref concepts::ReadWriteMap "read-write map" returns the simple
    409468  ///wrapping of the given map. Sometimes the reference maps cannot be
    410469  ///combined with simple read-write maps. This map adaptor wraps the
    411470  ///given map to simple read-write map.
     471  ///
     472  ///\sa SimpleMap
     473  ///
     474  /// \todo Revise the misleading name
    412475  template<typename M>
    413476  class SimpleWriteMap : public MapBase<typename M::Key, typename M::Value> {
     
    427490  };
    428491
     492  ///Returns a \c SimpleWriteMap class
     493
     494  ///This function just returns a \c SimpleWriteMap class.
     495  ///\relates SimpleWriteMap
     496  template<typename M>
     497  inline SimpleWriteMap<M> simpleWriteMap(M &m) {
     498    return SimpleWriteMap<M>(m);
     499  }
     500
    429501  ///Sum of two maps
    430502
    431   ///This \c concepts::ReadMap "read only map" returns the sum of the two
    432   ///given maps. Its \c Key and \c Value will be inherited from \c M1.
    433   ///The \c Key and \c Value of M2 must be convertible to those of \c M1.
    434 
     503  ///This \ref concepts::ReadMap "read only map" returns the sum of the two
     504  ///given maps.
     505  ///Its \c Key and \c Value are inherited from \c M1.
     506  ///The \c Key and \c Value of \c M2 must be convertible to those of \c M1.
    435507  template<typename M1, typename M2>
    436508  class AddMap : public MapBase<typename M1::Key, typename M1::Value> {
     
    462534  ///Shift a map with a constant.
    463535
    464   ///This \c concepts::ReadMap "read only map" returns the sum of the
     536  ///This \ref concepts::ReadMap "read only map" returns the sum of the
    465537  ///given map and a constant value.
    466538  ///Its \c Key and \c Value is inherited from \c M.
     
    470542  ///  ShiftMap<X> sh(x,v);
    471543  ///\endcode
    472   ///is equivalent with
     544  ///is equivalent to
    473545  ///\code
    474546  ///  ConstMap<X::Key, X::Value> c_tmp(v);
    475547  ///  AddMap<X, ConstMap<X::Key, X::Value> > sh(x,v);
    476548  ///\endcode
     549  ///
     550  ///\sa ShiftWriteMap
    477551  template<typename M, typename C = typename M::Value>
    478552  class ShiftMap : public MapBase<typename M::Key, typename M::Value> {
     
    494568  };
    495569
    496   ///Shift a map with a constant.
    497 
    498   ///This \c concepts::ReadWriteMap "read-write map" returns the sum of the
     570  ///Shift a map with a constant (ReadWrite version).
     571
     572  ///This \ref concepts::ReadWriteMap "read-write map" returns the sum of the
    499573  ///given map and a constant value. It makes also possible to write the map.
    500   ///Its \c Key and \c Value is inherited from \c M.
    501   ///
    502   ///Actually,
    503   ///\code
    504   ///  ShiftMap<X> sh(x,v);
    505   ///\endcode
    506   ///is equivalent with
    507   ///\code
    508   ///  ConstMap<X::Key, X::Value> c_tmp(v);
    509   ///  AddMap<X, ConstMap<X::Key, X::Value> > sh(x,v);
    510   ///\endcode
     574  ///Its \c Key and \c Value are inherited from \c M.
     575  ///
     576  ///\sa ShiftMap
    511577  template<typename M, typename C = typename M::Value>
    512578  class ShiftWriteMap : public MapBase<typename M::Key, typename M::Value> {
     
    530596  };
    531597 
    532   ///Returns an \c ShiftMap class
     598  ///Returns a \c ShiftMap class
    533599
    534600  ///This function just returns an \c ShiftMap class.
     
    539605  }
    540606
     607  ///Returns a \c ShiftWriteMap class
     608
     609  ///This function just returns a \c ShiftWriteMap class.
     610  ///\relates ShiftWriteMap
    541611  template<typename M, typename C>
    542612  inline ShiftWriteMap<M, C> shiftMap(M &m,const C &v) {
     
    546616  ///Difference of two maps
    547617
    548   ///This \c concepts::ReadMap "read only map" returns the difference
    549   ///of the values of the two
    550   ///given maps. Its \c Key and \c Value will be inherited from \c M1.
     618  ///This \ref concepts::ReadMap "read only map" returns the difference
     619  ///of the values of the two given maps.
     620  ///Its \c Key and \c Value are inherited from \c M1.
    551621  ///The \c Key and \c Value of \c M2 must be convertible to those of \c M1.
    552622
     
    578648  ///Product of two maps
    579649
    580   ///This \c concepts::ReadMap "read only map" returns the product of the
    581   ///values of the two
    582   ///given
    583   ///maps. Its \c Key and \c Value will be inherited from \c M1.
     650  ///This \ref concepts::ReadMap "read only map" returns the product of the
     651  ///values of the two given maps.
     652  ///Its \c Key and \c Value are inherited from \c M1.
    584653  ///The \c Key and \c Value of \c M2 must be convertible to those of \c M1.
    585 
    586654  template<typename M1, typename M2>
    587655  class MulMap : public MapBase<typename M1::Key, typename M1::Value> {
     
    608676  }
    609677 
    610   ///Scales a maps with a constant.
    611 
    612   ///This \c concepts::ReadMap "read only map" returns the value of the
     678  ///Scales a map with a constant.
     679
     680  ///This \ref concepts::ReadMap "read only map" returns the value of the
    613681  ///given map multiplied from the left side with a constant value.
    614   ///Its \c Key and \c Value is inherited from \c M.
     682  ///Its \c Key and \c Value are inherited from \c M.
    615683  ///
    616684  ///Actually,
     
    618686  ///  ScaleMap<X> sc(x,v);
    619687  ///\endcode
    620   ///is equivalent with
     688  ///is equivalent to
    621689  ///\code
    622690  ///  ConstMap<X::Key, X::Value> c_tmp(v);
    623691  ///  MulMap<X, ConstMap<X::Key, X::Value> > sc(x,v);
    624692  ///\endcode
     693  ///
     694  ///\sa ScaleWriteMap
    625695  template<typename M, typename C = typename M::Value>
    626696  class ScaleMap : public MapBase<typename M::Key, typename M::Value> {
     
    642712  };
    643713
    644   ///Scales a maps with a constant.
    645 
    646   ///This \c concepts::ReadWriteMap "read-write map" returns the value of the
     714  ///Scales a map with a constant (ReadWrite version).
     715
     716  ///This \ref concepts::ReadWriteMap "read-write map" returns the value of the
    647717  ///given map multiplied from the left side with a constant value. It can
    648   ///be used as write map also if the given multiplier is not zero.
    649   ///Its \c Key and \c Value is inherited from \c M.
     718  ///also be used as write map if the \c / operator is defined between
     719  ///\c Value and \c C and the given multiplier is not zero.
     720  ///Its \c Key and \c Value are inherited from \c M.
     721  ///
     722  ///\sa ScaleMap
    650723  template<typename M, typename C = typename M::Value>
    651724  class ScaleWriteMap : public MapBase<typename M::Key, typename M::Value> {
     
    669742  };
    670743 
    671   ///Returns an \c ScaleMap class
    672 
    673   ///This function just returns an \c ScaleMap class.
     744  ///Returns a \c ScaleMap class
     745
     746  ///This function just returns a \c ScaleMap class.
    674747  ///\relates ScaleMap
    675748  template<typename M, typename C>
     
    678751  }
    679752
     753  ///Returns a \c ScaleWriteMap class
     754
     755  ///This function just returns a \c ScaleWriteMap class.
     756  ///\relates ScaleWriteMap
    680757  template<typename M, typename C>
    681758  inline ScaleWriteMap<M, C> scaleMap(M &m,const C &v) {
     
    685762  ///Quotient of two maps
    686763
    687   ///This \c concepts::ReadMap "read only map" returns the quotient of the
    688   ///values of the two
    689   ///given maps. Its \c Key and \c Value will be inherited from \c M1.
     764  ///This \ref concepts::ReadMap "read only map" returns the quotient of the
     765  ///values of the two given maps.
     766  ///Its \c Key and \c Value are inherited from \c M1.
    690767  ///The \c Key and \c Value of \c M2 must be convertible to those of \c M1.
    691 
    692768  template<typename M1, typename M2>
    693769  class DivMap : public MapBase<typename M1::Key, typename M1::Value> {
     
    716792  ///Composition of two maps
    717793
    718   ///This \c concepts::ReadMap "read only map" returns the composition of
    719   ///two
    720   ///given maps. That is to say, if \c m1 is of type \c M1 and \c m2 is
    721   ///of \c M2,
     794  ///This \ref concepts::ReadMap "read only map" returns the composition of
     795  ///two given maps.
     796  ///That is to say, if \c m1 is of type \c M1 and \c m2 is of \c M2,
    722797  ///then for
    723798  ///\code
    724799  ///  ComposeMap<M1, M2> cm(m1,m2);
    725800  ///\endcode
    726   /// <tt>cm[x]</tt> will be equal to <tt>m1[m2[x]]</tt>
    727   ///
    728   ///Its \c Key is inherited from \c M2 and its \c Value is from
    729   ///\c M1.
    730   ///The \c M2::Value must be convertible to \c M1::Key.
     801  /// <tt>cm[x]</tt> will be equal to <tt>m1[m2[x]]</tt>.
     802  ///
     803  ///Its \c Key is inherited from \c M2 and its \c Value is from \c M1.
     804  ///\c M2::Value must be convertible to \c M1::Key.
     805  ///
     806  ///\sa CombineMap
     807  ///
    731808  ///\todo Check the requirements.
    732809  template <typename M1, typename M2>
     
    756833  }
    757834 
    758   ///Combines of two maps using an STL (binary) functor.
    759 
    760   ///Combines of two maps using an STL (binary) functor.
    761   ///
    762   ///
    763   ///This \c concepts::ReadMap "read only map" takes two maps and a
    764   ///binary functor and returns the composition of
    765   ///the two
     835  ///Combine of two maps using an STL (binary) functor.
     836
     837  ///Combine of two maps using an STL (binary) functor.
     838  ///
     839  ///This \ref concepts::ReadMap "read only map" takes two maps and a
     840  ///binary functor and returns the composition of the two
    766841  ///given maps unsing the functor.
    767842  ///That is to say, if \c m1 and \c m2 is of type \c M1 and \c M2
    768   ///and \c f is of \c F,
    769   ///then for
     843  ///and \c f is of \c F, then for
    770844  ///\code
    771845  ///  CombineMap<M1, M2,F,V> cm(m1,m2,f);
     
    774848  ///
    775849  ///Its \c Key is inherited from \c M1 and its \c Value is \c V.
    776   ///The \c M2::Value and \c M1::Value must be convertible to the corresponding
     850  ///\c M2::Value and \c M1::Value must be convertible to the corresponding
    777851  ///input parameter of \c F and the return type of \c F must be convertible
    778852  ///to \c V.
     853  ///
     854  ///\sa ComposeMap
     855  ///
    779856  ///\todo Check the requirements.
    780857  template<typename M1, typename M2, typename F,
     
    802879  ///For example if \c m1 and \c m2 are both \c double valued maps, then
    803880  ///\code
    804   ///combineMap<double>(m1,m2,std::plus<double>())
     881  ///combineMap(m1,m2,std::plus<double>())
    805882  ///\endcode
    806   ///is equivalent with
     883  ///is equivalent to
    807884  ///\code
    808885  ///addMap(m1,m2)
     
    810887  ///
    811888  ///This function is specialized for adaptable binary function
    812   ///classes and c++ functions.
     889  ///classes and C++ functions.
    813890  ///
    814891  ///\relates CombineMap
     
    833910  ///Negative value of a map
    834911
    835   ///This \c concepts::ReadMap "read only map" returns the negative
    836   ///value of the
    837   ///value returned by the
    838   ///given map. Its \c Key and \c Value will be inherited from \c M.
     912  ///This \ref concepts::ReadMap "read only map" returns the negative
     913  ///value of the value returned by the given map.
     914  ///Its \c Key and \c Value are inherited from \c M.
    839915  ///The unary \c - operator must be defined for \c Value, of course.
    840 
     916  ///
     917  ///\sa NegWriteMap
    841918  template<typename M>
    842919  class NegMap : public MapBase<typename M::Key, typename M::Value> {
     
    853930  };
    854931 
    855   ///Negative value of a map
    856 
    857   ///This \c concepts::ReadWriteMap "read-write map" returns the negative
    858   ///value of the value returned by the
    859   ///given map. Its \c Key and \c Value will be inherited from \c M.
     932  ///Negative value of a map (ReadWrite version)
     933
     934  ///This \ref concepts::ReadWriteMap "read-write map" returns the negative
     935  ///value of the value returned by the given map.
     936  ///Its \c Key and \c Value are inherited from \c M.
    860937  ///The unary \c - operator must be defined for \c Value, of course.
    861 
     938  ///
     939  /// \sa NegMap
    862940  template<typename M>
    863941  class NegWriteMap : public MapBase<typename M::Key, typename M::Value> {
     
    885963  }
    886964
     965  ///Returns a \c NegWriteMap class
     966
     967  ///This function just returns a \c NegWriteMap class.
     968  ///\relates NegWriteMap
    887969  template <typename M>
    888970  inline NegWriteMap<M> negMap(M &m) {
     
    892974  ///Absolute value of a map
    893975
    894   ///This \c concepts::ReadMap "read only map" returns the absolute value
    895   ///of the
    896   ///value returned by the
    897   ///given map. Its \c Key and \c Value will be inherited
    898   ///from <tt>M</tt>. <tt>Value</tt>
    899   ///must be comparable to <tt>0</tt> and the unary <tt>-</tt>
     976  ///This \ref concepts::ReadMap "read only map" returns the absolute value
     977  ///of the value returned by the given map.
     978  ///Its \c Key and \c Value are inherited from \c M.
     979  ///\c Value must be comparable to \c 0 and the unary \c -
    900980  ///operator must be defined for it, of course.
    901981  ///
     
    9311011  };
    9321012 
    933   ///Returns a \c AbsMap class
    934 
    935   ///This function just returns a \c AbsMap class.
     1013  ///Returns an \c AbsMap class
     1014
     1015  ///This function just returns an \c AbsMap class.
    9361016  ///\relates AbsMap
    9371017  template<typename M>
     
    9421022  ///Converts an STL style functor to a map
    9431023
    944   ///This \c concepts::ReadMap "read only map" returns the value
    945   ///of a
    946   ///given map.
     1024  ///This \ref concepts::ReadMap "read only map" returns the value
     1025  ///of a given functor.
    9471026  ///
    9481027  ///Template parameters \c K and \c V will become its
    949   ///\c Key and \c Value. They must be given explicitely
    950   ///because a functor does not provide such typedefs.
     1028  ///\c Key and \c Value.
     1029  ///In most cases they have to be given explicitly because a
     1030  ///functor typically does not provide \c argument_type and
     1031  ///\c result_type typedefs.
    9511032  ///
    9521033  ///Parameter \c F is the type of the used functor.
     1034  ///
     1035  ///\sa MapFunctor
    9531036  template<typename F,
    9541037           typename K = typename F::argument_type,
     
    9711054  ///This function just returns a \c FunctorMap class.
    9721055  ///
    973   ///It is specialized for adaptable function classes and
    974   ///c++ functions.
     1056  ///This function is specialized for adaptable binary function
     1057  ///classes and C++ functions.
     1058  ///
    9751059  ///\relates FunctorMap
    9761060  template<typename K, typename V, typename F> inline
     
    9951079
    9961080  ///This class Converts a map to an STL style (unary) functor.
    997   ///that is it provides an <tt>operator()</tt> to read its values.
     1081  ///That is it provides an <tt>operator()</tt> to read its values.
    9981082  ///
    9991083  ///For the sake of convenience it also works as
    1000   ///a ususal \c concepts::ReadMap "readable map",
     1084  ///a ususal \ref concepts::ReadMap "readable map",
    10011085  ///i.e. <tt>operator[]</tt> and the \c Key and \c Value typedefs also exist.
     1086  ///
     1087  ///\sa FunctorMap
    10021088  template <typename M>
    10031089  class MapFunctor : public MapBase<typename M::Key, typename M::Value> {
     
    10281114  }
    10291115
    1030   ///Applies all map setting operations to two maps
    1031 
    1032   ///This map has two \c concepts::ReadMap "readable map"
     1116  ///Just readable version of \ref ForkWriteMap
     1117
     1118  ///This map has two \ref concepts::ReadMap "readable map"
    10331119  ///parameters and each read request will be passed just to the
    1034   ///first map. This class is the just readable map type of the ForkWriteMap.
    1035   ///
    1036   ///The \c Key and \c Value will be inherited from \c M1.
    1037   ///The \c Key and \c Value of M2 must be convertible from those of \c M1.
     1120  ///first map. This class is the just readable map type of \c ForkWriteMap.
     1121  ///
     1122  ///The \c Key and \c Value are inherited from \c M1.
     1123  ///The \c Key and \c Value of \c M2 must be convertible from those of \c M1.
     1124  ///
     1125  ///\sa ForkWriteMap
     1126
    10381127  template<typename  M1, typename M2>
    10391128  class ForkMap : public MapBase<typename M1::Key, typename M1::Value> {
     
    10541143  ///Applies all map setting operations to two maps
    10551144
    1056   ///This map has two \c concepts::WriteMap "writable map"
     1145  ///This map has two \ref concepts::WriteMap "writable map"
    10571146  ///parameters and each write request will be passed to both of them.
    1058   ///If \c M1 is also \c concepts::ReadMap "readable",
     1147  ///If \c M1 is also \ref concepts::ReadMap "readable",
    10591148  ///then the read operations will return the
    10601149  ///corresponding values of \c M1.
    10611150  ///
    1062   ///The \c Key and \c Value will be inherited from \c M1.
    1063   ///The \c Key and \c Value of M2 must be convertible from those of \c M1.
     1151  ///The \c Key and \c Value are inherited from \c M1.
     1152  ///The \c Key and \c Value of \c M2 must be convertible from those of \c M1.
     1153  ///
     1154  ///\sa ForkMap
    10641155  template<typename  M1, typename M2>
    10651156  class ForkWriteMap : public MapBase<typename M1::Key, typename M1::Value> {
     
    10791170  };
    10801171 
    1081   ///Returns an \c ForkMap class
    1082 
    1083   ///This function just returns an \c ForkMap class.
    1084   ///
     1172  ///Returns a \c ForkMap class
     1173
     1174  ///This function just returns a \c ForkMap class.
    10851175  ///\relates ForkMap
    10861176  template <typename M1, typename M2>
     
    10891179  }
    10901180
     1181  ///Returns a \c ForkWriteMap class
     1182
     1183  ///This function just returns a \c ForkWriteMap class.
     1184  ///\relates ForkWriteMap
    10911185  template <typename M1, typename M2>
    10921186  inline ForkWriteMap<M1, M2> forkMap(M1 &m1, M2 &m2) {
     
    11001194  ///Logical 'not' of a map
    11011195 
    1102   ///This bool \c concepts::ReadMap "read only map" returns the
    1103   ///logical negation of
    1104   ///value returned by the
    1105   ///given map. Its \c Key and will be inherited from \c M,
    1106   ///its Value is <tt>bool</tt>.
     1196  ///This bool \ref concepts::ReadMap "read only map" returns the
     1197  ///logical negation of the value returned by the given map.
     1198  ///Its \c Key is inherited from \c M, its \c Value is \c bool.
     1199  ///
     1200  ///\sa NotWriteMap
    11071201  template <typename M>
    11081202  class NotMap : public MapBase<typename M::Key, bool> {
     
    11191213  };
    11201214
    1121   ///Logical 'not' of a map with writing possibility
    1122  
    1123   ///This bool \c concepts::ReadWriteMap "read-write map" returns the
    1124   ///logical negation of value returned by the given map. When it is set,
     1215  ///Logical 'not' of a map (ReadWrie version)
     1216 
     1217  ///This bool \ref concepts::ReadWriteMap "read-write map" returns the
     1218  ///logical negation of the value returned by the given map. When it is set,
    11251219  ///the opposite value is set to the original map.
    1126   ///Its \c Key and will be inherited from \c M,
    1127   ///its Value is <tt>bool</tt>.
     1220  ///Its \c Key is inherited from \c M, its \c Value is \c bool.
     1221  ///
     1222  ///\sa NotMap
    11281223  template <typename M>
    11291224  class NotWriteMap : public MapBase<typename M::Key, bool> {
     
    11511246  }
    11521247 
     1248  ///Returns a \c NotWriteMap class
     1249 
     1250  ///This function just returns a \c NotWriteMap class.
     1251  ///\relates NotWriteMap
    11531252  template <typename M>
    11541253  inline NotWriteMap<M> notMap(M &m) {
     
    11821281 
    11831282
    1184   /// \brief Writable bool map for store each true assigned elements.
    1185   ///
    1186   /// Writable bool map to store each true assigned elements. It will
    1187   /// copies all the keys set to true to the given iterator.
     1283  /// \brief Writable bool map for logging each \c true assigned element
     1284  ///
     1285  /// A \ref concepts::ReadWriteMap "read-write" bool map for logging
     1286  /// each \c true assigned element, i.e it copies all the keys set
     1287  /// to \c true to the given iterator.
    11881288  ///
    11891289  /// \note The container of the iterator should contain space
    11901290  /// for each element.
    11911291  ///
    1192   /// The next example shows how can you write the nodes directly
    1193   /// to the standard output.
     1292  /// The following example shows how you can write the edges found by
     1293  /// the \ref Prim algorithm directly to the standard output.
    11941294  ///\code
    11951295  /// typedef IdMap<UGraph, UEdge> UEdgeIdMap;
     
    12041304  /// prim(ugraph, cost, writerMap);
    12051305  ///\endcode
     1306  ///
     1307  ///\sa BackInserterBoolMap
     1308  ///\sa FrontInserterBoolMap
     1309  ///\sa InserterBoolMap
    12061310  template <typename _Iterator,
    12071311            typename _Functor =
     
    12211325      : _begin(it), _end(it), _functor(functor) {}
    12221326
    1223     /// Gives back the given iterator set for the first time.
     1327    /// Gives back the given iterator set for the first key
    12241328    Iterator begin() const {
    12251329      return _begin;
    12261330    }
    12271331 
    1228     /// Gives back the iterator after the last set operation.
     1332    /// Gives back the the 'after the last' iterator
    12291333    Iterator end() const {
    12301334      return _end;
    12311335    }
    12321336
    1233     /// Setter function of the map
     1337    /// The \c set function of the map
    12341338    void set(const Key& key, Value value) const {
    12351339      if (value) {
     
    12441348  };
    12451349
    1246   /// \brief Writable bool map for store each true assigned elements in
     1350  /// \brief Writable bool map for logging each \c true assigned element in
    12471351  /// a back insertable container.
    12481352  ///
    1249   /// Writable bool map for store each true assigned elements in a back
    1250   /// insertable container. It will push back all the keys set to true into
    1251   /// the container. It can be used to retrieve the items into a standard
    1252   /// container. The next example shows how can you store the undirected
    1253   /// edges in a vector with prim algorithm.
     1353  /// Writable bool map for logging each \c true assigned element by pushing
     1354  /// them into a back insertable container.
     1355  /// It can be used to retrieve the items into a standard
     1356  /// container. The next example shows how you can store the
     1357  /// edges found by the Prim algorithm in a vector.
    12541358  ///
    12551359  ///\code
     
    12581362  /// prim(ugraph, cost, inserter_map);
    12591363  ///\endcode
     1364  ///
     1365  ///\sa StoreBoolMap
     1366  ///\sa FrontInserterBoolMap
     1367  ///\sa InserterBoolMap
    12601368  template <typename Container,
    12611369            typename Functor =
     
    12631371  class BackInserterBoolMap {
    12641372  public:
    1265     typedef typename Container::value_type Key;
     1373    typedef typename Functor::argument_type Key;
    12661374    typedef bool Value;
    12671375
     
    12711379      : container(_container), functor(_functor) {}
    12721380
    1273     /// Setter function of the map
     1381    /// The \c set function of the map
    12741382    void set(const Key& key, Value value) {
    12751383      if (value) {
     
    12831391  };
    12841392
    1285   /// \brief Writable bool map for store each true assigned elements in
     1393  /// \brief Writable bool map for logging each \c true assigned element in
    12861394  /// a front insertable container.
    12871395  ///
    1288   /// Writable bool map for store each true assigned elements in a front
    1289   /// insertable container. It will push front all the keys set to \c true into
    1290   /// the container. For example see the BackInserterBoolMap.
     1396  /// Writable bool map for logging each \c true assigned element by pushing
     1397  /// them into a front insertable container.
     1398  /// It can be used to retrieve the items into a standard
     1399  /// container. For example see \ref BackInserterBoolMap.
     1400  ///
     1401  ///\sa BackInserterBoolMap
     1402  ///\sa InserterBoolMap
    12911403  template <typename Container,
    12921404            typename Functor =
     
    12941406  class FrontInserterBoolMap {
    12951407  public:
    1296     typedef typename Container::value_type Key;
     1408    typedef typename Functor::argument_type Key;
    12971409    typedef bool Value;
    12981410
     
    13021414      : container(_container), functor(_functor) {}
    13031415
    1304     /// Setter function of the map
     1416    /// The \c set function of the map
    13051417    void set(const Key& key, Value value) {
    13061418      if (value) {
    1307         container.push_front(key);
     1419        container.push_front(functor(key));
    13081420      }
    13091421    }
     
    13141426  };
    13151427
    1316   /// \brief Writable bool map for store each true assigned elements in
     1428  /// \brief Writable bool map for storing each \c true assigned element in
    13171429  /// an insertable container.
    13181430  ///
    1319   /// Writable bool map for store each true assigned elements in an
     1431  /// Writable bool map for storing each \c true assigned element in an
    13201432  /// insertable container. It will insert all the keys set to \c true into
    1321   /// the container. If you want to store the cut edges of the strongly
     1433  /// the container.
     1434  ///
     1435  /// For example, if you want to store the cut arcs of the strongly
    13221436  /// connected components in a set you can use the next code:
    13231437  ///
     
    13271441  /// stronglyConnectedCutEdges(graph, cost, inserter_map);
    13281442  ///\endcode
     1443  ///
     1444  ///\sa BackInserterBoolMap
     1445  ///\sa FrontInserterBoolMap
    13291446  template <typename Container,
    13301447            typename Functor =
     
    13351452    typedef bool Value;
    13361453
    1337     /// Constructor
     1454    /// Constructor with specified iterator
     1455   
     1456    /// Constructor with specified iterator.
     1457    /// \param _container The container for storing the elements.
     1458    /// \param _it The elements will be inserted before this iterator.
     1459    /// \param _functor The functor that is used when an element is stored.
    13381460    InserterBoolMap(Container& _container, typename Container::iterator _it,
    13391461                    const Functor& _functor = Functor())
     
    13411463
    13421464    /// Constructor
     1465
     1466    /// Constructor without specified iterator.
     1467    /// The elements will be inserted before <tt>_container.end()</tt>.
     1468    /// \param _container The container for storing the elements.
     1469    /// \param _functor The functor that is used when an element is stored.
    13431470    InserterBoolMap(Container& _container, const Functor& _functor = Functor())
    13441471      : container(_container), it(_container.end()), functor(_functor) {}
    13451472
    1346     /// Setter function of the map
     1473    /// The \c set function of the map
    13471474    void set(const Key& key, Value value) {
    13481475      if (value) {
    1349         it = container.insert(it, key);
     1476        it = container.insert(it, functor(key));
    13501477        ++it;
    13511478      }
     
    13581485  };
    13591486
    1360   /// \brief Fill the true set elements with a given value.
    1361   ///
    1362   /// Writable bool map to fill the elements set to \c true with a given value.
    1363   /// The value can set
    1364   /// the container.
    1365   ///
    1366   /// The next code finds the connected components of the undirected graph
     1487  /// \brief Writable bool map for filling each \c true assigned element with a
     1488  /// given value.
     1489  ///
     1490  /// Writable bool map for filling each \c true assigned element with a
     1491  /// given value. The value can set the container.
     1492  ///
     1493  /// The following code finds the connected components of a graph
    13671494  /// and stores it in the \c comp map:
    13681495  ///\code
     
    14121539    }
    14131540
    1414     /// Setter function of the map
     1541    /// The \c set function of the map
    14151542    void set(const Key& key, Value value) {
    14161543      if (value) {
     
    14251552
    14261553
    1427   /// \brief Writable bool map which stores for each true assigned elements 
    1428   /// the setting order number.
    1429   ///
    1430   /// Writable bool map which stores for each true assigned elements 
    1431   /// the setting order number. It make easy to calculate the leaving
     1554  /// \brief Writable bool map for storing the sequence number of
     1555  /// \c true assignments. 
     1556  ///
     1557  /// Writable bool map that stores for each \c true assigned elements 
     1558  /// the sequence number of this setting.
     1559  /// It makes it easy to calculate the leaving
    14321560  /// order of the nodes in the \c Dfs algorithm.
    14331561  ///
     
    14481576  ///\endcode
    14491577  ///
    1450   /// The discovering order can be stored a little harder because the
     1578  /// The storing of the discovering order is more difficult because the
    14511579  /// ReachedMap should be readable in the dfs algorithm but the setting
    1452   /// order map is not readable. Now we should use the fork map:
     1580  /// order map is not readable. Thus we must use the fork map:
    14531581  ///
    14541582  ///\code
     
    14881616    }
    14891617
    1490     /// Setter function of the map
     1618    /// The \c set function of the map
    14911619    void set(const Key& key, Value value) {
    14921620      if (value) {
Note: See TracChangeset for help on using the changeset viewer.