6#include "roo_logging.h"
8#if defined(ESP32) || defined(ESP8266) || defined(__linux__)
22 Work() : work_(std::nanf(
"")) {}
37 bool isUnknown()
const {
return std::isnan(work_); }
71#if defined(ESP32) || defined(ESP8266) || defined(__linux__)
73 std::string asString()
const;
77 String asArduinoString()
const;
85 explicit Work(
float work) : work_(work) {}
154roo_logging::Stream&
operator<<(roo_logging::Stream& os,
const Work& val);
Representation of work, internally stored as floating-point Joules.
bool operator!=(const Work &other) const
friend Work WorkInJoules(float)
Returns a work object equivalent to the specified work expressed in Joules.
bool isUnknown() const
Returns whether the object represents an unknown work.
Work & operator*=(float multi)
Work & operator-=(const Work &other)
float inMicroJoules() const
Returns the work in microjoules.
float inKiloJoules() const
Returns the work in kilojoules.
Work & operator/=(float div)
Work()
Creates a work object representing an 'unknown' work.
Work & operator+=(const Work &other)
float inMilliJoules() const
Returns the work in millijoules.
bool operator<(const Work &other) const
bool operator>(const Work &other) const
friend Work UnknownWork()
Returns a work object representing an unknown work.
bool operator>=(const Work &other) const
bool operator<=(const Work &other) const
bool operator==(const Work &other) const
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)
Work WorkInGigaJoules(float work)
Returns a work object equivalent to the specified work expressed in gigaJoules.
Area operator+(Area a, Area b)
Work WorkInMicroJoules(float work)
Returns a work object equivalent to the specified work expressed in microJoules.
Work WorkInKiloJoules(float work)
Returns a work object equivalent to the specified work expressed in kiloJoules.
Work UnknownWork()
Returns a work object representing an unknown work.
Area operator-(Area a, Area b)
Work WorkInJoules(float work)
Returns a work object equivalent to the specified work expressed in Joules.
Work WorkInMilliJoules(float work)
Returns a work object equivalent to the specified work expressed in milliJoules.
Work WorkInMegaJoules(float work)
Returns a work object equivalent to the specified work expressed in megaJoules.
Area operator/(Area a, float b)
Area operator*(Area a, float b)