From 47e37635f50c09b4f9a9ee7699e3120bab3e4088 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sun, 10 Apr 2016 04:29:29 +0200 Subject: NOISSUE split GUI stuff from logic library --- logic/RWStorage.h | 60 ------------------------------------------------------- 1 file changed, 60 deletions(-) delete mode 100644 logic/RWStorage.h (limited to 'logic/RWStorage.h') diff --git a/logic/RWStorage.h b/logic/RWStorage.h deleted file mode 100644 index b1598ca4..00000000 --- a/logic/RWStorage.h +++ /dev/null @@ -1,60 +0,0 @@ -#pragma once -template -class RWStorage -{ -public: - void add(K key, V value) - { - QWriteLocker l(&lock); - cache[key] = value; - stale_entries.remove(key); - } - V get(K key) - { - QReadLocker l(&lock); - if(cache.contains(key)) - { - return cache[key]; - } - else return V(); - } - bool get(K key, V& value) - { - QReadLocker l(&lock); - if(cache.contains(key)) - { - value = cache[key]; - return true; - } - else return false; - } - bool has(K key) - { - QReadLocker l(&lock); - return cache.contains(key); - } - bool stale(K key) - { - QReadLocker l(&lock); - if(!cache.contains(key)) - return true; - return stale_entries.contains(key); - } - void setStale(K key) - { - QReadLocker l(&lock); - if(cache.contains(key)) - { - stale_entries.insert(key); - } - } - void clear() - { - QWriteLocker l(&lock); - cache.clear(); - } -private: - QReadWriteLock lock; - QMap cache; - QSet stale_entries; -}; \ No newline at end of file -- cgit v1.2.3