From 0915b3ef56dfac3113cce55a59a5765dc94976be Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 14:34:54 +0200 Subject: Adding upstream version 2.13.6. Signed-off-by: Daniel Baumann --- lib/config/activationcontext.hpp | 46 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 lib/config/activationcontext.hpp (limited to 'lib/config/activationcontext.hpp') diff --git a/lib/config/activationcontext.hpp b/lib/config/activationcontext.hpp new file mode 100644 index 0000000..3fe5d09 --- /dev/null +++ b/lib/config/activationcontext.hpp @@ -0,0 +1,46 @@ +/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */ + +#ifndef ACTIVATIONCONTEXT_H +#define ACTIVATIONCONTEXT_H + +#include "config/i2-config.hpp" +#include "base/object.hpp" +#include +#include + +namespace icinga +{ + +class ActivationContext final : public Object +{ +public: + DECLARE_PTR_TYPEDEFS(ActivationContext); + + static ActivationContext::Ptr GetCurrentContext(); + +private: + static void PushContext(const ActivationContext::Ptr& context); + static void PopContext(); + + static std::stack& GetActivationStack(); + + static boost::thread_specific_ptr > m_ActivationStack; + + friend class ActivationScope; +}; + +class ActivationScope +{ +public: + ActivationScope(ActivationContext::Ptr context = nullptr); + ~ActivationScope(); + + ActivationContext::Ptr GetContext() const; + +private: + ActivationContext::Ptr m_Context; +}; + +} + +#endif /* ACTIVATIONCONTEXT_H */ -- cgit v1.2.3