14#ifndef IOX2_BB_DESIGN_POLYMORPHIC_HANDLER_HPP
15#define IOX2_BB_DESIGN_POLYMORPHIC_HANDLER_HPP
29template <
typename Interface>
56template <
typename Interface,
typename Default,
typename Hooks = detail::DefaultHooks<Interface>>
58 static_assert(std::is_base_of<Interface, Default>::value,
"Interface must be a base class of Default");
115 concurrent::Atomic<
bool> m_isFinal {
false };
122#include "iox2/legacy/detail/polymorphic_handler.inl"
Implements a singleton handler that has a default instance and can be changed to another instance at ...
static bool reset() noexcept
reset the current singleton instance to the default instance
static StaticLifetimeGuard< Self > guard() noexcept
returns a lifetime guard whose existence guarantees the created PolymorphicHandler singleton instance...
static Interface & get() noexcept
obtain the current singleton instance
static void finalize() noexcept
finalizes the instance, afterwards Hooks::onSetAfterFinalize will be called during the remaining prog...
static bool set(StaticLifetimeGuard< Handler > handlerGuard) noexcept
set the current singleton instance
Manages a static instance of type T in a way so that each existing StaticLifetimeGuard prevents the d...
A thin wrapper for a 'std::atomic' which ensures that all atomic operations are always lock-free in o...
constexpr bool always_false_v
Helper value to bind a static_assert to a type.
default hooks for the PolymorphicHandler
static void onSetAfterFinalize(Interface ¤tInstance, Interface &newInstance) noexcept
called if the polymorphic handler is set or reset after finalize