#include <IndexSet.h>
Public Member Functions | |
void | clear () |
Clear the set. More... | |
bool | empty () const |
Check if the set is empty. More... | |
bool | has (unsigned int index) const |
Check if an element (=index) is in the set. More... | |
IndexSet () | |
Construct empty set. More... | |
void | insert (unsigned int index) |
Insert an element (=index) to the set. More... | |
void | reserve (unsigned int size) |
Reserve memory for the set. More... | |
unsigned int | size () const |
Number of elements in the set. More... | |
Private Attributes | |
std::vector< bool > | content_ |
unsigned int | numTrueElements_ |
Each possible element of the set corresponds an index in this vector. The value of an element tells if that index exists in the set (true) or not (false). More... | |
A simple class representing a set of indices to another container for fast insert and search.
This class can be useful if one needs to record the indices of objects that form a subset of a container (e.g. passing some selection), and then repeatedly check if an object of a given index belongs to that subset. As the elements are assumed to be indices, the set can be implemented as a vector<bool> such that each possible element corresponds an index in the vector. Then the insert and search are (almost) array access operations.
From the set opreations, only insertion, search, and clear are supported for now. More can be added if needed.
Definition at line 23 of file IndexSet.h.
|
inline |
Construct empty set.
Definition at line 26 of file IndexSet.h.
|
inline |
Clear the set.
Definition at line 42 of file IndexSet.h.
References begin, content_, end, lumiContext::fill, and numTrueElements_.
|
inline |
Check if the set is empty.
Definition at line 29 of file IndexSet.h.
References numTrueElements_.
|
inline |
Check if an element (=index) is in the set.
Definition at line 55 of file IndexSet.h.
References content_.
Referenced by QuickTrackAssociatorByHitsImpl::associateTrack(), and MultiTrackValidator::bookHistograms().
|
inline |
Insert an element (=index) to the set.
Definition at line 48 of file IndexSet.h.
References content_, numTrueElements_, and reserve().
Referenced by MultiTrackValidator::bookHistograms().
|
inline |
Reserve memory for the set.
Definition at line 35 of file IndexSet.h.
References content_.
Referenced by associationMapFilterValues(), MultiTrackValidator::bookHistograms(), and insert().
|
inline |
Number of elements in the set.
Definition at line 32 of file IndexSet.h.
References numTrueElements_.
Referenced by ntupleDataFormat._Collection::__iter__(), and ntupleDataFormat._Collection::__len__().
|
private |
|
private |