13 #ifndef __UT_SUBSYSTEM_H__
14 #define __UT_SUBSYSTEM_H__
18 #define UT_ENABLE_SUBSYSTEMS
26 #include <type_traits>
53 template <
typename SubSystemT>
57 std::is_base_of_v<UT_ISubSystem, SubSystemT>
58 && std::is_default_constructible_v<SubSystemT>);
66 virtual void initialize_() = 0;
68 virtual void shutdown_() = 0;
70 friend class ut_SubSystemRegistry;
75 #define UT_SUBSYSTEM_CLASS(sub_type) \
77 static constexpr Type subsystem_type = UT_ISubSystem::Type::sub_type; \
78 Type type() const override \
80 return subsystem_type; \
84 static bool theIsRegistered;
86 #define UT_SUBSYSTEM_IMPL_INNER(cls) \
87 static SYS_StaticInit<cls> theSubSystem; \
88 static void cls##Init() \
90 UT_ISubSystem::registerSubSystem<cls>(*theSubSystem); \
92 static void cls##CleanUp() \
96 #define UT_SUBSYSTEM_IMPL(cls) \
97 namespace cls_Namespace \
99 UT_SUBSYSTEM_IMPL_INNER(cls) \
100 SYSimplementStaticInit(cls); \
103 #define UT_SUBSYSTEM_DECLARE(api, cls) \
104 namespace cls_Namespace \
106 SYSdeclareStaticInit(api, cls) \
123 friend class ut_SubSystemAccessor;
141 namespace UT_SubSystemImpl
148 template <
typename T>
152 static_assert(std::is_base_of_v<UT_ISubSystem, T>);
158 #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)