forked from matth-x/MicroOcpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConfigurationContainer.h
More file actions
54 lines (37 loc) · 1.62 KB
/
Copy pathConfigurationContainer.h
File metadata and controls
54 lines (37 loc) · 1.62 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
52
53
54
// matth-x/ArduinoOcpp
// Copyright Matthias Akstaller 2019 - 2022
// MIT License
#ifndef CONFIGURATIONCONTAINER_H
#define CONFIGURATIONCONTAINER_H
#include <vector>
#include <memory>
#include <ArduinoOcpp/Core/ConfigurationKeyValue.h>
namespace ArduinoOcpp {
class ConfigurationContainer {
private:
std::vector<uint16_t> configurations_revision;
const char *filename;
protected:
std::vector<std::shared_ptr<AbstractConfiguration>> configurations;
ConfigurationContainer(const char *filename) : filename(filename) { }
//Checks if configurations_revision is equal to (for all) configurations->getValueRevision(). If not, it refreshes the record
bool configurationsUpdated();
public:
virtual ~ConfigurationContainer() = default;
virtual bool load() = 0;
virtual bool save() = 0;
const char *getFilename() {return filename;};
std::shared_ptr<AbstractConfiguration> getConfiguration(const char *key);
std::vector<std::shared_ptr<AbstractConfiguration>>::iterator configurationsIteratorBegin() {return configurations.begin();}
std::vector<std::shared_ptr<AbstractConfiguration>>::iterator configurationsIteratorEnd() {return configurations.end();}
bool removeConfiguration(std::shared_ptr<AbstractConfiguration> configuration);
void addConfiguration(std::shared_ptr<AbstractConfiguration> configuration);
};
class ConfigurationContainerVolatile : public ConfigurationContainer {
public:
ConfigurationContainerVolatile(const char *filename) : ConfigurationContainer(filename) { }
bool load() {return true;}
bool save() {return true;}
};
} //end namespace ArduinoOcpp
#endif