6#include "roo_logging.h"
11#if defined(ESP32) || defined(ESP8266) || defined(__linux__)
34 float inBars()
const {
return pressure_ * 0.00001f; }
52 float inPSI()
const {
return pressure_ * 0.0001450377f; }
55 bool isUnknown()
const {
return std::isnan(pressure_); }
58 return pressure_ < other.pressure_;
62 return pressure_ == other.pressure_;
66 return other.pressure_ < pressure_;
70 return !(other.pressure_ < pressure_);
74 return !(pressure_ < other.pressure_);
78 return !(pressure_ == other.pressure_);
101#if defined(ESP32) || defined(ESP8266) || defined(__linux__)
103 std::string asString()
const;
107 String asArduinoString()
const;
115 explicit Pressure(
float pressure) : pressure_(pressure) {}
214roo_logging::Stream&
operator<<(roo_logging::Stream& os,
const Pressure& val);
Representation of area, internally stored as floating-point square meters.
float inSquareMeters() const
Returns the area in square meters.
Representation of areic number, a reciprocal of area, internally stored as floating-point units per s...
float inUnitsPerSquareMeter() const
Returns the areic number in units per square meter.
Representation of force, internally stored as floating-point Newtons.
float inNewtons() const
Returns the force in Newtons.
Representation of pressure, internally stored as floating-point Pascals.
float inHectoPascals() const
Returns the pressure in HectoPascals.
float inMilliPascals() const
Returns the pressure in milliPascals.
float inMicroPascals() const
Returns the pressure in microPascals.
float inBars() const
Returns the pressure in bars.
float inKiloPascals() const
Returns the pressure in kiloPascals.
Pressure()
Creates a pressure object representing an 'unknown' pressure.
bool operator>=(const Pressure &other) const
float inMegaPascals() const
Returns the pressure in MegaPascals.
float inPascals() const
Returns the pressure in Pascals.
bool operator==(const Pressure &other) const
Pressure & operator-=(const Pressure &other)
friend Pressure PressureInPascals(float)
Returns a pressure object equivalent to the specified pressure expressed in Pascals.
bool operator!=(const Pressure &other) const
Pressure & operator+=(const Pressure &other)
friend Pressure UnknownPressure()
Returns a pressure object representing an unknown pressure.
Pressure & operator/=(float div)
bool operator<(const Pressure &other) const
float inPSI() const
Returns the pressure in PSI (pound per square inch).
float inGigaPascals() const
Returns the pressure in GigaPascals.
bool isUnknown() const
Returns whether the object represents an unknown pressure.
Pressure & operator*=(float multi)
bool operator<=(const Pressure &other) const
bool operator>(const Pressure &other) const
For convenience conversion from roo_time::Duration.
Pressure PressureInKiloPascals(float pressure)
Returns a pressure object equivalent to the specified pressure expressed in kiloPascals.
roo_logging::Stream & operator<<(roo_logging::Stream &os, const Area &val)
Pressure PressureInPSI(float pressure)
Returns a pressure object equivalent to the specified pressure expressed in PSI (pounds per square in...
Pressure PressureInHectoPascals(float pressure)
Returns a pressure object equivalent to the specified pressure expressed in hectoPascals.
Area operator+(Area a, Area b)
Pressure PressureInGigaPascals(float pressure)
Returns a pressure object equivalent to the specified pressure expressed in GigaPascals.
Area operator-(Area a, Area b)
Pressure PressureInBars(float pressure)
Returns a pressure object equivalent to the specified pressure expressed in bars.
Pressure PressureInPascals(float pressure)
Returns a pressure object equivalent to the specified pressure expressed in Pascals.
Pressure PressureInMegaPascals(float pressure)
Returns a pressure object equivalent to the specified pressure expressed in MegaPascals.
Pressure PressureInMilliPascals(float pressure)
Returns a pressure object equivalent to the specified pressure expressed in milliPascals.
Pressure PressureInMicroPascals(float pressure)
Returns a pressure object equivalent to the specified pressure expressed in microPascals.
Area operator/(Area a, float b)
Area operator*(Area a, float b)
Pressure UnknownPressure()
Returns a pressure object representing an unknown pressure.