.. index:: pair: class; EventLoop .. _doxid-class_event_loop: class EventLoop =============== .. toctree:: :hidden: Overview ~~~~~~~~ Manages simulation loop. Runs physics and brain interface, and synchronizes them via Transfer Functions. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class EventLoop { public: // construction :target:`EventLoop`(); :ref:`EventLoop`( const :ref:`nlohmann::json`& graph_config, std::chrono::milliseconds timestep, std::chrono::milliseconds timestepThres, :ref:`ComputationalGraph::ExecMode` execMode = ComputationalGraph::ExecMode::ALL_NODES, bool ownGIL = true, bool spinROS = false ); // methods void :ref:`runLoopOnce`(const std::chrono::time_point& startTime); void :ref:`runLoop`(std::chrono::milliseconds timeout); void :ref:`runLoopAsync`(std::chrono::milliseconds timeout = std::chrono::milliseconds(0)); void :ref:`stopLoop`(); void :ref:`shutdown`(); bool :ref:`isRunning`(); void :ref:`waitForLoopEnd`(); }; .. _details-class_event_loop: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Manages simulation loop. Runs physics and brain interface, and synchronizes them via Transfer Functions. Construction ------------ .. index:: pair: function; EventLoop .. _doxid-class_event_loop_1a55155b3338a650e2ed6e293fc78d85b3: .. ref-code-block:: cpp :class: doxyrest-title-code-block EventLoop( const :ref:`nlohmann::json`& graph_config, std::chrono::milliseconds timestep, std::chrono::milliseconds timestepThres, :ref:`ComputationalGraph::ExecMode` execMode = ComputationalGraph::ExecMode::ALL_NODES, bool ownGIL = true, bool spinROS = false ) Constructor. Methods ------- .. index:: pair: function; runLoopOnce .. _doxid-class_event_loop_1a3213840806763f33ba1ad97776f7f35e: .. ref-code-block:: cpp :class: doxyrest-title-code-block void runLoopOnce(const std::chrono::time_point& startTime) Run a single loop. .. index:: pair: function; runLoop .. _doxid-class_event_loop_1a0052af6030c0356cca90e74512775e4d: .. ref-code-block:: cpp :class: doxyrest-title-code-block void runLoop(std::chrono::milliseconds timeout) Run loop. .. index:: pair: function; runLoopAsync .. _doxid-class_event_loop_1a4cbff5467f83d5e6fd0a67c4fb2e1086: .. ref-code-block:: cpp :class: doxyrest-title-code-block void runLoopAsync(std::chrono::milliseconds timeout = std::chrono::milliseconds(0)) Run loop in a thread. .. index:: pair: function; stopLoop .. _doxid-class_event_loop_1a660bd97a39a01dd15e527f9eee539047: .. ref-code-block:: cpp :class: doxyrest-title-code-block void stopLoop() Stop loop. .. index:: pair: function; shutdown .. _doxid-class_event_loop_1ac049fe8ddd57dd1c3cb12120a22d215b: .. ref-code-block:: cpp :class: doxyrest-title-code-block void shutdown() Shutdown loop. .. index:: pair: function; isRunning .. _doxid-class_event_loop_1aa5d546ac75355b3d114653a0659b9a65: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool isRunning() Returns true if the event loop is currently running, false otherwise. .. index:: pair: function; waitForLoopEnd .. _doxid-class_event_loop_1a991476bde7fc75b2c98a073c020e1a75: .. ref-code-block:: cpp :class: doxyrest-title-code-block void waitForLoopEnd() Blocks execution until the loop reaches timeout.