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

Function xml_invoke_callback

Core/SoarKernel/src/xml.cpp:272–302  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

270}
271
272void xml_invoke_callback(agent* pAgent)
273{
274 soarxml::XMLTrace* pXML = static_cast< soarxml::XMLTrace* >(pAgent->xml_destination);
275 if (pXML->IsEmpty())
276 {
277 return;
278 }
279
280 soarxml::ElementXML* pResult = pXML->DetatchObject();
281 pXML->Reset();
282
283#ifdef _DEBUG
284 char* pStr = pResult->GenerateXMLString(true) ;
285 pResult->DeleteString(pStr) ;
286#endif // _DEBUG
287
288 // We need to call the handler explicitly here instead of using soar_invoke_callbacks
289 // because we need to create a new ElementXML object for each handler that gets called.
290 for (cons* c = pAgent->soar_callbacks[XML_GENERATION_CALLBACK]; c != NIL; c = c->rest)
291 {
292 soarxml::ElementXML* pCallbackData = new soarxml::ElementXML(pResult->GetXMLHandle());
293 pCallbackData->AddRefOnHandle();
294
295 soar_callback* cb = static_cast< soar_callback* >(c->first);
296
297 // handler responsible for deleting pCallbackData
298 cb->function(pAgent, cb->eventid, cb->data, static_cast< soar_call_data >(pCallbackData));
299 }
300
301 delete pResult;
302}
303
304soarxml::ElementXML* xml_get_xml(agent* pAgent)
305{

Callers 4

DoInitSoarMethod · 0.85
do_one_top_level_phaseFunction · 0.85
FireRunEventMethod · 0.85
HandleCreateAgentMethod · 0.85

Calls 5

IsEmptyMethod · 0.45
DetatchObjectMethod · 0.45
ResetMethod · 0.45
GenerateXMLStringMethod · 0.45
DeleteStringMethod · 0.45

Tested by

no test coverage detected