Class for ensuring that variable of type D remains within limits of type S.
More...
#include <TypeUtils.h>
|
typedef D(* | value_t) (D) |
| Definition that simplifies.
|
|
|
template<class S , class T > |
static T | callback () |
|
|
template<class S , class T > |
static T | limitInteger (T x) |
|
template<class S , class T > |
static T | limitFloat (T x) |
|
template<class D>
class drain::typeLimiter< D >
Class for ensuring that variable of type D remains within limits of type S.
Returns a function pointer of type typeLimiter::value_t .
Limiter::value_t limit = Type::call<typeLimiter>(t);
double d = limit(12345.6789);
With images of type drain::image::Image, use convenient function:
Limiter::value_t limit = img.getEncoding().getLimiter<double>();
◆ callback()
- Template Parameters
-
S | - type selector |
T | - destination type |
◆ limitFloat()
static T limitFloat |
( |
T |
x | ) |
|
|
inlinestaticprotected |
- Template Parameters
-
S | - type selector |
T | - target value type (float or double) |
◆ limitInteger()
static T limitInteger |
( |
T |
x | ) |
|
|
inlinestaticprotected |
- Template Parameters
-
S | - type selector |
T | - target value type (integer type) |
Note: expecting T > S, ie. S is a narrower basetype.
The documentation for this class was generated from the following file: