MCPcopy Create free account
hub / github.com/SoarGroup/Soar / ReceivedStringEvent

Method ReceivedStringEvent

Core/ClientSML/src/sml_ClientKernel.cpp:578–605  ·  view source on GitHub ↗

* @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) *************************************************************/

Source from the content-addressed store, hash-verified

576* @param pResponse The reply (no real need to fill anything in here currently)
577*************************************************************/
578void 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

Callers

nothing calls this directly

Calls 6

GetArgStringMethod · 0.80
endMethod · 0.80
GetConnectionFunction · 0.70
getListMethod · 0.45
getUserDataMethod · 0.45

Tested by

no test coverage detected