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 PLUGIN_LABEL_H 17 #define PLUGIN_LABEL_H 18 19 #include <mutex> 20 #include <string> 21 22 #include "protocol/retcode_inner/aie_retcode_inner.h" 23 #include "utils/aie_macros.h" 24 25 namespace OHOS { 26 namespace AI { 27 class PluginLabel { 28 FORBID_COPY_AND_ASSIGN(PluginLabel); 29 FORBID_CREATE_BY_SELF(PluginLabel); 30 public: 31 /** 32 * Get plugin label which combined algorithm id and algorithm version. 33 * 34 * @return plugin label 35 */ 36 static PluginLabel *GetInstance(); 37 38 /** 39 * Release the singleton instance. 40 */ 41 static void ReleaseInstance(); 42 43 /** 44 * Get algorithm path 45 * 46 * @param [in] aid Algorithm id 47 * @param [in] version Algorithm version 48 * @param [out] libPath Algorithm path 49 * @return Algorithm path 50 */ 51 int GetLibPath(const std::string &aid, long long &version, std::string &libPath); 52 53 private: 54 static std::mutex instanceLock_; 55 static PluginLabel *instance_; 56 }; 57 } // namespace AI 58 } // namespace OHOS 59 60 #endif // PLUGIN_LABEL_H 61