.. index:: pair: class; SimulationDataManager .. _doxid-class_simulation_data_manager: class SimulationDataManager =========================== .. toctree:: :hidden: Overview ~~~~~~~~ Manages all simulation data. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class SimulationDataManager { public: // methods void :ref:`pushToTrajectory`(:ref:`datapacks_vector_t` dataPacks); const :ref:`datapacks_vector_t`& :ref:`getTrajectory`() const; void :ref:`clearTrajectory`(); void :ref:`setDoneFlag`(bool doneFlag); bool :ref:`getDoneFlag`() const; void :ref:`clear`(); void :ref:`updateExternalPool`(:ref:`datapacks_vector_t` dataPacks); void :ref:`updatePreprocessingPool`(:ref:`datapacks_vector_t` dataPacks); void :ref:`updateTransceiverPool`(:ref:`datapacks_vector_t` dataPacks); void :ref:`updateEnginePool`(:ref:`datapacks_vector_t` dataPacks); :ref:`datapacks_set_t` :ref:`getEngineDataPacks`(const std::string& engineName) const; :ref:`datapacks_set_t` :ref:`getTransceiverDataPacks`() const; :ref:`datapacks_set_t` :ref:`getPreprocessingDataPacks`() const; :ref:`datapacks_set_t` :ref:`getStatusDataPacks`() const; void :ref:`startNewIteration`(); }; .. _details-class_simulation_data_manager: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Manages all simulation data. This class is responsible for managing all simulation data. In particular, it manages all DataPacks that are produced during the course of the simulation. The DataPacks are stored in five separate pools: * Engine Pool for DataPacks coming from the Engines * Preprocessing Pool for DataPacks coming from the Preprocessing Functions * Transceiver Pool for DataPacks coming from the Transceiver Functions * External Pool for DataPacks coming from external processes, most likely a Master Script * Trajectory for DataPacks coming from the Status Function The first four pools are meant to store the most recent simulation data coming from various sources. They are implemented as sets, so he DataPacks stored in these pools are overwritten (updated) whenever a new :ref:`DataPack ` with matching ID is inserted. The Trajectory is used to store a history of observations produced by the Status Function. It is implemented using a vector, so the order of DataPacks is preserved. The DataPacks from this pool is intended to be sent back to the Master Script whenever the done flag coming from the Status Function is set. Methods ------- .. index:: pair: function; pushToTrajectory .. _doxid-class_simulation_data_manager_1ab10b2e7318f9096eeff5add2f5fc4446: .. ref-code-block:: cpp :class: doxyrest-title-code-block void pushToTrajectory(:ref:`datapacks_vector_t` dataPacks) Appends the input vector to the trajectory. .. index:: pair: function; getTrajectory .. _doxid-class_simulation_data_manager_1ae752d70656639e0150d8e994514a0985: .. ref-code-block:: cpp :class: doxyrest-title-code-block const :ref:`datapacks_vector_t`& getTrajectory() const Returns the trajectory vector. .. index:: pair: function; clearTrajectory .. _doxid-class_simulation_data_manager_1a4530060fcd7542bc3cebd08332b0104f: .. ref-code-block:: cpp :class: doxyrest-title-code-block void clearTrajectory() Clears the trajectory vector. .. index:: pair: function; setDoneFlag .. _doxid-class_simulation_data_manager_1ab27a8d08608f72068f2d581119d95d92: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setDoneFlag(bool doneFlag) Sets value of the 'done' flag. .. index:: pair: function; getDoneFlag .. _doxid-class_simulation_data_manager_1af855dd185a15f968b249f4092c87f7b5: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool getDoneFlag() const Returns value of the 'done' flag. .. index:: pair: function; clear .. _doxid-class_simulation_data_manager_1a01f43ac9a4fe00cd5b124b0c02ac4b32: .. ref-code-block:: cpp :class: doxyrest-title-code-block void clear() Clears all data stored in the manager. .. index:: pair: function; updateExternalPool .. _doxid-class_simulation_data_manager_1a06e0c39af703e1428671d12f28e2821f: .. ref-code-block:: cpp :class: doxyrest-title-code-block void updateExternalPool(:ref:`datapacks_vector_t` dataPacks) Updates the pool of DataPacks coming from an external source (e.g. a master script) The method will overwrite DataPacks that are already in the pool, if their ID matches the ID of any of the DataPacks passed as argument. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - dataPacks - A list of DataPacks that will be inserted into the External pool .. index:: pair: function; updatePreprocessingPool .. _doxid-class_simulation_data_manager_1a218da465704c7af6b4d599162d88da12: .. ref-code-block:: cpp :class: doxyrest-title-code-block void updatePreprocessingPool(:ref:`datapacks_vector_t` dataPacks) Updates the pool of DataPacks coming from the Preprocessing Functions. The method will overwrite DataPacks that are already in the pool, if their ID matches the ID of any of the DataPacks passed as argument. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - dataPacks - A list of DataPacks that will be inserted into the Preprocessing pool .. index:: pair: function; updateTransceiverPool .. _doxid-class_simulation_data_manager_1a415cab06836a35066303c2665c9bb891: .. ref-code-block:: cpp :class: doxyrest-title-code-block void updateTransceiverPool(:ref:`datapacks_vector_t` dataPacks) Updates the pool of DataPacks coming from the Transceiver Functions. The method will overwrite DataPacks that are already in the pool, if their ID matches the ID of any of the DataPacks passed as argument. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - dataPacks - A list of DataPacks that will be inserted into the Transceiver pool .. index:: pair: function; updateEnginePool .. _doxid-class_simulation_data_manager_1a60511fce4b58b63bf71f9b0c62dcb335: .. ref-code-block:: cpp :class: doxyrest-title-code-block void updateEnginePool(:ref:`datapacks_vector_t` dataPacks) Updates the pool of DataPacks coming from Engines. The method will overwrite DataPacks that are already in the pool, if their ID matches the ID of any of the DataPacks passed as argument, and if the new DataPacks are not empty. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - dataPacks - A list of DataPacks that will be inserted into the Engine pool .. index:: pair: function; getEngineDataPacks .. _doxid-class_simulation_data_manager_1a8a0a82f5c2779ff811eb4cf937f88d49: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`datapacks_set_t` getEngineDataPacks(const std::string& engineName) const Returns a set of DataPacks that are intended to be sent to the Engine with given name. The method combines DataPacks from the Transceiver and External pools, and filters them by the Engine name given as argument. .. index:: pair: function; getTransceiverDataPacks .. _doxid-class_simulation_data_manager_1a80e375e9befd8024b3510626722233b2: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`datapacks_set_t` getTransceiverDataPacks() const Returns a set of DataPacks that are intended to be accessed by the Transceiver Functions. The method combines DataPacks from the Engine and Preprocessing pools. .. index:: pair: function; getPreprocessingDataPacks .. _doxid-class_simulation_data_manager_1a838d5c76d3613366eb71bfdbb89dc74d: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`datapacks_set_t` getPreprocessingDataPacks() const Returns a set of DataPacks that are intended to be accessed by the Preprocessing Functions. The method returns DataPacks from the Engine pool. .. index:: pair: function; getStatusDataPacks .. _doxid-class_simulation_data_manager_1ab66af600773960311f4d6273d332469f: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`datapacks_set_t` getStatusDataPacks() const Returns a set of DataPacks that are intended to be accessed by the Status Function. The method combines DataPacks from the Engine, Preprocessing and Transceiver pools. .. index:: pair: function; startNewIteration .. _doxid-class_simulation_data_manager_1ac9383e37e39c0bfb7fd533a989a20e6a: .. ref-code-block:: cpp :class: doxyrest-title-code-block void startNewIteration() Performs bookkeeping at start of the simulation iteration. This method should be called at the start of each simulation iteration. It resets the isUpdated flags on all stored DataPacks.