10 #include <argos3/core/utility/datatypes/datatypes.h>
11 #include <argos3/core/utility/string_utilities.h>
12 #include <argos3/core/utility/configuration/argos_exception.h>
22 const T& t_max = T()) :
25 m_tSpan(m_tMax - m_tMin) {
27 "Error initializing CRange(" <<
28 t_min <<
", " << t_max <<
"): " <<
29 t_min <<
" is not <= " << t_max);
38 "Error setting min CRange bound (" <<
40 t_min <<
" is not <= " << m_tMax);
54 "Error setting max CRange bound (" <<
56 m_tMin <<
" is not <= " << t_max);
68 inline void Set(
const T& t_min,
const T& t_max) {
70 "Error setting CRange bounds (" <<
71 t_min <<
", " << t_max <<
"): " <<
72 t_min <<
" is not <= " << t_max);
82 return t_value >= m_tMin && t_value <= m_tMax;
86 return t_value >= m_tMin && t_value < m_tMax;
90 return t_value > m_tMin && t_value <= m_tMax;
94 return t_value > m_tMin && t_value < m_tMax;
98 if (t_value > m_tMax) t_value = m_tMax;
99 if (t_value < m_tMin) t_value = m_tMin;
103 T tTmpValue(t_value);
105 return static_cast<Real>(tTmpValue - m_tMin) /
106 static_cast<Real>(m_tSpan);
110 const T& t_input_value,
117 while(t_value > m_tMax) t_value -= m_tSpan;
118 while(t_value < m_tMin) t_value += m_tSpan;
123 os << c_range.m_tMin <<
":"
131 ParseValues<T> (is, 2, tValues,
':');
132 c_range.
Set(tValues[0], tValues[1]);
#define ARGOS_ASSERT(condition, message)
When code is compiled in debug, this macro throws an ARGoS exception with the passed message if the s...
float Real
Collects all ARGoS code.
The namespace containing all the ARGoS related code.
bool WithinMinBoundExcludedMaxBoundExcluded(const T &t_value) const
bool WithinMinBoundIncludedMaxBoundIncluded(const T &t_value) const
void TruncValue(T &t_value) const
friend std::istream & operator>>(std::istream &is, CRange &c_range)
bool WithinMinBoundExcludedMaxBoundIncluded(const T &t_value) const
void MapValueIntoRange(U &t_output_value, const T &t_input_value, const CRange< U > &c_range) const
friend std::ostream & operator<<(std::ostream &os, const CRange &c_range)
void SetMax(const T &t_max)
CRange(const T &t_min=T(), const T &t_max=T())
void SetMin(const T &t_min)
bool WithinMinBoundIncludedMaxBoundExcluded(const T &t_value) const
void WrapValue(T &t_value) const
void Set(const T &t_min, const T &t_max)
Real NormalizeValue(const T &t_value) const