diff --git a/src/Reactor.hpp b/src/Reactor.hpp index 42095e90..51f8952b 100644 --- a/src/Reactor.hpp +++ b/src/Reactor.hpp @@ -135,9 +135,9 @@ namespace dsl { template struct WatchdogServicer; template - WatchdogServicer ServiceWatchdog(RuntimeType&& data); + std::unique_ptr> ServiceWatchdog(RuntimeType&& data); template - WatchdogServicer ServiceWatchdog(); + std::unique_ptr> ServiceWatchdog(); } // namespace emit } // namespace word } // namespace dsl @@ -272,10 +272,7 @@ class Reactor { /// @copydoc dsl::word::emit::ServiceWatchdog template - auto ServiceWatchdog(Arguments&&... args) - // THIS IS VERY IMPORTANT, the return type must be dependent on the function call - // otherwise it won't check it's valid in SFINAE - -> decltype(dsl::word::emit::ServiceWatchdog(std::forward(args)...)) { + auto ServiceWatchdog(Arguments&&... args) { return dsl::word::emit::ServiceWatchdog(std::forward(args)...); } @@ -368,7 +365,7 @@ class Reactor { util::CallbackGenerator(std::forward(callback))); // Get our tuple from binding our reaction - auto tuple = DSL::bind(reaction, std::get(args)...); + auto tuple = DSL::bind(reaction, std::move(std::get(args))...); auto handle = threading::ReactionHandle(reaction); reactor.reaction_handles.push_back(handle); diff --git a/src/dsl/word/emit/Watchdog.hpp b/src/dsl/word/emit/Watchdog.hpp index 6024ec59..f5754ad0 100644 --- a/src/dsl/word/emit/Watchdog.hpp +++ b/src/dsl/word/emit/Watchdog.hpp @@ -125,8 +125,8 @@ namespace dsl { * @return A WatchdogServicer object which will update the service time of the specified watchdog */ template - WatchdogServicer ServiceWatchdog(RuntimeType&& data) { - return WatchdogServicer(std::forward(data)); + std::unique_ptr> ServiceWatchdog(RuntimeType&& data) { + return std::make_unique>(std::forward(data)); } /** @@ -137,8 +137,8 @@ namespace dsl { * @return WatchdogServicer */ template - WatchdogServicer ServiceWatchdog() { - return WatchdogServicer(); + std::unique_ptr> ServiceWatchdog() { + return std::make_unique>(); } /** @@ -158,9 +158,9 @@ namespace dsl { template static void emit(const PowerPlant& /*powerplant*/, - WatchdogServicer& servicer) { + const std::shared_ptr>& servicer) { // Update our service time - servicer.service(); + servicer->service(); } }; diff --git a/src/util/FunctionFusion.hpp b/src/util/FunctionFusion.hpp index da43a08e..185768a4 100644 --- a/src/util/FunctionFusion.hpp +++ b/src/util/FunctionFusion.hpp @@ -48,11 +48,13 @@ namespace util { * @return The object returned by the called subfunction */ template - auto apply_function_fusion_call(const std::tuple& args, + auto apply_function_fusion_call(std::tuple&& args, const Sequence& /*shared*/, const Sequence& /*selected*/) -> decltype(Function::call(std::get(args)..., std::get(args)...)) { - return Function::call(std::get(args)..., std::get(args)...); + return Function::call( + static_cast>>(std::get(args))..., + static_cast>>(std::get(args))...); } /**