1.1 --- a/lemon/bits/array_map.h Thu Oct 09 13:40:40 2008 +0100
1.2 +++ b/lemon/bits/array_map.h Thu Oct 09 13:54:50 2008 +0100
1.3 @@ -26,48 +26,48 @@
1.4 #include <lemon/concept_check.h>
1.5 #include <lemon/concepts/maps.h>
1.6
1.7 -/// \ingroup graphbits
1.8 -/// \file
1.9 -/// \brief Graph map based on the array storage.
1.10 +// \ingroup graphbits
1.11 +// \file
1.12 +// \brief Graph map based on the array storage.
1.13
1.14 namespace lemon {
1.15
1.16 - /// \ingroup graphbits
1.17 - ///
1.18 - /// \brief Graph map based on the array storage.
1.19 - ///
1.20 - /// The ArrayMap template class is graph map structure what
1.21 - /// automatically updates the map when a key is added to or erased from
1.22 - /// the map. This map uses the allocators to implement
1.23 - /// the container functionality.
1.24 - ///
1.25 - /// The template parameters are the Graph the current Item type and
1.26 - /// the Value type of the map.
1.27 + // \ingroup graphbits
1.28 + //
1.29 + // \brief Graph map based on the array storage.
1.30 + //
1.31 + // The ArrayMap template class is graph map structure what
1.32 + // automatically updates the map when a key is added to or erased from
1.33 + // the map. This map uses the allocators to implement
1.34 + // the container functionality.
1.35 + //
1.36 + // The template parameters are the Graph the current Item type and
1.37 + // the Value type of the map.
1.38 template <typename _Graph, typename _Item, typename _Value>
1.39 class ArrayMap
1.40 : public ItemSetTraits<_Graph, _Item>::ItemNotifier::ObserverBase {
1.41 public:
1.42 - /// The graph type of the maps.
1.43 + // The graph type of the maps.
1.44 typedef _Graph Graph;
1.45 - /// The item type of the map.
1.46 + // The item type of the map.
1.47 typedef _Item Item;
1.48 - /// The reference map tag.
1.49 + // The reference map tag.
1.50 typedef True ReferenceMapTag;
1.51
1.52 - /// The key type of the maps.
1.53 + // The key type of the maps.
1.54 typedef _Item Key;
1.55 - /// The value type of the map.
1.56 + // The value type of the map.
1.57 typedef _Value Value;
1.58
1.59 - /// The const reference type of the map.
1.60 + // The const reference type of the map.
1.61 typedef const _Value& ConstReference;
1.62 - /// The reference type of the map.
1.63 + // The reference type of the map.
1.64 typedef _Value& Reference;
1.65
1.66 - /// The notifier type.
1.67 + // The notifier type.
1.68 typedef typename ItemSetTraits<_Graph, _Item>::ItemNotifier Notifier;
1.69
1.70 - /// The MapBase of the Map which imlements the core regisitry function.
1.71 + // The MapBase of the Map which imlements the core regisitry function.
1.72 typedef typename Notifier::ObserverBase Parent;
1.73
1.74 private:
1.75 @@ -75,9 +75,9 @@
1.76
1.77 public:
1.78
1.79 - /// \brief Graph initialized map constructor.
1.80 - ///
1.81 - /// Graph initialized map constructor.
1.82 + // \brief Graph initialized map constructor.
1.83 + //
1.84 + // Graph initialized map constructor.
1.85 explicit ArrayMap(const Graph& graph) {
1.86 Parent::attach(graph.notifier(Item()));
1.87 allocate_memory();
1.88 @@ -89,9 +89,9 @@
1.89 }
1.90 }
1.91
1.92 - /// \brief Constructor to use default value to initialize the map.
1.93 - ///
1.94 - /// It constructs a map and initialize all of the the map.
1.95 + // \brief Constructor to use default value to initialize the map.
1.96 + //
1.97 + // It constructs a map and initialize all of the the map.
1.98 ArrayMap(const Graph& graph, const Value& value) {
1.99 Parent::attach(graph.notifier(Item()));
1.100 allocate_memory();
1.101 @@ -104,9 +104,9 @@
1.102 }
1.103
1.104 private:
1.105 - /// \brief Constructor to copy a map of the same map type.
1.106 - ///
1.107 - /// Constructor to copy a map of the same map type.
1.108 + // \brief Constructor to copy a map of the same map type.
1.109 + //
1.110 + // Constructor to copy a map of the same map type.
1.111 ArrayMap(const ArrayMap& copy) : Parent() {
1.112 if (copy.attached()) {
1.113 attach(*copy.notifier());
1.114 @@ -122,24 +122,24 @@
1.115 }
1.116 }
1.117
1.118 - /// \brief Assign operator.
1.119 - ///
1.120 - /// This operator assigns for each item in the map the
1.121 - /// value mapped to the same item in the copied map.
1.122 - /// The parameter map should be indiced with the same
1.123 - /// itemset because this assign operator does not change
1.124 - /// the container of the map.
1.125 + // \brief Assign operator.
1.126 + //
1.127 + // This operator assigns for each item in the map the
1.128 + // value mapped to the same item in the copied map.
1.129 + // The parameter map should be indiced with the same
1.130 + // itemset because this assign operator does not change
1.131 + // the container of the map.
1.132 ArrayMap& operator=(const ArrayMap& cmap) {
1.133 return operator=<ArrayMap>(cmap);
1.134 }
1.135
1.136
1.137 - /// \brief Template assign operator.
1.138 - ///
1.139 - /// The given parameter should be conform to the ReadMap
1.140 - /// concecpt and could be indiced by the current item set of
1.141 - /// the NodeMap. In this case the value for each item
1.142 - /// is assigned by the value of the given ReadMap.
1.143 + // \brief Template assign operator.
1.144 + //
1.145 + // The given parameter should be conform to the ReadMap
1.146 + // concecpt and could be indiced by the current item set of
1.147 + // the NodeMap. In this case the value for each item
1.148 + // is assigned by the value of the given ReadMap.
1.149 template <typename CMap>
1.150 ArrayMap& operator=(const CMap& cmap) {
1.151 checkConcept<concepts::ReadMap<Key, _Value>, CMap>();
1.152 @@ -152,9 +152,9 @@
1.153 }
1.154
1.155 public:
1.156 - /// \brief The destructor of the map.
1.157 - ///
1.158 - /// The destructor of the map.
1.159 + // \brief The destructor of the map.
1.160 + //
1.161 + // The destructor of the map.
1.162 virtual ~ArrayMap() {
1.163 if (attached()) {
1.164 clear();
1.165 @@ -170,38 +170,38 @@
1.166
1.167 public:
1.168
1.169 - /// \brief The subscript operator.
1.170 - ///
1.171 - /// The subscript operator. The map can be subscripted by the
1.172 - /// actual keys of the graph.
1.173 + // \brief The subscript operator.
1.174 + //
1.175 + // The subscript operator. The map can be subscripted by the
1.176 + // actual keys of the graph.
1.177 Value& operator[](const Key& key) {
1.178 int id = Parent::notifier()->id(key);
1.179 return values[id];
1.180 }
1.181
1.182 - /// \brief The const subscript operator.
1.183 - ///
1.184 - /// The const subscript operator. The map can be subscripted by the
1.185 - /// actual keys of the graph.
1.186 + // \brief The const subscript operator.
1.187 + //
1.188 + // The const subscript operator. The map can be subscripted by the
1.189 + // actual keys of the graph.
1.190 const Value& operator[](const Key& key) const {
1.191 int id = Parent::notifier()->id(key);
1.192 return values[id];
1.193 }
1.194
1.195 - /// \brief Setter function of the map.
1.196 - ///
1.197 - /// Setter function of the map. Equivalent with map[key] = val.
1.198 - /// This is a compatibility feature with the not dereferable maps.
1.199 + // \brief Setter function of the map.
1.200 + //
1.201 + // Setter function of the map. Equivalent with map[key] = val.
1.202 + // This is a compatibility feature with the not dereferable maps.
1.203 void set(const Key& key, const Value& val) {
1.204 (*this)[key] = val;
1.205 }
1.206
1.207 protected:
1.208
1.209 - /// \brief Adds a new key to the map.
1.210 - ///
1.211 - /// It adds a new key to the map. It called by the observer notifier
1.212 - /// and it overrides the add() member function of the observer base.
1.213 + // \brief Adds a new key to the map.
1.214 + //
1.215 + // It adds a new key to the map. It called by the observer notifier
1.216 + // and it overrides the add() member function of the observer base.
1.217 virtual void add(const Key& key) {
1.218 Notifier* nf = Parent::notifier();
1.219 int id = nf->id(key);
1.220 @@ -226,10 +226,10 @@
1.221 allocator.construct(&(values[id]), Value());
1.222 }
1.223
1.224 - /// \brief Adds more new keys to the map.
1.225 - ///
1.226 - /// It adds more new keys to the map. It called by the observer notifier
1.227 - /// and it overrides the add() member function of the observer base.
1.228 + // \brief Adds more new keys to the map.
1.229 + //
1.230 + // It adds more new keys to the map. It called by the observer notifier
1.231 + // and it overrides the add() member function of the observer base.
1.232 virtual void add(const std::vector<Key>& keys) {
1.233 Notifier* nf = Parent::notifier();
1.234 int max_id = -1;
1.235 @@ -270,19 +270,19 @@
1.236 }
1.237 }
1.238
1.239 - /// \brief Erase a key from the map.
1.240 - ///
1.241 - /// Erase a key from the map. It called by the observer notifier
1.242 - /// and it overrides the erase() member function of the observer base.
1.243 + // \brief Erase a key from the map.
1.244 + //
1.245 + // Erase a key from the map. It called by the observer notifier
1.246 + // and it overrides the erase() member function of the observer base.
1.247 virtual void erase(const Key& key) {
1.248 int id = Parent::notifier()->id(key);
1.249 allocator.destroy(&(values[id]));
1.250 }
1.251
1.252 - /// \brief Erase more keys from the map.
1.253 - ///
1.254 - /// Erase more keys from the map. It called by the observer notifier
1.255 - /// and it overrides the erase() member function of the observer base.
1.256 + // \brief Erase more keys from the map.
1.257 + //
1.258 + // Erase more keys from the map. It called by the observer notifier
1.259 + // and it overrides the erase() member function of the observer base.
1.260 virtual void erase(const std::vector<Key>& keys) {
1.261 for (int i = 0; i < int(keys.size()); ++i) {
1.262 int id = Parent::notifier()->id(keys[i]);
1.263 @@ -290,10 +290,10 @@
1.264 }
1.265 }
1.266
1.267 - /// \brief Buildes the map.
1.268 - ///
1.269 - /// It buildes the map. It called by the observer notifier
1.270 - /// and it overrides the build() member function of the observer base.
1.271 + // \brief Buildes the map.
1.272 + //
1.273 + // It buildes the map. It called by the observer notifier
1.274 + // and it overrides the build() member function of the observer base.
1.275 virtual void build() {
1.276 Notifier* nf = Parent::notifier();
1.277 allocate_memory();
1.278 @@ -304,10 +304,10 @@
1.279 }
1.280 }
1.281
1.282 - /// \brief Clear the map.
1.283 - ///
1.284 - /// It erase all items from the map. It called by the observer notifier
1.285 - /// and it overrides the clear() member function of the observer base.
1.286 + // \brief Clear the map.
1.287 + //
1.288 + // It erase all items from the map. It called by the observer notifier
1.289 + // and it overrides the clear() member function of the observer base.
1.290 virtual void clear() {
1.291 Notifier* nf = Parent::notifier();
1.292 if (capacity != 0) {