Generic measurement that stores values as either double or long long int.
More...
#include <Measurement.h>
|
bool | operator< (const Measurement &b) const |
| Compare the stored value with another value. More...
|
|
template<typename Floating , typename std::enable_if< !std::is_integral< Floating >::value, int >::type = 0> |
| Measurement (Floating v, std::string unit, std::list< std::string > raw={}) |
| Constructor to store a floating point value. More...
|
|
template<typename Integer , typename std::enable_if< std::is_integral< Integer >::value, int >::type = 0> |
| Measurement (Integer v, std::string unit, std::list< std::string > raw={}) |
| Constructor to store an integer value. More...
|
|
const std::string & | unit () const |
| Accessor for the unit of the measurement. More...
|
|
const std::list< std::string > & | raw_data () const |
| Accessor for the raw data. More...
|
|
const Value & | value () const |
| Accessor for the stored value. More...
|
|
Generic measurement that stores values as either double or long long int.
Definition at line 41 of file Measurement.h.
◆ Measurement() [1/2]
Measurement |
( |
Floating |
v, |
|
|
std::string |
unit, |
|
|
std::list< std::string > |
raw = {} |
|
) |
| |
|
inline |
Constructor to store a floating point value.
- Parameters
-
[in] | v | Value to store |
[in] | unit | Unit of v |
[in] | raw | (Optional) The raw value(s) was generated from. |
Definition at line 252 of file Measurement.h.
253 : _unit(
unit), _raw_data(std::move(raw)), _value(
true)
256 if(_raw_data.empty())
◆ Measurement() [2/2]
Measurement |
( |
Integer |
v, |
|
|
std::string |
unit, |
|
|
std::list< std::string > |
raw = {} |
|
) |
| |
|
inline |
Constructor to store an integer value.
- Parameters
-
[in] | v | Value to store |
[in] | unit | Unit of v |
[in] | raw | (Optional) The raw value(s) was generated from. |
Definition at line 269 of file Measurement.h.
270 : _unit(
unit), _raw_data(std::move(raw)), _value(
false)
272 _value.
v.
integer =
static_cast<long long int>(v);
273 if(_raw_data.empty())
◆ operator<()
◆ raw_data()
const std::list<std::string>& raw_data |
( |
| ) |
const |
|
inline |
◆ unit()
const std::string& unit |
( |
| ) |
const |
|
inline |
◆ value()
const Value& value |
( |
| ) |
const |
|
inline |
◆ operator<<
std::ostream& operator<< |
( |
std::ostream & |
os, |
|
|
const Measurement & |
measurement |
|
) |
| |
|
friend |
Stream output operator to print the measurement.
Prints value and unit.
- Parameters
-
- Returns
- the modified output stream.
Definition at line 239 of file Measurement.h.
241 os << measurement._value <<
" " << measurement._unit;
The documentation for this struct was generated from the following file: