Skip to content
Snippets Groups Projects
Commit 4bcb3ea1 authored by Tomasz Bold's avatar Tomasz Bold
Browse files

Added const accessors to the IDC Values Cache

parent 0950df3e
No related branches found
No related tags found
No related merge requests found
......@@ -47,9 +47,15 @@ public:
///Retrieve the Value stored in that hash
T retrieve(size_t i){ return m_vec.at(i).load(); }
/// As above, but no cache extension
T retrieve(size_t i) const { return i < maxSize() ? static_cast<T>(m_vec[i]) : emptyValue() ; }
///Returns true if the value is set to anything but the emptyValue
bool present(size_t i){ return m_vec.at(i).load() != emptyValue(); }
/// As above, but no cache extension
bool present(size_t i) const { return i < maxSize() and m_vec[i] != emptyValue() ? true : false; }
///Set the given hash to the value
bool setOrDrop(size_t i, const T &value);
......
......@@ -21,6 +21,8 @@ class IdentifiableValueContainer : IdentifiableValueContainerBase{
public:
typedef IdentifiableValueCache<T> Cache;
//Prevent accidental copying
IdentifiableValueContainer(const IdentifiableValueContainer<T>&) = delete;
......@@ -69,9 +71,12 @@ public:
///Get read only access to the whole external cache. This could be useful for special situations
const std::vector<std::atomic<T>>& wholeEventReadAccess() const { return m_cache->rawReadAccess(); }
/// Obtain const access to the cache
const Cache* cache() const { return m_cache; }
private:
std::vector<bool> m_mask;
IdentifiableValueCache<T> *m_cache;
Cache *m_cache;
bool m_own;
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment