|
Mantid
|
IndexSet is a container that can be used to define and access a subset of elements in a larger container such as std::vector. More...
#include <IndexSet.h>
Public Member Functions | |
| IndexSet (const std::vector< size_t > &indices, size_t fullRange) | |
| Constructor for a set containing all specified indices. More... | |
| IndexSet (int64_t min, int64_t max, size_t fullRange) | |
| Constructor for a set covering the range from min to max. More... | |
| IndexSet (size_t fullRange) | |
| Constructor for a set covering the full range from 0 to fullRange-1. More... | |
| size_t | operator[] (size_t index) const |
| Returns the element at given index (range 0...size()-1). More... | |
| size_t | size () const |
| Returns the size of the set. More... | |
Private Attributes | |
| std::vector< size_t > | m_indices |
| bool | m_isRange = true |
| size_t | m_min = 0 |
| size_t | m_size |
IndexSet is a container that can be used to define and access a subset of elements in a larger container such as std::vector.
In particular this is used when accessing the spectra in a workspace. Users frequently need to specify a certain range or list of spectra to use for an operation. This class provides a set of indices for this purpose.
Definition at line 26 of file IndexSet.h.
| IndexSet::IndexSet | ( | size_t | fullRange | ) |
Constructor for a set covering the full range from 0 to fullRange-1.
Definition at line 16 of file IndexSet.cpp.
| IndexSet::IndexSet | ( | int64_t | min, |
| int64_t | max, | ||
| size_t | fullRange | ||
| ) |
Constructor for a set covering the range from min to max.
Range is verified at construction time.
Definition at line 20 of file IndexSet.cpp.
| IndexSet::IndexSet | ( | const std::vector< size_t > & | indices, |
| size_t | fullRange | ||
| ) |
Constructor for a set containing all specified indices.
Range is verified at construction time and duplicates are removed.
Definition at line 33 of file IndexSet.cpp.
|
inline |
Returns the element at given index (range 0...size()-1).
Definition at line 36 of file IndexSet.h.
|
inline |
Returns the size of the set.
Definition at line 33 of file IndexSet.h.
References m_size.
Referenced by Mantid::Algorithms::SpectrumAlgorithm::for_each().
|
private |
Definition at line 48 of file IndexSet.h.
Referenced by IndexSet().
|
private |
Definition at line 44 of file IndexSet.h.
|
private |
Definition at line 46 of file IndexSet.h.
Referenced by IndexSet().
|
private |
Definition at line 47 of file IndexSet.h.
Referenced by IndexSet().