Graph::SetDataRecvFunctor
Sets the callback function for an engine in the graph to receive messages. The running environment of the code that calls the API must be the same as that of the engine. For example, if the engine runs on the device side, the code that calls the function must also run in the device side. This API is defined in graph.h.
This API, which must be used together with the DataRecvInterface::RecvData API, is generally used to return the inference result to the user. The detailed principles are as follows:
- Define a subclass (for example, DdkDataRecvInterface) of class DataRecvInterface and initialize the object of the subclass.
- Set the object of class DdkDataRecvInterface to a callback function by calling Graph::SetDataRecvFunctor.
- Send the input data to the corresponding output port by calling Engine::SendData.
- Return the inference result by calling the RecvData function of class DdkDataRecvInterface.
Syntax
static HIAI_StatusT Graph::SetDataRecvFunctor(const EnginePortID& targetPortConfig, const std::shared_ptr<DataRecvInterface>& dataRecv);
Parameter Description
Parameter |
Description |
Value Range |
---|---|---|
targetPortConfig |
Graph ID, engine ID, and port ID of the data receiver |
- |
dataRecv |
Callback function for receiving user-defined data |
- |
Return Value
For details about the returned error codes, see "Error Codes."
Error Codes
No. |
Error Code |
Description |
---|---|---|
1 |
HIAI_OK |
The running is OK. |
2 |
HIAI_PORT_ID_ERROR |
The port ID has an error. |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot