ATLAS Offline Software
|
A set of aux data identifiers. More...
#include <AuxTypes.h>
Public Types | |
typedef size_t | bit_t |
A bit number. More... | |
Public Member Functions | |
auxid_set_t (size_t nbits=auxid_set_size_hint) | |
Constructors, destructors, assignment. | |
void | emptyGarbage () |
Clean up old versions of the set. More... | |
Size, bit testing | |
bit_t | capacity () const |
The number of bits that this container can hold. More... | |
bit_t | count () const |
Count the number of 1 bits in the set. More... | |
size_t | count (bit_t bit) const |
Test to see if a bit is set. More... | |
bit_t | size () const |
Count the number of 1 bits in the set. More... | |
bool | test (bit_t bit) const |
Test to see if a bit is set. More... | |
bool | empty () const |
Return true if there are no 1 bits in the set. More... | |
bool | none () const |
Return true if there are no 1 bits in the set. More... | |
bool | all () const |
Return true if all bits in the set are 1. More... | |
bool | any () const |
Return true if there are any 1 bits in the set. More... | |
Single-bit manipulation. | |
ConcurrentBitset & | set (bit_t bit) |
Turn on one bit. More... | |
ConcurrentBitset & | set (bit_t bit, bool val) |
Set the value of one bit. More... | |
ConcurrentBitset & | reset (bit_t bit) |
Turn off one bit. More... | |
ConcurrentBitset & | erase (bit_t bit) |
Turn off one bit. More... | |
ConcurrentBitset & | flip (bit_t bit) |
Flip the value of one bit. More... | |
Set operations. | |
ConcurrentBitset & | set () |
Turn on all bits in the set. More... | |
ConcurrentBitset & | reset () |
Clear all bits in the set. More... | |
ConcurrentBitset & | flip () |
Flip the state of all bits in the set. More... | |
ConcurrentBitset & | clear () |
Clear all bits in the set. More... | |
ConcurrentBitset & | operator&= (const ConcurrentBitset &other) |
AND this set with another set. More... | |
ConcurrentBitset & | operator|= (const ConcurrentBitset &other) |
OR this set with another set. More... | |
ConcurrentBitset & | operator^= (const ConcurrentBitset &other) |
XOR this set with another set. More... | |
ConcurrentBitset & | operator-= (const ConcurrentBitset &other) |
Subtract another set from this set. More... | |
ConcurrentBitset | operator~ () const |
Return a new set that is the complement of this set. More... | |
Comparison. | |
bool | operator== (const ConcurrentBitset &other) const |
Test two sets for equality. More... | |
bool | operator!= (const ConcurrentBitset &other) const |
Test two sets for inequality. More... | |
Insert. | |
ConcurrentBitset & | insert (bit_t bit, bit_t new_nbits=0) |
Set a bit to 1. More... | |
template<class ITERATOR , typename = typename std::enable_if< std::is_base_of< typename std::forward_iterator_tag, typename std::iterator_traits<ITERATOR>::iterator_category >::value>> | |
ConcurrentBitset & | insert (ITERATOR beg, ITERATOR end, bit_t new_nbits=0) |
Set several bits to 1. More... | |
ConcurrentBitset & | insert (std::initializer_list< bit_t > l, bit_t new_nbits=0) |
Set several bits to 1. More... | |
ConcurrentBitset & | insert (const ConcurrentBitset &other) |
Turn on bits listed in another set. More... | |
Array-like element access. | |
bool | operator[] (bit_t bit) const |
Return the value of one bit. More... | |
reference | operator[] (bit_t bit) |
Return a reference to one bit. More... | |
Iterator operations. | |
const_iterator | begin () const |
Return a begin iterator. More... | |
const_iterator | end () const |
Return an end iterator. More... | |
const_iterator | find (bit_t bit) const |
If bit bit is set, return an iterator pointing to it. More... | |
Size, bit testing | |
bit_t | capacity () const |
The number of bits that this container can hold. More... | |
bit_t | count () const |
Count the number of 1 bits in the set. More... | |
bit_t | size () const |
Count the number of 1 bits in the set. More... | |
bool | test (bit_t bit) const |
Test to see if a bit is set. More... | |
size_t | count (bit_t bit) const |
Test to see if a bit is set. More... | |
bool | empty () const |
Return true if there are no 1 bits in the set. More... | |
bool | none () const |
Return true if there are no 1 bits in the set. More... | |
bool | all () const |
Return true if all bits in the set are 1. More... | |
bool | any () const |
Return true if there are any 1 bits in the set. More... | |
Single-bit manipulation. | |
ConcurrentBitset & | set (bit_t bit) |
Turn on one bit. More... | |
ConcurrentBitset & | reset (bit_t bit) |
Turn off one bit. More... | |
ConcurrentBitset & | erase (bit_t bit) |
Turn off one bit. More... | |
ConcurrentBitset & | flip (bit_t bit) |
Flip the value of one bit. More... | |
ConcurrentBitset & | set (bit_t bit, bool val) |
Set the value of one bit. More... | |
Set operations. | |
ConcurrentBitset & | clear () |
Clear all bits in the set. More... | |
ConcurrentBitset & | reset () |
Clear all bits in the set. More... | |
ConcurrentBitset & | set () |
Turn on all bits in the set. More... | |
ConcurrentBitset & | flip () |
Flip the state of all bits in the set. More... | |
ConcurrentBitset & | operator&= (const ConcurrentBitset &other) |
AND this set with another set. More... | |
ConcurrentBitset & | operator|= (const ConcurrentBitset &other) |
OR this set with another set. More... | |
ConcurrentBitset & | operator^= (const ConcurrentBitset &other) |
XOR this set with another set. More... | |
ConcurrentBitset & | operator-= (const ConcurrentBitset &other) |
Subtract another set from this set. More... | |
ConcurrentBitset | operator~ () const |
Return a new set that is the complement of this set. More... | |
Comparison. | |
bool | operator== (const ConcurrentBitset &other) const |
Test two sets for equality. More... | |
bool | operator!= (const ConcurrentBitset &other) const |
Test two sets for inequality. More... | |
Insert. | |
ConcurrentBitset & | insert (bit_t bit, bit_t new_nbits=0) |
Set a bit to 1. More... | |
template<class ITERATOR , typename = typename std::enable_if< std::is_base_of< typename std::forward_iterator_tag, typename std::iterator_traits<ITERATOR>::iterator_category >::value>> | |
ConcurrentBitset & | insert (ITERATOR beg, ITERATOR end, bit_t new_nbits=0) |
Set several bits to 1. More... | |
ConcurrentBitset & | insert (std::initializer_list< bit_t > l, bit_t new_nbits=0) |
Set several bits to 1. More... | |
ConcurrentBitset & | insert (const ConcurrentBitset &other) |
Turn on bits listed in another set. More... | |
Array-like element access. | |
bool | operator[] (bit_t bit) const |
Return the value of one bit. More... | |
reference | operator[] (bit_t bit) |
Return a reference to one bit. More... | |
Iterator operations. | |
const_iterator | begin () const |
Return a begin iterator. More... | |
const_iterator | end () const |
Return an end iterator. More... | |
const_iterator | find (bit_t bit) const |
If bit bit is set, return an iterator pointing to it. More... | |
Private Types | |
typedef unsigned long | Block_t |
Internal type used to hold the bitset data. More... | |
Static Private Attributes | |
static const size_t | BLOCKSIZE = sizeof(Block_t) * CHAR_BIT |
Size, in bits, of Block_t . More... | |
static const size_t | MASK = BLOCKSIZE-1 |
Mask to select out the bit offset within one Block_t . More... | |
Implementation. | |
typedef std::mutex | mutex_t |
Mutex used for synchronization when switching to a new implementation object. More... | |
typedef std::lock_guard< mutex_t > | lock_t |
std::atomic< Impl * > | m_impl |
The current implementation object. More... | |
std::vector< Impl * > | m_garbage |
Old implementation objects, pending deletion. More... | |
mutex_t | m_mutex |
static bit_t | nBlocks (bit_t nbits) |
Find number of blocks needed to hold a given number of bits. More... | |
Impl * | newImpl (bit_t nbits) |
Create a new, uninitialized implementation object. More... | |
void | expand (bit_t new_nbits) |
Expand the container. More... | |
void | expandOol (bit_t new_nbits) |
Expand the container: out-of-line portion. More... | |
A set of aux data identifiers.
This is a ConcurrentBitset, with the default size set to auxid_set_size_hint.
Definition at line 45 of file AuxTypes.h.
|
inherited |
A bit number.
Definition at line 168 of file ConcurrentBitset.h.
|
privateinherited |
Internal type used to hold the bitset data.
The bitset is an array of std::atomic<Block_t>. This type should generally be the largest unsigned type for which std::atomic is lockless.
Definition at line 155 of file ConcurrentBitset.h.
|
privateinherited |
Definition at line 1075 of file ConcurrentBitset.h.
|
privateinherited |
Mutex used for synchronization when switching to a new implementation object.
Definition at line 1074 of file ConcurrentBitset.h.
|
inline |
Definition at line 50 of file AuxTypes.h.
|
inherited |
Return true if all bits in the set are 1.
|
inherited |
Return true if there are any 1 bits in the set.
|
inherited |
Return a begin iterator.
|
inherited |
The number of bits that this container can hold.
|
inherited |
Clear all bits in the set.
This operation is not necessarily atomic; a simultaneous read may be able to see the operation partially done.
|
inherited |
Count the number of 1 bits in the set.
|
inherited |
Test to see if a bit is set.
bit | Number of the bit to test. |
Returns 0 if bit
is beyond the end of the set.
|
inherited |
Return true if there are no 1 bits in the set.
|
inherited |
Clean up old versions of the set.
The insert and assignment operations may need to grow the set. The original version of the set is not deleted immediately, since other threads may still be accessing it. Call this when no other threads can be accessing old versions in order to clean them up.
Definition at line 148 of file ConcurrentBitset.cxx.
|
inherited |
Return an end iterator.
|
inherited |
Turn off one bit.
bit | The bit to turn off. |
Does nothing if bit
beyond the end of the set.
|
privateinherited |
Expand the container.
new_nbits | The desired new size of the container. |
|
privateinherited |
Expand the container: out-of-line portion.
new_nbits | The desired new size of the container. |
Definition at line 162 of file ConcurrentBitset.cxx.
|
inherited |
If bit bit
is set, return an iterator pointing to it.
Otherwise, return an end iterator.
bit | Bit number to test. |
|
inherited |
Flip the state of all bits in the set.
This operation is not necessarily atomic; a simultaneous read may be able to see the operation partially done.
|
inherited |
Flip the value of one bit.
bit | The bit to turn flip. |
Does nothing if bit
beyond the end of the set.
|
inherited |
Set a bit to 1.
Expand the set if needed.
bit | Number of the bit to set. |
new_nbits | Hint for new size of set, if it needs to be expanded. |
If bit
is past the end of the container, then the container will be expanded as needed.
This operation is incompatible with any other simultaneous writes to the same set (reads are ok).
|
inherited |
Turn on bits listed in another set.
other | Set of bits to turn on. |
This is the same as operator|=
, except that if the size of other
is larger than this set, then this set will be expanded to match other
.
This operation is incompatible with any other simultaneous writes to the same set (reads are ok).
|
inherited |
Set several bits to 1.
Expand the set if needed.
beg | Start of range of bits to set. |
end | End of range of bits to set. |
new_nbits | Hint for new size of set, if it needs to be expanded. |
The iteration range should be over something convertible to bit_t
. If any bit is past the end of the container, then the container will be expanded as needed.
This operation is incompatible with any other simultaneous writes to the same set (reads are ok).
Example:
|
inherited |
Set several bits to 1.
Expand the set if needed.
l | List of bits to set. |
new_nbits | Hint for new size of set, if it needs to be expanded. |
If any bit is past the end of the container, then the container will be expanded as needed.
This operation is incompatible with any other simultaneous writes to the same set (reads are ok).
Example:
Find number of blocks needed to hold a given number of bits.
nbits | The number of bits. |
Create a new, uninitialized implementation object.
nbits | Number of bits to allocate. |
This will allocate memory for the Impl object, but will does not run the constructor.
|
inherited |
Return true if there are no 1 bits in the set.
|
inherited |
Test two sets for inequality.
other | The other set to test. |
|
inherited |
AND this set with another set.
other | The other set. |
This operation is not necessarily atomic; a simultaneous read may be able to see the operation partially done.
|
inherited |
Subtract another set from this set.
other | The other set. |
This is the same as (*this) &= ~other;
This operation is not necessarily atomic; a simultaneous read may be able to see the operation partially done.
|
inherited |
Test two sets for equality.
other | The other set to test. |
Return a reference to one bit.
bit | The number of the bit to reference. |
The reference will be invalidated by calls to insert()
or operator=
. Effects are undefined if bit
is past the end of the set.
|
inherited |
Return the value of one bit.
bit | The number of the bit to test. |
|
inherited |
XOR this set with another set.
other | The other set. |
This operation is not necessarily atomic; a simultaneous read may be able to see the operation partially done.
|
inherited |
OR this set with another set.
other | The other set. |
This operation is not necessarily atomic; a simultaneous read may be able to see the operation partially done.
|
inherited |
Return a new set that is the complement of this set.
|
inherited |
Clear all bits in the set.
This operation is not necessarily atomic; a simultaneous read may be able to see the operation partially done.
|
inherited |
Turn off one bit.
bit | The bit to turn off. |
Does nothing if bit
beyond the end of the set.
|
inherited |
Turn on all bits in the set.
This operation is not necessarily atomic; a simultaneous read may be able to see the operation partially done.
|
inherited |
Turn on one bit.
bit | The bit to turn on. |
Does nothing if bit
beyond the end of the set.
|
inherited |
Set the value of one bit.
bit | The bit to turn set. |
val | The value to which to set it. |
Does nothing if bit
beyond the end of the set.
|
inherited |
Count the number of 1 bits in the set.
Note: If you regard this like a std::bitset, you would expect this to return the number of bits that the set can hold, while if you regard this like a set<bit_t>, then you would expect this to return the number of 1 bits. We follow the latter here.
|
inherited |
Test to see if a bit is set.
bit | Number of the bit to test. |
Returns false if bit
is beyond the end of the set.
|
staticprivateinherited |
Size, in bits, of Block_t
.
Definition at line 158 of file ConcurrentBitset.h.
|
privateinherited |
Old implementation objects, pending deletion.
Definition at line 1071 of file ConcurrentBitset.h.
|
privateinherited |
The current implementation object.
Definition at line 1068 of file ConcurrentBitset.h.
|
privateinherited |
Definition at line 1076 of file ConcurrentBitset.h.
Mask to select out the bit offset within one Block_t
.
Definition at line 161 of file ConcurrentBitset.h.