示例#1
0
//=============================================================================
// METHOD: SPELLipcMessageMailbox::cancelAll()
//=============================================================================
void SPELLipcMessageMailbox::cancelAll()
{
    SPELLipcMessageQueueMap::iterator mit;
    for( mit = m_queueMap.begin(); mit != m_queueMap.end(); mit++)
    {
        SPELLipcMessage* dummyResponse = new SPELLipcMessage("dummy");
        dummyResponse->setType( MSG_TYPE_RESPONSE );
        SPELLipcMessageQueue* queue = (*mit).second;
        queue->push(dummyResponse);
    }
}
//=============================================================================
// METHOD: SPELLipcMessageMailbox::cancel()
//=============================================================================
void SPELLipcMessageMailbox::cancel( std::string id )
{
    SPELLipcMessageQueueMap::iterator mit;
    for( mit = m_queueMap.begin(); mit != m_queueMap.end(); mit++)
    {
        if (mit->first == id)
        {
            SPELLipcMessage* dummyResponse = new SPELLipcMessage("dummy");
            dummyResponse->setType( MSG_TYPE_RESPONSE );
            SPELLipcMessageQueue* queue = mit->second;
            queue->push(dummyResponse);
            break;
        }
    }
}
示例#3
0
 SPELLipcMessage* processRequest( SPELLipcMessage* msg )
 {
     SPELLipcMessage* resp = SPELLipcHelper::createResponse("dummy", msg);
     try
     {
         std::cout << "request received from " << msg->getKey() << ": " << msg->get("NUM") << std::endl;
         resp->setId("resp");
         resp->setType(MSG_TYPE_RESPONSE);
         resp->set("NUM", msg->get("NUM"));
         usleep(200000);
     }
     catch(SPELLcoreException& ex)
     {
         std::cerr << "PROCESS ERROR: " << ex.what() << std::endl;
     }
     return resp;
 };
示例#4
0
//=============================================================================
// METHOD: SPELLipcMessageMailbox::cancel()
//=============================================================================
void SPELLipcMessageMailbox::cancel( std::string id )
{
	DEBUG(NAME + "Requested to cancel request " + id);
    SPELLipcMessageQueueMap::iterator mit;
    for( mit = m_queueMap.begin(); mit != m_queueMap.end(); mit++)
    {
    	DEBUG(NAME + "Checking " + id + " <> " + mit->first);
        if (mit->first == id)
        {
        	DEBUG( NAME + "Canceling request " + id);
            SPELLipcMessage* cancelResponse = new SPELLipcMessage( MessageId::MSG_ID_CANCEL );
            cancelResponse->setType( MSG_TYPE_RESPONSE );
            SPELLipcMessageQueue* queue = mit->second;
            queue->push(cancelResponse);
            break;
        }
    }
}
示例#5
0
//=============================================================================
// METHOD: SPELLserverCif::processRequest
//=============================================================================
SPELLipcMessage* SPELLserverCif::processRequest( SPELLipcMessage* msg )
{
    std::string requestId = msg->getId();
    std::string procId = msg->get(MessageField::FIELD_PROC_ID);
    SPELLipcMessage* response = new SPELLipcMessage( msg->getId() );
    response->setType(MSG_TYPE_RESPONSE);
    response->setReceiver( msg->getSender() );
    response->setSender( msg->getReceiver() );

    if (requestId == ExecutorMessages::REQ_GET_CONFIG)
    {
        m_processor.processGetConfig(msg,response);
    }
    else if (requestId == ExecutorMessages::REQ_SET_CONFIG)
    {
        m_processor.processSetConfig(msg,response);
    }
    else if (requestId == ExecutorMessages::REQ_SET_BREAKPOINT)
    {
        m_processor.processSetBreakpoint(msg, response);
    }
    else if (requestId == ExecutorMessages::REQ_CLEAR_BREAKPOINT)
    {
        m_processor.processClearBreakpoints(msg, response);
    }
    else if (requestId == ExecutorMessages::REQ_VARIABLE_NAMES)
    {
        m_processor.processGetVariables(msg, response);
    }
    else if (requestId == ExecutorMessages::REQ_VARIABLE_WATCH)
    {
        m_processor.processVariableWatch(msg, response);
    }
    else if (requestId == ExecutorMessages::REQ_VARIABLE_NOWATCH)
    {
        m_processor.processVariableNoWatch(msg, response);
    }
    else if (requestId == ExecutorMessages::REQ_WATCH_NOTHING)
    {
        m_processor.processWatchNothing(msg, response);
    }
    else if (requestId == ExecutorMessages::REQ_CHANGE_VARIABLE)
    {
        m_processor.processChangeVariable(msg, response);
    }
    else if (msg->getType() == MSG_TYPE_NOTIFY)
    {
        if (procId != SPELLexecutor::instance().getProcId())
        {
            m_processor.processNotificationForChild(msg,response);
        }
        else
        {
            LOG_ERROR("[CIF] Unexpected message for executor " + procId);
        }
    }
    else
    {
        LOG_ERROR("[CIF] Unprocessed request: " + requestId)
    }
    return response;
}