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

Method IsAgentFinished

Core/KernelSML/src/sml_RunScheduler.cpp:224–249  ·  view source on GitHub ↗

* @brief Returns true if the given agent has reached the end of its run **************************************************************************/

Source from the content-addressed store, hash-verified

222* @brief Returns true if the given agent has reached the end of its run
223**************************************************************************/
224bool RunScheduler::IsAgentFinished(AgentSML* pAgentSML, bool forever, smlRunStepSize runStepSize, uint64_t count)
225{
226 uint64_t current = pAgentSML->GetRunCounter(runStepSize) ;
227 uint64_t initial = pAgentSML->GetInitialRunCount() ;
228
229 uint64_t difference = current - initial ;
230
231 //fprintf(stdout, "Agent %s current is %d initial is %d diff is %d\n", pAgent->GetName(), current, initial, difference) ; fflush(stdout) ;
232
233 bool finished = (difference >= count) && !forever;
234
235
236 // if a sml_STOP_AFTER_DECISION_CYCLE is requested, then
237 // agents that are running by Decisions should get marked as finished.
238 // They will generate interrupt in MoveTo_StopBeforePhase
239
240 if (((sml_DECISION == runStepSize) || forever) && (pAgentSML->GetInterruptFlags() & sml_STOP_AFTER_DECISION_CYCLE))
241 {
242 finished = true;
243 }
244
245 // The code that runs an agent to its appropriate StopBeforePhase only runs
246 // after all agents Finish the run. See MoveTo_StopBeforePhase. KJC 12/05
247
248 return finished ;
249}
250
251/********************************************************************
252* @brief Some agents will complete a RunType sooner than others.

Callers

nothing calls this directly

Calls 1

GetRunCounterMethod · 0.45

Tested by

no test coverage detected