Esempio n. 1
0
bool  MsgRouter::endBroadcast( const Receiver_p& _pReceiver )
{
    Receiver * pReceiver = _pReceiver.rawPtr();
    Route * p = m_broadcasts.first();
    while( p )
    {
        if( p->receiver() == pReceiver )
        {
            delete p;
            return true;
        }

        p = p->next();
    }
    return false;
}
Esempio n. 2
0
int MsgRouter::deleteRoutesTo( const Receiver_p& _pReceiver )
{
    Receiver * pReceiver = _pReceiver.rawPtr();
    int nDeleted = 0;

    // Delete from source routes

    for( auto it = m_sourceRoutes.begin() ; it != m_sourceRoutes.end() ; it++ )
    {
        Route * p = it->second.first();
        while( p )
        {
            if( p->receiver() == pReceiver )
            {
                Route * pNext = p->next();
                delete p;					// Receiver is dead, delete route.
                nDeleted++;
                p = pNext;
            }
            else
                p = p->next();

        }
    }

    // Delete from type routes

    for( auto it = m_typeRoutes.begin() ; it != m_typeRoutes.end() ; it++ )
    {
        Route * p = it->second.first();
        while( p )
        {
            if( p->receiver() == pReceiver )
            {
                Route * pNext = p->next();
                delete p;					// Receiver is dead, delete route.
                nDeleted++;
                p = pNext;
            }
            else
                p = p->next();
        }
    }

    return nDeleted;
}
Esempio n. 3
0
bool  MsgRouter::broadcastTo( const Receiver_p& pReceiver )
{
    Route * p = new Route( pReceiver.rawPtr(), MsgType::Dummy );
    m_broadcasts.pushBack( p );
    return true;
}
Esempio n. 4
0
RouteId MsgRouter::addRoute( MsgType msgType, const Receiver_p& pReceiver )
{
    Route * p = new Route( pReceiver.rawPtr(), MsgType::Dummy );
    return _addRoute( msgType, p );
}
Esempio n. 5
0
RouteId MsgRouter::addRoute( const Object_p& pSource, MsgType filter, const Receiver_p& pReceiver )
{
    Route * p = new Route( pReceiver.rawPtr(), filter );
    return _addRoute( pSource, p );
}
Esempio n. 6
0
	WgRouteId MsgRouter::addRoute( const MsgFilter& filter, MsgType msgType, const Receiver_p& pReceiver )
	{
		Route * p = new Route( filter, pReceiver.rawPtr() );
		return _addRoute( msgType, p );	
	}
Esempio n. 7
0
	WgRouteId MsgRouter::addRoute( const MsgFilter& filter, const Object_p& pSource, const Receiver_p& pReceiver )
	{
		Route * p = new Route( filter, pReceiver.rawPtr() );
		return _addRoute( pSource, p );
	}
Esempio n. 8
0
	bool  MsgRouter::broadcastTo( const MsgFilter& filter, const Receiver_p& pReceiver )
	{
		Route * p = new Route( filter, pReceiver.rawPtr() );
		m_broadcasts.pushBack( p );
		return true;
	}