mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-14 00:25:35 +08:00
Added utility functions to avoid warnings converting int/double to float
This commit is contained in:
committed by
Roland Winklmeier
parent
75c481228f
commit
291780244b
@@ -97,6 +97,12 @@ namespace XSwiftBus
|
|||||||
//! Set the value of the dataref (if it is writable)
|
//! Set the value of the dataref (if it is writable)
|
||||||
void set(DataRefType d) { DataRefImpl::implSet(d); }
|
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
|
//! Get the value of the dataref
|
||||||
DataRefType get() const { return DataRefImpl::implGet<DataRefType>(); }
|
DataRefType get() const { return DataRefImpl::implGet<DataRefType>(); }
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -24,10 +24,10 @@ namespace XSwiftBus
|
|||||||
template <class T>
|
template <class T>
|
||||||
void setCloudLayerImpl(T &layer, int base, int tops, int type, int coverage)
|
void setCloudLayerImpl(T &layer, int base, int tops, int type, int coverage)
|
||||||
{
|
{
|
||||||
layer.base.set(base);
|
layer.base.setAsInt(base);
|
||||||
layer.tops.set(tops);
|
layer.tops.setAsInt(tops);
|
||||||
layer.type.set(type);
|
layer.type.set(type);
|
||||||
layer.coverage.set(coverage);
|
layer.coverage.setAsInt(coverage);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWeather::setCloudLayer(int layer, int base, int tops, int type, int coverage)
|
void CWeather::setCloudLayer(int layer, int base, int tops, int type, int coverage)
|
||||||
@@ -45,12 +45,12 @@ namespace XSwiftBus
|
|||||||
template <class T>
|
template <class T>
|
||||||
void setWindLayerImpl(T &layer, int altitude, double direction, int speed, int shearDirection, int shearSpeed, int turbulence)
|
void setWindLayerImpl(T &layer, int altitude, double direction, int speed, int shearDirection, int shearSpeed, int turbulence)
|
||||||
{
|
{
|
||||||
layer.altitude.set(altitude);
|
layer.altitude.setAsInt(altitude);
|
||||||
layer.direction.set(static_cast<float>(direction));
|
layer.direction.set(static_cast<float>(direction));
|
||||||
layer.speed.set(speed);
|
layer.speed.setAsInt(speed);
|
||||||
layer.shearDirection.set(shearDirection);
|
layer.shearDirection.setAsInt(shearDirection);
|
||||||
layer.shearSpeed.set(shearSpeed);
|
layer.shearSpeed.setAsInt(shearSpeed);
|
||||||
layer.turbulence.set(turbulence);
|
layer.turbulence.setAsInt(turbulence);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWeather::setWindLayer(int layer, int altitude, double direction, int speed, int shearDirection, int shearSpeed, int turbulence)
|
void CWeather::setWindLayer(int layer, int altitude, double direction, int speed, int shearDirection, int shearSpeed, int turbulence)
|
||||||
@@ -248,7 +248,6 @@ namespace XSwiftBus
|
|||||||
invokeQueuedDBusCalls();
|
invokeQueuedDBusCalls();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//! \endcond
|
//! \endcond
|
||||||
|
|||||||
@@ -59,10 +59,10 @@ namespace XSwiftBus
|
|||||||
void setVisibility(double visibilityM) { m_visibilityM.set(static_cast<float>(visibilityM)); }
|
void setVisibility(double visibilityM) { m_visibilityM.set(static_cast<float>(visibilityM)); }
|
||||||
|
|
||||||
//! Set temperature at sea level in degrees C.
|
//! Set temperature at sea level in degrees C.
|
||||||
void setTemperature(int degreesC) { m_temperatureC.set(degreesC); }
|
void setTemperature(int degreesC) { m_temperatureC.setAsInt(degreesC); }
|
||||||
|
|
||||||
//! Set dew point at sea level in degrees C.
|
//! Set dew point at sea level in degrees C.
|
||||||
void setDewPoint(int degreesC) { m_dewPointC.set(degreesC); }
|
void setDewPoint(int degreesC) { m_dewPointC.setAsInt(degreesC); }
|
||||||
|
|
||||||
//! Set barometric pressure at sea level in inches of mercury.
|
//! Set barometric pressure at sea level in inches of mercury.
|
||||||
void setQNH(double inHg) { m_qnhInhg.set(static_cast<float>(inHg)); }
|
void setQNH(double inHg) { m_qnhInhg.set(static_cast<float>(inHg)); }
|
||||||
@@ -77,7 +77,7 @@ namespace XSwiftBus
|
|||||||
void setTurbulenceRatio(double turbulenceRatio) { m_turbulenceRatio.set(static_cast<float>(turbulenceRatio)); }
|
void setTurbulenceRatio(double turbulenceRatio) { m_turbulenceRatio.set(static_cast<float>(turbulenceRatio)); }
|
||||||
|
|
||||||
//! Set runway friction, 0=dry, 1=damp, 2=wet.
|
//! Set runway friction, 0=dry, 1=damp, 2=wet.
|
||||||
void setRunwayFriction(int friction) { m_runwayFriction.set(friction); }
|
void setRunwayFriction(int friction) { m_runwayFriction.setAsInt(friction); }
|
||||||
|
|
||||||
//! Set a cloud layer.
|
//! Set a cloud layer.
|
||||||
//! \param layer Layer 0, 1, or 2.
|
//! \param layer Layer 0, 1, or 2.
|
||||||
|
|||||||
Reference in New Issue
Block a user