24 #include "MASignal.hpp" 28 #include <boost/make_shared.hpp> 29 #include <boost/shared_ptr.hpp> 62 MANum(T value = (T)0, T min_value = (T)0, T max_value = (T)1) :
151 (*NewHighResValuesSignal).Emit(*
this, OldHighResValueNumber);
161 template <
typename U>
167 for (
typename std::vector<U>::const_iterator Iter = new_highres_values.begin();
168 Iter != new_highres_values.end(); ++Iter)
173 (*NewHighResValuesSignal).Emit(*
this, OldHighResValueNumber);
210 return MinValue >= (T)std::numeric_limits<int16_t>::min() &&
211 MaxValue <= (T)std::numeric_limits<int16_t>::max();
223 return MinValue >= (T)std::numeric_limits<int32_t>::min() &&
224 MaxValue <= (T)std::numeric_limits<int32_t>::max();
358 (*ValueChangeSignal).Emit(*
this);
375 template <
typename U>
381 if (
Value != OldValue)
386 (*ValueChangeSignal).Emit(*
this);
405 return Value == value;
419 return Value != value;
622 template <
typename T>
623 struct MAIntervalNum :
public MANum<T>
636 MAIntervalNum(T value = (T)0, T min_value = (T)-100, T max_value = (T)100) :
637 MANum<T>(value, min_value, max_value)
648 explicit MAIntervalNum(
MANum<T>& other)
650 *
static_cast<MANum<T>*
>(
this) = other;
666 virtual void SetMinMax(T min_value, T max_value)
override 669 max_value > (T)0 ? max_value : (T)0);
680 T GetScaledValue()
const 706 const MAIntervalNum<T>
operator-(
const T value)
const 708 MAIntervalNum<T> TempVar;
720 const MAIntervalNum<T>
operator+(
const T value)
const 722 MAIntervalNum<T> TempVar;
734 const MAIntervalNum<T>
operator*(
const T value)
const 736 MAIntervalNum<T> TempVar;
748 const MAIntervalNum<T>
operator/(
const T value)
const 750 MAIntervalNum<T> TempVar;
const MANum< T > operator-(const T value) const
Decrement (-) operator.
boost::shared_ptr< NewHighResValuesSignalType > NewHighResValuesSignal
New high resolution values change signal.
bool IsChanged() const
Check if the value is changed.
const MANum< T > operator/(const T value) const
Division (/) operator.
boost::shared_ptr< ValueChangeSignalType > ValueChangeSignal
Value change signal.
float GetMagnitude() const
Get the magnitude.
boost::shared_ptr< ValueChangeSignalType > & GetValueChangeSignal()
Get the value change signal.
MANum< T > & operator-=(const T value)
Subtraction assignment (-=) operator.
void SetBlockedNotifications(bool new_state)
Set the notifications to be blocked.
MANum(T value=(T) 0, T min_value=(T) 0, T max_value=(T) 1)
Class constructor.
float Magnitude
Magnitude.
bool IsInt16() const
Check if it can be stored in a 16 bit integer.
virtual void SetMinMax(T min_value, T max_value)
Set the minimal and maximal values.
MANum< T > & operator/=(const T value)
Division assignment (/=) operator.
const T & MCBound(const T &min, const T &value, const T &max)
Check a value bound according to a range.
MANum< T > & operator--()
Decrement (–) prefix operator.
bool BlockNotifications
Whenever the notifications are blocked.
const std::vector< T > & GetHighResolutionValues() const
Get high resolution values.
bool IsBlockedNotifications() const
Check if the notifications are blocked.
T GetMax() const
Get the maximal value.
This class represents a number with bound check.
bool Changed
The value changed.
int IsUchar() const
Check if it can be stored in an unsigned char.
MASignal< MANum< T > &, int > NewHighResValuesSignalType
High resolution value changes signal type.
bool operator==(const T value) const
Equality (==) operator.
boost::shared_ptr< NewHighResValuesSignalType > & GetNewHighResValuesSignal()
Get the new high resolution values signal.
MANum< T > & operator=(const U &new_value)
Copy assignment operator.
void operator--(int)
Decrement (–) suffix operator.
std::vector< T > HighResolutionValues
High resolution values.
void SetMagnitude(float value)
Set the magnitude.
MANum< T > & operator+=(const T value)
Addition assignment (+=) operator.
bool IsInt32() const
Check if it can be stored in a 32 bit integer.
T ValueChange
The value change.
T GetMin() const
Get the minimal value.
void SetHighResolutionValues(const std::vector< T > &new_highres_values)
Set high resolution values.
MASignal< MANum< T > & > ValueChangeSignalType
Value change signal type.
void SetHighResolutionValues(const std::vector< U > &new_highres_values)
Set high resolution values.
MANum< T > & operator*=(const T value)
Multiplication assignment (*=) operator.
const MANum< T > operator*(const T value) const
Multiply (*) operator.
const MANum< T > operator+(const T value) const
Increment (+) operator.
void operator++(int)
Increment (++) suffix operator.
T GetValueChange() const
The last value change difference.
bool operator!=(const T value) const
Inequality (!=) operator.
MANum< T > & operator=(const MANum< T > &other)
Copy assignment operator.
MANum< T > & operator++()
Increment (++) prefix operator.
float GetNormalizedValue() const
Get the normalized value by magnitude.