added explicit type conversion operator
This commit is contained in:
parent
d1beb96c60
commit
ef2e07b389
@ -121,6 +121,10 @@ public:
|
||||
LocalPoolVar<T> &operator=(const T& newValue);
|
||||
LocalPoolVar<T> &operator=(const LocalPoolVar<T>& newPoolVariable);
|
||||
|
||||
//! Explicit type conversion operator. Allows casting the class to
|
||||
//! its template type to perform operations on value.
|
||||
explicit operator T() const;
|
||||
|
||||
bool operator==(const LocalPoolVar<T>& other) const;
|
||||
bool operator==(const T& other) const;
|
||||
|
||||
|
@ -80,20 +80,6 @@ inline ReturnValue_t LocalPoolVar<T>::commitWithoutLock() {
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline LocalPoolVar<T> & LocalPoolVar<T>::operator=(const T& newValue) {
|
||||
value = newValue;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline LocalPoolVar<T>& LocalPoolVar<T>::operator =(
|
||||
const LocalPoolVar<T>& newPoolVariable) {
|
||||
value = newPoolVariable.value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
template<typename T>
|
||||
inline ReturnValue_t LocalPoolVar<T>::serialize(uint8_t** buffer, size_t* size,
|
||||
const size_t max_size, SerializeIF::Endianness streamEndianness) const {
|
||||
@ -119,6 +105,24 @@ inline std::ostream& operator<< (std::ostream &out,
|
||||
return out;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline LocalPoolVar<T>::operator T() const {
|
||||
return value;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline LocalPoolVar<T> & LocalPoolVar<T>::operator=(const T& newValue) {
|
||||
value = newValue;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline LocalPoolVar<T>& LocalPoolVar<T>::operator =(
|
||||
const LocalPoolVar<T>& newPoolVariable) {
|
||||
value = newPoolVariable.value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline bool LocalPoolVar<T>::operator ==(const LocalPoolVar<T> &other) const {
|
||||
return this->value == other.value;
|
||||
|
@ -60,7 +60,7 @@ ThermalComponentIF::HeaterRequest ThermalComponentCore::performOperation(
|
||||
//SHOULDDO: Better pass db_float_t* to getTemperature and set it invalid if invalid.
|
||||
temperature = getTemperature();
|
||||
updateMinMaxTemp();
|
||||
if ((temperature != INVALID_TEMPERATURE)) {
|
||||
if (temperature != INVALID_TEMPERATURE) {
|
||||
temperature.setValid(PoolVariableIF::VALID);
|
||||
State state = getState(temperature.value, getParameters(),
|
||||
targetState.value);
|
||||
@ -230,10 +230,10 @@ void ThermalComponentCore::updateMinMaxTemp() {
|
||||
return;
|
||||
}
|
||||
if (temperature < minTemp) {
|
||||
minTemp = temperature.value;
|
||||
minTemp = static_cast<float>(temperature);
|
||||
}
|
||||
if (temperature > maxTemp) {
|
||||
maxTemp = temperature.value;
|
||||
maxTemp = static_cast<float>(temperature);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user