From df752dcece8ba4d378ec817ff60d498f4b8150cf Mon Sep 17 00:00:00 2001 From: hsc <hsc@8c4709b5-6ec9-48aa-a5cd-a96041d1645a> Date: Tue, 10 Apr 2012 19:35:33 +0000 Subject: [PATCH] MemoryMap: doxygen documentation, iterator interface git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@1040 8c4709b5-6ec9-48aa-a5cd-a96041d1645a --- core/util/MemoryMap.hpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/core/util/MemoryMap.hpp b/core/util/MemoryMap.hpp index 26984449..bd2b26a3 100644 --- a/core/util/MemoryMap.hpp +++ b/core/util/MemoryMap.hpp @@ -29,13 +29,25 @@ public: std::set<sal::address_t> as; public: MemoryMap() {} + /** + * Clears the map. + */ void clear() { as.clear(); } + + /** + * Adds one or a sequence of addresses to the map. + */ void add(sal::address_t addr, int size = 1) { for (int i = 0; i < size; ++i) { as.insert(addr + i); } } + + /** + * Determines whether a given memory access at address \a addr with width + * \a size hits the map. + */ bool isMatching(sal::address_t addr, int size = 1) { for (int i = 0; i < size; ++i) { @@ -45,6 +57,24 @@ public: } return false; } + + /** + * The (STL-style) iterator of this class used to iterate over all + * addresses in this map. + */ + typedef std::set<sal::address_t>::iterator iterator; + + /** + * Returns an (STL-style) iterator to the beginning of the internal data + * structure. + */ + iterator begin() { return as.begin(); } + + /** + * Returns an (STL-style) iterator to the end of the interal data + * structure. + */ + iterator end() { return as.end(); } }; #endif -- GitLab