From f012a84e62a2afa0a788c8d77b96b268d7b7a72f Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 14 May 2012 17:46:07 +0000 Subject: [PATCH] Build libs/pbd/pbd/signal.h from its generator python script. git-svn-id: svn://localhost/ardour2/branches/3.0@12268 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/pbd/pbd/signal.h | 903 ------------------------------------------ libs/pbd/wscript | 4 + 2 files changed, 4 insertions(+), 903 deletions(-) delete mode 100644 libs/pbd/pbd/signal.h diff --git a/libs/pbd/pbd/signal.h b/libs/pbd/pbd/signal.h deleted file mode 100644 index 5eb8520a6f..0000000000 --- a/libs/pbd/pbd/signal.h +++ /dev/null @@ -1,903 +0,0 @@ - -/** THIS FILE IS AUTOGENERATED: DO NOT EDIT. - * - * This file is generated by signals.h.py. - */ - -#include -#include -#include -#include -#include -#include -#include "pbd/stacktrace.h" - -namespace PBD { - -class Connection; - -class SignalBase : public boost::enable_shared_from_this -{ -public: - virtual ~SignalBase () {} - virtual void disconnect (boost::shared_ptr) = 0; - -protected: - boost::mutex _mutex; -}; - -class Connection : public boost::enable_shared_from_this -{ -public: - Connection (boost::shared_ptr b) : _signal (b) {} - - void disconnect () - { - if (_signal) { - _signal->disconnect (shared_from_this ()); - } - } - -private: - boost::shared_ptr _signal; -}; - -template -class OptionalLastValue -{ -public: - typedef boost::optional result_type; - - template - result_type operator() (Iter first, Iter last) const { - result_type r; - while (first != last) { - r = *first; - ++first; - } - - return r; - } -}; - -template > -class SimpleSignal0 : public SignalBase -{ -public: - - typedef boost::function slot_function_type; - typedef boost::optional result_type; -private: - - - typedef std::map, slot_function_type> Slots; - Slots _slots; - -public: - - - boost::shared_ptr connect (slot_function_type f) - { - boost::shared_ptr c (new Connection (shared_from_this ())); - boost::mutex::scoped_lock lm (_mutex); - _slots[c] = f; - return c; - } - - typename C::result_type emit () - { - Slots s; - { - boost::mutex::scoped_lock lm (_mutex); - s = _slots; - } - std::list r; - for (typename Slots::iterator i = s.begin(); i != s.end(); ++i) { - - bool still_there = false; - { - boost::mutex::scoped_lock lm (_mutex); - still_there = _slots.find (i->first) != _slots.end (); - } - - if (still_there) { - r.push_back ((i->second)()); - } - } - C c; - return c (r.begin(), r.end()); - } - - bool empty () { - boost::mutex::scoped_lock lm (_mutex); - return _slots.empty (); - } - - static boost::shared_ptr > create () - { - return boost::shared_ptr > (new SimpleSignal0); - } - -private: - - friend class Connection; - - SimpleSignal0 () {} - - void disconnect (boost::shared_ptr c) - { - boost::mutex::scoped_lock lm (_mutex); - _slots.erase (c); - } -}; - -template <> -class SimpleSignal0 : public SignalBase -{ -public: - - typedef boost::function slot_function_type; - typedef void result_type; -private: - - - typedef std::map, slot_function_type> Slots; - Slots _slots; - -public: - - - boost::shared_ptr connect (slot_function_type f) - { - boost::shared_ptr c (new Connection (shared_from_this ())); - boost::mutex::scoped_lock lm (_mutex); - _slots[c] = f; - return c; - } - - void emit () - { - Slots s; - { - boost::mutex::scoped_lock lm (_mutex); - s = _slots; - } - -#if __GNUC__ > 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ >= 6)) - for (typename Slots::iterator i = s.begin(); i != s.end(); ++i) { -#else - for (Slots::iterator i = s.begin(); i != s.end(); ++i) { -#endif - - - bool still_there = false; - { - boost::mutex::scoped_lock lm (_mutex); - still_there = _slots.find (i->first) != _slots.end (); - } - - if (still_there) { - (i->second)(); - } - } - } - - bool empty () { - boost::mutex::scoped_lock lm (_mutex); - return _slots.empty (); - } - - static boost::shared_ptr > create () - { - return boost::shared_ptr > (new SimpleSignal0); - } - -private: - - friend class Connection; - - SimpleSignal0 () {} - - void disconnect (boost::shared_ptr c) - { - boost::mutex::scoped_lock lm (_mutex); - _slots.erase (c); - } -}; - -template > -class SimpleSignal1 : public SignalBase -{ -public: - - typedef boost::function slot_function_type; - typedef boost::optional result_type; -private: - - - typedef std::map, slot_function_type> Slots; - Slots _slots; - -public: - - - boost::shared_ptr connect (slot_function_type f) - { - boost::shared_ptr c (new Connection (shared_from_this ())); - boost::mutex::scoped_lock lm (_mutex); - _slots[c] = f; - return c; - } - - typename C::result_type emit (A1 a1) - { - Slots s; - { - boost::mutex::scoped_lock lm (_mutex); - s = _slots; - } - std::list r; - for (typename Slots::iterator i = s.begin(); i != s.end(); ++i) { - - bool still_there = false; - { - boost::mutex::scoped_lock lm (_mutex); - still_there = _slots.find (i->first) != _slots.end (); - } - - if (still_there) { - r.push_back ((i->second)(a1)); - } - } - C c; - return c (r.begin(), r.end()); - } - - bool empty () { - boost::mutex::scoped_lock lm (_mutex); - return _slots.empty (); - } - - static boost::shared_ptr > create () - { - return boost::shared_ptr > (new SimpleSignal1); - } - -private: - - friend class Connection; - - SimpleSignal1 () {} - - void disconnect (boost::shared_ptr c) - { - boost::mutex::scoped_lock lm (_mutex); - _slots.erase (c); - } -}; - -template -class SimpleSignal1 : public SignalBase -{ -public: - - typedef boost::function slot_function_type; - typedef void result_type; -private: - - - typedef std::map, slot_function_type> Slots; - Slots _slots; - -public: - - - boost::shared_ptr connect (slot_function_type f) - { - boost::shared_ptr c (new Connection (shared_from_this ())); - boost::mutex::scoped_lock lm (_mutex); - _slots[c] = f; - return c; - } - - void emit (A1 a1) - { - Slots s; - { - boost::mutex::scoped_lock lm (_mutex); - s = _slots; - } - for (typename Slots::iterator i = s.begin(); i != s.end(); ++i) { - - bool still_there = false; - { - boost::mutex::scoped_lock lm (_mutex); - still_there = _slots.find (i->first) != _slots.end (); - } - - if (still_there) { - (i->second)(a1); - } - } - } - - bool empty () { - boost::mutex::scoped_lock lm (_mutex); - return _slots.empty (); - } - - static boost::shared_ptr > create () - { - return boost::shared_ptr > (new SimpleSignal1); - } - -private: - - friend class Connection; - - SimpleSignal1 () {} - - void disconnect (boost::shared_ptr c) - { - boost::mutex::scoped_lock lm (_mutex); - _slots.erase (c); - } -}; - -template > -class SimpleSignal2 : public SignalBase -{ -public: - - typedef boost::function slot_function_type; - typedef boost::optional result_type; -private: - - - typedef std::map, slot_function_type> Slots; - Slots _slots; - -public: - - - boost::shared_ptr connect (slot_function_type f) - { - boost::shared_ptr c (new Connection (shared_from_this ())); - boost::mutex::scoped_lock lm (_mutex); - _slots[c] = f; - return c; - } - - typename C::result_type emit (A1 a1, A2 a2) - { - Slots s; - { - boost::mutex::scoped_lock lm (_mutex); - s = _slots; - } - std::list r; - for (typename Slots::iterator i = s.begin(); i != s.end(); ++i) { - - bool still_there = false; - { - boost::mutex::scoped_lock lm (_mutex); - still_there = _slots.find (i->first) != _slots.end (); - } - - if (still_there) { - r.push_back ((i->second)(a1, a2)); - } - } - C c; - return c (r.begin(), r.end()); - } - - bool empty () { - boost::mutex::scoped_lock lm (_mutex); - return _slots.empty (); - } - - static boost::shared_ptr > create () - { - return boost::shared_ptr > (new SimpleSignal2); - } - -private: - - friend class Connection; - - SimpleSignal2 () {} - - void disconnect (boost::shared_ptr c) - { - boost::mutex::scoped_lock lm (_mutex); - _slots.erase (c); - } -}; - -template -class SimpleSignal2 : public SignalBase -{ -public: - - typedef boost::function slot_function_type; - typedef void result_type; -private: - - - typedef std::map, slot_function_type> Slots; - Slots _slots; - -public: - - - boost::shared_ptr connect (slot_function_type f) - { - boost::shared_ptr c (new Connection (shared_from_this ())); - boost::mutex::scoped_lock lm (_mutex); - _slots[c] = f; - return c; - } - - void emit (A1 a1, A2 a2) - { - Slots s; - { - boost::mutex::scoped_lock lm (_mutex); - s = _slots; - } - for (typename Slots::iterator i = s.begin(); i != s.end(); ++i) { - - bool still_there = false; - { - boost::mutex::scoped_lock lm (_mutex); - still_there = _slots.find (i->first) != _slots.end (); - } - - if (still_there) { - (i->second)(a1, a2); - } - } - } - - bool empty () { - boost::mutex::scoped_lock lm (_mutex); - return _slots.empty (); - } - - static boost::shared_ptr > create () - { - return boost::shared_ptr > (new SimpleSignal2); - } - -private: - - friend class Connection; - - SimpleSignal2 () {} - - void disconnect (boost::shared_ptr c) - { - boost::mutex::scoped_lock lm (_mutex); - _slots.erase (c); - } -}; - -template > -class SimpleSignal3 : public SignalBase -{ -public: - - typedef boost::function slot_function_type; - typedef boost::optional result_type; -private: - - - typedef std::map, slot_function_type> Slots; - Slots _slots; - -public: - - - boost::shared_ptr connect (slot_function_type f) - { - boost::shared_ptr c (new Connection (shared_from_this ())); - boost::mutex::scoped_lock lm (_mutex); - _slots[c] = f; - return c; - } - - typename C::result_type emit (A1 a1, A2 a2, A3 a3) - { - Slots s; - { - boost::mutex::scoped_lock lm (_mutex); - s = _slots; - } - std::list r; - for (typename Slots::iterator i = s.begin(); i != s.end(); ++i) { - - bool still_there = false; - { - boost::mutex::scoped_lock lm (_mutex); - still_there = _slots.find (i->first) != _slots.end (); - } - - if (still_there) { - r.push_back ((i->second)(a1, a2, a3)); - } - } - C c; - return c (r.begin(), r.end()); - } - - bool empty () { - boost::mutex::scoped_lock lm (_mutex); - return _slots.empty (); - } - - static boost::shared_ptr > create () - { - return boost::shared_ptr > (new SimpleSignal3); - } - -private: - - friend class Connection; - - SimpleSignal3 () {} - - void disconnect (boost::shared_ptr c) - { - boost::mutex::scoped_lock lm (_mutex); - _slots.erase (c); - } -}; - -template -class SimpleSignal3 : public SignalBase -{ -public: - - typedef boost::function slot_function_type; - typedef void result_type; -private: - - - typedef std::map, slot_function_type> Slots; - Slots _slots; - -public: - - - boost::shared_ptr connect (slot_function_type f) - { - boost::shared_ptr c (new Connection (shared_from_this ())); - boost::mutex::scoped_lock lm (_mutex); - _slots[c] = f; - return c; - } - - void emit (A1 a1, A2 a2, A3 a3) - { - Slots s; - { - boost::mutex::scoped_lock lm (_mutex); - s = _slots; - } - for (typename Slots::iterator i = s.begin(); i != s.end(); ++i) { - - bool still_there = false; - { - boost::mutex::scoped_lock lm (_mutex); - still_there = _slots.find (i->first) != _slots.end (); - } - - if (still_there) { - (i->second)(a1, a2, a3); - } - } - } - - bool empty () { - boost::mutex::scoped_lock lm (_mutex); - return _slots.empty (); - } - - static boost::shared_ptr > create () - { - return boost::shared_ptr > (new SimpleSignal3); - } - -private: - - friend class Connection; - - SimpleSignal3 () {} - - void disconnect (boost::shared_ptr c) - { - boost::mutex::scoped_lock lm (_mutex); - _slots.erase (c); - } -}; - -template > -class SimpleSignal4 : public SignalBase -{ -public: - - typedef boost::function slot_function_type; - typedef boost::optional result_type; -private: - - - typedef std::map, slot_function_type> Slots; - Slots _slots; - -public: - - - boost::shared_ptr connect (slot_function_type f) - { - boost::shared_ptr c (new Connection (shared_from_this ())); - boost::mutex::scoped_lock lm (_mutex); - _slots[c] = f; - return c; - } - - typename C::result_type emit (A1 a1, A2 a2, A3 a3, A4 a4) - { - Slots s; - { - boost::mutex::scoped_lock lm (_mutex); - s = _slots; - } - std::list r; - for (typename Slots::iterator i = s.begin(); i != s.end(); ++i) { - - bool still_there = false; - { - boost::mutex::scoped_lock lm (_mutex); - still_there = _slots.find (i->first) != _slots.end (); - } - - if (still_there) { - r.push_back ((i->second)(a1, a2, a3, a4)); - } - } - C c; - return c (r.begin(), r.end()); - } - - bool empty () { - boost::mutex::scoped_lock lm (_mutex); - return _slots.empty (); - } - - static boost::shared_ptr > create () - { - return boost::shared_ptr > (new SimpleSignal4); - } - -private: - - friend class Connection; - - SimpleSignal4 () {} - - void disconnect (boost::shared_ptr c) - { - boost::mutex::scoped_lock lm (_mutex); - _slots.erase (c); - } -}; - -template -class SimpleSignal4 : public SignalBase -{ -public: - - typedef boost::function slot_function_type; - typedef void result_type; -private: - - - typedef std::map, slot_function_type> Slots; - Slots _slots; - -public: - - - boost::shared_ptr connect (slot_function_type f) - { - boost::shared_ptr c (new Connection (shared_from_this ())); - boost::mutex::scoped_lock lm (_mutex); - _slots[c] = f; - return c; - } - - void emit (A1 a1, A2 a2, A3 a3, A4 a4) - { - Slots s; - { - boost::mutex::scoped_lock lm (_mutex); - s = _slots; - } - for (typename Slots::iterator i = s.begin(); i != s.end(); ++i) { - - bool still_there = false; - { - boost::mutex::scoped_lock lm (_mutex); - still_there = _slots.find (i->first) != _slots.end (); - } - - if (still_there) { - (i->second)(a1, a2, a3, a4); - } - } - } - - bool empty () { - boost::mutex::scoped_lock lm (_mutex); - return _slots.empty (); - } - - static boost::shared_ptr > create () - { - return boost::shared_ptr > (new SimpleSignal4); - } - -private: - - friend class Connection; - - SimpleSignal4 () {} - - void disconnect (boost::shared_ptr c) - { - boost::mutex::scoped_lock lm (_mutex); - _slots.erase (c); - } -}; - -template > -class SimpleSignal5 : public SignalBase -{ -public: - - typedef boost::function slot_function_type; - typedef boost::optional result_type; -private: - - - typedef std::map, slot_function_type> Slots; - Slots _slots; - -public: - - - boost::shared_ptr connect (slot_function_type f) - { - boost::shared_ptr c (new Connection (shared_from_this ())); - boost::mutex::scoped_lock lm (_mutex); - _slots[c] = f; - return c; - } - - typename C::result_type emit (A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) - { - Slots s; - { - boost::mutex::scoped_lock lm (_mutex); - s = _slots; - } - std::list r; - for (typename Slots::iterator i = s.begin(); i != s.end(); ++i) { - - bool still_there = false; - { - boost::mutex::scoped_lock lm (_mutex); - still_there = _slots.find (i->first) != _slots.end (); - } - - if (still_there) { - r.push_back ((i->second)(a1, a2, a3, a4, a5)); - } - } - C c; - return c (r.begin(), r.end()); - } - - bool empty () { - boost::mutex::scoped_lock lm (_mutex); - return _slots.empty (); - } - - static boost::shared_ptr > create () - { - return boost::shared_ptr > (new SimpleSignal5); - } - -private: - - friend class Connection; - - SimpleSignal5 () {} - - void disconnect (boost::shared_ptr c) - { - boost::mutex::scoped_lock lm (_mutex); - _slots.erase (c); - } -}; - -template -class SimpleSignal5 : public SignalBase -{ -public: - - typedef boost::function slot_function_type; - typedef void result_type; -private: - - - typedef std::map, slot_function_type> Slots; - Slots _slots; - -public: - - - boost::shared_ptr connect (slot_function_type f) - { - boost::shared_ptr c (new Connection (shared_from_this ())); - boost::mutex::scoped_lock lm (_mutex); - _slots[c] = f; - return c; - } - - void emit (A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) - { - Slots s; - { - boost::mutex::scoped_lock lm (_mutex); - s = _slots; - } - for (typename Slots::iterator i = s.begin(); i != s.end(); ++i) { - - bool still_there = false; - { - boost::mutex::scoped_lock lm (_mutex); - still_there = _slots.find (i->first) != _slots.end (); - } - - if (still_there) { - (i->second)(a1, a2, a3, a4, a5); - } - } - } - - bool empty () { - boost::mutex::scoped_lock lm (_mutex); - return _slots.empty (); - } - - static boost::shared_ptr > create () - { - return boost::shared_ptr > (new SimpleSignal5); - } - -private: - - friend class Connection; - - SimpleSignal5 () {} - - void disconnect (boost::shared_ptr c) - { - boost::mutex::scoped_lock lm (_mutex); - _slots.erase (c); - } -}; - -} diff --git a/libs/pbd/wscript b/libs/pbd/wscript index 60799f0116..641b333a53 100644 --- a/libs/pbd/wscript +++ b/libs/pbd/wscript @@ -54,6 +54,10 @@ def configure(conf): # autowaf.check_header(conf, 'cxx', 'boost/uuid/uuid.hpp') def build(bld): + + # Make signal.h using signal.h.py + bld(rule = 'python ${SRC} ${TGT}', source = 'pbd/signal.h.py', target = 'pbd/signal.h') + # Library obj = bld(features = 'cxx cxxshlib') obj.source = '''