|
Boost : |
From: Stjepan Rajko (stipe_at_[hidden])
Date: 2008-03-14 01:23:05
On Thu, Mar 13, 2008 at 1:18 AM, Kowalke Oliver (QD IT PA AS)
<Oliver.Kowalke_at_[hidden]> wrote:
>
> > Another would be to have the consumer keep a copy of the
> > Boost.Signals connection object (for the connection between
> > its producer and itself), and disconnect at will.
>
> I would prefer this solution - maybe signals::filter can provide a bool connected() and void disconnect() function which internaly calls boost::signals::connection::disconnect()?
This is a great idea. I made a little proof of concept example here:
http://tinyurl.com/2zl9ar
There are some minimal comments that explain it. Basically, the
example defines a new type of consumer (tracking_call_consumer) for
which the connect operation will register the connection object with
the consumer. It then implements a simple class (tracking_consumer)
which is a tracking_call_consumer and will disconnect (from all
registered producers) once it has received a specified number of
signals.
Something like this will be a good addition to the library - when I
get more time I'll try to figure out a good way to integrate it with
the existing components, so that any component can be made to track
connections to its consumer ports.
Regards,
Stjepan
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk