LArSoft
v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
|
A range (interval) of integers. More...
#include "sparse_vector.h"
Public Types | |
typedef SIZE | size_type |
type for the indices in the range More... | |
typedef std::ptrdiff_t | difference_type |
type for index difference More... | |
typedef bool(* | less_int_range) (size_type, const range_t &b) |
Helper type to be used for binary searches. More... | |
Public Member Functions | |
range_t () | |
Default constructor: empty range. More... | |
range_t (size_type from, size_type to) | |
Constructor from first and last index. More... | |
void | set (size_type from, size_type to) |
Sets the borders of the range. More... | |
size_type | begin_index () const |
Returns the first absolute index included in the range. More... | |
size_type | end_index () const |
Returns the first absolute index not included in the range. More... | |
size_type | relative_index (size_type index) const |
Returns the position within the range of the absolute index specified. More... | |
size_type | size () const |
Returns the size of the range. More... | |
void | resize (size_type new_size) |
Moves the end of the range to fit the specified size. More... | |
void | move_head (difference_type shift) |
Moves the begin of the range by the specified amount. More... | |
void | move_tail (difference_type shift) |
Moves the end of the range by the specified amount. More... | |
bool | empty () const |
Returns whether the range is empty. More... | |
bool | includes (size_type index) const |
Returns whether the specified absolute index is included in this range. More... | |
bool | includes (const range_t &r) const |
Returns whether the specified range is completely included in this one. More... | |
bool | overlap (const range_t &r) const |
Returns if this and the specified range overlap. More... | |
bool | separate (const range_t &r) const |
Returns if there are elements in between this and the specified range. More... | |
bool | borders (size_type index) const |
Returns whether an index is within or immediately after this range. More... | |
bool | operator== (const range_t &as) const |
Returns whether the specified range has our same offset and size. More... | |
bool | is_valid () const |
Returns whether the range is valid (that is, non-negative size) More... | |
bool | operator< (const range_t &than) const |
Sort: this range is smaller if its offset is smaller. More... | |
Static Public Member Functions | |
static bool | less (const range_t &a, const range_t &b) |
Returns if a is "less" than b. More... | |
static bool | less (const range_t &a, size_type b) |
Returns if a is "less" than b. More... | |
static bool | less (size_type a, const range_t &b) |
Returns if a is "less" than b. More... | |
Public Attributes | |
size_type | offset |
offset (absolute index) of the first element More... | |
size_type | last |
offset (absolute index) after the last element More... | |
A range (interval) of integers.
SIZE | type of the indices (expected integral) |
Includes a first and an after-the-last value, and some relation metods.
Definition at line 186 of file sparse_vector.h.
typedef std::ptrdiff_t lar::range_t< SIZE >::difference_type |
type for index difference
Definition at line 189 of file sparse_vector.h.
typedef bool(* lar::range_t< SIZE >::less_int_range) (size_type, const range_t &b) |
Helper type to be used for binary searches.
Definition at line 279 of file sparse_vector.h.
typedef SIZE lar::range_t< SIZE >::size_type |
type for the indices in the range
Definition at line 188 of file sparse_vector.h.
|
inline |
Default constructor: empty range.
Definition at line 198 of file sparse_vector.h.
|
inline |
Constructor from first and last index.
Definition at line 201 of file sparse_vector.h.
|
inline |
Returns the first absolute index included in the range.
Definition at line 210 of file sparse_vector.h.
Referenced by lar::range_t< size_type >::includes(), lar::range_t< size_type >::overlap(), hit::HitAnaAlg::ProcessROI(), hit::HitAnaAlg::ROIInfo(), lar::range_t< size_type >::separate(), lar::sparse_vector< T >::should_merge(), and lar::sparse_vector< T >::unset_at().
|
inline |
Returns whether an index is within or immediately after this range.
Returns whether the specified absolute index is included in this range or is immediately after it (not before it!)
Definition at line 253 of file sparse_vector.h.
|
inline |
Returns whether the range is empty.
Definition at line 231 of file sparse_vector.h.
|
inline |
Returns the first absolute index not included in the range.
Definition at line 213 of file sparse_vector.h.
Referenced by lar::range_t< size_type >::includes(), lar::sparse_vector< T >::operator[](), lar::range_t< size_type >::overlap(), lar::range_t< size_type >::separate(), lar::sparse_vector< T >::set_at(), and lar::sparse_vector< T >::unset_at().
|
inline |
Returns whether the specified absolute index is included in this range.
Definition at line 234 of file sparse_vector.h.
|
inline |
Returns whether the specified range is completely included in this one.
Definition at line 238 of file sparse_vector.h.
|
inline |
Returns whether the range is valid (that is, non-negative size)
Definition at line 266 of file sparse_vector.h.
|
inlinestatic |
Returns if a is "less" than b.
Definition at line 270 of file sparse_vector.h.
|
inlinestatic |
Returns if a is "less" than b.
Definition at line 272 of file sparse_vector.h.
|
inlinestatic |
Returns if a is "less" than b.
Definition at line 274 of file sparse_vector.h.
|
inline |
Moves the begin of the range by the specified amount.
Definition at line 225 of file sparse_vector.h.
|
inline |
Moves the end of the range by the specified amount.
Definition at line 228 of file sparse_vector.h.
|
inline |
Sort: this range is smaller if its offset is smaller.
Definition at line 258 of file sparse_vector.h.
|
inline |
Returns whether the specified range has our same offset and size.
Definition at line 262 of file sparse_vector.h.
|
inline |
Returns if this and the specified range overlap.
Definition at line 242 of file sparse_vector.h.
|
inline |
Returns the position within the range of the absolute index specified.
Definition at line 216 of file sparse_vector.h.
Referenced by lar::sparse_vector< T >::unset_at().
|
inline |
Moves the end of the range to fit the specified size.
Definition at line 222 of file sparse_vector.h.
|
inline |
Returns if there are elements in between this and the specified range.
Definition at line 246 of file sparse_vector.h.
|
inline |
Sets the borders of the range.
Definition at line 206 of file sparse_vector.h.
|
inline |
Returns the size of the range.
Definition at line 219 of file sparse_vector.h.
Referenced by lar::sparse_vector< T >::count(), hit::HitAnaAlg::ProcessROI(), lar::sparse_vector< T >::should_merge(), and lar::sparse_vector< T >::unset_at().
size_type lar::range_t< SIZE >::last |
offset (absolute index) after the last element
Definition at line 195 of file sparse_vector.h.
Referenced by lar::range_t< size_type >::operator==().
size_type lar::range_t< SIZE >::offset |
offset (absolute index) of the first element
Definition at line 192 of file sparse_vector.h.
Referenced by lar::range_t< size_type >::is_valid(), lar::range_t< size_type >::less(), and lar::range_t< size_type >::operator==().