示例#1
0
int MsgRouter::deleteRoutesFrom( const Object_p& pSource )
{
    auto it = m_sourceRoutes.find(Object_wp(pSource.rawPtr()) );

    if( it == m_sourceRoutes.end() )
        return 0;

    int nDeleted = it->second.size();
    m_sourceRoutes.erase(it);
    return nDeleted;
}
示例#2
0
	void MsgRouter::_dispatchToSourceRoutes( const Msg_p& pMsg )
	{
		Object * pSource = pMsg->sourceRawPtr();
	
		if( pSource )
		{
			auto it = m_sourceRoutes.find(Object_wp(pSource));
			if( it != m_sourceRoutes.end() )
			{
				Route * pRoute = it->second.first();
				while( pRoute )
				{
					pRoute->dispatch( pMsg );
					pRoute = pRoute->next();
				}
			}
		}
	}