NRP Core  1.4.1
tf_manager_handle.h
Go to the documentation of this file.
1 /* * NRP Core - Backend infrastructure to synchronize simulations
2  *
3  * Copyright 2020-2023 NRP Team
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * This project has received funding from the European Union’s Horizon 2020
18  * Framework Programme for Research and Innovation under the Specific Grant
19  * Agreement No. 945539 (Human Brain Project SGA3).
20  */
21 
22 #ifndef TF_MANAGER_HANDLE_H
23 #define TF_MANAGER_HANDLE_H
24 
26 
28 
29 
34 
35 public:
36 
37  TFManagerHandle(SimulationDataManager * simulationDataManager):
38  DataPackProcessor(simulationDataManager)
39  {}
40 
41  void init(const jsonSharedPtr &simConfig, const engine_interfaces_t &engines) override;
42 
52  void postEngineInit(const std::vector<EngineClientInterfaceSharedPtr> &engines) override;
53 
62  void preEngineReset(const std::vector<EngineClientInterfaceSharedPtr> &engines) override;
63 
73  void postEngineReset(const std::vector<EngineClientInterfaceSharedPtr> &engines) override;
74 
75  void updateDataPacksFromEngines(const std::vector<EngineClientInterfaceSharedPtr> &engines) override;
76 
77  void compute(const std::vector<EngineClientInterfaceSharedPtr> &engines) override;
78 
79  void sendDataPacksToEngines(const std::vector<EngineClientInterfaceSharedPtr> &engines) override;
80 
81 private:
82 
89  void executePreprocessingFunctions(FunctionManager &functionManager,
90  const std::vector<EngineClientInterfaceSharedPtr> &engines,
91  datapacks_set_t dataPacks);
92 
99  void executeTransceiverFunctions(FunctionManager &functionManager,
100  const std::vector<EngineClientInterfaceSharedPtr> &engines,
101  datapacks_set_t dataPacks);
102 
106  void loadDataPackFunctions(const jsonSharedPtr &simConfig);
107 
111  void loadStatusFunction(const jsonSharedPtr &simConfig);
112 
118  void postEngineActivityHelper(const std::vector<EngineClientInterfaceSharedPtr> &engines);
119 
121  FunctionManager _functionManager;
122 };
123 
124 #endif // TF_MANAGER_HANDLE_H
datapacks_set_t
std::set< std::shared_ptr< const DataPackInterface >, DataPackPointerComparator > datapacks_set_t
Definition: datapack_interface.h:219
TFManagerHandle::TFManagerHandle
TFManagerHandle(SimulationDataManager *simulationDataManager)
Definition: tf_manager_handle.h:37
jsonSharedPtr
std::shared_ptr< nlohmann::json > jsonSharedPtr
Definition: json_schema_utils.h:35
DataPackProcessor
Helper class for FTILoop encapsulating the datapack operations between Engines in a simulation loop.
Definition: datapack_handle.h:34
function_manager.h
TFManagerHandle::init
void init(const jsonSharedPtr &simConfig, const engine_interfaces_t &engines) override
Initializes the handler.
Definition: tf_manager_handle.cpp:70
TFManagerHandle::postEngineInit
void postEngineInit(const std::vector< EngineClientInterfaceSharedPtr > &engines) override
Performs post-engine-initialization DataPack operations.
Definition: tf_manager_handle.cpp:101
SimulationDataManager
Manages all simulation data.
Definition: simulation_data_manager.h:53
TFManagerHandle::updateDataPacksFromEngines
void updateDataPacksFromEngines(const std::vector< EngineClientInterfaceSharedPtr > &engines) override
Request datapacks from engines.
Definition: tf_manager_handle.cpp:133
TFManagerHandle::postEngineReset
void postEngineReset(const std::vector< EngineClientInterfaceSharedPtr > &engines) override
Performs post-engine-reset DataPack operations.
Definition: tf_manager_handle.cpp:127
datapack_handle.h
TFManagerHandle::preEngineReset
void preEngineReset(const std::vector< EngineClientInterfaceSharedPtr > &engines) override
Performs pre-engine-reset DataPack operations.
Definition: tf_manager_handle.cpp:107
TFManagerHandle
Uses the TF framework to execute datapack transformation operations.
Definition: tf_manager_handle.h:33
TFManagerHandle::sendDataPacksToEngines
void sendDataPacksToEngines(const std::vector< EngineClientInterfaceSharedPtr > &engines) override
Send datapacks to engines.
Definition: tf_manager_handle.cpp:174
TFManagerHandle::compute
void compute(const std::vector< EngineClientInterfaceSharedPtr > &engines) override
Perform computations on datapacks.
Definition: tf_manager_handle.cpp:153
FunctionManager
Manages all types of Python functions that can be run as part of NRP Core.
Definition: function_manager.h:73
DataPackProcessor::engine_interfaces_t
std::vector< EngineClientInterfaceSharedPtr > engine_interfaces_t
Definition: datapack_handle.h:38