-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgroup.h
61 lines (53 loc) · 1.76 KB
/
group.h
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
55
56
57
58
59
60
61
/**
* @author Saef Taher
* @date 14/01/2018
*/
#ifndef GROUP_H
#define GROUP_H
#include "light.h"
#include <vector>
#include <memory>
/**
* @brief The Group class is a container to hold a group of Lights.
*
* This has nothing to do with the hue Lights and the bridge. The state
*/
class Group : public Light
{
public:
Group();
void setOn(bool on) override;
void setBri(double bri) override;
void setSat(double sat) override;
void setHue(double hue) override;
void setIsAmbi(bool isAmbi) override;
bool operator ==(const Group &l);
/**
* @brief removeLight removes a light at a given index.
* @param index index where the light should be removed.
*
* Atention: this removes the reversed weak ptr from the light to the group
*/
void removeLight(int index);
/**
* @brief addLight adds a light to the group.
* @param group the group where it should be added
* @param light the actual light
*
* the group is needed to set a revered weak ptr for the light to the group.
*/
static void addLight(std::shared_ptr<Group> group, std::shared_ptr<Light> light);
/**
* @brief lights returns the lights in this group
* @return lights in this group.
*/
std::vector<std::weak_ptr<Light> > lights() const;
/**
* @brief lights returns a reference to the vector containing the pointers to the lights
* @return vector
*/
std::vector<std::weak_ptr<Light> > &lights();
private:
std::vector<std::weak_ptr<Light>> lights_;
};
#endif // GROUP_H