Boost logo

Boost :

From: Edward Diener (eldiener_at_[hidden])
Date: 2007-05-23 17:48:20


Johan Torp wrote:
> I developed some classes which had similar functionality to slots and
> signals and now I want to transition to using slots and signals.
>
> I often find myself in the situation of wanting to listen to changes
> of a value type variable. I had a templated class called
> ConcreteObservable which encapsulated a get/set-able value and
> provided ways of listening to changes in the value. I.e.
> ConcreteObservable<bool> was a bool which you could get, set and
> listen to.

Your idea is essentially a 'property' whose change in value triggers a
notification event. Both Java and dotnet have such functionality
combined with the idea of Javabean properties in the former and dotnet
component properties in the latter.

I have worked on my own with the idea of a C++ 'property', but not with
enough personal satisfaction to put it in the sandbox or submit it to
Boost. Reece Dunn, I believe, has submitted his own idea of a C++
'property' as an implementation to the sandbox in the past. Obviously
notifiers as events can be built into the idea of a C++ 'property'
whenever the property changes and Java goes so far as to actually build
into their idea of a Javabeans 'property' the idea of being able to
cancel the change before it happens by an event ( signal ) listener (
slot ).

I do not think the idea of an event whenever a 'property' changes should
be part of the signals library itself but it can, and should IMO, use
the signals library whenever the change occurs. I think the idea itself
of a signalled 'property' change belongs in its own separate
implementation, since the signals library is sufficient enough providing
just the notion of signals and slots ( or events and handlers as others
may call it ).


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