Functional.hh
Go to the documentation of this file.
1 
39 #ifndef CRL_MULTISENSE_FUNCTIONAL_HH
40 #define CRL_MULTISENSE_FUNCTIONAL_HH
41 
42 namespace crl {
43 namespace multisense {
44 namespace details {
45 namespace utility {
46 
47 template <class Type>
48 inline bool
49 approximatelyEqual(Type const& xx, Type const& yy, Type const& epsilon) {
50  return (((xx)-(yy) < (epsilon)) && ((xx)-(yy) > -(epsilon)));
51 }
52 
53 template <class Type>
54 inline bool
55 approxEqual(Type const& xx, Type const& yy, Type const& epsilon) {
56  return approximatelyEqual(xx, yy, epsilon);
57 }
58 
59 template <class Type>
60 inline Type
61 boundValue(Type const& value, Type const& minimum, Type const& maximum) {
62  return ((value > maximum) ? maximum : (value < minimum) ? minimum : value);
63 }
64 
65 template <class Type>
66 inline Type
67 decayedAverage(Type const& previous, Type const& samples, Type const& newest) {
68  return (((samples - 1) * previous) + newest) / samples;
69 }
70 
71 }}}} // namespaces
72 
73 #endif /* #ifndef CRL_MULTISENSE_FUNCTIONAL_HH */
bool approximatelyEqual(Type const &xx, Type const &yy, Type const &epsilon)
Definition: Functional.hh:49
Definition: channel.cc:56
Type boundValue(Type const &value, Type const &minimum, Type const &maximum)
Definition: Functional.hh:61
Type decayedAverage(Type const &previous, Type const &samples, Type const &newest)
Definition: Functional.hh:67
bool approxEqual(Type const &xx, Type const &yy, Type const &epsilon)
Definition: Functional.hh:55


multisense_lib
Author(s):
autogenerated on Sat Apr 6 2019 02:16:46