]> granicus.if.org Git - icinga2/blob - lib/icinga/servicegroup.hpp
Merge pull request #7164 from Icinga/bugfix/notification-times-validate
[icinga2] / lib / icinga / servicegroup.hpp
1 /* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
2
3 #ifndef SERVICEGROUP_H
4 #define SERVICEGROUP_H
5
6 #include "icinga/i2-icinga.hpp"
7 #include "icinga/servicegroup-ti.hpp"
8 #include "icinga/service.hpp"
9
10 namespace icinga
11 {
12
13 class ConfigItem;
14
15 /**
16  * An Icinga service group.
17  *
18  * @ingroup icinga
19  */
20 class ServiceGroup final : public ObjectImpl<ServiceGroup>
21 {
22 public:
23         DECLARE_OBJECT(ServiceGroup);
24         DECLARE_OBJECTNAME(ServiceGroup);
25
26         std::set<Service::Ptr> GetMembers() const;
27         void AddMember(const Service::Ptr& service);
28         void RemoveMember(const Service::Ptr& service);
29
30         bool ResolveGroupMembership(const Service::Ptr& service, bool add = true, int rstack = 0);
31
32         static void EvaluateObjectRules(const Service::Ptr& service);
33
34 private:
35         mutable boost::mutex m_ServiceGroupMutex;
36         std::set<Service::Ptr> m_Members;
37
38         static bool EvaluateObjectRule(const Service::Ptr& service, const intrusive_ptr<ConfigItem>& group);
39 };
40
41 }
42
43 #endif /* SERVICEGROUP_H */