// guard need for compilers that require template source included in header #ifndef LISTENER_CC_TEMPLATE #define LISTENER_CC_TEMPLATE #include "Listener.h" #include "EventSender.h" /** \file Class method definition file. \copyright Copyright (C) 2002, 2003 Oliver Schoenborn This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. You can redistribute it and/or modify it under the terms found in the LICENSE file that is included in the library distribution. \endcopyright */ /** Tell EventSender that this listener is ignoring the event received. This will increment a counter in EventSender, such that a call to EventSender::getNumIgnored() will return how many listeners ignored the event. Note however that the listener is not \em required to notify EventSender that it is ignoring the event, hence this number is only a minimum. This method can be called more than once without screwing up the count. If called from outside a call to Listener::processEvent(), nothing is done. */ template void Listener::ignoreThisEvent() { // only a valid call if processing an event if (! _processingEvent) return; assert( EventSender::isSending() ); if (! _ignoringHeardEvent) { EventSender::instance().incEventIgnored(); _ignoringHeardEvent = true; } //assert( EventSender::isRegistered(this) == _registered); } /** Tell EventSender that this listener is not interested in hearing EvType events. This does nothing if already ignoring them. */ template void Listener::ignoreEvents() { if (_registered) { EventSender::instance().removeListener(this); _registered = false; } //assert( ! EventSender::isRegistered(this) ); } /** Tell EventSender that this listener wants to hear EvType events. This does nothing if already listening to them. */ template void Listener::listenForEvents() { if (!_registered) { EventSender::instance().registerListener(this); _registered = true; } //assert( EventSender::isRegistered(this) ); } #endif // LISTENER_CC_TEMPLATE