Manages all types of Python functions that can be run as part of NRP Core. More...
#include <function_manager.h>
Public Types | |
using | function_datas_t = std::multimap< std::string, FunctionData > |
using | linked_functions_t = std::pair< FunctionManager::function_datas_t::iterator, FunctionManager::function_datas_t::iterator > |
using | status_function_results_t = std::tuple< bool, datapacks_vector_t > |
Public Member Functions | |
FunctionManager () | |
FunctionManager (const boost::python::dict &tfGlobals) | |
datapack_identifiers_set_t | getRequestedDataPackIDs () const |
Get DataPack IDs requested by TFs. More... | |
DataPackPassingPolicy | getDataPackPassingPolicy () const |
void | setDataPackPassingPolicy (DataPackPassingPolicy method) |
void | setSimulationTime (SimulationTime simulationTime) |
Sets simulation time that will be accessible by all Python Functions. More... | |
const SimulationTime & | getSimulationTime () const |
Returns simulation time stored by the manager. More... | |
void | setSimulationIteration (unsigned long simulationIteration) |
Sets simulation iteration that will be accessible by all Python Functions. More... | |
unsigned long | getSimulationIteration () const |
Returns simulation iteration number stored by the manager. More... | |
void | loadDataPackFunction (const std::string &dataPackFunctionName, const std::string &dataPackFunctionFilename) |
Loads given DataPack Processing Function. More... | |
void | loadStatusFunction (const std::string &statusFunctionName, const std::string &statusFunctionFilename) |
Loads given status funtion. More... | |
datapacks_vector_t | executePreprocessingFunctions (const std::string &engineName, datapacks_set_t dataPacks) |
Executes all Preprocessing Functions linked to an engine. More... | |
datapacks_vector_t | executeTransceiverFunctions (const std::string &engineName, datapacks_set_t dataPacks) |
Executes all Transceiver Functions linked to an engine. More... | |
status_function_results_t | executeStatusFunction (datapacks_set_t dataPacks) |
Executes Status Function registered loaded by the manager. More... | |
Friends | |
class | TransceiverFunction |
class | PreprocessingFunction |
class | StatusFunction |
Manages all types of Python functions that can be run as part of NRP Core.
This class is responsible for loading and running all Python functions that are supported by NRP Core. The following function types are supported:
using FunctionManager::function_datas_t = std::multimap<std::string, FunctionData> |
using FunctionManager::linked_functions_t = std::pair<FunctionManager::function_datas_t::iterator, FunctionManager::function_datas_t::iterator> |
using FunctionManager::status_function_results_t = std::tuple<bool, datapacks_vector_t> |
FunctionManager::FunctionManager | ( | ) |
FunctionManager::FunctionManager | ( | const boost::python::dict & | tfGlobals | ) |
datapacks_vector_t FunctionManager::executePreprocessingFunctions | ( | const std::string & | engineName, |
datapacks_set_t | dataPacks | ||
) |
Executes all Preprocessing Functions linked to an engine.
engineName | Name of engine |
FunctionManager::status_function_results_t FunctionManager::executeStatusFunction | ( | datapacks_set_t | dataPacks | ) |
Executes Status Function registered loaded by the manager.
This method will run the Status Function that was loaded using loadStatusFunction
method.
datapacks_vector_t FunctionManager::executeTransceiverFunctions | ( | const std::string & | engineName, |
datapacks_set_t | dataPacks | ||
) |
Executes all Transceiver Functions linked to an engine.
engineName | Name of engine |
DataPackPassingPolicy FunctionManager::getDataPackPassingPolicy | ( | ) | const |
datapack_identifiers_set_t FunctionManager::getRequestedDataPackIDs | ( | ) | const |
Get DataPack IDs requested by TFs.
unsigned long FunctionManager::getSimulationIteration | ( | ) | const |
Returns simulation iteration number stored by the manager.
const SimulationTime & FunctionManager::getSimulationTime | ( | ) | const |
Returns simulation time stored by the manager.
void FunctionManager::loadDataPackFunction | ( | const std::string & | dataPackFunctionName, |
const std::string & | dataPackFunctionFilename | ||
) |
Loads given DataPack Processing Function.
dataPackFunctionName | Name of the function, used as function's ID. The name doesn't have to match the actual name of the python function. |
dataPackFunctionFilename | Name of the file where the function is located. |
The function runs python code from the given file, executes all decorators found in the function definition, and stores the function with some metadata for future use.
DataPack Processing Functions are Transceiver Functions and Preprocessing Functions.
void FunctionManager::loadStatusFunction | ( | const std::string & | statusFunctionName, |
const std::string & | statusFunctionFilename | ||
) |
Loads given status funtion.
statusFunctionName | Name of the function, used as function's ID. The name doesn't have to match the actual name of the python function. |
statusFunctionFilename | Name of the file where the function is located. |
The function runs python code from the given file, executes all decorators found in the definition of the function, and stores the function with some metadata for future use.
void FunctionManager::setDataPackPassingPolicy | ( | DataPackPassingPolicy | method | ) |
void FunctionManager::setSimulationIteration | ( | unsigned long | simulationIteration | ) |
Sets simulation iteration that will be accessible by all Python Functions.
simulationIteration | Current simulation iteration from the simulation manager |
void FunctionManager::setSimulationTime | ( | SimulationTime | simulationTime | ) |
Sets simulation time that will be accessible by all Python Functions.
simulationTime | Current simulation time from the simulation manager |
|
friend |
|
friend |
|
friend |