From 8183038080a2c388352d25bc1118433e7c7dd7da Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Mon, 28 Feb 2022 15:57:32 +0100 Subject: [PATCH] Pass std::function by const reference (sonar). --- src/mc/explo/SafetyChecker.hpp | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/mc/explo/SafetyChecker.hpp b/src/mc/explo/SafetyChecker.hpp index 3cd00c7b89..9426e2c3fd 100644 --- a/src/mc/explo/SafetyChecker.hpp +++ b/src/mc/explo/SafetyChecker.hpp @@ -43,22 +43,31 @@ public: void log_state() override; /** Called once when the exploration starts */ - static void on_exploration_start(std::function f) { on_exploration_start_signal.connect(f); } + static void on_exploration_start(std::function const& f) { on_exploration_start_signal.connect(f); } /** Called each time that the exploration backtracks from a exploration end */ - static void on_backtracking(std::function f) { on_backtracking_signal.connect(f); } + static void on_backtracking(std::function const& f) { on_backtracking_signal.connect(f); } /** Called each time that a new state is create */ - static void on_state_creation(std::function f) { on_state_creation_signal.connect(f); } + static void on_state_creation(std::function const& f) { on_state_creation_signal.connect(f); } /** Called when rollbacking directly onto a previously checkpointed state */ - static void on_restore_system_state(std::function f) { on_restore_system_state_signal.connect(f); } + static void on_restore_system_state(std::function const& f) + { + on_restore_system_state_signal.connect(f); + } /** Called when the state to which we backtrack was not checkpointed state, forcing us to restore the initial state * before replaying some transitions */ - static void on_restore_initial_state(std::function f) { on_restore_initial_state_signal.connect(f); } + static void on_restore_initial_state(std::function const& f) { on_restore_initial_state_signal.connect(f); } /** Called when replaying a transition that was previously executed, to reach a backtracked state */ - static void on_transition_replay(std::function f) { on_transition_replay_signal.connect(f); } + static void on_transition_replay(std::function const& f) + { + on_transition_replay_signal.connect(f); + } /** Called when executing a new transition */ - static void on_transition_execute(std::function f) { on_transition_execute_signal.connect(f); } + static void on_transition_execute(std::function const& f) + { + on_transition_execute_signal.connect(f); + } /** Called when displaying the statistics at the end of the exploration */ - static void on_log_state(std::function f) { on_log_state_signal.connect(f); } + static void on_log_state(std::function const& f) { on_log_state_signal.connect(f); } private: void check_non_termination(const State* current_state); -- 2.30.2