diff --git a/src/dsl/fusion/PostRunFusion.hpp b/src/dsl/fusion/PostRunFusion.hpp index 44be6b4b..a02c15ad 100644 --- a/src/dsl/fusion/PostRunFusion.hpp +++ b/src/dsl/fusion/PostRunFusion.hpp @@ -32,7 +32,7 @@ namespace NUClear { namespace dsl { namespace fusion { - /// Make a SFINAE type to check if a word has a postcondition method + /// Make a SFINAE type to check if a word has a post_run method HAS_NUCLEAR_DSL_METHOD(post_run); // Default case where there are no post_run words diff --git a/src/dsl/fusion/PreRunFusion.hpp b/src/dsl/fusion/PreRunFusion.hpp index c49321ea..4ba83c0a 100644 --- a/src/dsl/fusion/PreRunFusion.hpp +++ b/src/dsl/fusion/PreRunFusion.hpp @@ -26,12 +26,15 @@ #include "../../threading/ReactionTask.hpp" #include "../operation/DSLProxy.hpp" #include "FindWords.hpp" -#include "has_pre_run.hpp" +#include "has_nuclear_dsl_method.hpp" namespace NUClear { namespace dsl { namespace fusion { + /// Make a SFINAE type to check if a word has a pre_run method + HAS_NUCLEAR_DSL_METHOD(pre_run); + // Default case where there are no pre_run words template struct PreRunFuser {}; diff --git a/src/dsl/fusion/ScopeFusion.hpp b/src/dsl/fusion/ScopeFusion.hpp index f63810c5..3257c6d3 100644 --- a/src/dsl/fusion/ScopeFusion.hpp +++ b/src/dsl/fusion/ScopeFusion.hpp @@ -27,12 +27,15 @@ #include "../../util/tuplify.hpp" #include "../operation/DSLProxy.hpp" #include "FindWords.hpp" -#include "has_scope.hpp" +#include "has_nuclear_dsl_method.hpp" namespace NUClear { namespace dsl { namespace fusion { + /// Make a SFINAE type to check if a word has a scope method + HAS_NUCLEAR_DSL_METHOD(scope); + /** * This is our Function Fusion wrapper class that allows it to call scope functions. * diff --git a/src/dsl/fusion/has_pre_run.hpp b/src/dsl/fusion/has_pre_run.hpp deleted file mode 100644 index e09fa726..00000000 --- a/src/dsl/fusion/has_pre_run.hpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2024 NUClear Contributors - * - * This file is part of the NUClear codebase. - * See https://github.com/Fastcode/NUClear for further info. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated - * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE - * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef NUCLEAR_DSL_FUSION_HAS_PRE_RUN_HPP -#define NUCLEAR_DSL_FUSION_HAS_PRE_RUN_HPP - -#include "../../threading/ReactionTask.hpp" -#include "NoOp.hpp" - -namespace NUClear { -namespace dsl { - namespace fusion { - - /** - * SFINAE struct to test if the passed class has a pre_run function that conforms to the NUClear DSL. - * - * @tparam T the class to check - */ - template - struct has_pre_run { - private: - using yes = std::true_type; - using no = std::false_type; - - template - static auto test(int) -> decltype(U::template pre_run(std::declval()), - yes()); - template - static no test(...); - - public: - static constexpr bool value = std::is_same(0)), yes>::value; - }; - - } // namespace fusion -} // namespace dsl -} // namespace NUClear - -#endif // NUCLEAR_DSL_FUSION_HAS_PRE_RUN_HPP diff --git a/src/dsl/fusion/has_scope.hpp b/src/dsl/fusion/has_scope.hpp deleted file mode 100644 index 924dad7e..00000000 --- a/src/dsl/fusion/has_scope.hpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2024 NUClear Contributors - * - * This file is part of the NUClear codebase. - * See https://github.com/Fastcode/NUClear for further info. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated - * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE - * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef NUCLEAR_DSL_FUSION_HAS_SCOPE_HPP -#define NUCLEAR_DSL_FUSION_HAS_SCOPE_HPP - -#include "../../threading/ReactionTask.hpp" -#include "NoOp.hpp" - -namespace NUClear { -namespace dsl { - namespace fusion { - - /** - * SFINAE struct to test if the passed class has a scope function that conforms to the NUClear DSL. - * - * @tparam T the class to check - */ - template - struct has_scope { - private: - using yes = std::true_type; - using no = std::false_type; - - template - static auto test(int) -> decltype(U::template scope(std::declval()), - yes()); - template - static no test(...); - - public: - static constexpr bool value = std::is_same(0)), yes>::value; - }; - - } // namespace fusion -} // namespace dsl -} // namespace NUClear - -#endif // NUCLEAR_DSL_FUSION_HAS_SCOPE_HPP