60 Commits

Author SHA1 Message Date
Yonas Habteab
467e8b18e7 Type: Simplify sort by load dependencies algorithm 2024-09-20 16:18:12 +02:00
Alexander A. Klimov
b848934d57 Introduce Type::GetConfigTypesSortedByLoadDependencies() 2024-09-20 16:18:12 +02:00
Alexander A. Klimov
9376a311ea Fix file endings
git ls-files -z \
	|grep -zEe '^lib/' \
	|grep -zEe '\.[ch]pp$' \
	|xargs -0 perl -p0i -e 's/\n*(?!(?:.|\n))/\n/'
2023-05-17 18:05:13 +02:00
Julian Brost
3dab46623b Move Types namespace into type.cpp and simplify Type::GetByName()
This commit moves the initialization of the globals.Types namespace to type.cpp
in order to keep a pointer to the Namespace object in Type::m_Namespace and
simplify Type::GetByName() using it.

The dynamic type check is moved into an assertion after freezing the namespace.
2023-01-26 14:26:41 +01:00
Julian Brost
1c066fc02e Simplify NamespaceValue class hierarchy to one struct without member functions
This commit removes EmbeddedNamespaceValue and ConstEmbeddedNamespaceValue and
reduces NamespaceValue down to a simple struct without inheritance or member
functions. The code from these clases is inlined into the Namespace class. The
class hierarchy determining whether a value is const is moved to an attribute
of NamespaceValue.

This is done in preparation for changes to the locking in the Namespace class.
Currently, it relies on a recursive mutex. In the future, a shared mutex
(read/write lock) should be used instead, which cannot allow recursive locking
(without failing or risk deadlocking on lock upgrades). With this change, all
operations requiring a lock for one operation are within one function, no
recursive locking is not needed any more.
2023-01-19 17:55:11 +01:00
Julian Brost
0503ca1379 Initialize namespaces without using overrideFrozen
This commit adds a new initialization priority `FreezeNamespaces` that is run
last and moves all calls to `Namespace::Freeze()` there. This allows all other
initialization functions to still update namespaces without the use of the
`overrideFrozen` flag.

It also moves the initialization of `System.Platform*` and `System.Build*` to
an initialize function so that these can also be set without setting
`overrideFrozen`.

This is preparation for a following commit that will make the frozen flag in
namespaces finial, no longer allowing it to be overriden (freezing the
namespace will disable locking, so performing further updates would be unsafe).
2023-01-19 09:53:36 +01:00
Julian Brost
99bb687350 INITIALIZE_ONCE_WITH_PRIORITY: use enum for priority values
Change the type of the priority values from int to a new enum. By replacing the
magic int values throughout the code base with named values, there is now a
single place where all priority values are defined and you get an overview over
the initialization order.
2023-01-18 15:57:27 +01:00
Alexander A. Klimov
33e609d791 Type#GetLoadDependencies(): avoid malloc()
- cache result
- return it by const ref
- do Type::GetByName() for the callers
2022-11-21 15:07:39 +01:00
Michael Friedrich
d14a88235d Replace Copyright header with a short version, part I
CLion -> replace in path
2019-02-25 14:48:22 +01:00
Michael Friedrich
dab53448bc icinga.com: Update *.{h,c}pp 2018-10-18 09:27:04 +02:00
Michael Friedrich
19993df380 Fix static initializer priority for namespaces in LTO builds
fixes #6575
2018-09-04 16:36:22 +02:00
Gunnar Beutner
1a8692d972 Implement support for namespaces 2018-08-13 13:44:31 +02:00
Jean Flach
c54e042942 Add activation priorities for config object types
This patch ensures that specific configuration types
are pre-activated and post-activated. In general,
logging is first, then common configuration objects
like host/service, downtimes, etc.
In the end, all features are activated after to ensure
that notifications are only sent once downtimes are applied.
A similar thing happens for starting with checks too early.
The ApiListener feature runs first to allow cluster connections
at first glance.

