| 270 | } |
| 271 | |
| 272 | void 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 | |
| 304 | soarxml::ElementXML* xml_get_xml(agent* pAgent) |
| 305 | { |
no test coverage detected