13
0

Add Signal5.

git-svn-id: svn://localhost/ardour2/branches/3.0@10134 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2011-09-26 22:22:14 +00:00
parent 1f1abd0646
commit fa590d385b

View File

@ -323,6 +323,58 @@ private:
SignalType _signal; SignalType _signal;
}; };
template<typename R, typename A1, typename A2, typename A3, typename A4, typename A5>
class Signal5 {
public:
Signal5 () {}
typedef boost::signals2::signal<R(A1,A2,A3,A4,A5)> SignalType;
void connect_same_thread (ScopedConnectionList& clist,
const typename SignalType::slot_function_type& slot) {
clist.add_connection (_signal.connect (slot));
}
void connect_same_thread (ScopedConnection& c,
const typename SignalType::slot_function_type& slot) {
c = _signal.connect (slot);
}
static void compositor (typename boost::function<void(A1,A2,A3,A4,A5)> f, PBD::EventLoop* event_loop,
EventLoop::InvalidationRecord* ir,
A1 arg1, A2 arg2, A3 arg3, A4 arg4, A5 arg5) {
event_loop->call_slot (ir, boost::bind (f, arg1, arg2, arg3, arg4, arg5));
}
void connect (ScopedConnectionList& clist,
PBD::EventLoop::InvalidationRecord* ir,
const typename SignalType::slot_function_type& slot,
PBD::EventLoop* event_loop) {
if (ir) {
ir->event_loop = event_loop;
}
clist.add_connection (_signal.connect (boost::bind (&compositor, slot, event_loop, ir, _1, _2, _3, _4, _5)));
}
void connect (ScopedConnection& c,
PBD::EventLoop::InvalidationRecord* ir,
const typename SignalType::slot_function_type& slot,
PBD::EventLoop* event_loop) {
if (ir) {
ir->event_loop = event_loop;
}
c = _signal.connect (_signal.connect (boost::bind (&compositor, slot, event_loop, ir, _1, _2, _3, _4, _5)));
}
typename SignalType::result_type operator()(A1 arg1, A2 arg2, A3 arg3, A4 arg4, A5 arg5) {
return _signal (arg1, arg2, arg3, arg4, arg5);
}
bool empty() const { return _signal.empty(); }
private:
SignalType _signal;
};
} /* namespace */ } /* namespace */
#endif /* __pbd_signals_h__ */ #endif /* __pbd_signals_h__ */