Manages all simulation data. More...
#include <simulation_data_manager.h>
Public Member Functions | |
void | pushToTrajectory (datapacks_vector_t dataPacks) |
Appends the input vector to the trajectory. More... | |
const datapacks_vector_t & | getTrajectory () const |
Returns the trajectory vector. More... | |
void | clearTrajectory () |
Clears the trajectory vector. More... | |
void | setDoneFlag (bool doneFlag) |
Sets value of the 'done' flag. More... | |
bool | getDoneFlag () const |
Returns value of the 'done' flag. More... | |
void | clear () |
Clears all data stored in the manager. More... | |
void | updateExternalPool (datapacks_vector_t dataPacks) |
Updates the pool of DataPacks coming from an external source (e.g. a master script) More... | |
void | updatePreprocessingPool (datapacks_vector_t dataPacks) |
Updates the pool of DataPacks coming from the Preprocessing Functions. More... | |
void | updateTransceiverPool (datapacks_vector_t dataPacks) |
Updates the pool of DataPacks coming from the Transceiver Functions. More... | |
void | updateEnginePool (datapacks_vector_t dataPacks) |
Updates the pool of DataPacks coming from Engines. More... | |
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. More... | |
datapacks_set_t | getTransceiverDataPacks () const |
Returns a set of DataPacks that are intended to be accessed by the Transceiver Functions. More... | |
datapacks_set_t | getPreprocessingDataPacks () const |
Returns a set of DataPacks that are intended to be accessed by the Preprocessing Functions. More... | |
datapacks_set_t | getStatusDataPacks () const |
Returns a set of DataPacks that are intended to be accessed by the Status Function. More... | |
void | startNewIteration () |
Performs bookkeeping at start of the simulation iteration. More... | |
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:
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 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.
void SimulationDataManager::clear | ( | ) |
Clears all data stored in the manager.
void SimulationDataManager::clearTrajectory | ( | ) |
Clears the trajectory vector.
bool SimulationDataManager::getDoneFlag | ( | ) | const |
Returns value of the 'done' flag.
datapacks_set_t SimulationDataManager::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.
datapacks_set_t SimulationDataManager::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.
datapacks_set_t SimulationDataManager::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.
const datapacks_vector_t & SimulationDataManager::getTrajectory | ( | ) | const |
Returns the trajectory vector.
datapacks_set_t SimulationDataManager::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.
void SimulationDataManager::pushToTrajectory | ( | datapacks_vector_t | dataPacks | ) |
Appends the input vector to the trajectory.
void SimulationDataManager::setDoneFlag | ( | bool | doneFlag | ) |
Sets value of the 'done' flag.
void SimulationDataManager::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.
void SimulationDataManager::updateEnginePool | ( | 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.
dataPacks | A list of DataPacks that will be inserted into the Engine pool |
void SimulationDataManager::updateExternalPool | ( | 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.
dataPacks | A list of DataPacks that will be inserted into the External pool |
void SimulationDataManager::updatePreprocessingPool | ( | 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.
dataPacks | A list of DataPacks that will be inserted into the Preprocessing pool |
void SimulationDataManager::updateTransceiverPool | ( | 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.
dataPacks | A list of DataPacks that will be inserted into the Transceiver pool |