JeVois
1.22
JeVois Smart Embedded Machine Vision Toolkit
|
|
#include <jevois/Types/StepRange.H>
A generic range class with a step.
The StepRange class is used to represent a range from [min .. (step) .. max]
Valid values are min, min+step, min+2*step, min+3*step, ... max. Note that max is a valid value even if it is not equal to min+N*step for some integer N. Note that T must be a numeric type (can be cast to double). Throws if step is not a positive or zero number.
Because StepRange is typically only used for limited specific purposes (e.g., defining paremeters for controls in video4linux framegrabbers), the interface provided is minimal (much more limited than that of jevois::Range).
Definition at line 69 of file StepRange.H.
Public Member Functions | |
StepRange () | |
Default constructor, range is [0 .. (0) .. 0]. | |
StepRange (T const mini, T const stepi, T const maxi) | |
Constructor. | |
StepRange (StepRange< T > const &other)=default | |
Copy constructor. | |
StepRange (StepRange< T > &&other)=default | |
Move constructor. | |
template<typename U > | |
StepRange (StepRange< U > const &other) | |
Copy-conversion constructor, uses jevois::clamped_convert<T,U> internally. | |
StepRange< T > & | operator= (StepRange< T > const &other)=default |
Assignment. | |
StepRange< T > & | operator= (StepRange< T > &&other)=default |
Move assignment. | |
T const & | min () const |
Return the minimum value. | |
T const & | step () const |
Return the step value. | |
T const & | max () const |
Return the maximum value. | |
bool | empty () const |
Return whether min() == max() | |
bool | isValueValid (T const val) const |
Return true if a value is valid (i.e., it is min, min+step, min+step*2, ... or max) | |
Related Symbols | |
(Note that these are not member symbols.) | |
template<typename T > | |
std::ostream & | operator<< (std::ostream &out, StepRange< T > const &r) |
Stream out as "min...(step)...max". | |
template<typename T > | |
std::istream & | operator>> (std::istream &in, StepRange< T > &r) |
Stream in as "min...(step)...max". | |
template<class T > | |
void | paramValToString (StepRange< T > const &val, std::string &result) |
Machine-readable output to a string, for use in jevois::Parameter: outputs min ...step...max. | |
template<class T > | |
void | paramStringToVal (std::string const &valstring, StepRange< T > &result) |
Machine-readable input from a string, for use in jevois::Parameter: reads min ...step...max. | |
template<typename T > | |
bool | operator== (StepRange< T > const &range1, StepRange< T > const &range2) |
Equality test: StepRange<T> == StepRange<T> | |
template<typename T > | |
bool | operator!= (StepRange< T > const &range1, StepRange< T > const &range2) |
Inequality test: StepRange<T> != StepRange<T> | |
|
explicit |
Default constructor, range is [0 .. (0) .. 0].
|
explicit |
Constructor.
|
default |
Copy constructor.
|
default |
Move constructor.
|
explicit |
Copy-conversion constructor, uses jevois::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:
bool jevois::StepRange< T >::empty | ( | ) | const |
bool jevois::StepRange< T >::isValueValid | ( | T const | val | ) | const |
Return true if a value is valid (i.e., it is min, min+step, min+step*2, ... or max)
T const & jevois::StepRange< T >::max | ( | ) | const |
Return the maximum value.
T const & jevois::StepRange< T >::min | ( | ) | const |
Return the minimum value.
|
default |
Move assignment.
|
default |
Assignment.
T const & jevois::StepRange< T >::step | ( | ) | const |
Return the step value.
|
related |
Inequality test: StepRange<T> != StepRange<T>
|
related |
Stream out as "min...(step)...max".
|
related |
Equality test: StepRange<T> == StepRange<T>
|
related |
Stream in as "min...(step)...max".
|
related |
Machine-readable input from a string, for use in jevois::Parameter: reads min
...step...max.
|
related |
Machine-readable output to a string, for use in jevois::Parameter: outputs min
...step...max.