-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathoption.h
More file actions
51 lines (40 loc) · 1.04 KB
/
option.h
File metadata and controls
51 lines (40 loc) · 1.04 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef OPTION_H_
#define OPTION_H_
#include <climits>
#include <cstddef>
#include <cstdint>
#include <functional>
#include <map>
#include <memory>
#include <string>
namespace NaoControl {
class Option {
protected:
const std::string name;
uint8_t* buffer;
uint32_t length;
Option(const char* n);
public:
/** This class is not intended to by copied */
Option(Option& s) = delete;
Option(Option&& s) = delete;
Option& operator=(const Option&) = delete;
Option& operator=(Option&&) = delete;
enum OptionType { O_INT = 0, O_FLOAT, O_BOOL, O_ENUM };
virtual ~Option() {
free(buffer);
}
virtual uint8_t* save(uint8_t* start);
virtual size_t size() const {
return length;
}
virtual void setValue(const uint8_t* buffer, int len) = 0;
virtual const std::string& getName() {
return name;
}
virtual OptionType getOptionType() = 0;
virtual void* getValuePtr() = 0;
};
using OptionPtr = std::shared_ptr<Option>;
} /* namespace NaoControl */
#endif /* OPTION_H_ */