Boost logo

Boost :

From: Stjepan Rajko (stipe_at_[hidden])
Date: 2008-03-15 13:20:45


On Thu, Mar 13, 2008 at 11:57 PM, Kowalke Oliver (QD IT PA AS)
<Oliver.Kowalke_at_[hidden]> wrote:
>
> I don't know if your dataflow library can support selectivly disconnects.
> As you wrote in your previous email - one consumer can be connected to multiple
> producers. If we can associate the boost::signal::connection with the invokation of
> consumers operator() we could establish a selectively disconnect. At least I think
> it could work this way - but I don't know if it could be supported by your implementation.
>

I modified the previous example to allow selectivity:
http://tinyurl.com/28dyk3

The change is that the registration is now done per producer, and the
signal includes an ID for the producer (in this example, it sends the
address of the signal as the ID). Since the producer must now
identify itself, I added a custom little producer class that does so.

Note though that a strategy like this is only appropriate for very
simple cases (if that) - registrations go in the same bucket for all
overloads of operator(), which is probably not desired in general.
The long term solution might be to come up with a consumer version of
the signals class - a persistent, noncopyable object that holds
connections on the consumer end, and to enumerate all consumer ports
for the consumer (so that each gets its own tracking object). The
library already has port enumeration, but not the consumer tracking
object class. It would be a nice addition though, at some point :-)

Regards,

Stjepan


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk