Updated on 2022-03-13 GMT+08:00

AIContext

Saves the process context when the Process interface of the model manager is called asynchronously, including the key-value pair of the string type. This data type is defined in ai_types.h.
class AIContext
{
public:
    /*
    * @brief   Obtain a parameter.
    * @param [in] key   Key corresponding to the parameter
    * @return sring   Value corresponding to the key. If the value does not exist, a null string is returned.
    */
    const std::string GetPara(const std::string &key) const;

    /*
    * @brief   Set a parameter.
    * @param [in] key   Key corresponding to the parameter
    * @param [in] value   Value corresponding to the parameter
    */
    void AddPara(const std::string &key, const std::string &value);

    /*
    * @brief   Delete a parameter.
    * @param [in] key   Key corresponding to the parameter to be deleted
    */
    void DeletePara(const std::string &key);

    /*
     * @brief    Obtain all parameters.
    * @param [out] keys  Key corresponding to all parameters that have been set
    */
    void GetAllKeys(std::vector<std::string> &keys);

#if defined( __ANDROID__) || defined(ANDROID)
        std::string  Serialize();

        AIStatus  Deserialize(std::string str);
#endif

private:
    std::map<std::string, std::string> paras_; /** Definition of the name-value pairs of parameters */
};