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

Method StopAllAgents

Core/ClientSML/src/sml_ClientKernel.cpp:1506–1522  ·  view source on GitHub ↗

* @brief Interrupt the currently running Soar agent. * * Call this after calling "Run" in order to stop all Soar agents. * The usual way to do this is to register for an event (e.g. AFTER_DECISION_CYCLE) * and in that event handler decide if the user wishes to stop soar. * If so, call to this method inside that handler. * * The request to Stop may not be honored immediately. * Soar will stop at th

Source from the content-addressed store, hash-verified

1504* Soar will stop at the next point it is considered safe to do so.
1505*************************************************************/
1506char const* Kernel::StopAllAgents()
1507{
1508 std::string cmd = "stop-soar" ;
1509
1510 // The command line currently requires an agent in order
1511 // to execute a stop-soar command, so we provide one (which one should make no difference).
1512 if (GetNumberAgents() == 0)
1513 {
1514 return "There are no agents to stop" ;
1515 }
1516
1517 Agent* pFirstAgent = GetAgentByIndex(0) ;
1518
1519 // Execute the command.
1520 char const* pResult = ExecuteCommandLine(cmd.c_str(), pFirstAgent->GetAgentName()) ;
1521 return pResult ;
1522}
1523
1524/*************************************************************
1525* @brief Returns true if one or more agents are currently running.

Callers 4

MyInterruptHandlerMethod · 0.80
~CommandProcessorMethod · 0.80
updateMethod · 0.80

Calls 1

GetAgentNameMethod · 0.80

Tested by 2

~CommandProcessorMethod · 0.64
updateMethod · 0.64