roo_quantity
API Documentation for roo_quantity
Loading...
Searching...
No Matches
areic_number.cpp
Go to the documentation of this file.
2
3#include "roo_quantity/si.h"
4
5namespace roo_quantity {
6namespace {
7
8void AreicNumberToString(const AreicNumber& val, char* out, int maxlen) {
9 snprintf(out, maxlen, "%.6g/m²", val.inUnitsPerSquareMeter());
10}
11
12} // namespace
13
14#if defined(ESP32) || defined(ESP8266) || defined(__linux__)
15
16std::string AreicNumber::asString() const {
17 char out[16];
18 AreicNumberToString(*this, out, 16);
19 return out;
20}
21
22#endif
23
24#if defined(ARDUINO)
25
26String AreicNumber::asArduinoString() const {
27 char out[16];
28 AreicNumberToString(*this, out, 16);
29 return out;
30}
31
32#endif
33
34roo_logging::Stream& operator<<(roo_logging::Stream& os,
35 const AreicNumber& val) {
36 char out[16];
37 AreicNumberToString(val, out, 16);
38 os << out;
39 return os;
40}
41
42} // namespace roo_quantity
Representation of areic number, a reciprocal of area, internally stored as floating-point units per s...
For convenience conversion from roo_time::Duration.
Definition area.cpp:3
roo_logging::Stream & operator<<(roo_logging::Stream &os, const Area &val)
Definition area.cpp:57