From 015605410cbccaeaa8e09f719dcd54bca07e73dd Mon Sep 17 00:00:00 2001 From: GhostofCookie Date: Fri, 10 Jan 2025 09:41:46 -0500 Subject: [PATCH 1/2] Fix complete or variadic conversions only using the first conversion function. --- include/flow/core/NodeFactory.hpp | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/include/flow/core/NodeFactory.hpp b/include/flow/core/NodeFactory.hpp index 283ffd2..b45c3f1 100644 --- a/include/flow/core/NodeFactory.hpp +++ b/include/flow/core/NodeFactory.hpp @@ -88,8 +88,7 @@ class NodeFactory * @param converter The conversion function to use. */ template - void RegisterUnidirectionalConversion( - const TypeRegistry::ConversionFunc& converter = TypeRegistry::Convert); + void RegisterUnidirectionalConversion(); /** * @brief Registers bidirectional conversions between several types. @@ -101,9 +100,7 @@ class NodeFactory * @param to_from_converter The conversion function to use to convert To/Ts to From. */ template - void RegisterBidirectionalConversion( - const TypeRegistry::ConversionFunc& from_to_converter = TypeRegistry::Convert, - const TypeRegistry::ConversionFunc& to_from_converter = TypeRegistry::Convert); + void RegisterBidirectionalConversion(); /** * @brief Registers conversions between all given types. @@ -195,6 +192,16 @@ class NodeFactory { } + template + void RegisterUnidirectionalConversion() + { + } + + template + void RegisterBidirectionalConversion() + { + } + public: /** * @brief Event dispatcher that runs every time a new node class is registered. @@ -290,18 +297,18 @@ void* NodeFactory::ConstructorHelper(const std::string& uuid_str, const std::str } template -void NodeFactory::RegisterUnidirectionalConversion(const TypeRegistry::ConversionFunc& converter) +void NodeFactory::RegisterUnidirectionalConversion() { - _conversion_registry.RegisterUnidirectionalConversion(converter); - (_conversion_registry.RegisterUnidirectionalConversion(converter), ...); + _conversion_registry.RegisterUnidirectionalConversion(TypeRegistry::Convert); + RegisterUnidirectionalConversion(); } template -void NodeFactory::RegisterBidirectionalConversion(const TypeRegistry::ConversionFunc& from_to_converter, - const TypeRegistry::ConversionFunc& to_from_converter) +void NodeFactory::RegisterBidirectionalConversion() { - _conversion_registry.RegisterBidirectionalConversion(from_to_converter, to_from_converter); - (_conversion_registry.RegisterBidirectionalConversion(from_to_converter, to_from_converter), ...); + _conversion_registry.RegisterBidirectionalConversion(TypeRegistry::Convert, + TypeRegistry::Convert); + RegisterBidirectionalConversion(); } template From 245e84a8aa278aaa8aa6a43f657c6aba4417ee5f Mon Sep 17 00:00:00 2001 From: GhostofCookie Date: Fri, 10 Jan 2025 10:00:57 -0500 Subject: [PATCH 2/2] Adding back some functionality but keeping the bug fix. --- include/flow/core/NodeFactory.hpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/include/flow/core/NodeFactory.hpp b/include/flow/core/NodeFactory.hpp index b45c3f1..65bbeeb 100644 --- a/include/flow/core/NodeFactory.hpp +++ b/include/flow/core/NodeFactory.hpp @@ -88,7 +88,8 @@ class NodeFactory * @param converter The conversion function to use. */ template - void RegisterUnidirectionalConversion(); + void RegisterUnidirectionalConversion( + const TypeRegistry::ConversionFunc& converter = TypeRegistry::Convert); /** * @brief Registers bidirectional conversions between several types. @@ -100,7 +101,9 @@ class NodeFactory * @param to_from_converter The conversion function to use to convert To/Ts to From. */ template - void RegisterBidirectionalConversion(); + void RegisterBidirectionalConversion( + const TypeRegistry::ConversionFunc& from_to_converter = TypeRegistry::Convert, + const TypeRegistry::ConversionFunc& to_from_converter = TypeRegistry::Convert); /** * @brief Registers conversions between all given types. @@ -297,17 +300,17 @@ void* NodeFactory::ConstructorHelper(const std::string& uuid_str, const std::str } template -void NodeFactory::RegisterUnidirectionalConversion() +void NodeFactory::RegisterUnidirectionalConversion(const TypeRegistry::ConversionFunc& converter) { - _conversion_registry.RegisterUnidirectionalConversion(TypeRegistry::Convert); + _conversion_registry.RegisterUnidirectionalConversion(converter); RegisterUnidirectionalConversion(); } template -void NodeFactory::RegisterBidirectionalConversion() +void NodeFactory::RegisterBidirectionalConversion(const TypeRegistry::ConversionFunc& from_to_converter, + const TypeRegistry::ConversionFunc& to_from_converter) { - _conversion_registry.RegisterBidirectionalConversion(TypeRegistry::Convert, - TypeRegistry::Convert); + _conversion_registry.RegisterBidirectionalConversion(from_to_converter, to_from_converter); RegisterBidirectionalConversion(); }