|
ATLAS Offline Software
|
Go to the documentation of this file.
5 #ifndef EVENTCONTAINERS_IDENTIFIABLEVALUECACHE_H
6 #define EVENTCONTAINERS_IDENTIFIABLEVALUECACHE_H
64 std::vector<std::pair<size_t, T>>
getAll()
const;
69 std::vector<std::atomic<T>>
m_vec;
74 std::vector<std::pair<size_t, T>>
76 std::vector<std::pair<size_t, T>>
list;
77 for(
size_t i =0;
i<m_vec.size();
i++){
78 T item = m_vec[
i].load(std::memory_order_relaxed);
86 for(
auto &
x : m_vec)
x.store(emptyValue(), std::memory_order_relaxed);
92 return m_vec.at(
i).compare_exchange_strong(
val,
value);
IdentifiableValueCache(size_t maxSize, T emptyValuein)
Pass the maximum hash to size the cache and the defaultValue which will be interpreted as an empty va...
std::vector< std::pair< size_t, T > > getAll() const
Make a vector of hashes and values, convenient for iteration and other uses.
bool setOrDrop(size_t i, const T &value)
Set the given hash to the value.
const std::vector< std::atomic< T > > & rawReadAccess() const
const T & emptyValue() const
Return the empty value that is interpreted as an empty entry.
T retrieve(size_t i)
Retrieve the Value stored in that hash.
bool present(size_t i) const
As above, but no cache extension.
bool present(size_t i)
Returns true if the value is set to anything but the emptyValue.
IdentifiableValueCache(const IdentifiableValueCache &)=delete
std::vector< std::atomic< T > > m_vec
T retrieve(size_t i) const
As above, but no cache extension.
std::true_type thread_safe
size_t maxSize() const
Return the maxSize of the collection.
~IdentifiableValueCache()=default
This class is to provide an event wide MT container for concurrent storing of basic types,...
void forceReset()
Forceable empty the container, DO NOT USE THIS IN MT ENVIRONMENT.