iLab Neuromorphic Robotics Toolkit
0.1
|
#include <nrt/Core/Typing/Range.H>
A generic range class.
The Range class is used to represent a range from [min .. max]
Public Member Functions | |
Range () | |
Default constructor, range is [0 .. 0]. | |
Range (T const mini, T const maxi) | |
Constructor. | |
Range (Range< T > const &other)=default | |
Copy constructor. | |
Range (Range< T > &&other)=default | |
Move constructor. | |
template<class U > | |
Range (Range< U > const &other) | |
Copy-conversion constructor, uses nrt::clamped_convert<T,U> internally. More... | |
Range< T > & | operator= (Range< T > const &other)=default |
Assignment. | |
Range< T > & | operator= (Range< T > &&other)=default |
Move assignment. | |
T const & | min () const |
Return the minimum value. | |
T const & | max () const |
Return the maximum value. | |
bool const | empty () const |
Return whether min() == max() | |
void | extend (T const val) |
Extend the range, if needed, so that it includes val. | |
Friends | |
class | cereal::access |
Related Functions | |
(Note that these are not member functions.) | |
template<class T > | |
Range< T > | merge (Range< T > const &r1, Range< T > const &r2) |
Merge two ranges. More... | |
template<class T > | |
std::ostream & | operator<< (std::ostream &out, Range< T > const &r) |
Stream out as "min-max". More... | |
template<class T > | |
std::istream & | operator>> (std::istream &in, Range< T > &r) |
Stream in as "min-max". More... | |
template<class T > | |
void | paramValToString (Range< T > const &val, std::string &result) |
Machine-readable output to a string, for use in nrt::Parameter: outputs min-max (e.g., 0-100) More... | |
template<class T > | |
void | paramStringToVal (std::string const &valstring, Range< T > &result) |
Machine-readable input from a string, for use in nrt::Parameter: reads min-max (e.g., 0-100) More... | |
template<class T > | |
bool | operator== (Range< T > const &range1, Range< T > const &range2) |
Equality test: Range<T> == Range<T> More... | |
template<class T > | |
bool | operator!= (Range< T > const &range1, Range< T > const &range2) |
Inequality test: Range<T> != Range<T> More... | |
template<class T > | |
Range< T > | operator+ (Range< T > const &range, T const &scalar) |
Add constant to both ends of a range: Range<T> + T. More... | |
template<class T > | |
Range< T > | operator+ (T const &scalar, Range< T > const &range) |
Add constant to both ends of a range: T + Range<T> More... | |
template<class T > | |
Range< T > | operator- (Range< T > const &range, T const &scalar) |
Subtract constant from both ends of a range: Range<T> - T. More... | |
template<class T > | |
Range< T > | operator- (T const &scalar, Range< T > const &range) |
Subtract constant from both ends of a range: T - Range<T> More... | |
template<class T > | |
Range< T > | operator/ (Range< T > const &range, T const &scalar) |
Divide both ends of a range by a factor: Range<T> / T. More... | |
template<class T > | |
Range< T > | operator/ (T const &scalar, Range< T > const &range) |
Divide a factor by both ends of a range: T / Range<T> More... | |
template<class T > | |
Range< T > | operator* (Range< T > const &range, T const &scalar) |
Multiply both ends of a range by a factor: Range<T> * T. More... | |
template<class T > | |
Range< T > | operator* (T const &scalar, Range< T > const &range) |
Multiply a factor by both ends of a range: T * Range<T> More... | |
template<class T > | |
Range< T > & | operator+= (Range< T > &range, T const &scalar) |
Add constant to both ends of a range: Range<T> += T. More... | |
template<class T > | |
Range< T > & | operator-= (Range< T > &range, T const &scalar) |
Subtract constant from both ends of a range: Range<T> -= T. More... | |
template<class T > | |
Range< T > & | operator*= (Range< T > &range, T const &scalar) |
Multiply both ends of a range by a factor: Range<T> *= T. More... | |
template<class T > | |
Range< T > & | operator/= (Range< T > &range, T const &scalar) |
Divide both ends of a range by a factor: Range<T> /= T. More... | |
|
inlineexplicit |
Copy-conversion constructor, uses nrt::clamped_convert<T,U> internally.
Note that this constructor is explicit, i.e., you need to explicitly mention it. This is to avoid conversions to happen without a programmer being aware of it. For example:
Definition at line 60 of file RangeImpl.H.
Merge two ranges.
|
related |
Stream out as "min-max".
|
related |
Stream in as "min-max".
|
related |
Machine-readable output to a string, for use in nrt::Parameter: outputs min-max
(e.g., 0-100)
This is an overload for Range<T> of the function template in nrt/Core/Model/ParameterStringConversion.H.
|
related |
Machine-readable input from a string, for use in nrt::Parameter: reads min-max
(e.g., 0-100)
nrt::exception::Exception | if input is malformed. This is an overload for Range<T> of the function template in nrt/Core/Model/ParameterStringConversion.H. |
Equality test: Range<T> == Range<T>
Inequality test: Range<T> != Range<T>
Add constant to both ends of a range: Range<T> + T.
Add constant to both ends of a range: T + Range<T>
Subtract constant from both ends of a range: Range<T> - T.
Subtract constant from both ends of a range: T - Range<T>
Divide both ends of a range by a factor: Range<T> / T.
Divide a factor by both ends of a range: T / Range<T>
Multiply both ends of a range by a factor: Range<T> * T.
Multiply a factor by both ends of a range: T * Range<T>
Add constant to both ends of a range: Range<T> += T.
Subtract constant from both ends of a range: Range<T> -= T.
Multiply both ends of a range by a factor: Range<T> *= T.
Divide both ends of a range by a factor: Range<T> /= T.