6#include "roo_logging.h"
10#if defined(ESP32) || defined(ESP8266) || defined(__linux__)
24 Power() : power_(std::nanf(
"")) {}
45 bool isUnknown()
const {
return std::isnan(power_); }
58 return !(power_ == other.power_);
81#if defined(ESP32) || defined(ESP8266) || defined(__linux__)
83 std::string asString()
const;
87 String asArduinoString()
const;
95 explicit Power(
float power) : power_(power) {}
182roo_logging::Stream&
operator<<(roo_logging::Stream& os,
const Power& val);
Representation of power, internally stored as floating-point Watts.
friend Power UnknownPower()
Returns a power object representing an unknown power.
bool operator==(const Power &other) const
float inMicroWatts() const
Returns the power in microWatts.
Power & operator/=(float div)
bool operator>(const Power &other) const
Power()
Creates a power object representing an 'unknown' power.
float inMegaWatts() const
Returns the power in megaWatts.
bool operator<=(const Power &other) const
friend Power PowerInWatts(float)
Returns a power object equivalent to the specified power expressed in Watts.
bool operator<(const Power &other) const
float inGigaWatts() const
Returns the power in gigaWatts.
Power & operator-=(const Power &other)
bool isUnknown() const
Returns whether the object represents an unknown power.
float inMilliWatts() const
Returns the power in milliWatts.
Power & operator+=(const Power &other)
bool operator>=(const Power &other) const
float inWatts() const
Returns the power in Watts.
bool operator!=(const Power &other) const
Power & operator*=(float multi)
float inKiloWatts() const
Returns the power in kiloWatts.
Representation of elapsed, internally stored as floating-point seconds.
float inSeconds() const
Returns the time in seconds.
Representation of work, internally stored as floating-point Joules.
float inJoules() const
Returns the work in joules.
For convenience conversion from roo_time::Duration.
roo_logging::Stream & operator<<(roo_logging::Stream &os, const Area &val)
Area operator+(Area a, Area b)
Power PowerInMicroWatts(float power)
Returns a power object equivalent to the specified power expressed in microWatts.
Power UnknownPower()
Returns a power object representing an unknown power.
Power PowerInMegaWatts(float power)
Returns a power object equivalent to the specified power expressed in megaWatts.
Time TimeInSeconds(float time)
Returns a time object equivalent to the specified time expressed in seconds.
Power PowerInWatts(float power)
Returns a power object equivalent to the specified power expressed in Watts.
Power PowerInKiloWatts(float power)
Returns a power object equivalent to the specified power expressed in kiloWatts.
Area operator-(Area a, Area b)
Power PowerInGigaWatts(float power)
Returns a power object equivalent to the specified power expressed in gigaWatts.
Work WorkInJoules(float work)
Returns a work object equivalent to the specified work expressed in Joules.
Area operator/(Area a, float b)
Area operator*(Area a, float b)
Power PowerInMilliWatts(float power)
Returns a power object equivalent to the specified power expressed in milliWatts.