rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes
Map2D< TLength, TValue, TBin > Class Template Reference

#include <Map2D.h>

Inheritance diagram for Map2D< TLength, TValue, TBin >:
Inheritance graph
[legend]
Collaboration diagram for Map2D< TLength, TValue, TBin >:
Collaboration graph
[legend]

Public Member Functions

 Map2D (const char *const name)
 
void initTable (const TValue(&values)[TLength], const TBin(&bins)[TLength])
 
virtual std::optional< floatgetValue (const float x) const
 

Private Attributes

const char *const m_name
 
const TValue(* m_values )[TLength] = nullptr
 
const TBin(* m_bins )[TLength] = nullptr
 

Detailed Description

template<int TLength, typename TValue, typename TBin>
class Map2D< TLength, TValue, TBin >

Definition at line 15 of file Map2D.h.

Constructor & Destructor Documentation

◆ Map2D()

template<int TLength, typename TValue , typename TBin >
Map2D< TLength, TValue, TBin >::Map2D ( const char *const  name)

Definition at line 30 of file Map2D.h.

30 : m_name(name) {
31}
const char *const m_name
Definition Map2D.h:23

Member Function Documentation

◆ getValue()

template<int TLength, typename TValue , typename TBin >
std::optional< float > Map2D< TLength, TValue, TBin >::getValue ( const float  x) const
virtual

Implements ValueProvider2D.

Definition at line 40 of file Map2D.h.

40 {
41 if (!m_bins) {
42 criticalError("Access to uninitialized bins: %s", m_name);
43 return {};
44 } else if (!m_values) {
45 criticalError("Access to uninitialized values: %s", m_name);
46 return {};
47 } else if ((1 < TLength) && ((*m_bins)[0] == 0.0f) && ((*m_bins)[1] == 0.0f)) {
48 // bins are uninitialized, but it isn't critical - maybe old configuration
49 return {};
50 } else {
51 return std::make_optional(interpolate2d(x, *m_bins, *m_values));
52 }
53}
const TValue(* m_values)[TLength]
Definition Map2D.h:25
const TBin(* m_bins)[TLength]
Definition Map2D.h:26

◆ initTable()

template<int TLength, typename TValue , typename TBin >
void Map2D< TLength, TValue, TBin >::initTable ( const TValue(&)  values[TLength],
const TBin(&)  bins[TLength] 
)

Definition at line 34 of file Map2D.h.

34 {
35 m_values = &values;
36 m_bins = &bins;
37}

Field Documentation

◆ m_bins

template<int TLength, typename TValue , typename TBin >
const TBin(* Map2D< TLength, TValue, TBin >::m_bins)[TLength] = nullptr
private

Definition at line 26 of file Map2D.h.

◆ m_name

template<int TLength, typename TValue , typename TBin >
const char* const Map2D< TLength, TValue, TBin >::m_name
private

Definition at line 23 of file Map2D.h.

◆ m_values

template<int TLength, typename TValue , typename TBin >
const TValue(* Map2D< TLength, TValue, TBin >::m_values)[TLength] = nullptr
private

Definition at line 25 of file Map2D.h.


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