| 19 | using namespace cli; |
| 20 | |
| 21 | bool CommandLineInterface::DoInitSoar() |
| 22 | { |
| 23 | // Save the current result |
| 24 | std::string oldResult = m_Result.str(); |
| 25 | |
| 26 | SetTrapPrintCallbacks(false); |
| 27 | |
| 28 | bool ok = m_pAgentSML->Reinitialize() ; |
| 29 | |
| 30 | // S1 gets created during Reinitialize, clear its output from the trace buffers |
| 31 | xml_invoke_callback(m_pAgentSML->GetSoarAgent()); |
| 32 | m_pAgentSML->FlushPrintOutput(); |
| 33 | |
| 34 | SetTrapPrintCallbacks(true); |
| 35 | |
| 36 | // restore the old result, ignoring output from init-soar |
| 37 | m_Result.str(oldResult); |
| 38 | |
| 39 | if (!ok) |
| 40 | { |
| 41 | return SetError("Agent failed to reinitialize"); |
| 42 | } |
| 43 | |
| 44 | if (m_RawOutput) |
| 45 | { |
| 46 | m_Result << "Agent reinitialized.\n"; |
| 47 | } |
| 48 | |
| 49 | return ok; |
| 50 | } |
| 51 |
no test coverage detected