forked from WEARTHaptics/WEART-SDK-Cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWeArtTemperature.h
39 lines (29 loc) · 923 Bytes
/
WeArtTemperature.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#pragma once
#include "WeArtCommon.h"
//! @brief Temperature value to be applied to an effect
struct WeArtTemperature {
public:
WeArtTemperature() : active(false), _value(DefaultValue) {};
WeArtTemperature(bool active, float temperature) : active(active) {
value(temperature);
}
static constexpr float DefaultValue = 0.5f;
static constexpr float MinValue = 0.0f;
static constexpr float MaxValue = 1.0f;
bool active;
//! @brief Temperature value getter
//! @return the temperature value
float value() const {
return _value;
}
//! @brief Temperature value setter
//! @param temperature The temperature value to set
void value(float temperature) {
_value = temperature <= MinValue ? MinValue : temperature >= MaxValue ? MaxValue : temperature;
}
bool operator==(const WeArtTemperature& other) const {
return (active == other.active && _value == other.value());
};
private:
float _value;
};