fixes #6057
fixes #6231
2018-05-04 11:25:47 +02:00
Gunnar Beutner
91c256261a Apply clang-tidy fix 'modernize-use-default-member-init' 2018-01-04 12:24:58 +01:00
Gunnar Beutner
e0174b8f3f Apply clang-tidy fix 'modernize-return-braced-init-list' 2018-01-04 12:24:57 +01:00
Gunnar Beutner
ac155d1dda Apply clang-tidy fix 'modernize-redundant-void-arg' 2018-01-04 12:24:57 +01:00
Gunnar Beutner
fe8572d75b Remove inline methods and use explicit template instantiation to minimize the number of weak symbols 2018-01-03 11:04:58 +01:00
Michael Insel
158ae2188e Change copyright header for 2018 2018-01-02 12:08:55 +01:00
Jean Flach
2636e6a77a Whitespace fix
What does this change?
* Remove use of spaces for formatting
These could be found by using `grep -r -l -P '^\t+ +[^*]'
* Removal of training whitespaces
* A few lines longer than 120 chars
2017-12-20 14:53:52 +01:00
Gunnar Beutner
1ad83886ac Replace a few more NULLs with nullptr 2017-12-14 15:37:20 +01:00
Gunnar Beutner
325e4a2fb9 Use nullptr instead of <Type>::Ptr() 2017-11-30 17:47:09 +01:00
Michael Friedrich
b7caf0820d Ensure that *.icinga.com is used everywhere
fixes #13897
fixes #13277
2017-01-10 17:19:12 +01:00
Gunnar Beutner
b5b09216c6 Use lambda functions for INITIALIZE_ONCE
fixes #12562
2016-08-27 09:48:36 +02:00
Gunnar Beutner
288413f046 Replace BOOST_FOREACH with range-based for loops
fixes #12538
2016-08-25 06:46:17 +02:00
Gunnar Beutner
afc1b9bdc5 Move type variables into the 'Types' namespace
refs #12408
2016-08-12 17:05:19 +02:00
Gunnar Beutner
c6a753b67e Make sure base classes are registered in the right order
refs #12408
2016-08-12 14:18:59 +02:00
Gunnar Beutner
eb0892273e Implement the DateTime class
fixes #9839
2016-03-29 13:27:20 +02:00
Gunnar Beutner
599929b0f6 Update copyright headers for 2016 2016-01-12 08:29:59 +01:00
Gunnar Beutner
645f054980 Fix invalid field IDs in Type::GetField
refs #10387
2015-11-05 10:58:09 +01:00
Gunnar Beutner
783b58536f Fix 'Invalid field ID' error when serializing Type objects
refs #10387
2015-11-05 10:52:25 +01:00
Gunnar Beutner
b2829ca522 Fix plural name for the Array type
fixes #10501
2015-11-01 10:35:31 +01:00
Gunnar Beutner
1a6b41787a Implement joins for status queries
fixes #10060
2015-09-22 09:45:23 +02:00
Gunnar Beutner
3afe9a35d8 Implement the 'name' field for types
refs #9076
2015-08-26 13:05:09 +02:00
Gunnar Beutner
3ea71e82c5 Fix incorrect field type for the Type.base field
refs #9076
2015-08-26 11:00:05 +02:00
Gunnar Beutner
ae214db0fc Change base type for 'Type' to 'Object'
refs #9076
2015-08-26 10:58:03 +02:00
Gunnar Beutner
f45f6ccd82 Implement support for tracking dependencies between config objects
refs #9096
2015-08-25 13:54:05 +02:00
Gunnar Beutner
7d6a920b3d Build fix 2015-08-17 11:20:52 +02:00
Gunnar Beutner
ff974d4eee Fix compiler warnings
refs #9081
2015-08-17 10:09:15 +02:00
Gunnar Beutner
a546a67934 Implement the 'base' field for the Type class
fixes #9921
2015-08-17 07:59:44 +02:00
Gunnar Beutner
e2290d5012 Implement support for unregistering objects
refs #9101
2015-08-15 20:07:11 +02:00
Michael Friedrich
d7970f5bb1 Implement modified attributes v2
refs #9081
refs #9093
2015-08-15 20:07:10 +02:00
Gunnar Beutner
ec7224e3ed Generate C++ code for type validators
fixes #7709
fixes #8867
2015-03-27 07:59:27 +01:00
Gunnar Beutner
4da3b1c5b3 Make sure that Notification objects are activated after Host/Service objects
fixes #8517
2015-02-25 12:43:38 +01:00
Michael Friedrich
78bfd0204c Update copyright year 2015-01-22 12:00:23 +01:00
Gunnar Beutner
2ef798f378 Implement missing Type::SetField method
refs #8169
2015-01-14 13:34:52 +01:00
Gunnar Beutner
688e64ce40 Add missing meta type class for the Type class
refs #8169
2015-01-14 09:51:44 +01:00
Gunnar Beutner
1cb0231c05 Refactor how variable scopes work
refs #8074
2014-12-14 11:33:45 +01:00
Gunnar Beutner
aa38dde1fc Implement prototype functions
fixes #8065
2014-12-12 15:22:37 +01:00
Gunnar Beutner
cf2b6e7ccc Improve output of ToString for type objects
fixes #8020
2014-12-08 09:12:40 +01:00
Gunnar Beutner
57f84741b9 Register type objects as global variables
fixes #8019
2014-12-08 08:49:32 +01:00