LArSoft
v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
|
Range class, with range and data. More...
#include "sparse_vector.h"
Public Types | |
typedef range_t< size_type > | base_t |
base class More... | |
typedef vector_t::iterator | iterator |
typedef vector_t::const_iterator | const_iterator |
typedef size_type | 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 | |
datarange_t () | |
Default constructor: an empty range. More... | |
datarange_t (const base_t &range) | |
Constructor: range initialized with 0. More... | |
template<typename ITER > | |
datarange_t (size_type offset, ITER first, ITER last) | |
Constructor: offset and data. More... | |
datarange_t (size_type offset, vector_t &&data) | |
Constructor: offset and data as a vector (which will be used directly) More... | |
template<typename ITER > | |
datarange_t & | extend (size_type index, ITER first, ITER last) |
void | move_head (size_type to_index, value_type def_value=value_zero) |
Moves the begin of this range. More... | |
void | move_tail (size_type to_index, value_type def_value=value_zero) |
Moves the end of this range. More... | |
template<typename ITER > | |
lar::sparse_vector< T >::datarange_t & | extend (size_type index, ITER first, ITER last) |
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... | |
iterator | get_iterator (size_type index) |
Returns an iterator to the specified absolute value (no check!) More... | |
const_iterator | get_iterator (size_type index) const |
Returns an iterator to the specified absolute value (no check!) More... | |
iterator | begin () |
begin and end iterators More... | |
iterator | end () |
begin and end iterators More... | |
const_iterator | begin () const |
begin and end iterators More... | |
const_iterator | end () const |
begin and end iterators More... | |
const_iterator | cbegin () const |
begin and end iterators More... | |
const_iterator | cend () const |
begin and end iterators More... | |
void | resize (size_t new_size) |
Resizes the range (optionally filling the new elements with def_value) More... | |
void | resize (size_t new_size, value_type def_value) |
Resizes the range (optionally filling the new elements with def_value) More... | |
value_type & | operator[] (size_type index) |
Returns the value at the specified absolute index. More... | |
const value_type & | operator[] (size_type index) const |
Returns the value at the specified absolute index. More... | |
const vector_t & | data () const |
Return the vector of data values. 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... | |
Protected Member Functions | |
void | fit_size_from_data () |
Protected Attributes | |
vector_t | values |
data in the range More... | |
Range class, with range and data.
Definition at line 989 of file sparse_vector.h.
typedef range_t<size_type> lar::sparse_vector< T >::datarange_t::base_t |
base class
Definition at line 991 of file sparse_vector.h.
typedef vector_t::const_iterator lar::sparse_vector< T >::datarange_t::const_iterator |
Definition at line 994 of file sparse_vector.h.
|
inherited |
type for index difference
Definition at line 190 of file sparse_vector.h.
typedef vector_t::iterator lar::sparse_vector< T >::datarange_t::iterator |
Definition at line 993 of file sparse_vector.h.
|
inherited |
Helper type to be used for binary searches.
Definition at line 280 of file sparse_vector.h.
|
inherited |
type for the indices in the range
Definition at line 189 of file sparse_vector.h.
|
inline |
Default constructor: an empty range.
Definition at line 997 of file sparse_vector.h.
|
inline |
Constructor: range initialized with 0.
Definition at line 1000 of file sparse_vector.h.
|
inline |
Constructor: offset and data.
Definition at line 1004 of file sparse_vector.h.
|
inline |
Constructor: offset and data as a vector (which will be used directly)
Definition at line 1010 of file sparse_vector.h.
|
inline |
begin and end iterators
Definition at line 1025 of file sparse_vector.h.
Referenced by lar::sparse_vector< T >::unset_at().
|
inline |
begin and end iterators
Definition at line 1027 of file sparse_vector.h.
|
inlineinherited |
Returns the first absolute index included in the range.
Definition at line 211 of file sparse_vector.h.
|
inlineinherited |
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 254 of file sparse_vector.h.
References geo::operator<().
|
inline |
begin and end iterators
Definition at line 1029 of file sparse_vector.h.
|
inline |
begin and end iterators
Definition at line 1030 of file sparse_vector.h.
|
inline |
Return the vector of data values.
Definition at line 1051 of file sparse_vector.h.
|
inlineinherited |
Returns whether the range is empty.
Definition at line 232 of file sparse_vector.h.
|
inline |
begin and end iterators
Definition at line 1026 of file sparse_vector.h.
Referenced by lar::sparse_vector< T >::unset_at().
|
inline |
begin and end iterators
Definition at line 1028 of file sparse_vector.h.
|
inlineinherited |
Returns the first absolute index not included in the range.
Definition at line 214 of file sparse_vector.h.
datarange_t& lar::sparse_vector< T >::datarange_t::extend | ( | size_type | index, |
ITER | first, | ||
ITER | last | ||
) |
Adds copies of the specified elements to this range
index | the starting point |
first | iterator to the first object to copy |
last | iterator after the last object to copy |
Referenced by lar::sparse_vector< T >::merge_ranges(), and operator<<().
lar::sparse_vector<T>::datarange_t& lar::sparse_vector< T >::datarange_t::extend | ( | size_type | index, |
ITER | first, | ||
ITER | last | ||
) |
Definition at line 1854 of file sparse_vector.h.
References max, and lar::sparse_vector< T >::datarange_t::move_head().
|
inlineprotected |
Definition at line 1082 of file sparse_vector.h.
|
inline |
Returns an iterator to the specified absolute value (no check!)
Definition at line 1017 of file sparse_vector.h.
|
inline |
Returns an iterator to the specified absolute value (no check!)
Definition at line 1019 of file sparse_vector.h.
References evd::details::begin().
|
inlineinherited |
Returns whether the specified absolute index is included in this range.
Definition at line 235 of file sparse_vector.h.
|
inlineinherited |
Returns whether the specified range is completely included in this one.
Definition at line 239 of file sparse_vector.h.
References lar::range_t< SIZE >::begin_index(), and lar::range_t< SIZE >::end_index().
|
inlineinherited |
Returns whether the range is valid (that is, non-negative size)
Definition at line 267 of file sparse_vector.h.
References lar::range_t< SIZE >::offset.
|
inlinestaticinherited |
Returns if a is "less" than b.
Definition at line 271 of file sparse_vector.h.
|
inlinestaticinherited |
Returns if a is "less" than b.
Definition at line 273 of file sparse_vector.h.
References lar::range_t< SIZE >::offset.
|
inlinestaticinherited |
Returns if a is "less" than b.
Definition at line 275 of file sparse_vector.h.
References lar::range_t< SIZE >::offset.
|
inlineinherited |
Moves the begin of the range by the specified amount.
Definition at line 226 of file sparse_vector.h.
void lar::sparse_vector< T >::datarange_t::move_head | ( | size_type | to_index, |
value_type | def_value = value_zero |
||
) |
Moves the begin of this range.
to_index | absolute index to move the head to |
def_value | value to be inserted in case of expansion of the range |
Definition at line 1868 of file sparse_vector.h.
Referenced by lar::sparse_vector< T >::datarange_t::extend(), and lar::sparse_vector< T >::unset_at().
|
inlineinherited |
Moves the end of the range by the specified amount.
Definition at line 229 of file sparse_vector.h.
|
inline |
Moves the end of this range.
to_index | absolute index to move the tail to |
def_value | value to be inserted in case of expansion of the range |
Definition at line 1075 of file sparse_vector.h.
Referenced by lar::sparse_vector< T >::unset_at().
|
inlineinherited |
Sort: this range is smaller if its offset is smaller.
Definition at line 259 of file sparse_vector.h.
|
inlineinherited |
Returns whether the specified range has our same offset and size.
Definition at line 263 of file sparse_vector.h.
References lar::range_t< SIZE >::last, and lar::range_t< SIZE >::offset.
|
inline |
Returns the value at the specified absolute index.
Definition at line 1043 of file sparse_vector.h.
|
inline |
Returns the value at the specified absolute index.
Definition at line 1045 of file sparse_vector.h.
|
inlineinherited |
Returns if this and the specified range overlap.
Definition at line 243 of file sparse_vector.h.
References lar::range_t< SIZE >::begin_index(), and lar::range_t< SIZE >::end_index().
|
inlineinherited |
Returns the position within the range of the absolute index specified.
Definition at line 217 of file sparse_vector.h.
|
inlineinherited |
Moves the end of the range to fit the specified size.
Definition at line 223 of file sparse_vector.h.
|
inline |
Resizes the range (optionally filling the new elements with def_value)
Definition at line 1035 of file sparse_vector.h.
|
inline |
Resizes the range (optionally filling the new elements with def_value)
Definition at line 1037 of file sparse_vector.h.
|
inlineinherited |
Returns if there are elements in between this and the specified range.
Definition at line 247 of file sparse_vector.h.
References lar::range_t< SIZE >::begin_index(), and lar::range_t< SIZE >::end_index().
|
inlineinherited |
Sets the borders of the range.
Definition at line 207 of file sparse_vector.h.
References max.
|
inlineinherited |
Returns the size of the range.
Definition at line 220 of file sparse_vector.h.
|
inherited |
offset (absolute index) after the last element
Definition at line 196 of file sparse_vector.h.
|
inherited |
offset (absolute index) of the first element
Definition at line 193 of file sparse_vector.h.
|
protected |
data in the range
Definition at line 1080 of file sparse_vector.h.