.. index:: pair: class; FunctionManager .. _doxid-class_function_manager: class FunctionManager ===================== .. toctree:: :hidden: Overview ~~~~~~~~ Manages all types of Python functions that can be run as part of NRP Core. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class FunctionManager { public: // typedefs typedef std::multimap`> :target:`function_datas_t`; typedef std::pair :target:`linked_functions_t`; typedef std::tuple`> :target:`status_function_results_t`; // construction :target:`FunctionManager`(); :target:`FunctionManager`(const boost::python::dict& tfGlobals); // methods :ref:`datapack_identifiers_set_t` :ref:`getRequestedDataPackIDs`() const; :ref:`DataPackPassingPolicy` :target:`getDataPackPassingPolicy`() const; void :target:`setDataPackPassingPolicy`(:ref:`DataPackPassingPolicy` method); void :ref:`setSimulationTime`(:ref:`SimulationTime` simulationTime); const :ref:`SimulationTime`& :ref:`getSimulationTime`() const; void :ref:`setSimulationIteration`(unsigned long simulationIteration); unsigned long :ref:`getSimulationIteration`() const; void :ref:`loadDataPackFunction`( const std::string& dataPackFunctionName, const std::string& dataPackFunctionFilename ); void :ref:`loadStatusFunction`( const std::string& statusFunctionName, const std::string& statusFunctionFilename ); :ref:`datapacks_vector_t` :ref:`executePreprocessingFunctions`( const std::string& engineName, :ref:`datapacks_set_t` dataPacks ); :ref:`datapacks_vector_t` :ref:`executeTransceiverFunctions`( const std::string& engineName, :ref:`datapacks_set_t` dataPacks ); :ref:`status_function_results_t` :ref:`executeStatusFunction`(:ref:`datapacks_set_t` dataPacks); }; .. _details-class_function_manager: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ 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: * Preprocessing Functions * Transceiver Functions * Status Functions Preprocessing and Transceiver Functions will be also refered to as :ref:`DataPack ` (Processing) Functions, to distinguish them from Status Functions, which have a slightly different purpose. Methods ------- .. index:: pair: function; getRequestedDataPackIDs .. _doxid-class_function_manager_1a241a67aee472e40822138c95b2de86bc: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`datapack_identifiers_set_t` getRequestedDataPackIDs() const Get :ref:`DataPack ` IDs requested by TFs. .. rubric:: Returns: .. index:: pair: function; setSimulationTime .. _doxid-class_function_manager_1ada599a5144ac5f2b65d24d33ac595af0: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setSimulationTime(:ref:`SimulationTime` simulationTime) Sets simulation time that will be accessible by all Python Functions. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - simulationTime - Current simulation time from the simulation manager .. index:: pair: function; getSimulationTime .. _doxid-class_function_manager_1a11d0ce938b19aa58e026e3aeb7e51af1: .. ref-code-block:: cpp :class: doxyrest-title-code-block const :ref:`SimulationTime`& getSimulationTime() const Returns simulation time stored by the manager. .. index:: pair: function; setSimulationIteration .. _doxid-class_function_manager_1a9ae6b58fa3604c4b3e204399091fb0c0: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setSimulationIteration(unsigned long simulationIteration) Sets simulation iteration that will be accessible by all Python Functions. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - simulationIteration - Current simulation iteration from the simulation manager .. index:: pair: function; getSimulationIteration .. _doxid-class_function_manager_1a4ce22e0bb7f9eca45aace9ca0dc701bd: .. ref-code-block:: cpp :class: doxyrest-title-code-block unsigned long getSimulationIteration() const Returns simulation iteration number stored by the manager. .. index:: pair: function; loadDataPackFunction .. _doxid-class_function_manager_1a2d3c43dc5d4089d8764b46267f4ce1db: .. ref-code-block:: cpp :class: doxyrest-title-code-block void loadDataPackFunction( const std::string& dataPackFunctionName, const std::string& dataPackFunctionFilename ) Loads given :ref:`DataPack ` Processing Function. 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. :ref:`DataPack ` Processing Functions are Transceiver Functions and Preprocessing Functions. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - 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. .. index:: pair: function; loadStatusFunction .. _doxid-class_function_manager_1ae12e26eec30ba54f7678cfeddccc3730: .. ref-code-block:: cpp :class: doxyrest-title-code-block void loadStatusFunction( const std::string& statusFunctionName, const std::string& statusFunctionFilename ) Loads given status funtion. 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. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - 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. .. index:: pair: function; executePreprocessingFunctions .. _doxid-class_function_manager_1a901e42df04f88673774ebd8861bbe7b5: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`datapacks_vector_t` executePreprocessingFunctions( const std::string& engineName, :ref:`datapacks_set_t` dataPacks ) Executes all Preprocessing Functions linked to an engine. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - engineName - Name of engine .. rubric:: Returns: Returns results of executed Preprocessing Functions .. index:: pair: function; executeTransceiverFunctions .. _doxid-class_function_manager_1ae9ab57a0f45814c83fd983f8004871cc: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`datapacks_vector_t` executeTransceiverFunctions( const std::string& engineName, :ref:`datapacks_set_t` dataPacks ) Executes all Transceiver Functions linked to an engine. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - engineName - Name of engine .. rubric:: Returns: Returns results of executed Preprocessing Functions .. index:: pair: function; executeStatusFunction .. _doxid-class_function_manager_1ab0368b09156ffb85faf4e91aac9fc026: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`status_function_results_t` executeStatusFunction(:ref:`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. .. rubric:: Returns: Results of the Status Function execution as JSON object