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

Method TestForFiringUpdateWorldEvents

Core/KernelSML/src/sml_RunScheduler.cpp:563–591  ·  view source on GitHub ↗

* @brief Check if the "AFTER_ALL_OUTPUT_PHASES" event should be * fired or not. Then check if the "AFTER_ALL_GENERATED_OUTPUT" * event should be fired or not. *********************************************************************/

Source from the content-addressed store, hash-verified

561* event should be fired or not.
562*********************************************************************/
563void RunScheduler::TestForFiringUpdateWorldEvents()
564{
565 if (AreAllOutputPhasesComplete())
566 {
567 // If so fire the after_all_output_phases event
568 m_pKernelSML->FireUpdateListenerEvent(smlEVENT_AFTER_ALL_OUTPUT_PHASES, m_RunFlags) ;
569
570 // Then clear the completed output flags so we can repeat the process.
571 for (AgentMapIter iter = m_pKernelSML->m_AgentMap.begin() ; iter != m_pKernelSML->m_AgentMap.end() ; iter++)
572 {
573 AgentSML* pAgentSML = iter->second ;
574 pAgentSML->SetCompletedOutputPhase(false) ;
575 }
576 // the GeneratedOutput can only be true if output phases completed was true
577 if (HaveAllGeneratedOutput())
578 {
579 // If so fire the after_all_generated_output event
580 m_pKernelSML->FireUpdateListenerEvent(smlEVENT_AFTER_ALL_GENERATED_OUTPUT, m_RunFlags) ;
581
582 // Then clear the generated output flags and repeat the process.
583 for (AgentMapIter iter = m_pKernelSML->m_AgentMap.begin() ; iter != m_pKernelSML->m_AgentMap.end() ; iter++)
584 {
585 AgentSML* pAgentSML = iter->second ;
586 pAgentSML->SetGeneratedOutput(false) ;
587 pAgentSML->SetInitialOutputCount(pAgentSML->GetNumOutputsGenerated()) ;
588 }
589 }
590 }
591}
592/********************************************************************
593* @brief Clean up for the update world events.
594*********************************************************************/

Callers

nothing calls this directly

Calls 2

endMethod · 0.80

Tested by

no test coverage detected