From 096a5aca0d635aabda391cc4a972038fef9a6bfd Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Wed, 31 Jan 2024 07:56:31 +0100 Subject: [PATCH] TaskTree: Fix internal naming Make it more consistent. Change-Id: I00ced6c742be9e884b328f51e75db552f8c22115 Reviewed-by: Reviewed-by: hjk --- src/libs/solutions/tasking/tasktree.h | 68 +++++++++++++-------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/src/libs/solutions/tasking/tasktree.h b/src/libs/solutions/tasking/tasktree.h index 3851f704f15..e9b626293a5 100644 --- a/src/libs/solutions/tasking/tasktree.h +++ b/src/libs/solutions/tasking/tasktree.h @@ -314,14 +314,14 @@ private: template static GroupSetupHandler wrapGroupSetup(Handler &&handler) { - // S, V stands for: [S]etupResult, [V]oid - static constexpr bool isS = isInvocable(); + // R, V stands for: Setup[R]esult, [V]oid + static constexpr bool isR = isInvocable(); static constexpr bool isV = isInvocable(); - static_assert(isS || isV, + static_assert(isR || isV, "Group setup handler needs to take no arguments and has to return void or SetupResult. " "The passed handler doesn't fulfill these requirements."); return [handler] { - if constexpr (isS) + if constexpr (isR) return std::invoke(handler); std::invoke(handler); return SetupResult::Continue; @@ -330,20 +330,20 @@ private: template static GroupDoneHandler wrapGroupDone(Handler &&handler) { - // D, V, W stands for: [D]oneResult, [V]oid, Done[W]ith - static constexpr bool isDW = isInvocable(); - static constexpr bool isD = isInvocable(); - static constexpr bool isVW = isInvocable(); + // R, V, D stands for: Done[R]esult, [V]oid, [D]oneWith + static constexpr bool isRD = isInvocable(); + static constexpr bool isR = isInvocable(); + static constexpr bool isVD = isInvocable(); static constexpr bool isV = isInvocable(); - static_assert(isDW || isD || isVW || isV, + static_assert(isRD || isR || isVD || isV, "Group done handler needs to take (DoneWith) or (void) as an argument and has to " "return void or DoneResult. The passed handler doesn't fulfill these requirements."); return [handler](DoneWith result) { - if constexpr (isDW) + if constexpr (isRD) return std::invoke(handler, result); - if constexpr (isD) + if constexpr (isR) return std::invoke(handler); - if constexpr (isVW) + if constexpr (isVD) std::invoke(handler, result); else if constexpr (isV) std::invoke(handler); @@ -397,14 +397,14 @@ public: private: template static GroupSetupHandler wrapHandler(Handler &&handler) { - // D, V stands for: [D]oneResult, [V]oid - static constexpr bool isB = isInvocable(); + // R, V stands for: Done[R]esult, [V]oid + static constexpr bool isR = isInvocable(); static constexpr bool isV = isInvocable(); - static_assert(isB || isV, + static_assert(isR || isV, "Sync handler needs to take no arguments and has to return void or DoneResult. " "The passed handler doesn't fulfill these requirements."); return [handler] { - if constexpr (isB) { + if constexpr (isR) { return std::invoke(handler) == DoneResult::Success ? SetupResult::StopWithSuccess : SetupResult::StopWithError; } @@ -461,15 +461,15 @@ private: static InterfaceSetupHandler wrapSetup(Handler &&handler) { if constexpr (std::is_same_v) return {}; // When user passed {} for the setup handler. - // S, V stands for: [S]etupResult, [V]oid - static constexpr bool isS = isInvocable(); + // R, V stands for: Setup[R]esult, [V]oid + static constexpr bool isR = isInvocable(); static constexpr bool isV = isInvocable(); - static_assert(isS || isV, + static_assert(isR || isV, "Task setup handler needs to take (Task &) as an argument and has to return void or " "SetupResult. The passed handler doesn't fulfill these requirements."); return [handler](TaskInterface &taskInterface) { Adapter &adapter = static_cast(taskInterface); - if constexpr (isS) + if constexpr (isR) return std::invoke(handler, *adapter.task()); std::invoke(handler, *adapter.task()); return SetupResult::Continue; @@ -480,34 +480,34 @@ private: static InterfaceDoneHandler wrapDone(Handler &&handler) { if constexpr (std::is_same_v) return {}; // When user passed {} for the done handler. - // D, V, T, W stands for: [D]oneResult, [V]oid, [T]ask, done[W]ith - static constexpr bool isDTW = isInvocable(); - static constexpr bool isDT = isInvocable(); - static constexpr bool isDW = isInvocable(); - static constexpr bool isD = isInvocable(); - static constexpr bool isVTW = isInvocable(); + // R, V, T, D stands for: Done[R]esult, [V]oid, [T]ask, [D]oneWith + static constexpr bool isRTD = isInvocable(); + static constexpr bool isRT = isInvocable(); + static constexpr bool isRD = isInvocable(); + static constexpr bool isR = isInvocable(); + static constexpr bool isVTD = isInvocable(); static constexpr bool isVT = isInvocable(); - static constexpr bool isVW = isInvocable(); + static constexpr bool isVD = isInvocable(); static constexpr bool isV = isInvocable(); - static_assert(isDTW || isDT || isDW || isD || isVTW || isVT || isVW || isV, + static_assert(isRTD || isRT || isRD || isR || isVTD || isVT || isVD || isV, "Task done handler needs to take (const Task &, DoneWith), (const Task &), " "(DoneWith) or (void) as arguments and has to return void or DoneResult. " "The passed handler doesn't fulfill these requirements."); return [handler](const TaskInterface &taskInterface, DoneWith result) { const Adapter &adapter = static_cast(taskInterface); - if constexpr (isDTW) + if constexpr (isRTD) return std::invoke(handler, *adapter.task(), result); - if constexpr (isDT) + if constexpr (isRT) return std::invoke(handler, *adapter.task()); - if constexpr (isDW) + if constexpr (isRD) return std::invoke(handler, result); - if constexpr (isD) + if constexpr (isR) return std::invoke(handler); - if constexpr (isVTW) + if constexpr (isVTD) std::invoke(handler, *adapter.task(), result); else if constexpr (isVT) std::invoke(handler, *adapter.task()); - else if constexpr (isVW) + else if constexpr (isVD) std::invoke(handler, result); else if constexpr (isV) std::invoke(handler);