icinga2/base/configcollection.h

39 lines
959 B
C
Raw Normal View History

#ifndef CONFIGCOLLECTION_H
#define CONFIGCOLLECTION_H
namespace icinga
{
class ConfigHive;
class I2_BASE_API ConfigCollection : public Object
{
private:
weak_ptr<ConfigHive> m_Hive;
public:
typedef shared_ptr<ConfigCollection> Ptr;
typedef weak_ptr<ConfigCollection> WeakPtr;
typedef map<string, ConfigObject::Ptr>::iterator ObjectIterator;
2012-04-24 14:02:15 +02:00
typedef map<string, ConfigObject::Ptr>::const_iterator ObjectConstIterator;
map<string, ConfigObject::Ptr> Objects;
void SetHive(const weak_ptr<ConfigHive>& hive);
weak_ptr<ConfigHive> GetHive(void) const;
void AddObject(const ConfigObject::Ptr& object);
void RemoveObject(const ConfigObject::Ptr& object);
2012-04-24 14:02:15 +02:00
ConfigObject::Ptr GetObject(const string& name = string()) const;
2012-04-20 13:49:04 +02:00
void ForEachObject(function<int (const EventArgs&)> callback);
2012-04-20 13:49:04 +02:00
Event<EventArgs> OnObjectCreated;
Event<EventArgs> OnObjectRemoved;
2012-04-22 16:45:31 +02:00
Event<PropertyChangedEventArgs> OnPropertyChanged;
};
}
#endif /* CONFIGCOLLECTION_H */