Changeset 2331:e389580e3348 in lemon-0.x for lemon
- Timestamp:
- 12/18/06 15:35:33 (17 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@3117
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/graph_utils.h
r2329 r2331 1583 1583 /// \brief Constructor. 1584 1584 /// 1585 /// Constructor for creating idmap.1585 /// Constructor of the map. 1586 1586 explicit IdMap(const Graph& _graph) : graph(&_graph) {} 1587 1587 1588 1588 /// \brief Gives back the \e id of the item. 1589 1589 /// 1590 /// Gives back the immutable and unique \e id of the map.1590 /// Gives back the immutable and unique \e id of the item. 1591 1591 int operator[](const Item& item) const { return graph->id(item);} 1592 1592 1593 /// \brief Gives back the item by its id. 1594 /// 1595 /// Gives back the item by its id. 1596 Item operator()(int id) { return graph->fromId(id, Item()); } 1593 1597 1594 1598 private: … … 1619 1623 /// 1620 1624 Item operator[](int id) const { return graph->fromId(id, Item());} 1625 1621 1626 private: 1622 1627 const Graph* graph; … … 1745 1750 } 1746 1751 1752 /// \brief Gives back the item by its value. 1753 /// 1754 /// Gives back the item by its value. 1755 Key operator()(const Value& key) const { 1756 typename Container::const_iterator it = invMap.find(key); 1757 return it != invMap.end() ? it->second : INVALID; 1758 } 1759 1747 1760 protected: 1748 1761 … … 1808 1821 /// what was last assigned to the value. 1809 1822 Value operator[](const Key& key) const { 1810 typename Container::const_iterator it = inverted.invMap.find(key); 1811 return it->second; 1823 return inverted(key); 1812 1824 } 1813 1825 … … 1967 1979 return Map::operator[](item); 1968 1980 } 1981 1982 /// \brief Gives back the item by its descriptor. 1983 /// 1984 /// Gives back th item by its descriptor. 1985 Item operator()(int id) const { 1986 return invMap[id]; 1987 } 1969 1988 1970 1989 private: … … 1996 2015 /// that the descriptor belongs to currently. 1997 2016 Value operator[](const Key& key) const { 1998 return inverted .invMap[key];2017 return inverted(key); 1999 2018 } 2000 2019 … … 2003 2022 /// Returns the size of the map. 2004 2023 unsigned int size() const { 2005 return inverted. invMap.size();2024 return inverted.size(); 2006 2025 } 2007 2026
Note: See TracChangeset
for help on using the changeset viewer.