class SimulationDataManager

Overview

Manages all simulation data. More…

#include <simulation_data_manager.h>

class SimulationDataManager {
public:
    // methods

    void pushToTrajectory(datapacks_vector_t dataPacks);
    const datapacks_vector_t& getTrajectory() const;
    void clearTrajectory();
    void setDoneFlag(bool doneFlag);
    bool getDoneFlag() const;
    void clear();
    void updateExternalPool(datapacks_vector_t dataPacks);
    void updatePreprocessingPool(datapacks_vector_t dataPacks);
    void updateTransceiverPool(datapacks_vector_t dataPacks);
    void updateEnginePool(datapacks_vector_t dataPacks);
    datapacks_set_t getEngineDataPacks(const std::string& engineName) const;
    datapacks_set_t getTransceiverDataPacks() const;
    datapacks_set_t getPreprocessingDataPacks() const;
    datapacks_set_t getStatusDataPacks() const;
    void startNewIteration();
};

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 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

void pushToTrajectory(datapacks_vector_t dataPacks)

Appends the input vector to the trajectory.

const datapacks_vector_t& getTrajectory() const

Returns the trajectory vector.

void clearTrajectory()

Clears the trajectory vector.

void setDoneFlag(bool doneFlag)

Sets value of the ‘done’ flag.

bool getDoneFlag() const

Returns value of the ‘done’ flag.

void clear()

Clears all data stored in the manager.

void 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.

Parameters:

dataPacks

A list of DataPacks that will be inserted into the External pool

void 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.

Parameters:

dataPacks

A list of DataPacks that will be inserted into the Preprocessing pool

void 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.

Parameters:

dataPacks

A list of DataPacks that will be inserted into the Transceiver pool

void 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.

Parameters:

dataPacks

A list of DataPacks that will be inserted into the Engine pool

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.

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.

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.

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.

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.