NRP Core  1.4.1
StatusFunction Class Reference

Holds a single Python function created with StatusFunction decorator. More...

#include <status_function.h>

Inheritance diagram for StatusFunction:
TransceiverDataPackInterface PtrTemplates< StatusFunction > PtrTemplates< TransceiverDataPackInterface >

Public Member Functions

 StatusFunction ()
 Constructs a status function object. More...
 
virtual ~StatusFunction () override=default
 
const std::string & linkedEngineName () const override final
 Returns an empty string. More...
 
bool isPreprocessing () const override final
 Returns false. More...
 
TransceiverDataPackInterface::shared_ptr pySetup (boost::python::object statusFunction)
 Performs actual initialization of the object. More...
 
boost::python::object runTf (boost::python::tuple &args, boost::python::dict &kwargs, datapacks_set_t dataPacks) override
 Runs the status function. More...
 
- Public Member Functions inherited from TransceiverDataPackInterface
 TransceiverDataPackInterface ()=default
 
virtual ~TransceiverDataPackInterface ()=default
 
template<class TRANSCEIVER_DATAPACK >
TransceiverDataPackInterface::shared_ptr pySetup (const TransceiverDataPackInterface::shared_ptr &tfDataPack)
 Decorator call() function. Takes the lower decorator as a parameter. Moves the given class into a shared_ptr, which will be managed by the next decorator. More...
 

Protected Member Functions

datapack_identifiers_set_t getRequestedDataPackIDs () const override
 Returns datapack IDs of this DataPack that should be requested from the engines. TODO: Make protected. More...
 
datapack_identifiers_set_t updateRequestedDataPackIDs (datapack_identifiers_set_t &&datapackIDs) const override
 Appends its own datapack requests onto datapackIDs. Uses getRequestedDataPackIDs to check which IDs are requested by this datapack. More...
 
- Protected Member Functions inherited from TransceiverDataPackInterface
template<class TRANSCEIVER_DATAPACK >
PtrTemplates< TRANSCEIVER_DATAPACK >::shared_ptr moveToSharedPtr ()
 

Additional Inherited Members

- Public Types inherited from PtrTemplates< TransceiverDataPackInterface >
using shared_ptr = std::shared_ptr< TransceiverDataPackInterface >
 
using const_shared_ptr = std::shared_ptr< const TransceiverDataPackInterface >
 
using unique_ptr = std::unique_ptr< TransceiverDataPackInterface >
 
using const_unique_ptr = std::unique_ptr< const TransceiverDataPackInterface >
 
- Public Types inherited from PtrTemplates< StatusFunction >
using shared_ptr = std::shared_ptr< StatusFunction >
 
using const_shared_ptr = std::shared_ptr< const StatusFunction >
 
using unique_ptr = std::unique_ptr< StatusFunction >
 
using const_unique_ptr = std::unique_ptr< const StatusFunction >
 
- Static Public Member Functions inherited from TransceiverDataPackInterface
static void setTFInterpreter (FunctionManager *interpreter)
 Set global TF Interpreter. All Transceiver Functions will register themselves with it upon creation. More...
 
static const FunctionManagergetFunctionManager ()
 
- Static Protected Attributes inherited from TransceiverDataPackInterface
static FunctionManager_functionManager = nullptr
 Pointer to TF Interpreter. Will be used to register a new TF function. More...
 

Detailed Description

Holds a single Python function created with StatusFunction decorator.

Constructor & Destructor Documentation

◆ StatusFunction()

StatusFunction::StatusFunction ( )

Constructs a status function object.

Status functions live on the boundary between C++ and Python worlds. The constructor only allocates the memory needed by the objects, but they are truly initialized only when a proper Python decorator is called from the Python context. The decorators are linked to the pySetup method, which performs the true initialization.

◆ ~StatusFunction()

virtual StatusFunction::~StatusFunction ( )
overridevirtualdefault

Member Function Documentation

◆ getRequestedDataPackIDs()

datapack_identifiers_set_t StatusFunction::getRequestedDataPackIDs ( ) const
overrideprotectedvirtual

Returns datapack IDs of this DataPack that should be requested from the engines. TODO: Make protected.

Reimplemented from TransceiverDataPackInterface.

◆ isPreprocessing()

bool StatusFunction::isPreprocessing ( ) const
finaloverridevirtual

Returns false.

Status functions don't have the concept of pre-processing. The method is implemented in order to conform to the base interface.

Reimplemented from TransceiverDataPackInterface.

◆ linkedEngineName()

const std::string & StatusFunction::linkedEngineName ( ) const
finaloverridevirtual

Returns an empty string.

Status functions are not linked to any engine, so the string returned by this method should always be empty. The method is implemented in order to conform to the base interface.

Reimplemented from TransceiverDataPackInterface.

◆ pySetup()

TransceiverDataPackInterface::shared_ptr StatusFunction::pySetup ( boost::python::object  statusFunction)

Performs actual initialization of the object.

Parameters
statusFunctionUser-defined python function. It will be linked to this C++ object.
Returns
shared_ptr referencing data from this object

This method is linked to the call() method of Python StatusFunction decorator. It links the user-defined python function to this C++ object. It also registers the C++ object in the function manager.

◆ runTf()

boost::python::object StatusFunction::runTf ( boost::python::tuple &  args,
boost::python::dict &  kwargs,
datapacks_set_t  dataPacks 
)
overridevirtual

Runs the status function.

Parameters
argsPython args
kwargsPython keywords
Returns
Result of status function execution

Reimplemented from TransceiverDataPackInterface.

◆ updateRequestedDataPackIDs()

datapack_identifiers_set_t StatusFunction::updateRequestedDataPackIDs ( datapack_identifiers_set_t &&  datapackIDs) const
overrideprotectedvirtual

Appends its own datapack requests onto datapackIDs. Uses getRequestedDataPackIDs to check which IDs are requested by this datapack.

Parameters
datapackIDsContainer with datapack IDs that gets expanded
Returns
Returns datapackIDs, with own datapackIDs appended

Reimplemented from TransceiverDataPackInterface.


The documentation for this class was generated from the following files: