bool Dispatcher::dispatchCommand( ICommand& command ) { LBASSERT( command.isValid( )); LBVERB << "dispatch " << command << " on " << lunchbox::className( this ) << std::endl; const uint32_t which = command.getCommand(); #ifndef NDEBUG if( which >= _impl->qTable.size( )) { LBABORT( "ICommand " << command << " higher than number of registered command handlers (" << _impl->qTable.size() << ") for object of type " << lunchbox::className( this ) << std::endl ); return false; } #endif CommandQueue* queue = _impl->qTable[ which ]; if( queue ) { command.setDispatchFunction( _impl->fTable[ which ] ); queue->push( command ); return true; } // else LBCHECK( _impl->fTable[ which ]( command )); return true; }
void CommandQueue::pushFront( const ICommand& command ) { LBASSERT( command.isValid( )); _impl->commands.pushFront( command ); }