roo_quantity
API Documentation for roo_quantity
Loading...
Searching...
No Matches
lineic_number.cpp
Go to the documentation of this file.
2
3#include "roo_quantity/si.h"
4
5namespace roo_quantity {
6namespace {
7
8void LineicNumberToString(const LineicNumber& val, char* out,
9 int maxlen) {
10 snprintf(out, maxlen, "%.6g/m", val.inUnitsPerMeter());
11}
12
13} // namespace
14
15#if defined(ESP32) || defined(ESP8266) || defined(__linux__)
16
17std::string LineicNumber::asString() const {
18 char out[16];
19 LineicNumberToString(*this, out, 16);
20 return out;
21}
22
23#endif
24
25#if defined(ARDUINO)
26
27String LineicNumber::asArduinoString() const {
28 char out[16];
29 LineicNumberToString(*this, out, 16);
30 return out;
31}
32
33#endif
34
35roo_logging::Stream& operator<<(roo_logging::Stream& os,
36 const LineicNumber& val) {
37 char out[16];
38 LineicNumberToString(val, out, 16);
39 os << out;
40 return os;
41}
42
43} // namespace roo_quantity
Representation of lineic number, a reciprocal of length, internally stored as floating-point units pe...
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