Extract Shade struct and create ShadeRepository
This commit is contained in:
25
lib/shade_repository/ShadeRepository.h
Normal file
25
lib/shade_repository/ShadeRepository.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef SHADE_REPOSITORY_H
|
||||
#define SHADE_REPOSITORY_H
|
||||
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
#include "Shade.h"
|
||||
|
||||
class ShadeRepository {
|
||||
private:
|
||||
std::vector<Shade> shades;
|
||||
std::vector<std::function<void(Shade&)>> shadeAddedCallbacks;
|
||||
std::vector<std::function<void(Shade&)>> shadeChangedCallbacks;
|
||||
|
||||
public:
|
||||
void upsert(Shade shade);
|
||||
std::vector<Shade>::iterator begin();
|
||||
std::vector<Shade>::iterator end();
|
||||
Shade* findById(const uint16_t id);
|
||||
Shade* findByKey(const std::string& key);
|
||||
|
||||
void addShadeAddedCallback(std::function<void(Shade&)> callback);
|
||||
void addShadeChangedCallback(std::function<void(Shade&)> callback);
|
||||
};
|
||||
|
||||
#endif // SHADE_REPOSITORY_H
|
||||
Reference in New Issue
Block a user