25 lines
751 B
C++
25 lines
751 B
C++
#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
|