LCOV - code coverage report
Current view: top level - common - bqs_so_manager.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 7 7
Test Date: 2026-08-12 11:05:07 Functions: 100.0 % 2 2

            Line data    Source code
       1              : /**
       2              :  * Copyright (c) 2025 Huawei Technologies Co., Ltd.
       3              :  * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
       4              :  * CANN Open Software License Agreement Version 2.0 (the "License").
       5              :  * Please refer to the License for details. You may not use this file except in compliance with the License.
       6              :  * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
       7              :  * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
       8              :  * See LICENSE in the root of the software repository for the full text of the License.
       9              :  */
      10              : 
      11              : #ifndef QUEUE_SCHEDULE_SO_MANAGER_H
      12              : #define QUEUE_SCHEDULE_SO_MANAGER_H
      13              : 
      14              : #include <map>
      15              : #include <string>
      16              : #include <vector>
      17              : 
      18              : namespace bqs {
      19              : class SoManager {
      20              : public:
      21           14 :     SoManager(const std::string& soName, const std::vector<std::string>& funcNames)
      22           28 :         : soName_(soName), soHandle_(nullptr), funcHandleMap_({})
      23              :     {
      24           14 :         OpenSo();
      25           14 :         if (soHandle_ != nullptr) {
      26            4 :             BatchLoadFunc(funcNames);
      27              :         }
      28           14 :     };
      29              : 
      30           14 :     ~SoManager() { CloseSo(); }
      31              : 
      32              :     void* GetFuncHandle(const std::string& funcName) const;
      33              : 
      34              :     bool IsSoLoad() const;
      35              : 
      36              : private:
      37              :     SoManager(const SoManager&) = delete;
      38              :     SoManager& operator=(const SoManager&) = delete;
      39              :     SoManager(SoManager&&) = delete;
      40              :     SoManager& operator=(SoManager&&) = delete;
      41              : 
      42              :     void OpenSo();
      43              :     void CloseSo();
      44              :     void BatchLoadFunc(const std::vector<std::string>& funcNames);
      45              :     void* GetFuncHandleFromSo(const std::string& funcName) const;
      46              : 
      47              :     std::string soName_;
      48              :     void* soHandle_;
      49              :     std::map<std::string, void*> funcHandleMap_;
      50              : };
      51              : } // namespace bqs
      52              : 
      53              : #endif // QUEUE_SCHEDULE_SO_MANAGER_H
        

Generated by: LCOV version 2.0-1