ATLAS Offline Software
Loading...
Searching...
No Matches
IDCInDetBSErrContainer Class Reference

IDC like storage for BS errors, TODO, customise implementation further so that we store int rather than int*. More...

#include <IDCInDetBSErrContainer.h>

Inheritance diagram for IDCInDetBSErrContainer:
Collaboration diagram for IDCInDetBSErrContainer:

Public Types

typedef uint64_t ErrorCode
typedef uint64_t value_type
typedef IdentifiableValueCache< uint64_t > Cache

Public Member Functions

const uint64_t & emptyValue () const
 Return the empty value that is interpreted as an empty entry.
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 uint64_t &value)
 Set the value for the given hash.
size_t maxSize () const
 Return the maxSize of the collection.
size_t numberSet () const
 Return the number of entries set and accessible according to the mask.
bool tryAddFromCache (size_t i)
 Returns true if the value is also in the external cache, sets mask to true if it is.
uint64_t retrieve (size_t i) const
 Retrieve the value of the hash, if accessible according to the mask.
std::vector< std::pair< size_t, uint64_t > > getAll () const
 Make a vector of hashes and values, convenient for iteration and other uses.
const std::vector< std::atomic< uint64_t > > & wholeEventReadAccess () const
 Get read only access to the whole external cache. This could be useful for special situations.
const Cachecache () const
 Obtain const access to the cache.
const std::set< size_t > & getMask () const

Private Attributes

std::set< size_t > m_mask
Cachem_cache
bool m_own

Detailed Description

IDC like storage for BS errors, TODO, customise implementation further so that we store int rather than int*.

Definition at line 19 of file IDCInDetBSErrContainer.h.

Member Typedef Documentation

◆ Cache

typedef IdentifiableValueCache<uint64_t> IdentifiableValueContainer< uint64_t >::Cache
inherited

Definition at line 25 of file IdentifiableValueContainer.h.

◆ ErrorCode

Definition at line 21 of file IDCInDetBSErrContainer.h.

◆ value_type

typedef uint64_t IdentifiableValueContainer< uint64_t >::value_type
inherited

Definition at line 24 of file IdentifiableValueContainer.h.

Member Function Documentation

◆ cache()

const Cache * IdentifiableValueContainer< uint64_t >::cache ( ) const
inlineinherited

Obtain const access to the cache.

Definition at line 77 of file IdentifiableValueContainer.h.

◆ emptyValue()

const uint64_t & IdentifiableValueContainer< uint64_t >::emptyValue ( ) const
inlineinherited

Return the empty value that is interpreted as an empty entry.

Definition at line 48 of file IdentifiableValueContainer.h.

48{ return m_cache->emptyValue(); }

◆ getAll()

std::vector< std::pair< size_t, uint64_t > > IdentifiableValueContainer< uint64_t >::getAll ( ) const
inherited

Make a vector of hashes and values, convenient for iteration and other uses.

Definition at line 71 of file IdentifiableValueContainer.h.

93 {
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));
99 }
100 return list;
101}

◆ getMask()

const std::set< size_t > & IdentifiableValueContainer< uint64_t >::getMask ( ) const
inlineinherited

Definition at line 79 of file IdentifiableValueContainer.h.

79{ return m_mask; }

◆ maxSize()

size_t IdentifiableValueContainer< uint64_t >::maxSize ( ) const
inlineinherited

Return the maxSize of the collection.

Definition at line 58 of file IdentifiableValueContainer.h.

58{ return m_cache->maxSize(); }

◆ numberSet()

size_t IdentifiableValueContainer< uint64_t >::numberSet ( ) const
inherited

Return the number of entries set and accessible according to the mask.

This is not a trivial function do not repeatedly call.

Definition at line 62 of file IdentifiableValueContainer.h.

124 {
125 return m_mask.size();
126}

◆ present()

bool IdentifiableValueContainer< uint64_t >::present ( size_t i) const
inherited

Is the value for this has set and also accepted in the mask.

Definition at line 52 of file IdentifiableValueContainer.h.

88{
89 return m_mask.count(i);
90}

◆ retrieve()

uint64_t IdentifiableValueContainer< uint64_t >::retrieve ( size_t i) const
inherited

Retrieve the value of the hash, if accessible according to the mask.

Definition at line 68 of file IdentifiableValueContainer.h.

104 {
106 auto r = cache->retrieve(i);
107 //Should be quicker to establish empty cache than empty mask with a std::set
108 //So the cache is checked first
109 if(r!= cache->emptyValue() && present(i)) return r;
110 else return cache->emptyValue();
111}
IdentifiableValueCache< uint64_t > Cache

◆ setOrDrop()

bool IdentifiableValueContainer< uint64_t >::setOrDrop ( size_t i,
const uint64_t & value )
inherited

Set the value for the given hash.

Definition at line 55 of file IdentifiableValueContainer.h.

129 {
130 bool b = m_cache->setOrDrop(i, value);
131 m_mask.emplace(i);
132 return b;
133}

◆ tryAddFromCache()

bool IdentifiableValueContainer< uint64_t >::tryAddFromCache ( size_t i)
inherited

Returns true if the value is also in the external cache, sets mask to true if it is.

Definition at line 65 of file IdentifiableValueContainer.h.

114 {
115 if(i >= maxSize()) return false;
116 bool b = m_cache->present(i);
117 if(b) m_mask.emplace(i);
118 return b;
119}

◆ wholeEventReadAccess()

const std::vector< std::atomic< uint64_t > > & IdentifiableValueContainer< uint64_t >::wholeEventReadAccess ( ) const
inlineinherited

Get read only access to the whole external cache. This could be useful for special situations.

Definition at line 74 of file IdentifiableValueContainer.h.

74{ return m_cache->rawReadAccess(); }

Member Data Documentation

◆ m_cache

Cache* IdentifiableValueContainer< uint64_t >::m_cache
privateinherited

Definition at line 82 of file IdentifiableValueContainer.h.

◆ m_mask

std::set<size_t> IdentifiableValueContainer< uint64_t >::m_mask
privateinherited

Definition at line 81 of file IdentifiableValueContainer.h.

◆ m_own

bool IdentifiableValueContainer< uint64_t >::m_own
privateinherited

Definition at line 83 of file IdentifiableValueContainer.h.


The documentation for this class was generated from the following file: