diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 11:32:39 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 11:32:39 +0000 |
commit | 56ae875861ab260b80a030f50c4aff9f9dc8fff0 (patch) | |
tree | 531412110fc901a5918c7f7442202804a83cada9 /lib/base/configobject.ti | |
parent | Initial commit. (diff) | |
download | icinga2-56ae875861ab260b80a030f50c4aff9f9dc8fff0.tar.xz icinga2-56ae875861ab260b80a030f50c4aff9f9dc8fff0.zip |
Adding upstream version 2.14.2.upstream/2.14.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'lib/base/configobject.ti')
-rw-r--r-- | lib/base/configobject.ti | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/lib/base/configobject.ti b/lib/base/configobject.ti new file mode 100644 index 0000000..ea67dfa --- /dev/null +++ b/lib/base/configobject.ti @@ -0,0 +1,94 @@ +/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */ + +#include "base/debuginfo.hpp" +#include "base/configtype.hpp" + +library base; + +namespace icinga +{ + +code {{{ +enum HAMode +{ + HARunOnce, + HARunEverywhere +}; + +class NameComposer +{ +public: + virtual ~NameComposer(); + + 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 {{{ +class ConfigObjectBase : public ObjectImpl<ConfigObjectBase> +{ +public: + inline DebugInfo GetDebugInfo() const + { + return m_DebugInfo; + } + + void SetDebugInfo(const DebugInfo& di) + { + m_DebugInfo = di; + } + + inline virtual void Start(bool /* runtimeCreated */) + { } + + inline virtual void Stop(bool /* runtimeRemoved */) + { } + +private: + DebugInfo m_DebugInfo; +}; + +}}} + +abstract class ConfigObject : ConfigObjectBase < ConfigType +{ + [config, no_user_modify] String __name (Name); + [config, no_user_modify, required] String "name" (ShortName) { + get {{{ + String shortName = m_ShortName.load(); + if (shortName.IsEmpty()) + return GetName(); + else + return 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; }}} + }; + [no_user_view, no_user_modify] String icingadb_identifier; +}; + +} |