Changeset 26:61bf7f22a6d6 in lemon for lemon/maps.h
 Timestamp:
 12/22/07 15:04:22 (12 years ago)
 Branch:
 default
 Children:
 27:6724953f2f44, 29:0cb4ba427bfd
 Phase:
 public
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

lemon/maps.h
r25 r26 248 248 /// are stored in a \c std::vector<T> container. It can be used with 249 249 /// some data structures, for example \c UnionFind, \c BinHeap, when 250 /// the used items are small integer numbers. 250 /// the used items are small integer numbers. 251 /// 252 /// \todo Revise its name 251 253 template <typename T> 252 254 class IntegerMap { … … 347 349 348 350 349 ///Convert the \c Value of a map to another type. 350 351 ///\brief Convert the \c Value of a map to another type using 352 ///the default conversion. 353 /// 351 354 ///This \c concepts::ReadMap "read only map" 352 355 ///converts the \c Value of a maps to type \c T. … … 369 372 /// 370 373 /// The subscript operator. 371 /// \param k The key372 /// \return The target of the arc373 374 Value operator[](const Key& k) const {return m[k];} 374 375 }; … … 389 390 ///combined with simple read maps. This map adaptor wraps the given 390 391 ///map to simple read map. 392 /// 393 /// \todo Revise the misleading name 391 394 template<typename M> 392 395 class SimpleMap : public MapBase<typename M::Key, typename M::Value> { … … 406 409 ///Simple writeable wrapping of the map 407 410 408 ///This \c concepts:: ReadMap "read onlymap" returns the simple411 ///This \c concepts::WriteMap "write map" returns the simple 409 412 ///wrapping of the given map. Sometimes the reference maps cannot be 410 413 ///combined with simple readwrite maps. This map adaptor wraps the 411 414 ///given map to simple readwrite map. 415 /// 416 /// \todo Revise the misleading name 412 417 template<typename M> 413 418 class SimpleWriteMap : public MapBase<typename M::Key, typename M::Value> { … … 494 499 }; 495 500 496 ///Shift a map with a constant. 501 ///Shift a map with a constant. This map is also writable. 497 502 498 503 ///This \c concepts::ReadWriteMap "readwrite map" returns the sum of the … … 550 555 ///given maps. Its \c Key and \c Value will be inherited from \c M1. 551 556 ///The \c Key and \c Value of \c M2 must be convertible to those of \c M1. 552 557 /// 558 /// \todo Revise the misleading name 553 559 template<typename M1, typename M2> 554 560 class SubMap : public MapBase<typename M1::Key, typename M1::Value> { … … 642 648 }; 643 649 644 ///Scales a maps with a constant .650 ///Scales a maps with a constant (ReadWrite version). 645 651 646 652 ///This \c concepts::ReadWriteMap "readwrite map" returns the value of the … … 859 865 }; 860 866 861 ///Negative value of a map 867 ///Negative value of a map (ReadWrite version) 862 868 863 869 ///This \c concepts::ReadWriteMap "readwrite map" returns the negative … … 906 912 ///operator must be defined for it, of course. 907 913 /// 908 ///\bug We need a unified way to handle the situation below:909 ///\code910 /// struct _UnConvertible {};911 /// template<class A> inline A t_abs(A a) {return _UnConvertible();}912 /// template<> inline int t_abs<>(int n) {return abs(n);}913 /// template<> inline long int t_abs<>(long int n) {return labs(n);}914 /// template<> inline long long int t_abs<>(long long int n) {return ::llabs(n);}915 /// template<> inline float t_abs<>(float n) {return fabsf(n);}916 /// template<> inline double t_abs<>(double n) {return fabs(n);}917 /// template<> inline long double t_abs<>(long double n) {return fabsl(n);}918 ///\endcode919 920 914 921 915 template<typename M> … … 1042 1036 ///The \c Key and \c Value will be inherited from \c M1. 1043 1037 ///The \c Key and \c Value of M2 must be convertible from those of \c M1. 1038 /// 1039 /// \todo Why is it needed? 1044 1040 template<typename M1, typename M2> 1045 1041 class ForkMap : public MapBase<typename M1::Key, typename M1::Value> { … … 1125 1121 }; 1126 1122 1127 ///Logical 'not' of a map with writing possibility1123 ///Logical 'not' of a map (ReadWrie version) 1128 1124 1129 1125 ///This bool \c concepts::ReadWriteMap "readwrite map" returns the … … 1188 1184 1189 1185 1190 /// \brief Writable bool map for store each true assigned elements.1191 /// 1192 /// Writable bool map to store each true assigned elements. It will1186 /// \brief Writable bool map for logging each true assigned elements 1187 /// 1188 /// Writable bool map for logging each true assigned elements, i.e it 1193 1189 /// copies all the keys set to true to the given iterator. 1194 1190 /// … … 1196 1192 /// for each element. 1197 1193 /// 1198 /// The next example shows how can you write the nodes directly 1194 /// The following example shows how you can write the edges found by the Prim 1195 /// algorithm directly 1199 1196 /// to the standard output. 1200 1197 ///\code … … 1210 1207 /// prim(graph, cost, writerMap); 1211 1208 ///\endcode 1209 /// 1210 ///\todo Revise the name of this class and the relates ones. 1212 1211 template <typename _Iterator, 1213 1212 typename _Functor = … … 1227 1226 : _begin(it), _end(it), _functor(functor) {} 1228 1227 1229 /// Gives back the given iterator set for the first time.1228 /// Gives back the given iterator set for the first key 1230 1229 Iterator begin() const { 1231 1230 return _begin; 1232 1231 } 1233 1232 1234 /// Gives back the iterator after the last set operation.1233 /// Gives back the the 'after the last' iterator 1235 1234 Iterator end() const { 1236 1235 return _end; … … 1250 1249 }; 1251 1250 1252 /// \brief Writable bool map for storeeach true assigned elements in1253 /// a back insertable container .1254 /// 1255 /// Writable bool map for store each true assigned elements in a back1256 /// insertable container. It will push back all the keys set to true into1257 /// the container.It can be used to retrieve the items into a standard1258 /// container. The next example shows how can you store the undirected1259 /// arcs in a vector with prim algorithm.1251 /// \brief Writable bool map for logging each true assigned elements in 1252 /// a back insertable container 1253 /// 1254 /// Writable bool map for logging each true assigned elements by pushing 1255 /// back them into a back insertable container. 1256 /// It can be used to retrieve the items into a standard 1257 /// container. The next example shows how you can store the 1258 /// edges found by the Prim algorithm in a vector. 1260 1259 /// 1261 1260 ///\code … … 1289 1288 }; 1290 1289 1291 /// \brief Writable bool map for stor e each true assigned elements in1290 /// \brief Writable bool map for storing each true assignments in 1292 1291 /// a front insertable container. 1293 1292 /// 1294 /// Writable bool map for stor e each true assigned elementsin a front1293 /// Writable bool map for storing each true assignment in a front 1295 1294 /// insertable container. It will push front all the keys set to \c true into 1296 1295 /// the container. For example see the BackInserterBoolMap. … … 1320 1319 }; 1321 1320 1322 /// \brief Writable bool map for stor eeach true assigned elements in1321 /// \brief Writable bool map for storing each true assigned elements in 1323 1322 /// an insertable container. 1324 1323 /// 1325 /// Writable bool map for stor eeach true assigned elements in an1324 /// Writable bool map for storing each true assigned elements in an 1326 1325 /// insertable container. It will insert all the keys set to \c true into 1327 /// the container. If you want to store the cut arcs of the strongly 1326 /// the container. 1327 /// 1328 /// For example, if you want to store the cut arcs of the strongly 1328 1329 /// connected components in a set you can use the next code: 1329 1330 /// … … 1370 1371 /// the container. 1371 1372 /// 1372 /// The next code finds the connected components of the undirected digraph1373 /// The following code finds the connected components of a graph 1373 1374 /// and stores it in the \c comp map: 1374 1375 ///\code … … 1418 1419 } 1419 1420 1420 /// Set terfunction of the map1421 /// Set function of the map 1421 1422 void set(const Key& key, Value value) { 1422 1423 if (value) { … … 1431 1432 1432 1433 1433 /// \brief Writable bool map which stores for each true assigned elements1434 /// t he setting order number.1435 /// 1434 /// \brief Writable bool map which stores the sequence number of 1435 /// true assignments. 1436 /// 1436 1437 /// Writable bool map which stores for each true assigned elements 1437 /// the setting order number. It make easy to calculate the leaving 1438 /// the sequence number of this setting. 1439 /// It makes it easy to calculate the leaving 1438 1440 /// order of the nodes in the \c Dfs algorithm. 1439 1441 /// … … 1454 1456 ///\endcode 1455 1457 /// 1456 /// The discovering order can be stored a little harderbecause the1458 /// The storing of the discovering order is more difficult because the 1457 1459 /// ReachedMap should be readable in the dfs algorithm but the setting 1458 /// order map is not readable. Now we shoulduse the fork map:1460 /// order map is not readable. Thus we must use the fork map: 1459 1461 /// 1460 1462 ///\code
Note: See TracChangeset
for help on using the changeset viewer.