1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef I_PLUGIN_MANAGER_H 17 #define I_PLUGIN_MANAGER_H 18 19 #include <memory> 20 #include <string> 21 22 #include "plugin_manager/include/plugin.h" 23 24 namespace OHOS { 25 namespace AI { 26 class IPluginManager { 27 public: 28 /** 29 * Create plugin manager. 30 * 31 * @return plugin manager 32 */ 33 static IPluginManager *GetPluginManager(); 34 35 /** 36 * Destroy plugin. 37 */ 38 virtual void Destroy() = 0; 39 40 /** 41 * Get plugin. 42 * 43 * @param [in] aid Algorithm id 44 * @param [in] version Algorithm version 45 * @param [out] plugin Plugin 46 * @return Returns RETCODE_SUCCESS(0) if the operation is successful, returns a non-zero value otherwise. 47 */ 48 virtual int GetPlugin(const std::string &aid, long long version, std::shared_ptr<Plugin> &plugin) = 0; 49 50 /** 51 * Unload plugin. 52 * 53 * @param [in] aid Algorithm id 54 * @param [in] version Algorithm version 55 */ 56 virtual void UnloadPlugin(const std::string &aid, long long version) = 0; 57 58 protected: 59 virtual ~IPluginManager() = default; 60 }; 61 } // namespace AI 62 } // namespace OHOS 63 #endif // I_PLUGIN_MANAGER_H