NRP Core  1.4.1
simulation_data_manager.h
Go to the documentation of this file.
1 /*
2  * NRP Core - Backend infrastructure to synchronize simulations
3  *
4  * Copyright 2020-2023 NRP Team
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  * This project has received funding from the European Union’s Horizon 2020
19  * Framework Programme for Research and Innovation under the Specific Grant
20  * Agreement No. 945539 (Human Brain Project SGA3).
21  */
22 
23 #ifndef SIMULATION_DATA_MANAGER_H
24 #define SIMULATION_DATA_MANAGER_H
25 
26 
28 #include "nrp_protobuf/nrp_server.grpc.pb.h"
29 
30 
54 {
55 
56 public:
57 
61  void pushToTrajectory(datapacks_vector_t dataPacks);
62 
66  const datapacks_vector_t & getTrajectory() const;
67 
71  void clearTrajectory();
72 
76  void setDoneFlag(bool doneFlag);
77 
81  bool getDoneFlag() const;
82 
86  void clear();
87 
96  void updateExternalPool(datapacks_vector_t dataPacks);
97 
107 
117 
126  void updateEnginePool(datapacks_vector_t dataPacks);
127 
134  datapacks_set_t getEngineDataPacks(const std::string & engineName) const;
135 
142 
149 
156 
163  void startNewIteration();
164 
165 private:
166 
167  bool _doneFlag = false;
168 
172  datapacks_set_t _preprocessingPool;
173 
177  datapacks_set_t _transceiverPool;
178 
182  datapacks_set_t _enginePool;
183 
187  datapacks_vector_t _trajectory;
188 
192  datapacks_set_t _externalPool;
193 };
194 
195 
196 #endif // SIMULATION_DATA_MANAGER_H
197 
198 // EOF
datapacks_vector_t
std::vector< std::shared_ptr< const DataPackInterface > > datapacks_vector_t
Definition: datapack_interface.h:220
SimulationDataManager::startNewIteration
void startNewIteration()
Performs bookkeeping at start of the simulation iteration.
Definition: simulation_data_manager.cpp:172
datapacks_set_t
std::set< std::shared_ptr< const DataPackInterface >, DataPackPointerComparator > datapacks_set_t
Definition: datapack_interface.h:219
SimulationDataManager::getPreprocessingDataPacks
datapacks_set_t getPreprocessingDataPacks() const
Returns a set of DataPacks that are intended to be accessed by the Preprocessing Functions.
Definition: simulation_data_manager.cpp:156
SimulationDataManager::getStatusDataPacks
datapacks_set_t getStatusDataPacks() const
Returns a set of DataPacks that are intended to be accessed by the Status Function.
Definition: simulation_data_manager.cpp:162
SimulationDataManager::getEngineDataPacks
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.
Definition: simulation_data_manager.cpp:123
SimulationDataManager::setDoneFlag
void setDoneFlag(bool doneFlag)
Sets value of the 'done' flag.
Definition: simulation_data_manager.cpp:65
SimulationDataManager::updateTransceiverPool
void updateTransceiverPool(datapacks_vector_t dataPacks)
Updates the pool of DataPacks coming from the Transceiver Functions.
Definition: simulation_data_manager.cpp:100
SimulationDataManager::getDoneFlag
bool getDoneFlag() const
Returns value of the 'done' flag.
Definition: simulation_data_manager.cpp:71
SimulationDataManager::updateExternalPool
void updateExternalPool(datapacks_vector_t dataPacks)
Updates the pool of DataPacks coming from an external source (e.g. a master script)
Definition: simulation_data_manager.cpp:88
SimulationDataManager::getTrajectory
const datapacks_vector_t & getTrajectory() const
Returns the trajectory vector.
Definition: simulation_data_manager.cpp:59
SimulationDataManager::getTransceiverDataPacks
datapacks_set_t getTransceiverDataPacks() const
Returns a set of DataPacks that are intended to be accessed by the Transceiver Functions.
Definition: simulation_data_manager.cpp:147
function_manager.h
SimulationDataManager::pushToTrajectory
void pushToTrajectory(datapacks_vector_t dataPacks)
Appends the input vector to the trajectory.
Definition: simulation_data_manager.cpp:47
SimulationDataManager::clearTrajectory
void clearTrajectory()
Clears the trajectory vector.
Definition: simulation_data_manager.cpp:53
SimulationDataManager::clear
void clear()
Clears all data stored in the manager.
Definition: simulation_data_manager.cpp:77
SimulationDataManager
Manages all simulation data.
Definition: simulation_data_manager.h:53
SimulationDataManager::updateEnginePool
void updateEnginePool(datapacks_vector_t dataPacks)
Updates the pool of DataPacks coming from Engines.
Definition: simulation_data_manager.cpp:106
SimulationDataManager::updatePreprocessingPool
void updatePreprocessingPool(datapacks_vector_t dataPacks)
Updates the pool of DataPacks coming from the Preprocessing Functions.
Definition: simulation_data_manager.cpp:94