COIN-OR::LEMON - Graph Library

Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/bits/vector_map.h

    r220 r314  
    2929#include <lemon/concepts/maps.h>
    3030
    31 ///\ingroup graphbits
    32 ///
    33 ///\file
    34 ///\brief Vector based graph maps.
     31//\ingroup graphbits
     32//
     33//\file
     34//\brief Vector based graph maps.
    3535namespace lemon {
    3636
    37   /// \ingroup graphbits
    38   ///
    39   /// \brief Graph map based on the std::vector storage.
    40   ///
    41   /// The VectorMap template class is graph map structure what
    42   /// automatically updates the map when a key is added to or erased from
    43   /// the map. This map type uses the std::vector to store the values.
    44   ///
    45   /// \tparam _Notifier The AlterationNotifier that will notify this map.
    46   /// \tparam _Item The item type of the graph items.
    47   /// \tparam _Value The value type of the map.
    48   /// \todo Fix the doc: there is _Graph parameter instead of _Notifier.
     37  // \ingroup graphbits
     38  //
     39  // \brief Graph map based on the std::vector storage.
     40  //
     41  // The VectorMap template class is graph map structure what
     42  // automatically updates the map when a key is added to or erased from
     43  // the map. This map type uses the std::vector to store the values.
     44  //
     45  // \tparam _Graph The graph this map is attached to.
     46  // \tparam _Item The item type of the graph items.
     47  // \tparam _Value The value type of the map.
    4948  template <typename _Graph, typename _Item, typename _Value>
    5049  class VectorMap
     
    5251  private:
    5352
    54     /// The container type of the map.
     53    // The container type of the map.
    5554    typedef std::vector<_Value> Container;
    5655
    5756  public:
    5857
    59     /// The graph type of the map.
     58    // The graph type of the map.
    6059    typedef _Graph Graph;
    61     /// The item type of the map.
     60    // The item type of the map.
    6261    typedef _Item Item;
    63     /// The reference map tag.
     62    // The reference map tag.
    6463    typedef True ReferenceMapTag;
    6564
    66     /// The key type of the map.
     65    // The key type of the map.
    6766    typedef _Item Key;
    68     /// The value type of the map.
     67    // The value type of the map.
    6968    typedef _Value Value;
    7069
    71     /// The notifier type.
     70    // The notifier type.
    7271    typedef typename ItemSetTraits<_Graph, _Item>::ItemNotifier Notifier;
    7372
    74     /// The map type.
     73    // The map type.
    7574    typedef VectorMap Map;
    76     /// The base class of the map.
     75    // The base class of the map.
    7776    typedef typename Notifier::ObserverBase Parent;
    7877
    79     /// The reference type of the map;
     78    // The reference type of the map;
    8079    typedef typename Container::reference Reference;
    81     /// The const reference type of the map;
     80    // The const reference type of the map;
    8281    typedef typename Container::const_reference ConstReference;
    8382
    8483
    85     /// \brief Constructor to attach the new map into the notifier.
    86     ///
    87     /// It constructs a map and attachs it into the notifier.
    88     /// It adds all the items of the graph to the map.
     84    // \brief Constructor to attach the new map into the notifier.
     85    //
     86    // It constructs a map and attachs it into the notifier.
     87    // It adds all the items of the graph to the map.
    8988    VectorMap(const Graph& graph) {
    9089      Parent::attach(graph.notifier(Item()));
     
    9291    }
    9392
    94     /// \brief Constructor uses given value to initialize the map.
    95     ///
    96     /// It constructs a map uses a given value to initialize the map.
    97     /// It adds all the items of the graph to the map.
     93    // \brief Constructor uses given value to initialize the map.
     94    //
     95    // It constructs a map uses a given value to initialize the map.
     96    // It adds all the items of the graph to the map.
    9897    VectorMap(const Graph& graph, const Value& value) {
    9998      Parent::attach(graph.notifier(Item()));
     
    101100    }
    102101
    103     /// \brief Copy constructor
    104     ///
    105     /// Copy constructor.
     102  private:
     103    // \brief Copy constructor
     104    //
     105    // Copy constructor.
    106106    VectorMap(const VectorMap& _copy) : Parent() {
    107107      if (_copy.attached()) {
     
    111111    }
    112112
    113     /// \brief Assign operator.
    114     ///
    115     /// This operator assigns for each item in the map the
    116     /// value mapped to the same item in the copied map.
    117     /// The parameter map should be indiced with the same
    118     /// itemset because this assign operator does not change
    119     /// the container of the map.
     113    // \brief Assign operator.
     114    //
     115    // This operator assigns for each item in the map the
     116    // value mapped to the same item in the copied map.
     117    // The parameter map should be indiced with the same
     118    // itemset because this assign operator does not change
     119    // the container of the map.
    120120    VectorMap& operator=(const VectorMap& cmap) {
    121121      return operator=<VectorMap>(cmap);
     
    123123
    124124
    125     /// \brief Template assign operator.
    126     ///
    127     /// The given parameter should be conform to the ReadMap
    128     /// concecpt and could be indiced by the current item set of
    129     /// the NodeMap. In this case the value for each item
    130     /// is assigned by the value of the given ReadMap.
     125    // \brief Template assign operator.
     126    //
     127    // The given parameter should be conform to the ReadMap
     128    // concecpt and could be indiced by the current item set of
     129    // the NodeMap. In this case the value for each item
     130    // is assigned by the value of the given ReadMap.
    131131    template <typename CMap>
    132132    VectorMap& operator=(const CMap& cmap) {
     
    142142  public:
    143143
    144     /// \brief The subcript operator.
    145     ///
    146     /// The subscript operator. The map can be subscripted by the
    147     /// actual items of the graph.
     144    // \brief The subcript operator.
     145    //
     146    // The subscript operator. The map can be subscripted by the
     147    // actual items of the graph.
    148148    Reference operator[](const Key& key) {
    149149      return container[Parent::notifier()->id(key)];
    150150    }
    151151
    152     /// \brief The const subcript operator.
    153     ///
    154     /// The const subscript operator. The map can be subscripted by the
    155     /// actual items of the graph.
     152    // \brief The const subcript operator.
     153    //
     154    // The const subscript operator. The map can be subscripted by the
     155    // actual items of the graph.
    156156    ConstReference operator[](const Key& key) const {
    157157      return container[Parent::notifier()->id(key)];
     
    159159
    160160
    161     /// \brief The setter function of the map.
    162     ///
    163     /// It the same as operator[](key) = value expression.
     161    // \brief The setter function of the map.
     162    //
     163    // It the same as operator[](key) = value expression.
    164164    void set(const Key& key, const Value& value) {
    165165      (*this)[key] = value;
     
    168168  protected:
    169169
    170     /// \brief Adds a new key to the map.
    171     ///
    172     /// It adds a new key to the map. It called by the observer notifier
    173     /// and it overrides the add() member function of the observer base.
     170    // \brief Adds a new key to the map.
     171    //
     172    // It adds a new key to the map. It called by the observer notifier
     173    // and it overrides the add() member function of the observer base.
    174174    virtual void add(const Key& key) {
    175175      int id = Parent::notifier()->id(key);
     
    179179    }
    180180
    181     /// \brief Adds more new keys to the map.
    182     ///
    183     /// It adds more new keys to the map. It called by the observer notifier
    184     /// and it overrides the add() member function of the observer base.
     181    // \brief Adds more new keys to the map.
     182    //
     183    // It adds more new keys to the map. It called by the observer notifier
     184    // and it overrides the add() member function of the observer base.
    185185    virtual void add(const std::vector<Key>& keys) {
    186186      int max = container.size() - 1;
     
    194194    }
    195195
    196     /// \brief Erase a key from the map.
    197     ///
    198     /// Erase a key from the map. It called by the observer notifier
    199     /// and it overrides the erase() member function of the observer base.
     196    // \brief Erase a key from the map.
     197    //
     198    // Erase a key from the map. It called by the observer notifier
     199    // and it overrides the erase() member function of the observer base.
    200200    virtual void erase(const Key& key) {
    201201      container[Parent::notifier()->id(key)] = Value();
    202202    }
    203203
    204     /// \brief Erase more keys from the map.
    205     ///
    206     /// Erase more keys from the map. It called by the observer notifier
    207     /// and it overrides the erase() member function of the observer base.
     204    // \brief Erase more keys from the map.
     205    //
     206    // Erase more keys from the map. It called by the observer notifier
     207    // and it overrides the erase() member function of the observer base.
    208208    virtual void erase(const std::vector<Key>& keys) {
    209209      for (int i = 0; i < int(keys.size()); ++i) {
     
    212212    }
    213213
    214     /// \brief Buildes the map.
    215     ///
    216     /// It buildes the map. It called by the observer notifier
    217     /// and it overrides the build() member function of the observer base.
     214    // \brief Buildes the map.
     215    //
     216    // It buildes the map. It called by the observer notifier
     217    // and it overrides the build() member function of the observer base.
    218218    virtual void build() {
    219219      int size = Parent::notifier()->maxId() + 1;
     
    222222    }
    223223
    224     /// \brief Clear the map.
    225     ///
    226     /// It erase all items from the map. It called by the observer notifier
    227     /// and it overrides the clear() member function of the observer base.
     224    // \brief Clear the map.
     225    //
     226    // It erase all items from the map. It called by the observer notifier
     227    // and it overrides the clear() member function of the observer base.
    228228    virtual void clear() {
    229229      container.clear();
Note: See TracChangeset for help on using the changeset viewer.