13 #ifndef __UT_SUBSYSTEM_H__
14 #define __UT_SUBSYSTEM_H__
18 #define UT_ENABLE_SUBSYSTEMS
26 #include <type_traits>
64 template <
typename SubSystemT>
68 std::is_base_of_v<UT_ISubSystem, SubSystemT>
69 && std::is_default_constructible_v<SubSystemT>);
77 virtual void initialize_() = 0;
79 virtual void shutdown_() = 0;
81 friend class ut_SubSystemRegistry;
86 #define UT_SUBSYSTEM_CLASS(sub_type) \
88 static constexpr Type subsystem_type = UT_ISubSystem::Type::sub_type; \
89 Type type() const override \
91 return subsystem_type; \
95 static bool theIsRegistered;
97 #define UT_SUBSYSTEM_IMPL_INNER(cls) \
98 static SYS_StaticInit<cls> theSubSystem; \
99 static void cls##Init() \
101 UT_ISubSystem::registerSubSystem<cls>(*theSubSystem); \
103 static void cls##CleanUp() \
107 #define UT_SUBSYSTEM_IMPL(cls) \
108 namespace cls_Namespace \
110 UT_SUBSYSTEM_IMPL_INNER(cls) \
111 SYSimplementStaticInit(cls); \
114 #define UT_SUBSYSTEM_DECLARE(api, cls) \
115 namespace cls_Namespace \
117 SYSdeclareStaticInit(api, cls) \
134 friend class ut_SubSystemAccessor;
152 namespace UT_SubSystemImpl
159 template <
typename T>
163 static_assert(std::is_base_of_v<UT_ISubSystem, T>);
169 #endif // __UT_SUBSYSTEM_H__
The subsystem to initialize and cleanup UT.
virtual void shutdown_()=0
Shutdown this subsystem.
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
SYS_NO_DISCARD_RESULT SYS_FORCE_INLINE constexpr T * SYSaddressof(T &val) noexcept
UT_API void UTsubSystemShutdown()
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
UT_API UT_ThreadIOPool & UThoudiniIOPool()
#define UT_SUBSYSTEM_CLASS(sub_type)
static bool registerSubSystem(SubSystemT &subsys)
#define UT_SUBSYSTEM_DECLARE(api, cls)
SYSdeclareStaticObject(UT_API, theRegistry)
virtual void initialize_()=0
Initialize this subsystem.
UT_API void UTsubSystemInitialize()
Initialize all subsystems.
UT_API UT_ISubSystem * utGetSubSystem(UT_SubSystem::Type t)