6#include "roo_logging.h"
10#if defined(ESP32) || defined(ESP8266) || defined(__linux__)
33 float inLiters()
const {
return volume_ * 1000.0f; }
57 bool isUnknown()
const {
return std::isnan(volume_); }
62 return volume_ == other.volume_;
68 return !(other.volume_ < volume_);
72 return !(volume_ < other.volume_);
76 return !(volume_ == other.volume_);
99#if defined(ESP32) || defined(ESP8266) || defined(__linux__)
101 std::string asString()
const;
105 String asArduinoString()
const;
113 explicit Volume(
float volume) : volume_(volume) {}
220roo_logging::Stream &
operator<<(roo_logging::Stream &os,
const Volume &val);
Representation of area, internally stored as floating-point square meters.
float inSquareMeters() const
Returns the area in square meters.
Representation of length, internally stored as floating-point meters.
float inMeters() const
Returns the length in meters.
Representation of volume, internally stored as floating-point cubic meters.
float inCubicMillimeters() const
Returns the volume in microliters.
float inCubicMeters() const
Returns the volume in cubic meters.
Volume & operator+=(const Volume &other)
float inMilliliters() const
Returns the volume in milliliters.
float inLiters() const
Returns the volume in liters.
bool operator>(const Volume &other) const
bool operator>=(const Volume &other) const
bool isUnknown() const
Returns whether the object represents an unknown volume.
friend Volume UnknownVolume()
Returns a volume object representing an unknown volume.
bool operator!=(const Volume &other) const
bool operator==(const Volume &other) const
Volume & operator-=(const Volume &other)
float inCubicInches() const
Returns the volume in cubic inches.
float inCubicMicrometers() const
Returns the volume in cubic micrometers.
float inCubicKilometers() const
Returns the volume in cubic kilometers.
float inCubicDecimeters() const
Returns the volume in liters.
Volume()
Creates a volume object representing an 'unknown' volume.
Volume & operator/=(float div)
Volume & operator*=(float multi)
float inMicroliters() const
Returns the volume in microliters.
float inCubicCentimeters() const
Returns the volume in milliliters.
bool operator<=(const Volume &other) const
friend Volume VolumeInCubicMeters(float)
Returns a volume object equivalent to the specified volume expressed in cubic meters.
bool operator<(const Volume &other) const
For convenience conversion from roo_time::Duration.
Length LengthInMeters(float length)
Returns a length object equivalent to the specified length expressed in meters.
roo_logging::Stream & operator<<(roo_logging::Stream &os, const Area &val)
Volume VolumeInCubicMeters(float volume)
Returns a volume object equivalent to the specified volume expressed in cubic meters.
Area AreaInSquareMeters(float area)
Returns a area object equivalent to the specified area expressed in square meters.
Volume VolumeInCubicKilometers(float volume)
Returns a volume object equivalent to the specified volume expressed in cubic kilometers.
Volume VolumeInLiters(float volume)
Returns a volume object equivalent to the specified volume expressed in liters.
Area operator+(Area a, Area b)
Volume VolumeInCubicDecimeters(float volume)
Returns a volume object equivalent to the specified volume expressed in liters.
Volume UnknownVolume()
Returns a volume object representing an unknown volume.
Volume VolumeInCubicMicrometers(float volume)
Returns a volume object equivalent to the specified volume expressed in cubic micrometers.
Area operator-(Area a, Area b)
Volume VolumeInMilliliters(float volume)
Returns a volume object equivalent to the specified volume expressed in milliliters.
Volume VolumeInCubicCentimeters(float volume)
Returns a volume object equivalent to the specified volume expressed in milliliters.
Area operator/(Area a, float b)
Volume VolumeInCubicInches(float volume)
Returns a volume object equivalent to the specified volume expressed in cubic inches.
Volume VolumeInCubicMillimeters(float volume)
Returns a volume object equivalent to the specified volume expressed in cubic millimeters.
Area operator*(Area a, float b)