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