lemon/maps.h
changeset 2259 da142c310d02
parent 2248 1ac928089d68
child 2260 4274224f8a7d
equal deleted inserted replaced
25:6d5e9d388843 26:fe91c7bf9ade
  1016   };
  1016   };
  1017 
  1017 
  1018   ///Logical 'not' of a map with writing possibility
  1018   ///Logical 'not' of a map with writing possibility
  1019   
  1019   
  1020   ///This bool \ref concept::ReadWriteMap "read-write map" returns the 
  1020   ///This bool \ref concept::ReadWriteMap "read-write map" returns the 
  1021   ///logical negation of value returned by the given map. It is setted
  1021   ///logical negation of value returned by the given map. When it is set,
  1022   ///then the negation of the value be setted to the original map.
  1022   ///the opposite value is set to the original map.
  1023   ///Its \c Key and will be inherited from \c M,
  1023   ///Its \c Key and will be inherited from \c M,
  1024   ///its Value is <tt>bool</tt>.
  1024   ///its Value is <tt>bool</tt>.
  1025   template <typename M> 
  1025   template <typename M> 
  1026   class NotWriteMap : public MapBase<typename M::Key, bool> {
  1026   class NotWriteMap : public MapBase<typename M::Key, bool> {
  1027     M& m;
  1027     M& m;
  1062   }
  1062   }
  1063   
  1063   
  1064 
  1064 
  1065   /// \brief Writable bool map for store each true assigned elements.
  1065   /// \brief Writable bool map for store each true assigned elements.
  1066   ///
  1066   ///
  1067   /// Writable bool map for store each true assigned elements. It will
  1067   /// Writable bool map to store each true assigned elements. It will
  1068   /// copies all the true setted keys to the given iterator.
  1068   /// copies all the keys set to true to the given iterator.
  1069   ///
  1069   ///
  1070   /// \note The container of the iterator should contain space 
  1070   /// \note The container of the iterator should contain space 
  1071   /// for each element.
  1071   /// for each element.
  1072   ///
  1072   ///
  1073   /// The next example shows how can you write the nodes directly
  1073   /// The next example shows how can you write the nodes directly
  1098 
  1098 
  1099     /// Constructor
  1099     /// Constructor
  1100     StoreBoolMap(Iterator it, const Functor& functor = Functor()) 
  1100     StoreBoolMap(Iterator it, const Functor& functor = Functor()) 
  1101       : _begin(it), _end(it), _functor(functor) {}
  1101       : _begin(it), _end(it), _functor(functor) {}
  1102 
  1102 
  1103     /// Gives back the given first setted iterator.
  1103     /// Gives back the given iterator set for the first time.
  1104     Iterator begin() const {
  1104     Iterator begin() const {
  1105       return _begin;
  1105       return _begin;
  1106     }
  1106     }
  1107  
  1107  
  1108     /// Gives back the iterator after the last setted.
  1108     /// Gives back the iterator after the last set operation.
  1109     Iterator end() const {
  1109     Iterator end() const {
  1110       return _end;
  1110       return _end;
  1111     }
  1111     }
  1112 
  1112 
  1113     /// Setter function of the map
  1113     /// Setter function of the map
  1124 
  1124 
  1125   /// \brief Writable bool map for store each true assigned elements in 
  1125   /// \brief Writable bool map for store each true assigned elements in 
  1126   /// a back insertable container.
  1126   /// a back insertable container.
  1127   ///
  1127   ///
  1128   /// Writable bool map for store each true assigned elements in a back 
  1128   /// Writable bool map for store each true assigned elements in a back 
  1129   /// insertable container. It will push back all the true setted keys into
  1129   /// insertable container. It will push back all the keys set to true into
  1130   /// the container. It can be used to retrieve the items into a standard
  1130   /// the container. It can be used to retrieve the items into a standard
  1131   /// container. The next example shows how can you store the undirected
  1131   /// container. The next example shows how can you store the undirected
  1132   /// edges in a vector with prim algorithm.
  1132   /// edges in a vector with prim algorithm.
  1133   ///
  1133   ///
  1134   ///\code
  1134   ///\code
  1163 
  1163 
  1164   /// \brief Writable bool map for store each true assigned elements in 
  1164   /// \brief Writable bool map for store each true assigned elements in 
  1165   /// a front insertable container.
  1165   /// a front insertable container.
  1166   ///
  1166   ///
  1167   /// Writable bool map for store each true assigned elements in a front 
  1167   /// Writable bool map for store each true assigned elements in a front 
  1168   /// insertable container. It will push front all the true setted keys into
  1168   /// insertable container. It will push front all the keys set to \c true into
  1169   /// the container. For example see the BackInserterBoolMap.
  1169   /// the container. For example see the BackInserterBoolMap.
  1170   template <typename Container,
  1170   template <typename Container,
  1171             typename Functor =
  1171             typename Functor =
  1172             _maps_bits::Identity<typename Container::value_type> >
  1172             _maps_bits::Identity<typename Container::value_type> >
  1173   class FrontInserterBoolMap {
  1173   class FrontInserterBoolMap {
  1194 
  1194 
  1195   /// \brief Writable bool map for store each true assigned elements in 
  1195   /// \brief Writable bool map for store each true assigned elements in 
  1196   /// an insertable container.
  1196   /// an insertable container.
  1197   ///
  1197   ///
  1198   /// Writable bool map for store each true assigned elements in an 
  1198   /// Writable bool map for store each true assigned elements in an 
  1199   /// insertable container. It will insert all the true setted keys into
  1199   /// insertable container. It will insert all the keys set to \c true into
  1200   /// the container. If you want to store the cut edges of the strongly
  1200   /// the container. If you want to store the cut edges of the strongly
  1201   /// connected components in a set you can use the next code:
  1201   /// connected components in a set you can use the next code:
  1202   ///
  1202   ///
  1203   ///\code
  1203   ///\code
  1204   /// set<Edge> cut_edges;
  1204   /// set<Edge> cut_edges;
  1234     Container& container;
  1234     Container& container;
  1235     typename Container::iterator it;
  1235     typename Container::iterator it;
  1236     Functor functor;
  1236     Functor functor;
  1237   };
  1237   };
  1238 
  1238 
  1239   /// \brief Fill the true setted elements with a given value.
  1239   /// \brief Fill the true set elements with a given value.
  1240   ///
  1240   ///
  1241   /// Writable bool map for fill the true setted elements with a given value.
  1241   /// Writable bool map to fill the elements set to \c true with a given value.
  1242   /// The value can be setted 
  1242   /// The value can set 
  1243   /// the container.
  1243   /// the container.
  1244   ///
  1244   ///
  1245   /// The next code finds the connected components of the undirected graph
  1245   /// The next code finds the connected components of the undirected graph
  1246   /// and stores it in the \c comp map:
  1246   /// and stores it in the \c comp map:
  1247   ///\code
  1247   ///\code
  1360 
  1360 
  1361     /// Constructor
  1361     /// Constructor
  1362     SettingOrderBoolMap(Map& _map) 
  1362     SettingOrderBoolMap(Map& _map) 
  1363       : map(_map), counter(0) {}
  1363       : map(_map), counter(0) {}
  1364 
  1364 
  1365     /// Number of setted keys.
  1365     /// Number of set operations.
  1366     int num() const {
  1366     int num() const {
  1367       return counter;
  1367       return counter;
  1368     }
  1368     }
  1369 
  1369 
  1370     /// Setter function of the map
  1370     /// Setter function of the map