Boost logo

Boost :

From: Reece Dunn (msclrhd_at_[hidden])
Date: 2004-08-20 00:52:49


Edward Diener wrote:
>Why not use boost::signals for your event interface. It is much better than
>hand-coded actions and listeners, since any type of function can handle an
>event. The technology is already in Boost so why re-invent the wheel.

The signals library looks very good, but it solves half the problem. You
need to work out what types of signals are raised:
   MouseUp
   MouseDown
   MouseDoubleClick
   MouseMove
and have a signal for each. This would mean that you could have hundreds of
signals!

It might be easier to group events by type, use signals to dispatch them and
an event handler like I suggested to deal with them, e.g.
   MouseEvent( unsigned int event, const MouseEvent & info );
   KeyEvent( unsigned int event, const KeyEvent & info );

This might be useful for command/reflection type events, having a
   std::list< boost::signal< bool ( const Event & ) > >
or even
   std::map< std::string, boost::signal< ... > >

Regards,
Reece

_________________________________________________________________
Express yourself with cool new emoticons http://www.msn.co.uk/specials/myemo


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