25 template <
typename val_type, val_type MAXVAL, val_type MINVAL>
31 static val_type
clamp(val_type val) {
return std::clamp(val, MINVAL, MAXVAL); }
34 constexpr
static val_type
minimum = MINVAL;
35 constexpr
static val_type
maximum = MAXVAL;
40 template <
typename Numeric>
53 template <
typename Numeric>
56 template <
typename Numeric>
59 template <
typename Numeric>
62 template <
typename Numeric>
75 template <std::
size_t WIDTH>
81 template <std::
size_t WIDTH>
87 template <
typename val_type, val_type MAXVAL, val_type MINVAL>
88 template <
typename Numeric>
95 template <
typename val_type, val_type MAXVAL, val_type MINVAL>
96 template <
typename Numeric>
99 _value = clamp(_value + rhs);
103 template <
typename val_type, val_type MAXVAL, val_type MINVAL>
104 template <
typename Numeric>
107 _value = clamp(_value - rhs);
111 template <
typename val_type, val_type MAXVAL, val_type MINVAL>
112 template <
typename Numeric>
115 _value = clamp(_value * rhs);
119 template <
typename val_type, val_type MAXVAL, val_type MINVAL>
120 template <
typename Numeric>
123 _value = clamp(_value / rhs);
131 template <
typename val_type, val_type MAXVAL, val_type MINVAL>
137 template <
typename val_type, val_type MAXVAL, val_type MINVAL>
146 template <
typename val_type, val_type MAXVAL, val_type MINVAL>
154 template <
typename val_type, val_type MAXVAL, val_type MINVAL>
165 template <
typename vt, vt mxvl, vt mnvl,
typename Numeric>
172 template <
typename vt, vt mxvl, vt mnvl,
typename Numeric>
179 template <
typename vt, vt mxvl, vt mnvl,
typename Numeric>
186 template <
typename vt, vt mxvl, vt mnvl,
typename Numeric>
196 template <
typename vt, vt mxvl, vt mnvl,
typename Numeric>
199 return lhs.
value() < rhs;
202 template <
typename vt, vt mxvl, vt mnvl,
typename Numeric>
205 return lhs.
value() == rhs;
211 template <
typename vt, vt mxvl, vt mnvl,
typename Numeric>
214 return !(lhs == rhs || lhs < rhs);
217 template <
typename vt, vt mxvl, vt mnvl,
typename Numeric>
223 template <
typename vt, vt mxvl, vt mnvl,
typename Numeric>
229 template <
typename vt, vt mxvl, vt mnvl,
typename Numeric>
232 return !(lhs == rhs);
239 template <
typename val_type, val_type MAXVAL, val_type MINVAL>
242 return (*
this += rhs.
_value);
245 template <
typename val_type, val_type MAXVAL, val_type MINVAL>
248 return (*
this -= rhs.
_value);
251 template <
typename vt, vt mxvl, vt mnvl>
254 return lhs + rhs.
value();
257 template <
typename vt, vt mxvl, vt mnvl>
260 return lhs - rhs.
value();
266 template <
typename vt, vt mxvl, vt mnvl>
269 return lhs < rhs.
value();
272 template <
typename vt, vt mxvl, vt mnvl>
275 return lhs > rhs.
value();
278 template <
typename vt, vt mxvl, vt mnvl>
281 return lhs <= rhs.
value();
284 template <
typename vt, vt mxvl, vt mnvl>
287 return lhs >= rhs.
value();
290 template <
typename vt, vt mxvl, vt mnvl>
293 return lhs == rhs.
value();
296 template <
typename vt, vt mxvl, vt mnvl>
299 return lhs != rhs.
value();
Definition: fwcounter.h:27
base_fwcounter< val_type, MAXVAL, MINVAL > & operator*=(base_fwcounter< val_type, MAXVAL, MINVAL >)
base_fwcounter()
Definition: fwcounter.h:37
base_fwcounter< val_type, MAXVAL, MINVAL > & operator--()
Definition: fwcounter.h:138
base_fwcounter< val_type, MAXVAL, MINVAL > & operator+=(base_fwcounter< val_type, MAXVAL, MINVAL >)
Definition: fwcounter.h:240
base_fwcounter< val_type, MAXVAL, MINVAL > & operator=(Numeric)
Definition: fwcounter.h:89
base_fwcounter< val_type, MAXVAL, MINVAL > & operator++()
Definition: fwcounter.h:132
static val_type clamp(val_type val)
Definition: fwcounter.h:31
base_fwcounter< val_type, MAXVAL, MINVAL > & operator/=(base_fwcounter< val_type, MAXVAL, MINVAL >)
val_type _value
Definition: fwcounter.h:29
val_type value() const
Definition: fwcounter.h:69
constexpr static val_type maximum
Definition: fwcounter.h:35
bool is_max() const
Definition: fwcounter.h:65
constexpr static val_type minimum
Definition: fwcounter.h:34
base_fwcounter< val_type, MAXVAL, MINVAL > & operator-=(base_fwcounter< val_type, MAXVAL, MINVAL >)
Definition: fwcounter.h:246
bool is_min() const
Definition: fwcounter.h:66
base_fwcounter(val_type value)
Definition: fwcounter.h:38
bool operator>(const base_fwcounter< vt, mxvl, mnvl > &lhs, Numeric rhs)
Definition: fwcounter.h:212
bool operator>=(const base_fwcounter< vt, mxvl, mnvl > &lhs, Numeric rhs)
Definition: fwcounter.h:218
bool operator!=(const base_fwcounter< vt, mxvl, mnvl > &lhs, Numeric rhs)
Definition: fwcounter.h:230
base_fwcounter< vt, mxvl, mnvl > operator*(base_fwcounter< vt, mxvl, mnvl > lhs, Numeric rhs)
Definition: fwcounter.h:180
bool operator<(const base_fwcounter< vt, mxvl, mnvl > &lhs, Numeric rhs)
Definition: fwcounter.h:197
base_fwcounter< vt, mxvl, mnvl > operator/(base_fwcounter< vt, mxvl, mnvl > lhs, Numeric rhs)
Definition: fwcounter.h:187
bool operator<=(const base_fwcounter< vt, mxvl, mnvl > &lhs, Numeric rhs)
Definition: fwcounter.h:224
base_fwcounter< vt, mxvl, mnvl > operator+(base_fwcounter< vt, mxvl, mnvl > lhs, Numeric rhs)
Definition: fwcounter.h:166
bool operator==(const base_fwcounter< vt, mxvl, mnvl > &lhs, Numeric rhs)
Definition: fwcounter.h:203
base_fwcounter< vt, mxvl, mnvl > operator-(base_fwcounter< vt, mxvl, mnvl > lhs, Numeric rhs)
Definition: fwcounter.h:173