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