* @brief This function is called when an event is received * from the Soar kernel. * * @param pIncoming The event command * @param pResponse The reply (no real need to fill anything in here currently) *************************************************************/
| 576 | * @param pResponse The reply (no real need to fill anything in here currently) |
| 577 | *************************************************************/ |
| 578 | void Kernel::ReceivedStringEvent(smlStringEventId id, AnalyzeXML* pIncoming, ElementXML* pResponse) |
| 579 | { |
| 580 | char const* pValue = pIncoming->GetArgString(sml_Names::kParamValue) ; |
| 581 | |
| 582 | // Look up the handler(s) from the map |
| 583 | StringEventMap::ValueList* pHandlers = m_StringEventMap.getList(id) ; |
| 584 | |
| 585 | if (!pHandlers) |
| 586 | { |
| 587 | return ; |
| 588 | } |
| 589 | |
| 590 | // Go through the list of event handlers calling each in turn |
| 591 | for (StringEventMap::ValueListIter iter = pHandlers->begin() ; iter != pHandlers->end() ;) |
| 592 | { |
| 593 | StringEventHandlerPlusData handlerWithData = *iter ; |
| 594 | iter++ ; |
| 595 | |
| 596 | StringEventHandler handler = handlerWithData.m_Handler ; |
| 597 | void* pUserData = handlerWithData.getUserData() ; |
| 598 | |
| 599 | // Call the handler |
| 600 | std::string result = handler(id, pUserData, this, pValue) ; |
| 601 | |
| 602 | // If we got back a result then fill in the value in the response message. |
| 603 | GetConnection()->AddSimpleResultToSMLResponse(pResponse, result.c_str()) ; |
| 604 | } |
| 605 | } |
| 606 | |
| 607 | /************************************************************* |
| 608 | * @brief This function is called when an event is received |
nothing calls this directly
no test coverage detected