From b6ea19deb9dd03609f5cae9ac5b212d3bccd8475 Mon Sep 17 00:00:00 2001 From: Trent Houliston Date: Thu, 21 Sep 2023 19:13:50 +1000 Subject: [PATCH] more constification --- src/dsl/word/emit/UDP.hpp | 2 +- src/dsl/word/emit/Watchdog.hpp | 3 ++- tests/dsl/emit/EmitFusion.cpp | 14 ++++++++++---- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/dsl/word/emit/UDP.hpp b/src/dsl/word/emit/UDP.hpp index 640bfacf3..d27d8450c 100644 --- a/src/dsl/word/emit/UDP.hpp +++ b/src/dsl/word/emit/UDP.hpp @@ -60,7 +60,7 @@ namespace dsl { template struct UDP { - static inline void emit(PowerPlant& /*powerplant*/, + static inline void emit(const PowerPlant& /*powerplant*/, std::shared_ptr data, const std::string& to_addr, in_port_t to_port, diff --git a/src/dsl/word/emit/Watchdog.hpp b/src/dsl/word/emit/Watchdog.hpp index 1374e9f6a..91607607e 100644 --- a/src/dsl/word/emit/Watchdog.hpp +++ b/src/dsl/word/emit/Watchdog.hpp @@ -166,7 +166,8 @@ namespace dsl { struct Watchdog { template - static void emit(PowerPlant& /*powerplant*/, WatchdogServicer& servicer) { + static void emit(const PowerPlant& /*powerplant*/, + WatchdogServicer& servicer) { // Update our service time servicer.service(); } diff --git a/tests/dsl/emit/EmitFusion.cpp b/tests/dsl/emit/EmitFusion.cpp index df14bbc3d..5eca9aea6 100644 --- a/tests/dsl/emit/EmitFusion.cpp +++ b/tests/dsl/emit/EmitFusion.cpp @@ -34,22 +34,28 @@ std::vector events; // NOLINT(cppcoreguidelines-avoid-non-const-gl template struct E1 { - static inline void emit(NUClear::PowerPlant& /*unused*/, std::shared_ptr p, const int& a, const std::string& b) { + static inline void emit(const NUClear::PowerPlant& /*powerplant*/, + std::shared_ptr p, + const int& a, + const std::string& b) { events.push_back("E1a " + *p + " " + std::to_string(a) + " " + b); } - static inline void emit(NUClear::PowerPlant& /*unused*/, std::shared_ptr p, const std::string& c) { + static inline void emit(const NUClear::PowerPlant& /*powerplant*/, std::shared_ptr p, const std::string& c) { events.push_back("E1b " + *p + " " + c); } }; template struct E2 { - static inline void emit(NUClear::PowerPlant& /*unused*/, std::shared_ptr p, const bool& d) { + static inline void emit(const NUClear::PowerPlant& /*powerplant*/, std::shared_ptr p, const bool& d) { events.push_back("E2a " + *p + " " + (d ? "true" : "false")); } - static inline void emit(NUClear::PowerPlant& /*unused*/, std::shared_ptr p, const int& e, const std::string& f) { + static inline void emit(const NUClear::PowerPlant& /*powerplant*/, + std::shared_ptr p, + const int& e, + const std::string& f) { events.push_back("E2b " + *p + " " + std::to_string(e) + " " + f); } };