summaryrefslogtreecommitdiff
path: root/src/mem/cache/blk.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/mem/cache/blk.hh')
-rw-r--r--src/mem/cache/blk.hh60
1 files changed, 8 insertions, 52 deletions
diff --git a/src/mem/cache/blk.hh b/src/mem/cache/blk.hh
index 6c72817c0..09599b694 100644
--- a/src/mem/cache/blk.hh
+++ b/src/mem/cache/blk.hh
@@ -397,63 +397,19 @@ class CacheBlkPrintWrapper : public Printable
};
/**
- * Wrap a method and present it as a cache block visitor.
- *
- * For example the forEachBlk method in the tag arrays expects a
- * callable object/function as their parameter. This class wraps a
- * method in an object and presents callable object that adheres to
- * the cache block visitor protocol.
- */
-template <typename T, typename BlkType>
-class CacheBlkVisitorWrapper
-{
- public:
- typedef bool (T::*visitorPtr)(BlkType &blk);
-
- CacheBlkVisitorWrapper(T &_obj, visitorPtr _visitor)
- : obj(_obj), visitor(_visitor) {}
-
- bool operator()(BlkType &blk) {
- return (obj.*visitor)(blk);
- }
-
- private:
- T &obj;
- visitorPtr visitor;
-};
-
-/**
- * Cache block visitor that determines if there are dirty blocks in a
- * cache.
- *
- * Use with the forEachBlk method in the tag array to determine if the
- * array contains dirty blocks.
+ * Base class for cache block visitor, operating on the cache block
+ * base class (later subclassed for the various tag classes). This
+ * visitor class is used as part of the forEachBlk interface in the
+ * tag classes.
*/
-template <typename BlkType>
-class CacheBlkIsDirtyVisitor
+class CacheBlkVisitor
{
public:
- CacheBlkIsDirtyVisitor()
- : _isDirty(false) {}
-
- bool operator()(BlkType &blk) {
- if (blk.isDirty()) {
- _isDirty = true;
- return false;
- } else {
- return true;
- }
- }
- /**
- * Does the array contain a dirty line?
- *
- * \return true if yes, false otherwise.
- */
- bool isDirty() const { return _isDirty; };
+ CacheBlkVisitor() {}
+ virtual ~CacheBlkVisitor() {}
- private:
- bool _isDirty;
+ virtual bool operator()(CacheBlk &blk) = 0;
};
#endif //__CACHE_BLK_HH__