From: <sv...@ww...> - 2006-01-22 03:01:41
|
Author: mkrose Date: 2006-01-21 19:01:34 -0800 (Sat, 21 Jan 2006) New Revision: 1824 Modified: trunk/CSP/csp/cspsim/InputEventChannel.h Log: Add another InputEventChannel convenience constructor taking a sigc::slot callback. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1824 Modified: trunk/CSP/csp/cspsim/InputEventChannel.h =================================================================== --- trunk/CSP/csp/cspsim/InputEventChannel.h 2006-01-22 01:39:15 UTC (rev 1823) +++ trunk/CSP/csp/cspsim/InputEventChannel.h 2006-01-22 03:01:34 UTC (rev 1824) @@ -63,6 +63,7 @@ InputEventChannel(std::string const &name, InputInterface *input_interface): ChannelBase(name, ACCESS_SHARED) { input_interface->bindActionEvent(name, sigc::mem_fun(*this, &InputEventChannel::onInputEvent)); } + /** A convenience method to construct an InputEventChannel and bind a callback * method in one step. Useful when the System creating and registering the * channel does not need to retain a private reference. Note that the instance @@ -74,6 +75,15 @@ instance->bindActionEvent(name, sigc::mem_fun(*this, &InputEventChannel::onInputEvent)); } + /** Another convenience method to construct an InputEventChannel and bind a + * callback in one step. Useful when the System creating and registering the + * channel does not need to retain a private reference. + */ + InputEventChannel(std::string const &name, InputInterface *input_interface, sigc::slot<void> const &functor): ChannelBase(name, ACCESS_SHARED) { + connect(functor); + input_interface->bindActionEvent(name, sigc::mem_fun(*this, &InputEventChannel::onInputEvent)); + } + /** Connect a new signal handler to the channel. The handler will be called * whenever the corresponding input event is received, and when the signal() * method is called. |