10 #ifndef smtk_task_json_Configurator_h
11 #define smtk_task_json_Configurator_h
13 #include "smtk/task/Task.h"
15 #include "smtk/common/Managers.h"
18 #include "nlohmann/json.hpp"
34 SMTKCORE_EXPORT std::mutex& typeMutex();
36 typedef std::mutex& (*TypeMutexFunction)();
42 template<
typename ObjectType, TypeMutexFunction = &smtk::task::json::typeMutex>
48 std::function<
typename ObjectType::Configuration(
const ObjectType*,
Helper&)>;
53 using HelperTypeMap = std::unordered_map<std::string, ConfigurationHelper>;
60 using json = nlohmann::json;
77 template<
typename ClassList,
typename HelperList>
78 inline static bool registerTypes();
80 template<
typename ClassList>
81 inline static bool unregisterTypes();
83 template<std::
size_t I,
typename ClassList,
class HelperList>
84 inline static typename std::enable_if<I != std::tuple_size<ClassList>::value,
bool>::type
87 template<std::
size_t I,
typename ClassList,
class HelperList>
88 inline static typename std::enable_if<I == std::tuple_size<ClassList>::value,
bool>::type
91 template<std::
size_t I,
typename ClassList>
92 inline static typename std::enable_if<I != std::tuple_size<ClassList>::value,
bool>::type
95 template<std::
size_t I,
typename ClassList>
96 inline static typename std::enable_if<I == std::tuple_size<ClassList>::value,
bool>::type
101 inline static bool unregisterType(
const std::string&
typeName);
104 typename ObjectType::Configuration configuration(
const ObjectType*
object);
123 void clearNestedSwizzles();
127 SwizzleId nestedSwizzleId(
const ObjectType*
object);
131 SwizzleId swizzleId(
const ObjectType*
object);
136 bool setSwizzleId(
const ObjectType*
object,
SwizzleId swizzle);
139 ObjectType* unswizzle(
SwizzleId objectId)
const;
142 void currentObjects(std::vector<ObjectType*>& objects,
SwizzleId start = 2);
146 std::unordered_map<ObjectType*, SwizzleId> m_swizzleFwd;
147 std::map<SwizzleId, ObjectType*> m_swizzleBck;
150 static HelperTypeMap s_types;
157 #endif // smtk_task_json_Configurator_h