icinga2/lib/config
Julian Brost fbb68dbcd0 Namespace: replace behavior classes with a bool
In essence, namespace behaviors acted as hooks for update operations on
namespaces. Two behaviors were implemented:

- `NamespaceBehavior`: allows the update operation unless it acts on a value
  that itself was explicitly marked as constant.
- `ConstNamespaceBehavior`: initially allows insert operations but marks the
  individual values as const. Additionally provides a `Freeze()` member
  function. After this was called, updates are rejected unless a special
  `overrideFrozen` flag is set explicitly.

This marvel of object-oriented programming can be replaced with a simple bool.
This commit basically replaces `Namespace::m_Behavior` with
`Namespace::m_ConstValues` and inlines the behavior functions where they were
called. While doing so, the code was slightly simplified by assuming that
`m_ConstValues` is true if `m_Frozen` is true. This is similar to what the API
allowed in the old code as you could only freeze a `ConstNamespaceBehavior`.
However, this PR moves the `Freeze()` member function and the related
`m_Freeze` member variable to the `Namespace` class. So now the API allows any
namespace to be frozen. The new code also makes sense with the previously
mentioned simplification: a `Namespace` with `m_ConstValues = false` can be
modified without restrictions until `Freeze()` is called. When this is done, it
becomes read-only.

The changes outside of `namespace.*` just adapt the code to the slightly
changed API.
2022-12-09 09:25:46 +01:00
..
activationcontext.cpp Replace Copyright header with a short version, part I 2019-02-25 14:48:22 +01:00
activationcontext.hpp Replace Copyright header with a short version, part I 2019-02-25 14:48:22 +01:00
applyrule-targeted.cpp Avoid evaluating the same filter twice for the same target 2022-11-04 10:15:22 +01:00
applyrule.cpp ApplyRule: Make m_HasMatches atomic 2022-11-28 14:13:58 +01:00
applyrule.hpp ApplyRule: Make m_HasMatches atomic 2022-11-28 14:13:58 +01:00
CMakeLists.txt Separately handle apply rules targetting only specific parent objects 2022-10-28 14:27:53 +02:00
config_lexer.ll Make ConfigCompiler#m_LexBuffer a String 2020-01-21 13:38:59 +01:00
config_parser.yy ApplyRule::GetTargetTypes(): return by const ref not to malloc() 2022-10-19 13:43:51 +02:00
configcompiler.cpp CONTEXT: use << everywhere to unify usages 2022-11-30 11:06:51 +01:00
configcompiler.hpp Use std::mutex, not boost::mutex 2021-02-03 09:54:57 +01:00
configcompilercontext.cpp icinga2 daemon -C: write icinga2.debug only if --dump-objects given 2022-11-23 12:54:33 +01:00
configcompilercontext.hpp icinga2 daemon -C: write icinga2.debug only if --dump-objects given 2022-11-23 12:54:33 +01:00
configfragment.hpp Replace Copyright header with a short version, part I 2019-02-25 14:48:22 +01:00
configitem.cpp icinga2 daemon: w/o --dump-objects just check for circular refs 2022-11-30 10:45:50 +01:00
configitem.hpp Rename silent parameter of ConfigItem::ActivateItems() 2021-06-21 16:07:36 +02:00
configitembuilder.cpp Replace std::shared_ptr<Expression> with Expression::Ptr 2019-10-21 17:10:51 +02:00
configitembuilder.hpp Replace std::shared_ptr<Expression> with Expression::Ptr 2019-10-21 17:10:51 +02:00
expression.cpp Namespace: replace behavior classes with a bool 2022-12-09 09:25:46 +01:00
expression.hpp VariableExpression#GetVariable(): return by const ref not to unnecessarily malloc() 2022-10-28 14:27:53 +02:00
i2-config.hpp Replace Copyright header with a short version, part I 2019-02-25 14:48:22 +01:00
objectrule.cpp Replace Copyright header with a short version, part I 2019-02-25 14:48:22 +01:00
objectrule.hpp Replace Copyright header with a short version, part I 2019-02-25 14:48:22 +01:00
vmops.hpp Replace std::shared_ptr<Expression> with Expression::Ptr 2019-10-21 17:10:51 +02:00