Boost logo

Boost :

From: Rene Rivera (grafik.list_at_[hidden])
Date: 2006-03-03 02:30:24

Dean Michael C. Berris wrote:
> Good day everyone,
> I have just uploaded a simple implementation to the vault of my proposed
> listener-registry pattern implementation.

Hm, doesn't seem to be much there, and hence it's hard to comment on it.
A little bit of explanatory documentation would go a long way ;-)

> Let me explain how this is
> different from Boost.Signals:
> 1) It doesn't use MPL (yet) -- since because the pattern is quite
> simple, I have implemented it such that the listener class should be
> inherited, and a handle() method should be overridden by the specific
> listeners. This would change, once I start learning more about MPL --
> which should make the implementation more flexible at compile time.

Change into what?

> 2) It maps inputs to processors, while Boost.Signals allows you to use a
> signal which maps to different slots (which are all called in turn, once
> the signal is invoked). The listener-registry pattern implementation
> defines a registry to which listeners register themselves -- the
> registry then does the routing of inputs to the listeners. Think event
> driven processing, where a listener listens for a specific event and is
> invoked only when the specific input is passed into the registry which
> it is registered to.

Over the past few weeks I've been implementing something basically like
that for a model-view-* system. And as I understand your goals, does
what you want. That is, it does signal to call dispatching from many
sources to many endpoints through a single router/dispatcher. To give
you some idea the signal points would look like:

reflection->Signal(signal::Resize((width = 20, height = 30)));

The registration of endpoints like:

void handle_resize(Window * window, int w, int h);

*reflection << MakeReflector<Resize>((
   signal = boost::bind(&handle_resize, my_window, _1, _2) ));

Types are enforced at compile time, all around, even though the
implementation uses boost::any for it's safe type erasure. There's some
other type definitions involved to make the above possible of course ;-)

> The file is up at the vault (listener.tar.gz) and unfortunately, I chose
> to use the CppUnit test framework, and the GNU Make build system -- I've
> tried it on Ubuntu Linux 5.10, and requires libcppunit to build the test
> case.

Kinda limits how many people will give you feedback :-\

-- Grafik - Don't Assume Anything
-- Redshift Software, Inc. -
-- rrivera/ - grafik/
-- 102708583/icq - grafikrobot/aim - grafikrobot/yahoo

Boost list run by bdawes at, gregod at, cpdaniel at, john at