From 495c048ecefe6ba74941d7e034e6df767403c174 Mon Sep 17 00:00:00 2001 From: wmayer Date: Thu, 21 Dec 2017 22:22:33 +0100 Subject: [PATCH] add helper class to tmp. block a boost signal/slot connection --- src/Base/Tools.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/Base/Tools.h b/src/Base/Tools.h index 9490210888..158c7bb319 100644 --- a/src/Base/Tools.h +++ b/src/Base/Tools.h @@ -30,6 +30,7 @@ #include #include #include +#include #include namespace Base @@ -146,6 +147,8 @@ private: Private* d; }; +// ---------------------------------------------------------------------------- + template class ObjectStatusLocker { @@ -162,6 +165,23 @@ private: // ---------------------------------------------------------------------------- +class ConnectionBlocker { + typedef boost::BOOST_SIGNALS_NAMESPACE::connection Connection; + bool b; + Connection& c; + +public: + ConnectionBlocker(Connection& c) : c(c) { + b = c.blocked(); + c.block(true); + } + ~ConnectionBlocker() { + c.block(b); + } +}; + +// ---------------------------------------------------------------------------- + struct BaseExport Tools { static std::string getUniqueName(const std::string&, const std::vector&,int d=0);