On 5/11/2015 10:25 PM, Emil Dotchevski wrote:
Hello,
I realize that Boost has Signals library already, but I've implemented a non-intrusive one which approaches the problem differently, and I'm pretty sure that there is no overlap between the two. It turned out more generic than I originally anticipated, so I thought I'd ask if others would find it useful as well.
Specifically I was motivated by wanting to use Qt without MOCing. I asked the Qt community if that was possible which generated several rather annoyed negative responses. :) The issue is that while in Qt it's possible to use any function as a Slot, to define a new Qt signal for an existing Qt type one needs to derive from the Qt type, define the signal (as a member function) and do the MOC dance -- which I wanted to avoid.
The result is a small, non-intrusive signals/slots library that allows objects of any type to be used as signal emitters, e.g. one of the included examples shows how signals can be emitted by a Windows HWND object.
Documentation and source code released under the Boost license can be found here: http://www.revergestudios.com/boost-synapse/.+
It would be nicer if Synapse used git and possibly Github. My understanding of the 'connect' function is that weak_ptr must be of the same object that emitted the signal in order for the signal to be received. In other words that the emitter/signal combination is what ties together a signal and a function for handling the signal. Do I have that right ? This means that in your system the handler of a signal has to have some way to access the emitter of the signal in order to setup the connection. This is similar to the way in the signals2 library that one has to have access to a boost::signals2::signal in order to setup a connection to a slot. So while I like your library I do not immediately understand the advantage it has over signals2. Could you discuss that more, either here or in your documentation ?