2012-04-02 08:56:30 +02:00
|
|
|
#ifndef CONFIGOBJECT_H
|
|
|
|
#define CONFIGOBJECT_H
|
2012-03-31 15:18:09 +02:00
|
|
|
|
|
|
|
#include <map>
|
|
|
|
|
|
|
|
namespace icinga
|
|
|
|
{
|
|
|
|
|
|
|
|
class ConfigHive;
|
|
|
|
|
2012-04-06 08:56:52 +02:00
|
|
|
struct I2_BASE_API ConfigObjectEventArgs : public EventArgs
|
2012-04-04 10:04:38 +02:00
|
|
|
{
|
|
|
|
typedef shared_ptr<ConfigObjectEventArgs> Ptr;
|
|
|
|
typedef weak_ptr<ConfigObjectEventArgs> WeakPtr;
|
|
|
|
|
|
|
|
string Property;
|
|
|
|
string OldValue;
|
|
|
|
};
|
|
|
|
|
2012-04-06 08:56:52 +02:00
|
|
|
class I2_BASE_API ConfigObject : public Object
|
2012-03-31 15:18:09 +02:00
|
|
|
{
|
|
|
|
private:
|
|
|
|
weak_ptr<ConfigHive> m_Hive;
|
|
|
|
|
|
|
|
string m_Name;
|
|
|
|
string m_Type;
|
|
|
|
|
|
|
|
public:
|
2012-04-02 20:50:35 +02:00
|
|
|
typedef shared_ptr<ConfigObject> Ptr;
|
|
|
|
typedef weak_ptr<ConfigObject> WeakPtr;
|
2012-03-31 15:18:09 +02:00
|
|
|
|
|
|
|
typedef map<string, string>::iterator ParameterIterator;
|
|
|
|
map<string, string> Properties;
|
|
|
|
|
2012-04-04 10:04:38 +02:00
|
|
|
ConfigObject(const string& type, const string& name);
|
|
|
|
|
|
|
|
void SetHive(const weak_ptr<ConfigHive>& hive);
|
2012-03-31 15:18:09 +02:00
|
|
|
weak_ptr<ConfigHive> GetHive(void) const;
|
|
|
|
|
|
|
|
void SetName(const string& name);
|
|
|
|
string GetName(void) const;
|
|
|
|
|
|
|
|
void SetType(const string& type);
|
|
|
|
string GetType(void) const;
|
|
|
|
|
|
|
|
void SetProperty(const string& name, const string& value);
|
|
|
|
void SetPropertyInteger(const string& name, int value);
|
|
|
|
void SetPropertyDouble(const string& name, double value);
|
|
|
|
|
2012-04-01 19:32:41 +02:00
|
|
|
bool GetProperty(const string& name, string *value) const;
|
|
|
|
bool GetPropertyInteger(const string& name, int *value) const;
|
|
|
|
bool GetPropertyDouble(const string& name, double *value) const;
|
2012-03-31 15:18:09 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2012-04-02 08:56:30 +02:00
|
|
|
#endif /* CONFIGOBJECT_H */
|