.. index:: pair: class; EventLoopInterface .. _doxid-class_event_loop_interface: class EventLoopInterface ======================== .. 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 EventLoopInterface { public: // construction :target:`EventLoopInterface`(); :ref:`EventLoopInterface`( std::chrono::milliseconds timestep, std::chrono::milliseconds timestepThres ); // methods virtual void :ref:`initialize`(); 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), bool doInit = false ); void :ref:`stopLoop`(); void :ref:`shutdown`(); bool :ref:`isRunning`(); void :ref:`waitForLoopEnd`(); }; // direct descendants class :ref:`EventLoop`; class :ref:`EventLoopEngine`; .. _details-class_event_loop_interface: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Manages simulation loop. Runs physics and brain interface, and synchronizes them via Transfer Functions. Construction ------------ .. index:: pair: function; EventLoopInterface .. _doxid-class_event_loop_interface_1a65e91f02f337ad5c1585b2e7e9122f22: .. ref-code-block:: cpp :class: doxyrest-title-code-block EventLoopInterface( std::chrono::milliseconds timestep, std::chrono::milliseconds timestepThres ) Constructor. Methods ------- .. index:: pair: function; initialize .. _doxid-class_event_loop_interface_1a2e22c3258fdabf00684e44aa0d0442a8: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual void initialize() Initialize loop. .. index:: pair: function; runLoopOnce .. _doxid-class_event_loop_interface_1a0e7bdd17ef043783cdd114e50f9395ea: .. 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_interface_1aa3846ab68274baaad7dd0312eb66163e: .. 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_interface_1ad514f116ddad73d86f86ac472eee98aa: .. ref-code-block:: cpp :class: doxyrest-title-code-block void runLoopAsync( std::chrono::milliseconds timeout = std::chrono::milliseconds(0), bool doInit = false ) Run loop in a thread. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - timeout - time in seconds the loop will be run for * - doInit - if true, Initialize is executed before runLoop, also in the same thread. This is useful in cases where initialize needs to interact with the main thread .. index:: pair: function; stopLoop .. _doxid-class_event_loop_interface_1a83222332a5fea6f3cc18e43b2b53526e: .. ref-code-block:: cpp :class: doxyrest-title-code-block void stopLoop() Stop loop. It is intended to be used together with runLoopAsync .. index:: pair: function; shutdown .. _doxid-class_event_loop_interface_1a1c0d40edda1f183fc9896b6b7b4c472a: .. ref-code-block:: cpp :class: doxyrest-title-code-block void shutdown() Shutdown loop. .. index:: pair: function; isRunning .. _doxid-class_event_loop_interface_1ae5548c2ea732de04f2ddb0f1b334646b: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool isRunning() Returns true if the event loop is currently running, false otherwise. It is intended to be used together with runLoopAsync .. index:: pair: function; waitForLoopEnd .. _doxid-class_event_loop_interface_1a4cebf0dc92e1eec5a09f213dd05228b0: .. ref-code-block:: cpp :class: doxyrest-title-code-block void waitForLoopEnd() Blocks execution until the loop reaches timeout. It is intended to be used together with runLoopAsync