5#ifndef EVENTCONTAINERS_IDENTIFIABLEVALUECONTAINER_H
6#define EVENTCONTAINERS_IDENTIFIABLEVALUECONTAINER_H
71 std::vector<std::pair<size_t, T>>
getAll()
const;
94 std::vector<std::pair<size_t, T>> list;
95 list.reserve(
m_mask.size());
96 const auto& raw =
m_cache->rawReadAccess();
98 list.emplace_back(i, raw[i].load(std::memory_order_relaxed));
106 auto r =
cache->retrieve(i);
110 else return cache->emptyValue();
115 if(i >=
maxSize())
return false;
130 bool b =
m_cache->setOrDrop(i, value);
Define macros for attributes used to control the static checker.
#define ATLAS_THREAD_SAFE
This class is to provide an event wide MT container for concurrent storing of basic types,...
~IdentifiableValueContainer()
size_t maxSize() const
Return the maxSize of the collection.
std::set< size_t > m_mask
bool present(size_t i) const
Is the value for this has set and also accepted in the mask.
IdentifiableValueContainer & operator=(const IdentifiableValueContainer &)=delete
IdentifiableValueContainer(IdentifiableValueCache< T > *ptr)
External Cache Constructor Pass the external cache to set up a view specific view interface.
const Cache * cache() const
Obtain const access to the cache.
T retrieve(size_t i) const
Retrieve the value of the hash, if accessible according to the mask.
IdentifiableValueContainer(size_t maxSize, T defaultValue)
Self Owning Constructor Pass the maximum hash to size the cache and the defaultValue which will be in...
bool setOrDrop(size_t i, const T &value)
Set the value for the given hash.
IdentifiableValueCache< T > Cache
const std::vector< std::atomic< T > > & wholeEventReadAccess() const
Get read only access to the whole external cache. This could be useful for special situations.
const T & emptyValue() const
Return the empty value that is interpreted as an empty entry.
const std::set< size_t > & getMask() const
bool tryAddFromCache(size_t i)
Returns true if the value is also in the external cache, sets mask to true if it is.
IdentifiableValueContainer(const IdentifiableValueContainer< T > &)=delete
size_t numberSet() const
Return the number of entries set and accessible according to the mask.
std::vector< std::pair< size_t, T > > getAll() const
Make a vector of hashes and values, convenient for iteration and other uses.