Added utility functions to avoid warnings converting int/double to float

This commit is contained in:
Klaus Basan
2018-04-04 20:12:06 +02:00
committed by Roland Winklmeier
parent 75c481228f
commit 291780244b
3 changed files with 17 additions and 12 deletions

View File

@@ -97,6 +97,12 @@ namespace XSwiftBus
//! Set the value of the dataref (if it is writable)
void set(DataRefType d) { DataRefImpl::implSet(d); }
//! Set as integer, avoids cast warnings such as "possible loss of data"
void setAsInt(int d) { this->set(static_cast<DataRefType>(d)); }
//! Set as integer, avoids cast warnings such as "possible loss of data"
void setAsDouble(double d) { this->set(static_cast<DataRefType>(d)); }
//! Get the value of the dataref
DataRefType get() const { return DataRefImpl::implGet<DataRefType>(); }
};