Observable Reference
Generic observable objects for C++
|
Everything related to observable expressions. More...
Macros | |
#define | OBSERVABLE_ADAPT_FILTER(NAME, OP) |
Create an expression filter from a callable. More... | |
Functions | |
template<typename ValueType , typename ... Args> | |
auto | observable::expr::construct (Args &&... args) -> std::enable_if_t< expr_detail::are_any_observable< Args ... >::value, expression_node< ValueType >> |
Construct an object. More... | |
template<typename To , typename From > | |
auto | observable::expr::static_expr_cast (From &&from) -> std::enable_if_t< expr_detail::is_observable< From >::value, expression_node< To >> |
Cast an expression node to another type using static_cast. More... | |
template<typename To , typename From > | |
auto | observable::expr::reinterpret_expr_cast (From &&from) -> std::enable_if_t< expr_detail::is_observable< From >::value, expression_node< To >> |
Cast an expression node to another type using reinterpret_cast. More... | |
template<typename Cond , typename TrueVal , typename FalseVal > | |
auto | observable::expr::select (Cond &&cond, TrueVal &&true_val, FalseVal &&false_val) |
Select between two values based on a condition. More... | |
template<typename ... Values> | |
auto | observable::expr::min (Values ... values) |
Return the argument with the minimum value. More... | |
template<typename ... Values> | |
auto | observable::expr::max (Values ... values) |
Return the argument with the maximum value. More... | |
template<typename ... Values> | |
auto | observable::expr::mean (Values ... values) |
Return the mean of the arguments. More... | |
template<typename Val , typename Low , typename High > | |
auto | observable::expr::clamp (Val &&val, Low &&low, High &&high) |
Keep a value between a minimum and maximum. More... | |
template<typename ... Args> | |
auto | observable::expr::zip (Args &&... args) |
Convert a number of arguments to a tuple containing the arguments. More... | |
template<typename T > | |
auto | observable::expr::abs (T &&val) |
Compute the absolute value of an integral expression. More... | |
template<typename X , typename Y > | |
auto | observable::expr::div (X &&x, Y &&y) |
Compute both the quotient and the remainder of the division of the numerator x by the denominator y. More... | |
template<typename T > | |
auto | observable::expr::exp (T &&v) |
Computes e (Euler's number) raised to the given power. More... | |
template<typename T > | |
auto | observable::expr::exp2 (T &&v) |
Computes 2 raised to the given power. More... | |
template<typename T > | |
auto | observable::expr::log (T &&v) |
Computes the the natural (base e) logarithm of the provided argument. More... | |
template<typename T > | |
auto | observable::expr::log10 (T &&v) |
Computes the common (base-10) logarithm of the provided argument. More... | |
template<typename T > | |
auto | observable::expr::log2 (T &&v) |
Computes the binary (base-2) logarithm of the provided argument. More... | |
template<typename B , typename E > | |
auto | observable::expr::pow (B &&b, E &&e) |
Computes the value of the provided base raised to the power of the provided exponent. More... | |
template<typename T > | |
auto | observable::expr::sqrt (T &&v) |
Computes the square root of the provided argument. More... | |
template<typename T > | |
auto | observable::expr::cbrt (T &&v) |
Computes the cubic root of the provided argument. More... | |
template<typename X , typename Y > | |
auto | observable::expr::hypot (X &&x, Y &&y) |
Computes the square root of the sum of the squares of x and y, without undue overflow or underflow at intermediate stages of the computation. More... | |
template<typename T > | |
auto | observable::expr::sin (T &&v) |
Computes the sine of the provided argument (measured in radians). More... | |
template<typename T > | |
auto | observable::expr::cos (T &&v) |
Computes the cosine of the provided argument (measured in radians). More... | |
template<typename T > | |
auto | observable::expr::tan (T &&v) |
Computes the tangent of the provided argument (measured in radians). More... | |
template<typename T > | |
auto | observable::expr::asin (T &&v) |
Computes the arc sine of the provided argument. More... | |
template<typename T > | |
auto | observable::expr::acos (T &&v) |
Computes the arc cosine of the provided argument. More... | |
template<typename T > | |
auto | observable::expr::atan (T &&v) |
Computes the arc tangent of the provided argument. More... | |
template<typename Y , typename X > | |
auto | observable::expr::atan2 (Y &&y, X &&x) |
Computes the arc tangent of y / x using the signs of arguments to determine the correct quadrant. More... | |
template<typename T > | |
auto | observable::expr::ceil (T &&v) |
Nearest integer not less than the given value. More... | |
template<typename T > | |
auto | observable::expr::floor (T &&v) |
Nearest integer not greater than the given value. More... | |
template<typename T > | |
auto | observable::expr::trunc (T &&v) |
Nearest integer not greater in magnitude than the given value. More... | |
template<typename T > | |
auto | observable::expr::round (T &&v) |
Nearest integer, rounding away from zero in halfway cases. More... | |
Everything related to observable expressions.
#define OBSERVABLE_ADAPT_FILTER | ( | NAME, | |
OP | |||
) |
Create an expression filter from a callable.
Expression filters take expression nodes as arguments and return an expression node.
This macro wraps a regular callable (i.e. one that does not work with expression nodes) and turns it into an expression filter.
NAME | The name that will be used for the expression filter. This must be a valid function identifier. |
OP | Callable instance that will be converted to an expression filter. This instance must be copy-constructible. |
|
inline |
Construct an object.
args | Arguments to be passed to the object's constructor. You must have at least one observable argument. |
ValueType | The constructed object's type. |
Args | Argument pack for the parameters passed to the constructor. |
|
inline |
Cast an expression node to another type using static_cast.
from | Incoming type. |
|
inline |
Cast an expression node to another type using reinterpret_cast.
from | Incoming type. |
auto observable::expr::select | ( | Cond && | cond, |
TrueVal && | true_val, | ||
FalseVal && | false_val | ||
) |
Select between two values based on a condition.
This is basically the ternary operator for expressions.
cond | A value that evaluates to true or false. This will be used to choose the return value. |
true_val | Value that will be returned if cond evaluates to true. |
false_val | Value that will be returned if cond evaluates to false. |
auto observable::expr::min | ( | Values ... | values | ) |
Return the argument with the minimum value.
Will use the less-than operator to compare values.
values | ... Arguments from which the minimum will be chosen. |
auto observable::expr::max | ( | Values ... | values | ) |
Return the argument with the maximum value.
Will use the less-than operator to compare values.
values | ... Arguments from which the maximum will be chosen. |
auto observable::expr::mean | ( | Values ... | values | ) |
Return the mean of the arguments.
values | ... Arguments for which the mean will be computed. |
auto observable::expr::clamp | ( | Val && | val, |
Low && | low, | ||
High && | high | ||
) |
Keep a value between a minimum and maximum.
Will use the less-than operator to compare values.
val | Value to clamp. |
low | The minimum allowed value of the val parameter. |
high | The maximum allowed value of the val parameter. |
auto observable::expr::zip | ( | Args &&... | args | ) |
Convert a number of arguments to a tuple containing the arguments.
args | ... Arguments to pack into a tuple. |
auto observable::expr::abs | ( | T && | val | ) |
Compute the absolute value of an integral expression.
auto observable::expr::div | ( | X && | x, |
Y && | y | ||
) |
Compute both the quotient and the remainder of the division of the numerator x by the denominator y.
auto observable::expr::exp | ( | T && | v | ) |
Computes e (Euler's number) raised to the given power.
auto observable::expr::exp2 | ( | T && | v | ) |
Computes 2 raised to the given power.
auto observable::expr::log | ( | T && | v | ) |
Computes the the natural (base e) logarithm of the provided argument.
auto observable::expr::log10 | ( | T && | v | ) |
Computes the common (base-10) logarithm of the provided argument.
auto observable::expr::log2 | ( | T && | v | ) |
Computes the binary (base-2) logarithm of the provided argument.
auto observable::expr::pow | ( | B && | b, |
E && | e | ||
) |
Computes the value of the provided base raised to the power of the provided exponent.
auto observable::expr::sqrt | ( | T && | v | ) |
Computes the square root of the provided argument.
auto observable::expr::cbrt | ( | T && | v | ) |
Computes the cubic root of the provided argument.
auto observable::expr::hypot | ( | X && | x, |
Y && | y | ||
) |
Computes the square root of the sum of the squares of x and y, without undue overflow or underflow at intermediate stages of the computation.
auto observable::expr::sin | ( | T && | v | ) |
Computes the sine of the provided argument (measured in radians).
auto observable::expr::cos | ( | T && | v | ) |
Computes the cosine of the provided argument (measured in radians).
auto observable::expr::tan | ( | T && | v | ) |
Computes the tangent of the provided argument (measured in radians).
auto observable::expr::asin | ( | T && | v | ) |
Computes the arc sine of the provided argument.
auto observable::expr::acos | ( | T && | v | ) |
Computes the arc cosine of the provided argument.
auto observable::expr::atan | ( | T && | v | ) |
Computes the arc tangent of the provided argument.
auto observable::expr::atan2 | ( | Y && | y, |
X && | x | ||
) |
Computes the arc tangent of y / x using the signs of arguments to determine the correct quadrant.
auto observable::expr::ceil | ( | T && | v | ) |
Nearest integer not less than the given value.
auto observable::expr::floor | ( | T && | v | ) |
Nearest integer not greater than the given value.
auto observable::expr::trunc | ( | T && | v | ) |
Nearest integer not greater in magnitude than the given value.
auto observable::expr::round | ( | T && | v | ) |
Nearest integer, rounding away from zero in halfway cases.