icinga2/lib/base/configobject.ti

93 lines
2.0 KiB
Plaintext
Raw Normal View History

/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
#include "base/debuginfo.hpp"
#include "base/configtype.hpp"
library base;
2013-10-26 09:41:45 +02:00
namespace icinga
{
code {{{
enum HAMode
{
HARunOnce,
HARunEverywhere
};
2017-12-31 07:22:16 +01:00
class NameComposer
{
public:
virtual ~NameComposer();
2014-11-06 19:35:47 +01:00
virtual String MakeName(const String& shortName, const Object::Ptr& context) const = 0;
virtual Dictionary::Ptr ParseName(const String& name) const = 0;
};
}}}
abstract class ConfigObjectBase
{ };
code {{{
2017-12-31 07:22:16 +01:00
class ConfigObjectBase : public ObjectImpl<ConfigObjectBase>
{
public:
inline DebugInfo GetDebugInfo() const
{
return m_DebugInfo;
}
void SetDebugInfo(const DebugInfo& di)
{
m_DebugInfo = di;
}
2016-08-24 19:59:13 +02:00
inline virtual void Start(bool /* runtimeCreated */)
{ }
2016-08-24 19:59:13 +02:00
inline virtual void Stop(bool /* runtimeRemoved */)
{ }
private:
DebugInfo m_DebugInfo;
};
}}}
abstract class ConfigObject : ConfigObjectBase < ConfigType
2013-10-26 09:41:45 +02:00
{
[config, no_user_modify] String __name (Name);
[config, no_user_modify] String "name" (ShortName) {
get {{{
if (m_ShortName.IsEmpty())
return GetName();
else
return m_ShortName;
}}}
};
[config, no_user_modify] name(Zone) zone (ZoneName);
[config, no_user_modify] String package;
[config, get_protected, no_user_modify] Array::Ptr templates;
[config, no_storage, no_user_modify] Dictionary::Ptr source_location {
get;
};
[get_protected, no_user_modify] bool active;
[get_protected, no_user_modify] bool paused {
default {{{ return true; }}}
};
[get_protected, no_user_view, no_user_modify] bool start_called;
[get_protected, no_user_view, no_user_modify] bool stop_called;
[get_protected, no_user_view, no_user_modify] bool pause_called;
[get_protected, no_user_view, no_user_modify] bool resume_called;
[enum] HAMode ha_mode (HAMode);
[protected, no_user_view, no_user_modify] Dictionary::Ptr extensions;
[protected, no_user_view, no_user_modify] bool state_loaded;
[no_user_modify] Dictionary::Ptr original_attributes;
[state, no_user_modify] double version {
default {{{ return 0; }}}
};
2013-10-26 09:41:45 +02:00
};
}