The Sparta Modeling Framework
|
This class allows a developer to bound a value within an upper and lower value. More...
#include <BoundedValue.hpp>
Public Types | |
using | value_type = T |
template<typename U > | |
using | pure_value_t = MetaStruct::decay_t< U > |
Public Member Functions | |
template<typename U , typename V = T, typename W = T> | |
BoundedValue (U value, V lower_bound=std::numeric_limits< T >::min(), W upper_bound=std::numeric_limits< T >::max(), MetaStruct::enable_if_t< MetaStruct::all_are_integral< T, U, V, W >::value and MetaStruct::all_same_sign< T, U, V, W >::value > *=0) | |
Parameterized Constructor from related integral arguments. The 4 variables are BV type, initial value, upper bound and lower bound. | |
template<typename U , typename V = T, typename W = T> | |
BoundedValue (U value, V lower_bound=std::numeric_limits< T >::min(), W upper_bound=std::numeric_limits< T >::max(), MetaStruct::enable_if_t< MetaStruct::all_are_integral< T, U, V, W >::value and std::is_unsigned< pure_value_t< T > >::value and std::is_signed< pure_value_t< U > >::value and std::is_unsigned< pure_value_t< V > >::value and std::is_unsigned< pure_value_t< W > >::value > *=0) | |
Parameterized Constructor from related integral arguments. The 4 variables are BV type, initial value, upper bound and lower bound. | |
template<typename U , typename V = T, typename W = T> | |
BoundedValue (U value, V lower_bound=std::numeric_limits< T >::min(), W upper_bound=std::numeric_limits< T >::max(), MetaStruct::enable_if_t< MetaStruct::all_are_integral< T, U, V, W >::value and std::is_unsigned< pure_value_t< T > >::value and std::is_unsigned< pure_value_t< U > >::value and(std::is_signed< pure_value_t< V > >::value or std::is_signed< pure_value_t< W > >::value)> *=0) | |
Parameterized Constructor from related integral arguments. | |
template<typename U , typename V = T, typename W = T> | |
BoundedValue (U value, V lower_bound=std::numeric_limits< T >::min(), W upper_bound=std::numeric_limits< T >::max(), MetaStruct::enable_if_t< MetaStruct::all_are_integral< T, U, V, W >::value and std::is_unsigned< pure_value_t< T > >::value and std::is_signed< pure_value_t< U > >::value and(std::is_signed< pure_value_t< V > >::value or std::is_signed< pure_value_t< W > >::value)> *=0) | |
Parameterized Constructor from related integral arguments. | |
template<typename U , typename V = T, typename W = T> | |
BoundedValue (U value, V lower_bound=std::numeric_limits< T >::min(), W upper_bound=std::numeric_limits< T >::max(), MetaStruct::enable_if_t< MetaStruct::all_are_integral< T, U, V, W >::value and std::is_signed< pure_value_t< T > >::value and std::is_unsigned< pure_value_t< U > >::value and std::is_signed< pure_value_t< V > >::value and std::is_signed< pure_value_t< W > >::value > *=0) | |
Parameterized Constructor from related integral arguments. | |
template<typename U , typename V = T, typename W = T> | |
BoundedValue (U value, V lower_bound=std::numeric_limits< T >::min(), W upper_bound=std::numeric_limits< T >::max(), MetaStruct::enable_if_t< MetaStruct::all_are_integral< T, U, V, W >::value and std::is_signed< pure_value_t< T > >::value and std::is_signed< pure_value_t< U > >::value and(std::is_unsigned< pure_value_t< V > >::value or std::is_unsigned< pure_value_t< W > >::value)> *=0) | |
Parameterized Constructor from related integral arguments. | |
template<typename U , typename V = T, typename W = T> | |
BoundedValue (U value, V lower_bound=std::numeric_limits< T >::min(), W upper_bound=std::numeric_limits< T >::max(), MetaStruct::enable_if_t< MetaStruct::all_are_integral< T, U, V, W >::value and std::is_signed< pure_value_t< T > >::value and std::is_unsigned< pure_value_t< U > >::value and(std::is_unsigned< pure_value_t< V > >::value or std::is_unsigned< pure_value_t< W > >::value)> *=0) | |
Parameterized Constructor from related integral arguments. | |
template<typename U , typename V = T, typename W = T> | |
BoundedValue (U value, V lower_bound=std::numeric_limits< T >::min(), W upper_bound=std::numeric_limits< T >::max(), MetaStruct::enable_if_t< std::is_integral< pure_value_t< T > >::value and(std::is_floating_point< pure_value_t< U > >::value or std::is_floating_point< pure_value_t< V > >::value or std::is_floating_point< pure_value_t< W > >::value)> *=0) | |
Parameterized Constructor from related integral arguments. | |
template<typename U > | |
BoundedValue (const BoundedValue< U > &rhs, MetaStruct::enable_if_t< std::is_integral< pure_value_t< U > >::value and std::is_signed< pure_value_t< T > >::value==std::is_signed< pure_value_t< U > >::value > *=0) | |
Copy Constructor from related integral BV of same sign. | |
template<typename U > | |
BoundedValue (const BoundedValue< U > &rhs, MetaStruct::enable_if_t< std::is_integral< pure_value_t< U > >::value and std::is_signed< pure_value_t< T > >::value and std::is_unsigned< pure_value_t< U > >::value > *=0) | |
Copy Constructor from related unsigned integral BV to signed BV. | |
template<typename U > | |
BoundedValue (const BoundedValue< U > &rhs, MetaStruct::enable_if_t< std::is_integral< pure_value_t< U > >::value and std::is_unsigned< pure_value_t< T > >::value and std::is_signed< pure_value_t< U > >::value > *=0) | |
Copy Constructor from related signed integral BV to unsigned BV. | |
template<typename U > | |
BoundedValue (const BoundedValue< U > &rhs, MetaStruct::enable_if_t< std::is_floating_point< pure_value_t< U > >::value and std::is_integral< pure_value_t< T > >::value > *=0) | |
Copy Constructor from floating-point BV to integral BV. | |
template<typename U > | |
MetaStruct::enable_if_t< std::is_integral< pure_value_t< U > >::value and std::is_signed< pure_value_t< T > >::value==std::is_signed< pure_value_t< U > >::value, BoundedValue< pure_value_t< T > > & > | operator= (const BoundedValue< U > &rhs) |
Copy Assignment Operator from related integral BV of same sign. | |
template<typename U > | |
MetaStruct::enable_if_t< std::is_integral< pure_value_t< U > >::value and std::is_signed< pure_value_t< T > >::value and std::is_unsigned< pure_value_t< U > >::value, BoundedValue< pure_value_t< T > > & > | operator= (const BoundedValue< U > &rhs) |
Copy Constructor from related unsigned integral BV to signed BV. | |
template<typename U > | |
MetaStruct::enable_if_t< std::is_integral< pure_value_t< U > >::value and std::is_signed< pure_value_t< U > >::value and std::is_unsigned< pure_value_t< T > >::value, BoundedValue< pure_value_t< T > > & > | operator= (const BoundedValue< U > &rhs) |
Copy Constructor from related signed integral BV to unsigned BV. | |
template<typename U > | |
MetaStruct::enable_if_t< std::is_floating_point< pure_value_t< U > >::value and std::is_integral< pure_value_t< T > >::value, void > | operator= (const BoundedValue< U > &rhs) |
Copy Assignment Operator for floating-point BV to integral BV. | |
template<typename U > | |
MetaStruct::enable_if_t< std::is_integral< pure_value_t< U > >::value, BoundedValue< pure_value_t< T > > & > | operator= (U value) |
Assignment operator for integral arguments to related BV. | |
template<typename U > | |
MetaStruct::enable_if_t< std::is_floating_point< pure_value_t< U > >::value and std::is_integral< pure_value_t< T > >::value, void > | operator= (U value) |
Assignment operator for floating-point arguments to integral BV. | |
BoundedValue< T > & | operator++ () |
Overload pre-increment operator. | |
BoundedValue< T > | operator++ (int) |
Overload post-increment operator. | |
BoundedValue< T > & | operator-- () |
Overload pre-decrement operator. | |
BoundedValue< T > | operator-- (int) |
Overload post-decrement operator. | |
template<typename U = T> | |
MetaStruct::enable_if_t< std::is_integral< pure_value_t< U > >::value, BoundedValue< T > & > | operator+= (U value) |
Overload shorthand += operator. | |
template<typename U = T> | |
MetaStruct::enable_if_t< std::is_integral< pure_value_t< U > >::value, BoundedValue< T > & > | operator-= (U value) |
Overload shorthand -= operator. | |
const value_type | getValue () const |
Get the value - const version. | |
value_type | getValue () |
Get the value - non-const version. | |
const value_type | getLowerBound () const |
Return the lower bound value, const version. | |
value_type | getLowerBound () |
Return the lower bound value, non-const version. | |
const value_type | getUpperBound () const |
Return the upper bound value, const version. | |
value_type | getUpperBound () |
Return the upper bound value, non-const version. | |
operator const value_type & () const | |
Convert the BoundedValue into underlying resource, const version. | |
operator value_type & () | |
Convert the BoundedValue into underlying resource, non-const version. | |
This class allows a developer to bound a value within an upper and lower value.
T | The type to wrap - a POD type |
Definition at line 32 of file BoundedValue.hpp.
using sparta::utils::BoundedValue< T >::pure_value_t = MetaStruct::decay_t<U> |
Definition at line 36 of file BoundedValue.hpp.
using sparta::utils::BoundedValue< T >::value_type = T |
Definition at line 34 of file BoundedValue.hpp.
|
inlineexplicit |
Parameterized Constructor from related integral arguments. The 4 variables are BV type, initial value, upper bound and lower bound.
value | The value to assign |
lower_bound | The lower bound of this BoundedValue |
upper_bound | The upper bound of this BoundedValue |
Case when all 4 variables are integral and of the same sign(signed). Example:
Case when all 4 variables are integral and of the same sign(unsigned). The 4 variables are BV type, initial value, upper bound and lower bound. Example:
Definition at line 68 of file BoundedValue.hpp.
|
inlineexplicit |
Parameterized Constructor from related integral arguments. The 4 variables are BV type, initial value, upper bound and lower bound.
value | The value to assign |
lower_bound | The lower bound of this BoundedValue |
upper_bound | The upper bound of this BoundedValue |
Case when BV type, lower and upper bounds are unsigned but initial value is signed. Example:
Definition at line 104 of file BoundedValue.hpp.
|
inlineexplicit |
Parameterized Constructor from related integral arguments.
value | The value to assign |
lower_bound | The lower bound of this BoundedValue |
upper_bound | The upper bound of this BoundedValue |
Case when BV type, and initial value is unsigned but one of the bounds are signed. Example:
Definition at line 144 of file BoundedValue.hpp.
|
inlineexplicit |
Parameterized Constructor from related integral arguments.
value | The value to assign |
lower_bound | The lower bound of this BoundedValue |
upper_bound | The upper bound of this BoundedValue |
Case when BV type and one of the bounds is unsigned but initial value and one of the bounds are signed.
Definition at line 185 of file BoundedValue.hpp.
|
inlineexplicit |
Parameterized Constructor from related integral arguments.
value | The value to assign |
lower_bound | The lower bound of this BoundedValue |
upper_bound | The upper bound of this BoundedValue Case when BV type, lower and upper bounds are signed but initial value is unsigned. Example: uint32_t data = 15;
BoundedValue<int64_t> bv(data, -10, 20);
int16_t lower_bound = 20;
int32_t upper_bound = 40;
BoundedValue<intmax_t> bv(data, lower_bound, upper_bound);
|
Definition at line 226 of file BoundedValue.hpp.
|
inlineexplicit |
Parameterized Constructor from related integral arguments.
value | The value to assign |
lower_bound | The lower bound of this BoundedValue |
upper_bound | The upper bound of this BoundedValue Case when BV type and initial value is signed but one of the bounds is unsigned. Example: int32_t data = 15;
BoundedValue<int64_t> bv(data, -10, 20ull);
int16_t lower_bound = 20;
uint32_t upper_bound = 40;
BoundedValue<intmax_t> bv(data, lower_bound, upper_bound);
|
Definition at line 263 of file BoundedValue.hpp.
|
inlineexplicit |
Parameterized Constructor from related integral arguments.
value | The value to assign |
lower_bound | The lower bound of this BoundedValue |
upper_bound | The upper bound of this BoundedValue Case when BV type is signed but initial value and one of the bounds is unsigned. Example: uint32_t data = 15;
BoundedValue<int64_t> bv(data, -10, 20ull);
int16_t lower_bound = 20;
uint32_t upper_bound = 40;
BoundedValue<intmax_t> bv(data, lower_bound, upper_bound);
|
Definition at line 307 of file BoundedValue.hpp.
|
inlineexplicit |
Parameterized Constructor from related integral arguments.
value | The value to assign |
lower_bound | The lower bound of this BoundedValue |
upper_bound | The upper bound of this BoundedValue Case which will immediately assert on compilation. If we are creating a BV of type integral, then none of initial_value, lower_bound or upper_bound can be non-integral type. |
Definition at line 345 of file BoundedValue.hpp.
|
inline |
Copy Constructor from related integral BV of same sign.
rhs | The other BoundedValue object to construct from. |
Definition at line 369 of file BoundedValue.hpp.
|
inline |
Copy Constructor from related unsigned integral BV to signed BV.
rhs | The other BoundedValue object to construct from. |
Definition at line 387 of file BoundedValue.hpp.
|
inline |
Copy Constructor from related signed integral BV to unsigned BV.
rhs | The other BoundedValue object to construct from. |
Definition at line 404 of file BoundedValue.hpp.
|
inline |
Copy Constructor from floating-point BV to integral BV.
rhs | The other BoundedValue object to construct from. |
Definition at line 425 of file BoundedValue.hpp.
|
inline |
Return the lower bound value, non-const version.
Definition at line 644 of file BoundedValue.hpp.
|
inline |
Return the lower bound value, const version.
Definition at line 636 of file BoundedValue.hpp.
|
inline |
Return the upper bound value, non-const version.
Definition at line 660 of file BoundedValue.hpp.
|
inline |
Return the upper bound value, const version.
Definition at line 652 of file BoundedValue.hpp.
|
inline |
Get the value - non-const version.
Definition at line 628 of file BoundedValue.hpp.
|
inline |
Get the value - const version.
Definition at line 620 of file BoundedValue.hpp.
|
inline |
Convert the BoundedValue into underlying resource, const version.
Definition at line 668 of file BoundedValue.hpp.
|
inline |
Convert the BoundedValue into underlying resource, non-const version.
Definition at line 676 of file BoundedValue.hpp.
|
inline |
Overload pre-increment operator.
Definition at line 539 of file BoundedValue.hpp.
|
inline |
Overload post-increment operator.
Definition at line 549 of file BoundedValue.hpp.
|
inline |
Overload shorthand += operator.
value | The value to add. |
Definition at line 580 of file BoundedValue.hpp.
|
inline |
Overload pre-decrement operator.
Definition at line 558 of file BoundedValue.hpp.
|
inline |
Overload post-decrement operator.
Definition at line 568 of file BoundedValue.hpp.
|
inline |
Overload shorthand -= operator.
value | The value to subtract. |
Definition at line 601 of file BoundedValue.hpp.
|
inline |
Copy Assignment Operator from related integral BV of same sign.
rhs | The other BoundedValue object to assign from. |
Definition at line 442 of file BoundedValue.hpp.
|
inline |
Copy Constructor from related unsigned integral BV to signed BV.
rhs | The other BoundedValue object to assign from. |
Definition at line 462 of file BoundedValue.hpp.
|
inline |
Copy Constructor from related signed integral BV to unsigned BV.
rhs | The other BoundedValue object to assign from. |
Definition at line 481 of file BoundedValue.hpp.
|
inline |
Copy Assignment Operator for floating-point BV to integral BV.
rhs | The other BoundedValue object to assign from. |
Definition at line 503 of file BoundedValue.hpp.
|
inline |
Assignment operator for integral arguments to related BV.
value | The value to assign to this BoundedValue. |
Definition at line 516 of file BoundedValue.hpp.
|
inline |
Assignment operator for floating-point arguments to integral BV.
value | The value to assign to this BoundedValue. |
Definition at line 530 of file BoundedValue.hpp.