|
ant
A2 ant: class-based analysis framework
|
Interval class template. More...
#include <interval.h>
Inheritance diagram for ant::interval< T >:
Collaboration diagram for ant::interval< T >:Public Member Functions | |
| constexpr | interval (const T &start, const T &stop) noexcept |
| constexpr const T & | Start () const noexcept |
| Get the lower boundary. More... | |
| T & | Start () noexcept |
| Get the lower boundary. More... | |
| constexpr const T & | Stop () const noexcept |
| Get the upper boundary. More... | |
| T & | Stop () noexcept |
| Get the upper boundary. More... | |
| constexpr T | Length () const noexcept |
| Get the length of the interval. More... | |
| constexpr T | Center () const noexcept |
| Get the center. More... | |
| interval< T > & | operator+= (const T &a) |
| Add a value to both boundaries. This shifts the interval to higher values. More... | |
| interval< T > & | operator-= (const T &a) |
| Subtract a value to both boundaries. This shifts the interval to lower values. More... | |
| interval< T > & | operator*= (const T &f) |
| Multiply both boundaries with a factor. This scales the interval (but also moves the center if center != 0) More... | |
| interval< T > & | operator/= (const T &f) |
| Deivide both boundaries by a factor. This scales the interval (but also moves the center if center != 0) More... | |
| interval< T > | operator+ (const T &a) const |
| Add a value to both boundaries and return the resulting interval (a new copy) The result is shifted to higher values (if a positive, of course). More... | |
| interval< T > | operator- (const T &a) const |
| Subtract a value to both boundaries and return the resulting interval (a new copy) The result is shifted to lower values (if a positive, of course). More... | |
| interval< T > | operator* (const T &f) const |
| Multiply both boundaries with a factor and return the resulting interval (a new copy). The result is scaled and the center is shifted if != 0. More... | |
| interval< T > | operator/ (const T &f) const |
| Deivide both boundaries by a factor and return the resulting interval (a new copy). The result is scaled and the center is shifted if != 0. More... | |
| T | operator[] (const index_t n) const |
| operator []: Access boundaries array-style More... | |
| constexpr bool | operator== (const interval< T > &rhs) const noexcept |
| constexpr bool | operator!= (const interval< T > &rhs) const noexcept |
| void | SetWidth (const T &width) |
| void | SetCenter (const T ¢er) |
| constexpr bool | Contains (const T &x) const noexcept |
| constexpr bool | Disjoint (const ant::interval< T > &i) const noexcept |
| void | Extend (const interval< T > &other) |
| Extend the interval if the given covers a larger range. More... | |
| void | Extend (const T &other) |
| Extend the interval if the given covers a larger range. More... | |
| bool | tryJoinWith (const ant::interval< T > &other) |
| Join another interval into this one if they overlap. More... | |
| void | MakeSane () |
| Make sure, start < stop. More... | |
| constexpr bool | IsSane () const noexcept |
| constexpr T | Clip (const T &x) const |
| Clip x to be inside the interval. More... | |
| interval< T > & | Round () noexcept |
| Round boundaries to integer using std::round. More... | |
| std::string | AsRangeString (const std::string &label="x") const noexcept |
| AsRangeString makes "mathematical" string expression of interval. More... | |
Static Public Member Functions | |
| static constexpr interval | CenterWidth (const T center, const T width) noexcept |
| Factory Function: Create interval from center and width. More... | |
| static constexpr interval | getMaxRange () noexcept |
| static constexpr interval | getMaxPositiveRange () noexcept |
| static constexpr interval | getMaxNegativeRange () noexcept |
Protected Attributes | |
| T | _start |
| T | _stop |
Friends | |
| std::ostream & | operator<< (std::ostream &stream, const interval< T > &i) |
| std::istream & | operator>> (std::istream &out, interval< T > &t) |
Interval class template.
|
inlinenoexcept |
|
inlinenoexcept |
AsRangeString makes "mathematical" string expression of interval.
| label | the label this interval applies to |
|
inlinenoexcept |
Get the center.
|
inlinestaticnoexcept |
Factory Function: Create interval from center and width.
| center | the center |
| width | the width |
|
inline |
Clip x to be inside the interval.
| x |
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
Extend the interval if the given covers a larger range.
| other | another interval |
|
inline |
Extend the interval if the given covers a larger range.
| other | another interval |
|
inlinestaticnoexcept |
|
inlinestaticnoexcept |
|
inlinestaticnoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Get the length of the interval.
|
inline |
Make sure, start < stop.
This protected method is called whenever a write access to _start or _stop occurs.
|
inlinenoexcept |
|
inline |
Multiply both boundaries with a factor and return the resulting interval (a new copy). The result is scaled and the center is shifted if != 0.
| f | The factor to multiply with |
|
inline |
Multiply both boundaries with a factor. This scales the interval (but also moves the center if center != 0)
| f | The factor to multiply with |
|
inline |
Add a value to both boundaries and return the resulting interval (a new copy) The result is shifted to higher values (if a positive, of course).
| a | The value to add |
|
inline |
Add a value to both boundaries. This shifts the interval to higher values.
| a | The value to add |
|
inline |
Subtract a value to both boundaries and return the resulting interval (a new copy) The result is shifted to lower values (if a positive, of course).
| a | The value to subtract |
|
inline |
Subtract a value to both boundaries. This shifts the interval to lower values.
| a | The value to subtract |
|
inline |
Deivide both boundaries by a factor and return the resulting interval (a new copy). The result is scaled and the center is shifted if != 0.
| f | The factor to divide by |
|
inline |
Deivide both boundaries by a factor. This scales the interval (but also moves the center if center != 0)
| f | The factor to divide by |
|
inlinenoexcept |
|
inline |
operator []: Access boundaries array-style
| n | =0 -> lower, =1 -> upper |
| std::out_of_range | if index != {0,1} |
|
inlinenoexcept |
Round boundaries to integer using std::round.
|
inline |
|
inline |
|
inlinenoexcept |
Get the lower boundary.
|
inlinenoexcept |
Get the lower boundary.
|
inlinenoexcept |
Get the upper boundary.
|
inlinenoexcept |
Get the upper boundary.
|
inline |
Join another interval into this one if they overlap.
| other | another interval |
|
friend |
|
friend |
|
protected |
|
protected |