From 6df9a3b76431762b48211397a8070a6a56e01c0a Mon Sep 17 00:00:00 2001 From: Nicolas Cornu Date: Fri, 13 Dec 2024 17:08:06 +0100 Subject: [PATCH] Put signal outside --- src/nrncvode/netcon.h | 21 +-------------------- src/utils/signal.hpp | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 20 deletions(-) create mode 100644 src/utils/signal.hpp diff --git a/src/nrncvode/netcon.h b/src/nrncvode/netcon.h index 7120032ec2..f65051ceca 100644 --- a/src/nrncvode/netcon.h +++ b/src/nrncvode/netcon.h @@ -7,6 +7,7 @@ #include "nrnneosm.h" #include "pool.hpp" #include "tqitem.hpp" +#include "utils/signal.hpp" #include @@ -211,26 +212,6 @@ class ConditionEvent: public DiscreteEvent { static unsigned long deliver_qthresh_; }; -#include - -template -class signal_ { - public: - template - void connect(F f) { - functors.push_back(f); - } - - void send(T wc) { - for (auto& f: functors) { - std::invoke(f, wc); - } - } - - private: - std::list> functors; -}; - class WatchCondition: public ConditionEvent { public: WatchCondition(Point_process*, double (*)(Point_process*)); diff --git a/src/utils/signal.hpp b/src/utils/signal.hpp new file mode 100644 index 0000000000..49362c8de4 --- /dev/null +++ b/src/utils/signal.hpp @@ -0,0 +1,21 @@ +#pragma + +#include + +template +class signal_ { + public: + template + void connect(F f) { + functors.push_back(f); + } + + void send(T wc) { + for (auto& f: functors) { + std::invoke(f, wc); + } + } + + private: + std::list> functors; +};