| ... | ... |
@@ -149,25 +149,25 @@ |
| 149 | 149 |
void set(const K&, const V&) { }
|
| 150 | 150 |
}; |
| 151 | 151 |
|
| 152 | 152 |
///Returns a \c ConstMap class |
| 153 | 153 |
|
| 154 | 154 |
///This function just returns a \c ConstMap class with inlined value. |
| 155 | 155 |
///\relates ConstMap |
| 156 | 156 |
template<typename K, typename V, V v> |
| 157 | 157 |
inline ConstMap<K, Const<V, v> > constMap() {
|
| 158 | 158 |
return ConstMap<K, Const<V, v> >(); |
| 159 | 159 |
} |
| 160 | 160 |
|
| 161 |
///Map based on std::map |
|
| 161 |
///Map based on \c std::map |
|
| 162 | 162 |
|
| 163 | 163 |
///This is essentially a wrapper for \c std::map with addition that |
| 164 | 164 |
///you can specify a default value different from \c Value(). |
| 165 | 165 |
template <typename K, typename T, typename Compare = std::less<K> > |
| 166 | 166 |
class StdMap : public MapBase<K, T> {
|
| 167 | 167 |
template <typename K1, typename T1, typename C1> |
| 168 | 168 |
friend class StdMap; |
| 169 | 169 |
public: |
| 170 | 170 |
|
| 171 | 171 |
typedef MapBase<K, T> Parent; |
| 172 | 172 |
///\e |
| 173 | 173 |
typedef typename Parent::Key Key; |
| ... | ... |
@@ -233,37 +233,37 @@ |
| 233 | 233 |
else |
| 234 | 234 |
_map.insert(it, std::make_pair(k, t)); |
| 235 | 235 |
} |
| 236 | 236 |
|
| 237 | 237 |
/// \e |
| 238 | 238 |
void setAll(const T &t) {
|
| 239 | 239 |
_value = t; |
| 240 | 240 |
_map.clear(); |
| 241 | 241 |
} |
| 242 | 242 |
|
| 243 | 243 |
}; |
| 244 | 244 |
|
| 245 |
///Returns a \ |
|
| 245 |
///Returns a \c StdMap class |
|
| 246 | 246 |
|
| 247 |
///This function just returns a \ |
|
| 247 |
///This function just returns a \c StdMap class with specified |
|
| 248 | 248 |
///default value. |
| 249 | 249 |
///\relates StdMap |
| 250 | 250 |
template<typename K, typename V, typename Compare = std::less<K> > |
| 251 | 251 |
inline StdMap<K, V, Compare> stdMap(const V& value = V()) {
|
| 252 | 252 |
return StdMap<K, V, Compare>(value); |
| 253 | 253 |
} |
| 254 | 254 |
|
| 255 |
///Returns a \ |
|
| 255 |
///Returns a \c StdMap class created from an appropriate std::map |
|
| 256 | 256 |
|
| 257 |
///This function just returns a \ |
|
| 257 |
///This function just returns a \c StdMap class created from an |
|
| 258 | 258 |
///appropriate std::map. |
| 259 | 259 |
///\relates StdMap |
| 260 | 260 |
template<typename K, typename V, typename Compare = std::less<K> > |
| 261 | 261 |
inline StdMap<K, V, Compare> stdMap( const std::map<K, V, Compare> &map, |
| 262 | 262 |
const V& value = V() ) {
|
| 263 | 263 |
return StdMap<K, V, Compare>(map, value); |
| 264 | 264 |
} |
| 265 | 265 |
|
| 266 | 266 |
/// \brief Map for storing values for keys from the range <tt>[0..size-1]</tt> |
| 267 | 267 |
/// |
| 268 | 268 |
/// The current map has the <tt>[0..size-1]</tt> keyset and the values |
| 269 | 269 |
/// are stored in a \c std::vector<T> container. It can be used with |
| ... | ... |
@@ -330,27 +330,27 @@ |
| 330 | 330 |
/// \e |
| 331 | 331 |
ConstReference operator[](Key k) const {
|
| 332 | 332 |
return _vector[k]; |
| 333 | 333 |
} |
| 334 | 334 |
|
| 335 | 335 |
/// \e |
| 336 | 336 |
void set(const Key &k, const T& t) {
|
| 337 | 337 |
_vector[k] = t; |
| 338 | 338 |
} |
| 339 | 339 |
|
| 340 | 340 |
}; |
| 341 | 341 |
|
| 342 |
///Returns an \ |
|
| 342 |
///Returns an \c IntegerMap class |
|
| 343 | 343 |
|
| 344 |
///This function just returns an \ |
|
| 344 |
///This function just returns an \c IntegerMap class. |
|
| 345 | 345 |
///\relates IntegerMap |
| 346 | 346 |
template<typename T> |
| 347 | 347 |
inline IntegerMap<T> integerMap(int size = 0, const T& value = T()) {
|
| 348 | 348 |
return IntegerMap<T>(size, value); |
| 349 | 349 |
} |
| 350 | 350 |
|
| 351 | 351 |
/// @} |
| 352 | 352 |
|
| 353 | 353 |
/// \addtogroup map_adaptors |
| 354 | 354 |
/// @{
|
| 355 | 355 |
|
| 356 | 356 |
/// \brief Identity map. |
| ... | ... |
@@ -374,25 +374,25 @@ |
| 374 | 374 |
|
| 375 | 375 |
///This function just returns an \c IdentityMap class. |
| 376 | 376 |
///\relates IdentityMap |
| 377 | 377 |
template<typename T> |
| 378 | 378 |
inline IdentityMap<T> identityMap() {
|
| 379 | 379 |
return IdentityMap<T>(); |
| 380 | 380 |
} |
| 381 | 381 |
|
| 382 | 382 |
|
| 383 | 383 |
///\brief Convert the \c Value of a map to another type using |
| 384 | 384 |
///the default conversion. |
| 385 | 385 |
/// |
| 386 |
///This \ |
|
| 386 |
///This \ref concepts::ReadMap "read only map" |
|
| 387 | 387 |
///converts the \c Value of a map to type \c T. |
| 388 | 388 |
///Its \c Key is inherited from \c M. |
| 389 | 389 |
template <typename M, typename T> |
| 390 | 390 |
class ConvertMap : public MapBase<typename M::Key, T> {
|
| 391 | 391 |
const M& m; |
| 392 | 392 |
public: |
| 393 | 393 |
typedef MapBase<typename M::Key, T> Parent; |
| 394 | 394 |
typedef typename Parent::Key Key; |
| 395 | 395 |
typedef typename Parent::Value Value; |
| 396 | 396 |
|
| 397 | 397 |
///Constructor |
| 398 | 398 |
|
| ... | ... |
@@ -431,72 +431,72 @@ |
| 431 | 431 |
|
| 432 | 432 |
public: |
| 433 | 433 |
typedef MapBase<typename M::Key, typename M::Value> Parent; |
| 434 | 434 |
typedef typename Parent::Key Key; |
| 435 | 435 |
typedef typename Parent::Value Value; |
| 436 | 436 |
|
| 437 | 437 |
///Constructor |
| 438 | 438 |
SimpleMap(const M &_m) : m(_m) {};
|
| 439 | 439 |
///\e |
| 440 | 440 |
Value operator[](Key k) const {return m[k];}
|
| 441 | 441 |
}; |
| 442 | 442 |
|
| 443 |
///Returns a \ |
|
| 443 |
///Returns a \c SimpleMap class |
|
| 444 | 444 |
|
| 445 |
///This function just returns a \ |
|
| 445 |
///This function just returns a \c SimpleMap class. |
|
| 446 | 446 |
///\relates SimpleMap |
| 447 | 447 |
template<typename M> |
| 448 | 448 |
inline SimpleMap<M> simpleMap(const M &m) {
|
| 449 | 449 |
return SimpleMap<M>(m); |
| 450 | 450 |
} |
| 451 | 451 |
|
| 452 | 452 |
///Simple writable wrapping of a map |
| 453 | 453 |
|
| 454 |
///This \ref concepts:: |
|
| 454 |
///This \ref concepts::ReadWriteMap "read-write map" returns the simple |
|
| 455 | 455 |
///wrapping of the given map. Sometimes the reference maps cannot be |
| 456 | 456 |
///combined with simple read-write maps. This map adaptor wraps the |
| 457 | 457 |
///given map to simple read-write map. |
| 458 | 458 |
/// |
| 459 | 459 |
///\sa SimpleMap |
| 460 | 460 |
/// |
| 461 | 461 |
/// \todo Revise the misleading name |
| 462 | 462 |
template<typename M> |
| 463 | 463 |
class SimpleWriteMap : public MapBase<typename M::Key, typename M::Value> {
|
| 464 | 464 |
M& m; |
| 465 | 465 |
|
| 466 | 466 |
public: |
| 467 | 467 |
typedef MapBase<typename M::Key, typename M::Value> Parent; |
| 468 | 468 |
typedef typename Parent::Key Key; |
| 469 | 469 |
typedef typename Parent::Value Value; |
| 470 | 470 |
|
| 471 | 471 |
///Constructor |
| 472 | 472 |
SimpleWriteMap(M &_m) : m(_m) {};
|
| 473 | 473 |
///\e |
| 474 | 474 |
Value operator[](Key k) const {return m[k];}
|
| 475 | 475 |
///\e |
| 476 | 476 |
void set(Key k, const Value& c) { m.set(k, c); }
|
| 477 | 477 |
}; |
| 478 | 478 |
|
| 479 |
///Returns a \ |
|
| 479 |
///Returns a \c SimpleWriteMap class |
|
| 480 | 480 |
|
| 481 |
///This function just returns a \ |
|
| 481 |
///This function just returns a \c SimpleWriteMap class. |
|
| 482 | 482 |
///\relates SimpleWriteMap |
| 483 | 483 |
template<typename M> |
| 484 | 484 |
inline SimpleWriteMap<M> simpleWriteMap(M &m) {
|
| 485 | 485 |
return SimpleWriteMap<M>(m); |
| 486 | 486 |
} |
| 487 | 487 |
|
| 488 | 488 |
///Sum of two maps |
| 489 | 489 |
|
| 490 |
///This \ |
|
| 490 |
///This \ref concepts::ReadMap "read only map" returns the sum of the two |
|
| 491 | 491 |
///given maps. |
| 492 | 492 |
///Its \c Key and \c Value are inherited from \c M1. |
| 493 | 493 |
///The \c Key and \c Value of M2 must be convertible to those of \c M1. |
| 494 | 494 |
template<typename M1, typename M2> |
| 495 | 495 |
class AddMap : public MapBase<typename M1::Key, typename M1::Value> {
|
| 496 | 496 |
const M1& m1; |
| 497 | 497 |
const M2& m2; |
| 498 | 498 |
|
| 499 | 499 |
public: |
| 500 | 500 |
typedef MapBase<typename M1::Key, typename M1::Value> Parent; |
| 501 | 501 |
typedef typename Parent::Key Key; |
| 502 | 502 |
typedef typename Parent::Value Value; |
| ... | ... |
@@ -511,25 +511,25 @@ |
| 511 | 511 |
|
| 512 | 512 |
///This function just returns an \c AddMap class. |
| 513 | 513 |
///\todo How to call these type of functions? |
| 514 | 514 |
/// |
| 515 | 515 |
///\relates AddMap |
| 516 | 516 |
template<typename M1, typename M2> |
| 517 | 517 |
inline AddMap<M1, M2> addMap(const M1 &m1,const M2 &m2) {
|
| 518 | 518 |
return AddMap<M1, M2>(m1,m2); |
| 519 | 519 |
} |
| 520 | 520 |
|
| 521 | 521 |
///Shift a map with a constant. |
| 522 | 522 |
|
| 523 |
///This \ |
|
| 523 |
///This \ref concepts::ReadMap "read only map" returns the sum of the |
|
| 524 | 524 |
///given map and a constant value. |
| 525 | 525 |
///Its \c Key and \c Value are inherited from \c M. |
| 526 | 526 |
/// |
| 527 | 527 |
///Actually, |
| 528 | 528 |
///\code |
| 529 | 529 |
/// ShiftMap<X> sh(x,v); |
| 530 | 530 |
///\endcode |
| 531 | 531 |
///is equivalent to |
| 532 | 532 |
///\code |
| 533 | 533 |
/// ConstMap<X::Key, X::Value> c_tmp(v); |
| 534 | 534 |
/// AddMap<X, ConstMap<X::Key, X::Value> > sh(x,v); |
| 535 | 535 |
///\endcode |
| ... | ... |
@@ -547,25 +547,25 @@ |
| 547 | 547 |
///Constructor |
| 548 | 548 |
|
| 549 | 549 |
///Constructor. |
| 550 | 550 |
///\param _m is the undelying map. |
| 551 | 551 |
///\param _v is the shift value. |
| 552 | 552 |
ShiftMap(const M &_m, const C &_v ) : m(_m), v(_v) {};
|
| 553 | 553 |
///\e |
| 554 | 554 |
Value operator[](Key k) const {return m[k] + v;}
|
| 555 | 555 |
}; |
| 556 | 556 |
|
| 557 | 557 |
///Shift a map with a constant (ReadWrite version). |
| 558 | 558 |
|
| 559 |
///This \ |
|
| 559 |
///This \ref concepts::ReadWriteMap "read-write map" returns the sum of the |
|
| 560 | 560 |
///given map and a constant value. It makes also possible to write the map. |
| 561 | 561 |
///Its \c Key and \c Value are inherited from \c M. |
| 562 | 562 |
/// |
| 563 | 563 |
///\sa ShiftMap |
| 564 | 564 |
template<typename M, typename C = typename M::Value> |
| 565 | 565 |
class ShiftWriteMap : public MapBase<typename M::Key, typename M::Value> {
|
| 566 | 566 |
M& m; |
| 567 | 567 |
C v; |
| 568 | 568 |
public: |
| 569 | 569 |
typedef MapBase<typename M::Key, typename M::Value> Parent; |
| 570 | 570 |
typedef typename Parent::Key Key; |
| 571 | 571 |
typedef typename Parent::Value Value; |
| ... | ... |
@@ -593,25 +593,25 @@ |
| 593 | 593 |
|
| 594 | 594 |
///Returns a \c ShiftWriteMap class |
| 595 | 595 |
|
| 596 | 596 |
///This function just returns a \c ShiftWriteMap class. |
| 597 | 597 |
///\relates ShiftWriteMap |
| 598 | 598 |
template<typename M, typename C> |
| 599 | 599 |
inline ShiftWriteMap<M, C> shiftMap(M &m,const C &v) {
|
| 600 | 600 |
return ShiftWriteMap<M, C>(m,v); |
| 601 | 601 |
} |
| 602 | 602 |
|
| 603 | 603 |
///Difference of two maps |
| 604 | 604 |
|
| 605 |
///This \ |
|
| 605 |
///This \ref concepts::ReadMap "read only map" returns the difference |
|
| 606 | 606 |
///of the values of the two given maps. |
| 607 | 607 |
///Its \c Key and \c Value are inherited from \c M1. |
| 608 | 608 |
///The \c Key and \c Value of \c M2 must be convertible to those of \c M1. |
| 609 | 609 |
/// |
| 610 | 610 |
/// \todo Revise the misleading name |
| 611 | 611 |
template<typename M1, typename M2> |
| 612 | 612 |
class SubMap : public MapBase<typename M1::Key, typename M1::Value> {
|
| 613 | 613 |
const M1& m1; |
| 614 | 614 |
const M2& m2; |
| 615 | 615 |
public: |
| 616 | 616 |
typedef MapBase<typename M1::Key, typename M1::Value> Parent; |
| 617 | 617 |
typedef typename Parent::Key Key; |
| ... | ... |
@@ -626,25 +626,25 @@ |
| 626 | 626 |
///Returns a \c SubMap class |
| 627 | 627 |
|
| 628 | 628 |
///This function just returns a \c SubMap class. |
| 629 | 629 |
/// |
| 630 | 630 |
///\relates SubMap |
| 631 | 631 |
template<typename M1, typename M2> |
| 632 | 632 |
inline SubMap<M1, M2> subMap(const M1 &m1, const M2 &m2) {
|
| 633 | 633 |
return SubMap<M1, M2>(m1, m2); |
| 634 | 634 |
} |
| 635 | 635 |
|
| 636 | 636 |
///Product of two maps |
| 637 | 637 |
|
| 638 |
///This \ |
|
| 638 |
///This \ref concepts::ReadMap "read only map" returns the product of the |
|
| 639 | 639 |
///values of the two given maps. |
| 640 | 640 |
///Its \c Key and \c Value are inherited from \c M1. |
| 641 | 641 |
///The \c Key and \c Value of \c M2 must be convertible to those of \c M1. |
| 642 | 642 |
template<typename M1, typename M2> |
| 643 | 643 |
class MulMap : public MapBase<typename M1::Key, typename M1::Value> {
|
| 644 | 644 |
const M1& m1; |
| 645 | 645 |
const M2& m2; |
| 646 | 646 |
public: |
| 647 | 647 |
typedef MapBase<typename M1::Key, typename M1::Value> Parent; |
| 648 | 648 |
typedef typename Parent::Key Key; |
| 649 | 649 |
typedef typename Parent::Value Value; |
| 650 | 650 |
|
| ... | ... |
@@ -656,25 +656,25 @@ |
| 656 | 656 |
|
| 657 | 657 |
///Returns a \c MulMap class |
| 658 | 658 |
|
| 659 | 659 |
///This function just returns a \c MulMap class. |
| 660 | 660 |
///\relates MulMap |
| 661 | 661 |
template<typename M1, typename M2> |
| 662 | 662 |
inline MulMap<M1, M2> mulMap(const M1 &m1,const M2 &m2) {
|
| 663 | 663 |
return MulMap<M1, M2>(m1,m2); |
| 664 | 664 |
} |
| 665 | 665 |
|
| 666 | 666 |
///Scales a map with a constant. |
| 667 | 667 |
|
| 668 |
///This \ |
|
| 668 |
///This \ref concepts::ReadMap "read only map" returns the value of the |
|
| 669 | 669 |
///given map multiplied from the left side with a constant value. |
| 670 | 670 |
///Its \c Key and \c Value are inherited from \c M. |
| 671 | 671 |
/// |
| 672 | 672 |
///Actually, |
| 673 | 673 |
///\code |
| 674 | 674 |
/// ScaleMap<X> sc(x,v); |
| 675 | 675 |
///\endcode |
| 676 | 676 |
///is equivalent to |
| 677 | 677 |
///\code |
| 678 | 678 |
/// ConstMap<X::Key, X::Value> c_tmp(v); |
| 679 | 679 |
/// MulMap<X, ConstMap<X::Key, X::Value> > sc(x,v); |
| 680 | 680 |
///\endcode |
| ... | ... |
@@ -692,25 +692,25 @@ |
| 692 | 692 |
///Constructor |
| 693 | 693 |
|
| 694 | 694 |
///Constructor. |
| 695 | 695 |
///\param _m is the undelying map. |
| 696 | 696 |
///\param _v is the scaling value. |
| 697 | 697 |
ScaleMap(const M &_m, const C &_v ) : m(_m), v(_v) {};
|
| 698 | 698 |
/// \e |
| 699 | 699 |
Value operator[](Key k) const {return v * m[k];}
|
| 700 | 700 |
}; |
| 701 | 701 |
|
| 702 | 702 |
///Scales a map with a constant (ReadWrite version). |
| 703 | 703 |
|
| 704 |
///This \ |
|
| 704 |
///This \ref concepts::ReadWriteMap "read-write map" returns the value of the |
|
| 705 | 705 |
///given map multiplied from the left side with a constant value. It can |
| 706 | 706 |
///also be used as write map if the \c / operator is defined between |
| 707 | 707 |
///\c Value and \c C and the given multiplier is not zero. |
| 708 | 708 |
///Its \c Key and \c Value are inherited from \c M. |
| 709 | 709 |
/// |
| 710 | 710 |
///\sa ScaleMap |
| 711 | 711 |
template<typename M, typename C = typename M::Value> |
| 712 | 712 |
class ScaleWriteMap : public MapBase<typename M::Key, typename M::Value> {
|
| 713 | 713 |
M& m; |
| 714 | 714 |
C v; |
| 715 | 715 |
public: |
| 716 | 716 |
typedef MapBase<typename M::Key, typename M::Value> Parent; |
| ... | ... |
@@ -740,25 +740,25 @@ |
| 740 | 740 |
|
| 741 | 741 |
///Returns a \c ScaleWriteMap class |
| 742 | 742 |
|
| 743 | 743 |
///This function just returns a \c ScaleWriteMap class. |
| 744 | 744 |
///\relates ScaleWriteMap |
| 745 | 745 |
template<typename M, typename C> |
| 746 | 746 |
inline ScaleWriteMap<M, C> scaleMap(M &m,const C &v) {
|
| 747 | 747 |
return ScaleWriteMap<M, C>(m,v); |
| 748 | 748 |
} |
| 749 | 749 |
|
| 750 | 750 |
///Quotient of two maps |
| 751 | 751 |
|
| 752 |
///This \ |
|
| 752 |
///This \ref concepts::ReadMap "read only map" returns the quotient of the |
|
| 753 | 753 |
///values of the two given maps. |
| 754 | 754 |
///Its \c Key and \c Value are inherited from \c M1. |
| 755 | 755 |
///The \c Key and \c Value of \c M2 must be convertible to those of \c M1. |
| 756 | 756 |
template<typename M1, typename M2> |
| 757 | 757 |
class DivMap : public MapBase<typename M1::Key, typename M1::Value> {
|
| 758 | 758 |
const M1& m1; |
| 759 | 759 |
const M2& m2; |
| 760 | 760 |
public: |
| 761 | 761 |
typedef MapBase<typename M1::Key, typename M1::Value> Parent; |
| 762 | 762 |
typedef typename Parent::Key Key; |
| 763 | 763 |
typedef typename Parent::Value Value; |
| 764 | 764 |
|
| ... | ... |
@@ -770,25 +770,25 @@ |
| 770 | 770 |
|
| 771 | 771 |
///Returns a \c DivMap class |
| 772 | 772 |
|
| 773 | 773 |
///This function just returns a \c DivMap class. |
| 774 | 774 |
///\relates DivMap |
| 775 | 775 |
template<typename M1, typename M2> |
| 776 | 776 |
inline DivMap<M1, M2> divMap(const M1 &m1,const M2 &m2) {
|
| 777 | 777 |
return DivMap<M1, M2>(m1,m2); |
| 778 | 778 |
} |
| 779 | 779 |
|
| 780 | 780 |
///Composition of two maps |
| 781 | 781 |
|
| 782 |
///This \ |
|
| 782 |
///This \ref concepts::ReadMap "read only map" returns the composition of |
|
| 783 | 783 |
///two given maps. |
| 784 | 784 |
///That is to say, if \c m1 is of type \c M1 and \c m2 is of \c M2, |
| 785 | 785 |
///then for |
| 786 | 786 |
///\code |
| 787 | 787 |
/// ComposeMap<M1, M2> cm(m1,m2); |
| 788 | 788 |
///\endcode |
| 789 | 789 |
/// <tt>cm[x]</tt> will be equal to <tt>m1[m2[x]]</tt>. |
| 790 | 790 |
/// |
| 791 | 791 |
///Its \c Key is inherited from \c M2 and its \c Value is from \c M1. |
| 792 | 792 |
///\c M2::Value must be convertible to \c M1::Key. |
| 793 | 793 |
/// |
| 794 | 794 |
///\sa CombineMap |
| ... | ... |
@@ -821,25 +821,25 @@ |
| 821 | 821 |
|
| 822 | 822 |
///This function just returns a \c ComposeMap class. |
| 823 | 823 |
///\relates ComposeMap |
| 824 | 824 |
template <typename M1, typename M2> |
| 825 | 825 |
inline ComposeMap<M1, M2> composeMap(const M1 &m1,const M2 &m2) {
|
| 826 | 826 |
return ComposeMap<M1, M2>(m1,m2); |
| 827 | 827 |
} |
| 828 | 828 |
|
| 829 | 829 |
///Combine of two maps using an STL (binary) functor. |
| 830 | 830 |
|
| 831 | 831 |
///Combine of two maps using an STL (binary) functor. |
| 832 | 832 |
/// |
| 833 |
///This \ |
|
| 833 |
///This \ref concepts::ReadMap "read only map" takes two maps and a |
|
| 834 | 834 |
///binary functor and returns the composition of the two |
| 835 | 835 |
///given maps unsing the functor. |
| 836 | 836 |
///That is to say, if \c m1 and \c m2 is of type \c M1 and \c M2 |
| 837 | 837 |
///and \c f is of \c F, then for |
| 838 | 838 |
///\code |
| 839 | 839 |
/// CombineMap<M1,M2,F,V> cm(m1,m2,f); |
| 840 | 840 |
///\endcode |
| 841 | 841 |
/// <tt>cm[x]</tt> will be equal to <tt>f(m1[x],m2[x])</tt> |
| 842 | 842 |
/// |
| 843 | 843 |
///Its \c Key is inherited from \c M1 and its \c Value is \c V. |
| 844 | 844 |
///\c M2::Value and \c M1::Value must be convertible to the corresponding |
| 845 | 845 |
///input parameter of \c F and the return type of \c F must be convertible |
| ... | ... |
@@ -894,47 +894,47 @@ |
| 894 | 894 |
combineMap(const M1& m1, const M2& m2, const F& f) {
|
| 895 | 895 |
return combineMap<M1, M2, F, typename F::result_type>(m1,m2,f); |
| 896 | 896 |
} |
| 897 | 897 |
|
| 898 | 898 |
template<typename M1, typename M2, typename K1, typename K2, typename V> |
| 899 | 899 |
inline CombineMap<M1, M2, V (*)(K1, K2), V> |
| 900 | 900 |
combineMap(const M1 &m1, const M2 &m2, V (*f)(K1, K2)) {
|
| 901 | 901 |
return combineMap<M1, M2, V (*)(K1, K2), V>(m1,m2,f); |
| 902 | 902 |
} |
| 903 | 903 |
|
| 904 | 904 |
///Negative value of a map |
| 905 | 905 |
|
| 906 |
///This \ |
|
| 906 |
///This \ref concepts::ReadMap "read only map" returns the negative |
|
| 907 | 907 |
///value of the value returned by the given map. |
| 908 | 908 |
///Its \c Key and \c Value are inherited from \c M. |
| 909 | 909 |
///The unary \c - operator must be defined for \c Value, of course. |
| 910 | 910 |
/// |
| 911 | 911 |
///\sa NegWriteMap |
| 912 | 912 |
template<typename M> |
| 913 | 913 |
class NegMap : public MapBase<typename M::Key, typename M::Value> {
|
| 914 | 914 |
const M& m; |
| 915 | 915 |
public: |
| 916 | 916 |
typedef MapBase<typename M::Key, typename M::Value> Parent; |
| 917 | 917 |
typedef typename Parent::Key Key; |
| 918 | 918 |
typedef typename Parent::Value Value; |
| 919 | 919 |
|
| 920 | 920 |
///Constructor |
| 921 | 921 |
NegMap(const M &_m) : m(_m) {};
|
| 922 | 922 |
/// \e |
| 923 | 923 |
Value operator[](Key k) const {return -m[k];}
|
| 924 | 924 |
}; |
| 925 | 925 |
|
| 926 | 926 |
///Negative value of a map (ReadWrite version) |
| 927 | 927 |
|
| 928 |
///This \ |
|
| 928 |
///This \ref concepts::ReadWriteMap "read-write map" returns the negative |
|
| 929 | 929 |
///value of the value returned by the given map. |
| 930 | 930 |
///Its \c Key and \c Value are inherited from \c M. |
| 931 | 931 |
///The unary \c - operator must be defined for \c Value, of course. |
| 932 | 932 |
/// |
| 933 | 933 |
/// \sa NegMap |
| 934 | 934 |
template<typename M> |
| 935 | 935 |
class NegWriteMap : public MapBase<typename M::Key, typename M::Value> {
|
| 936 | 936 |
M& m; |
| 937 | 937 |
public: |
| 938 | 938 |
typedef MapBase<typename M::Key, typename M::Value> Parent; |
| 939 | 939 |
typedef typename Parent::Key Key; |
| 940 | 940 |
typedef typename Parent::Value Value; |
| ... | ... |
@@ -958,25 +958,25 @@ |
| 958 | 958 |
|
| 959 | 959 |
///Returns a \c NegWriteMap class |
| 960 | 960 |
|
| 961 | 961 |
///This function just returns a \c NegWriteMap class. |
| 962 | 962 |
///\relates NegWriteMap |
| 963 | 963 |
template <typename M> |
| 964 | 964 |
inline NegWriteMap<M> negMap(M &m) {
|
| 965 | 965 |
return NegWriteMap<M>(m); |
| 966 | 966 |
} |
| 967 | 967 |
|
| 968 | 968 |
///Absolute value of a map |
| 969 | 969 |
|
| 970 |
///This \ |
|
| 970 |
///This \ref concepts::ReadMap "read only map" returns the absolute value |
|
| 971 | 971 |
///of the value returned by the given map. |
| 972 | 972 |
///Its \c Key and \c Value are inherited from \c M. |
| 973 | 973 |
///\c Value must be comparable to \c 0 and the unary \c - |
| 974 | 974 |
///operator must be defined for it, of course. |
| 975 | 975 |
template<typename M> |
| 976 | 976 |
class AbsMap : public MapBase<typename M::Key, typename M::Value> {
|
| 977 | 977 |
const M& m; |
| 978 | 978 |
public: |
| 979 | 979 |
typedef MapBase<typename M::Key, typename M::Value> Parent; |
| 980 | 980 |
typedef typename Parent::Key Key; |
| 981 | 981 |
typedef typename Parent::Value Value; |
| 982 | 982 |
|
| ... | ... |
@@ -992,25 +992,25 @@ |
| 992 | 992 |
|
| 993 | 993 |
///Returns an \c AbsMap class |
| 994 | 994 |
|
| 995 | 995 |
///This function just returns an \c AbsMap class. |
| 996 | 996 |
///\relates AbsMap |
| 997 | 997 |
template<typename M> |
| 998 | 998 |
inline AbsMap<M> absMap(const M &m) {
|
| 999 | 999 |
return AbsMap<M>(m); |
| 1000 | 1000 |
} |
| 1001 | 1001 |
|
| 1002 | 1002 |
///Converts an STL style functor to a map |
| 1003 | 1003 |
|
| 1004 |
///This \ |
|
| 1004 |
///This \ref concepts::ReadMap "read only map" returns the value |
|
| 1005 | 1005 |
///of a given functor. |
| 1006 | 1006 |
/// |
| 1007 | 1007 |
///Template parameters \c K and \c V will become its |
| 1008 | 1008 |
///\c Key and \c Value. |
| 1009 | 1009 |
///In most cases they have to be given explicitly because a |
| 1010 | 1010 |
///functor typically does not provide such typedefs. |
| 1011 | 1011 |
/// |
| 1012 | 1012 |
///Parameter \c F is the type of the used functor. |
| 1013 | 1013 |
/// |
| 1014 | 1014 |
///\sa MapFunctor |
| 1015 | 1015 |
template<typename F, |
| 1016 | 1016 |
typename K = typename F::argument_type, |
| ... | ... |
@@ -1050,25 +1050,25 @@ |
| 1050 | 1050 |
template <typename K, typename V> inline |
| 1051 | 1051 |
FunctorMap<V (*)(K), K, V> functorMap(V (*f)(K)) {
|
| 1052 | 1052 |
return FunctorMap<V (*)(K), K, V>(f); |
| 1053 | 1053 |
} |
| 1054 | 1054 |
|
| 1055 | 1055 |
|
| 1056 | 1056 |
///Converts a map to an STL style (unary) functor |
| 1057 | 1057 |
|
| 1058 | 1058 |
///This class Converts a map to an STL style (unary) functor. |
| 1059 | 1059 |
///that is it provides an <tt>operator()</tt> to read its values. |
| 1060 | 1060 |
/// |
| 1061 | 1061 |
///For the sake of convenience it also works as |
| 1062 |
///a ususal \ |
|
| 1062 |
///a ususal \ref concepts::ReadMap "readable map", |
|
| 1063 | 1063 |
///i.e. <tt>operator[]</tt> and the \c Key and \c Value typedefs also exist. |
| 1064 | 1064 |
/// |
| 1065 | 1065 |
///\sa FunctorMap |
| 1066 | 1066 |
template <typename M> |
| 1067 | 1067 |
class MapFunctor : public MapBase<typename M::Key, typename M::Value> {
|
| 1068 | 1068 |
const M& m; |
| 1069 | 1069 |
public: |
| 1070 | 1070 |
typedef MapBase<typename M::Key, typename M::Value> Parent; |
| 1071 | 1071 |
typedef typename Parent::Key Key; |
| 1072 | 1072 |
typedef typename Parent::Value Value; |
| 1073 | 1073 |
|
| 1074 | 1074 |
typedef typename M::Key argument_type; |
| ... | ... |
@@ -1084,27 +1084,27 @@ |
| 1084 | 1084 |
|
| 1085 | 1085 |
///Returns a \c MapFunctor class |
| 1086 | 1086 |
|
| 1087 | 1087 |
///This function just returns a \c MapFunctor class. |
| 1088 | 1088 |
///\relates MapFunctor |
| 1089 | 1089 |
template<typename M> |
| 1090 | 1090 |
inline MapFunctor<M> mapFunctor(const M &m) {
|
| 1091 | 1091 |
return MapFunctor<M>(m); |
| 1092 | 1092 |
} |
| 1093 | 1093 |
|
| 1094 | 1094 |
///Applies all map setting operations to two maps |
| 1095 | 1095 |
|
| 1096 |
///This map has two \ |
|
| 1096 |
///This map has two \ref concepts::ReadMap "readable map" |
|
| 1097 | 1097 |
///parameters and each read request will be passed just to the |
| 1098 |
///first map. This class is the just readable map type of the ForkWriteMap. |
|
| 1098 |
///first map. This class is the just readable map type of the \c ForkWriteMap. |
|
| 1099 | 1099 |
/// |
| 1100 | 1100 |
///The \c Key and \c Value are inherited from \c M1. |
| 1101 | 1101 |
///The \c Key and \c Value of M2 must be convertible from those of \c M1. |
| 1102 | 1102 |
/// |
| 1103 | 1103 |
///\sa ForkWriteMap |
| 1104 | 1104 |
/// |
| 1105 | 1105 |
/// \todo Why is it needed? |
| 1106 | 1106 |
template<typename M1, typename M2> |
| 1107 | 1107 |
class ForkMap : public MapBase<typename M1::Key, typename M1::Value> {
|
| 1108 | 1108 |
const M1& m1; |
| 1109 | 1109 |
const M2& m2; |
| 1110 | 1110 |
public: |
| ... | ... |
@@ -1112,27 +1112,27 @@ |
| 1112 | 1112 |
typedef typename Parent::Key Key; |
| 1113 | 1113 |
typedef typename Parent::Value Value; |
| 1114 | 1114 |
|
| 1115 | 1115 |
///Constructor |
| 1116 | 1116 |
ForkMap(const M1 &_m1, const M2 &_m2) : m1(_m1), m2(_m2) {};
|
| 1117 | 1117 |
/// \e |
| 1118 | 1118 |
Value operator[](Key k) const {return m1[k];}
|
| 1119 | 1119 |
}; |
| 1120 | 1120 |
|
| 1121 | 1121 |
|
| 1122 | 1122 |
///Applies all map setting operations to two maps |
| 1123 | 1123 |
|
| 1124 |
///This map has two \ |
|
| 1124 |
///This map has two \ref concepts::WriteMap "writable map" |
|
| 1125 | 1125 |
///parameters and each write request will be passed to both of them. |
| 1126 |
///If \c M1 is also \ |
|
| 1126 |
///If \c M1 is also \ref concepts::ReadMap "readable", |
|
| 1127 | 1127 |
///then the read operations will return the |
| 1128 | 1128 |
///corresponding values of \c M1. |
| 1129 | 1129 |
/// |
| 1130 | 1130 |
///The \c Key and \c Value are inherited from \c M1. |
| 1131 | 1131 |
///The \c Key and \c Value of M2 must be convertible from those of \c M1. |
| 1132 | 1132 |
/// |
| 1133 | 1133 |
///\sa ForkMap |
| 1134 | 1134 |
template<typename M1, typename M2> |
| 1135 | 1135 |
class ForkWriteMap : public MapBase<typename M1::Key, typename M1::Value> {
|
| 1136 | 1136 |
M1& m1; |
| 1137 | 1137 |
M2& m2; |
| 1138 | 1138 |
public: |
| ... | ... |
@@ -1163,46 +1163,46 @@ |
| 1163 | 1163 |
///\relates ForkWriteMap |
| 1164 | 1164 |
template <typename M1, typename M2> |
| 1165 | 1165 |
inline ForkWriteMap<M1, M2> forkMap(M1 &m1, M2 &m2) {
|
| 1166 | 1166 |
return ForkWriteMap<M1, M2>(m1,m2); |
| 1167 | 1167 |
} |
| 1168 | 1168 |
|
| 1169 | 1169 |
|
| 1170 | 1170 |
|
| 1171 | 1171 |
/* ************* BOOL MAPS ******************* */ |
| 1172 | 1172 |
|
| 1173 | 1173 |
///Logical 'not' of a map |
| 1174 | 1174 |
|
| 1175 |
///This bool \ |
|
| 1175 |
///This bool \ref concepts::ReadMap "read only map" returns the |
|
| 1176 | 1176 |
///logical negation of the value returned by the given map. |
| 1177 | 1177 |
///Its \c Key is inherited from \c M, its Value is \c bool. |
| 1178 | 1178 |
/// |
| 1179 | 1179 |
///\sa NotWriteMap |
| 1180 | 1180 |
template <typename M> |
| 1181 | 1181 |
class NotMap : public MapBase<typename M::Key, bool> {
|
| 1182 | 1182 |
const M& m; |
| 1183 | 1183 |
public: |
| 1184 | 1184 |
typedef MapBase<typename M::Key, bool> Parent; |
| 1185 | 1185 |
typedef typename Parent::Key Key; |
| 1186 | 1186 |
typedef typename Parent::Value Value; |
| 1187 | 1187 |
|
| 1188 | 1188 |
/// Constructor |
| 1189 | 1189 |
NotMap(const M &_m) : m(_m) {};
|
| 1190 | 1190 |
///\e |
| 1191 | 1191 |
Value operator[](Key k) const {return !m[k];}
|
| 1192 | 1192 |
}; |
| 1193 | 1193 |
|
| 1194 | 1194 |
///Logical 'not' of a map (ReadWrie version) |
| 1195 | 1195 |
|
| 1196 |
///This bool \ |
|
| 1196 |
///This bool \ref concepts::ReadWriteMap "read-write map" returns the |
|
| 1197 | 1197 |
///logical negation of the value returned by the given map. When it is set, |
| 1198 | 1198 |
///the opposite value is set to the original map. |
| 1199 | 1199 |
///Its \c Key is inherited from \c M, its Value is \c bool. |
| 1200 | 1200 |
/// |
| 1201 | 1201 |
///\sa NotMap |
| 1202 | 1202 |
template <typename M> |
| 1203 | 1203 |
class NotWriteMap : public MapBase<typename M::Key, bool> {
|
| 1204 | 1204 |
M& m; |
| 1205 | 1205 |
public: |
| 1206 | 1206 |
typedef MapBase<typename M::Key, bool> Parent; |
| 1207 | 1207 |
typedef typename Parent::Key Key; |
| 1208 | 1208 |
typedef typename Parent::Value Value; |
| ... | ... |
@@ -1252,26 +1252,27 @@ |
| 1252 | 1252 |
template <typename _Iterator> |
| 1253 | 1253 |
struct IteratorTraits<_Iterator, |
| 1254 | 1254 |
typename exists<typename _Iterator::container_type>::type> |
| 1255 | 1255 |
{
|
| 1256 | 1256 |
typedef typename _Iterator::container_type::value_type Value; |
| 1257 | 1257 |
}; |
| 1258 | 1258 |
|
| 1259 | 1259 |
} |
| 1260 | 1260 |
|
| 1261 | 1261 |
|
| 1262 | 1262 |
/// \brief Writable bool map for logging each \c true assigned element |
| 1263 | 1263 |
/// |
| 1264 |
/// Writable bool map for logging each \c true assigned element, i.e it |
|
| 1265 |
/// copies all the keys set to \c true to the given iterator. |
|
| 1264 |
/// A \ref concepts::ReadWriteMap "read-write" bool map for logging |
|
| 1265 |
/// each \c true assigned element, i.e it/ copies all the keys set |
|
| 1266 |
/// to \c true to the given iterator. |
|
| 1266 | 1267 |
/// |
| 1267 | 1268 |
/// \note The container of the iterator should contain space |
| 1268 | 1269 |
/// for each element. |
| 1269 | 1270 |
/// |
| 1270 | 1271 |
/// The following example shows how you can write the edges found by the Prim |
| 1271 | 1272 |
/// algorithm directly |
| 1272 | 1273 |
/// to the standard output. |
| 1273 | 1274 |
///\code |
| 1274 | 1275 |
/// typedef IdMap<Graph, Edge> EdgeIdMap; |
| 1275 | 1276 |
/// EdgeIdMap edgeId(graph); |
| 1276 | 1277 |
/// |
| 1277 | 1278 |
/// typedef MapFunctor<EdgeIdMap> EdgeIdFunctor; |
0 comments (0 inline)