Boost logo

Boost :

Subject: Re: [boost] Interest in non-intrusive signal/slot lib?
From: Edward Diener (eldiener_at_[hidden])
Date: 2015-05-16 10:09:35


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/.

The documentation says that a signal emitter is a void pointer. Doesn't
it need to be a shared_ptr<void> instead, since it must be passed to
emit as a weak_pointer ? You might clarify this in the documentation.
Instead of:

"Boost Synapse does not define its own signal emitter type. Instead,
signal emitters are identified by void pointers."

you might say:

"Boost Synapse does not define its own signal emitter type. Instead,
signal emitters are identified by pointers to any type specified as a
shared_ptr<void>."

It looks like shared_ptr, weak_ptr, and function are C++ standard types
and not Boost types, but this is not clarified.

I assume that the purpose of having the signal type be a pointer to a
function taking some data and returning an incomplete type instead of
returning void is to make each signal type unique. But is this really
necessary ?


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