roo_monitoring
API Documentation for roo_monitoring
Loading...
Searching...
No Matches
roo_monitoring::Transform Class Reference

Maps application-domain floats to 16-bit stored values. More...

#include <transform.h>

Public Member Functions

uint16_t apply (float value) const
 Applies the transform and clamps to [0, 65535].
 
float unapply (uint16_t value) const
 Recovers the application-domain value from encoded data.
 
float multiplier () const
 Returns the multiplier used by the transform.
 
float offset () const
 Returns the offset used by the transform.
 

Static Public Member Functions

static Transform Linear (float multiplier, float offset)
 Creates a linear transformation ax+b.
 
static Transform LinearRange (float min_value, float max_value)
 Creates a linear transform from min/max representable values.
 

Detailed Description

Maps application-domain floats to 16-bit stored values.

Currently implemented as a linear transformation.

Definition at line 10 of file transform.h.

Member Function Documentation

◆ apply()

uint16_t roo_monitoring::Transform::apply ( float  value) const

Applies the transform and clamps to [0, 65535].

Definition at line 13 of file transform.cpp.

Referenced by roo_monitoring::WriteTransaction::write().

◆ Linear()

Transform roo_monitoring::Transform::Linear ( float  multiplier,
float  offset 
)
static

Creates a linear transformation ax+b.

The result is rounded to the nearest integer.

Definition at line 5 of file transform.cpp.

References multiplier(), and offset().

◆ LinearRange()

Transform roo_monitoring::Transform::LinearRange ( float  min_value,
float  max_value 
)
static

Creates a linear transform from min/max representable values.

The minimum maps to 0 and the maximum maps to 65535.

Definition at line 9 of file transform.cpp.

◆ multiplier()

float roo_monitoring::Transform::multiplier ( ) const
inline

Returns the multiplier used by the transform.

Definition at line 29 of file transform.h.

Referenced by Linear().

◆ offset()

float roo_monitoring::Transform::offset ( ) const
inline

Returns the offset used by the transform.

Definition at line 31 of file transform.h.

Referenced by Linear().

◆ unapply()

float roo_monitoring::Transform::unapply ( uint16_t  value) const

Recovers the application-domain value from encoded data.

Definition at line 24 of file transform.cpp.


The documentation for this class was generated from the following files: