----------------------------------------------------------------------------- Print the subscribers to an event. @param event The event whose subscribers are to be printed. -----------------------------------------------------------------------------
| 388 | /// @param event The event whose subscribers are to be printed. |
| 389 | //----------------------------------------------------------------------------- |
| 390 | void EventManager::dumpSubscribers( const char* event ) |
| 391 | { |
| 392 | Vector<EventManagerListener::Subscriber>* subscribers = mListener.mSubscribers.retreive( event ); |
| 393 | if( !subscribers ) |
| 394 | { |
| 395 | Con::warnf( "EventManager::dumpSubscriber - %s is not a valid event.", event ); |
| 396 | return; |
| 397 | } |
| 398 | |
| 399 | Con::printf( "%s Subscribers", event ); |
| 400 | for( Vector<EventManagerListener::Subscriber>::const_iterator iter = subscribers->begin(); iter != subscribers->end(); iter++ ) |
| 401 | if( iter->listener ) |
| 402 | { |
| 403 | // Grab the best fit name. This should be the first found of name, class, superclass, or class type. |
| 404 | Namespace* ns = iter->listener->getNamespace(); |
| 405 | const char* name = ns ? ns->mName : getClassName() ; |
| 406 | Con::printf( " %s -> %s", name, iter->callback ); |
| 407 | } |
| 408 | } |
| 409 | |
| 410 | //----------------------------------------------------------------------------- |
| 411 | /// Print all registered events and their subscribers to the console. |