-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathfloatoption.h
More file actions
39 lines (31 loc) · 1015 Bytes
/
floatoption.h
File metadata and controls
39 lines (31 loc) · 1015 Bytes
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
38
39
#ifndef FLOATOPTION_H_
#define FLOATOPTION_H_
#include <option.h>
#include <cfloat>
#include <climits>
#include <cstdint>
namespace NaoControl {
class FloatOption : public Option {
private:
float* value;
std::function<void(float)> callback;
public:
/** This class is not intended to by copied */
FloatOption(FloatOption& s) = delete;
FloatOption(FloatOption&& s) = delete;
FloatOption& operator=(const FloatOption&) = delete;
FloatOption& operator=(FloatOption&&) = delete;
~FloatOption() override = default;
FloatOption(const char* cname, float* val, float min = FLT_MIN, float max = FLT_MAX, float step = 0.1f,
std::function<void(float)> callb = nullptr);
uint8_t* save(uint8_t* start) override;
void setValue(const uint8_t* buffer, int len) override;
OptionType getOptionType() override {
return O_FLOAT;
}
void* getValuePtr() override {
return value;
}
};
} // namespace NaoControl
#endif /* FLOATOPTION_H_ */