
I suppose that it's good to back up a bit, and discuss that to make sure I'm at least on the right track. I have an object which will signal when something interesting occurs. (Signaller) I want other "interested" objects to receive this signal when that "interesting thing" occurs. (Slotter) We wanted to encapsulate the signal.connect(&slot) calls within the Signaller and then the Slotter just hooks up whatever function they want (provided it matches the function signature). Now, the slots are most likely going to be instance member functions, which according to my research, and my own testing, is easiest done with boost::bind. So, the Signaller has a connect(&slot) function, that returns success or not. It didn't seem "natural" for the Slotter to have to keep & maintain his connection object for eventual disconnection of the signal. So a disconnect(&slot) function was added to the Signaller class. We want to be as robust as possible, and our use case doesn't allow the same slot to be connected to a signal multiple times, so this (and several other reasons) are why we are looking at maintaining this stl map separately. I'm going from memory at this point, but I believe the reason we call connection.disconnect() versus signal.disconnect(&slot), is in our Signaller.disconnect(&slot), the Slotter didn't necessarily maintain their own bind object permanently. For simple cases, you don't even need the bind object at all. If I go from memory, it was creating a new bind object every single time, and you couldn't disconnect properly. Let me dig up that code again, see if I can remember why I decided to go this route. It's obviously a bit complicated, and I would love to alleviate the connection management from the Signaller class alltogether. --dw
-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Frank Mori Hess Sent: Wednesday, December 10, 2008 2:48 PM To: boost-users@lists.boost.org Subject: Re: [Boost-users] signals/slots and boost::functions
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Part of the management, is I need to map the function
On Wednesday 10 December 2008 14:45 pm, david.weber@l-3com.com wrote: pointer to the
actual connection object.
I'm curious to hear more about your use case. The signal class supports disconnect-by-slot, did you need the connection object for something other than just disconnecting? It would seem possible to generalize disconnect-by-slot into a more general method which returns a list of connections whose slot or group is equal to the method's argument. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFJQCry5vihyNWuA4URAhFtAKDQpxYlM4YEC6JyJ11wNgDH7ggtrgCgtPnh fX5tzx2Q9v11fm04RPZbXBo= =Viis -----END PGP SIGNATURE----- _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users