LCOV - code coverage report
Current view: top level - basic_component/package_manager/inc - package_env_info.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 7 7
Test Date: 2026-07-28 10:52:48 Functions: 100.0 % 7 7

            Line data    Source code
       1              : /**
       2              :  * Copyright (c) 2026 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 TSD_PACKAGE_ENV_INFO_H
      12              : #define TSD_PACKAGE_ENV_INFO_H
      13              : 
      14              : #include "plugin_pkg_version.h"
      15              : #include "hdc_message_builder.h"
      16              : #include "driver/ascend_hal.h"
      17              : #include "proto/tsd_message.pb.h"
      18              : #include "basic_define.h"
      19              : 
      20              : #include <string>
      21              : #include <vector>
      22              : 
      23              : namespace tsd {
      24              : 
      25              : class PackageEnvInfo {
      26              : public:
      27              :     PackageEnvInfo(uint32_t logicDeviceId, uint32_t platInfoMode, bool isAdcEnv, uint32_t chipType);
      28        51701 :     ~PackageEnvInfo() = default;
      29              : 
      30              :     // 平台信息
      31            8 :     uint32_t GetPlatInfoMode() const { return platInfoMode_; }
      32           10 :     void SetPlatInfoMode(uint32_t mode) { platInfoMode_ = mode; }
      33           16 :     bool IsAdcEnv() const { return isAdcEnv_; }
      34            6 :     uint32_t GetPlatInfoChipType() const { return chipType_; }
      35            5 :     void SetPlatInfoChipType(uint32_t chipType) { chipType_ = chipType; }
      36          167 :     uint32_t GetLogicDeviceId() const { return logicDeviceId_; }
      37              : 
      38              :     // 包扫描
      39              :     bool CheckPackageExists(const bool loadAicpuKernelFlag = true);
      40              :     bool GetPackageTitle(std::string& packageTitle) const;
      41              :     static bool ResolvePackageTitle(uint32_t chipType, uint32_t platInfoMode, std::string& packageTitle);
      42              :     const std::string& GetPackageName(uint32_t type) const { return packageName_[type]; }
      43              :     const std::string& GetPackagePath(uint32_t type) const { return packagePath_[type]; }
      44              : 
      45              :     // 路径解析
      46              :     void GetAscendLatestIntallPath(std::string& pkgBasePath) const;
      47              :     bool GetShortSocVersion(std::string& shortSocVersion) const;
      48              :     std::string GetCurHostMutexFile(bool useCannPath) const;
      49              :     std::string GetTrustedBasePath(bool useV2) const;
      50              :     TSD_StatusT GetTrustedBasePathFromDevice(int32_t& peerNode, std::string& dstDirPreFix) const;
      51              : 
      52              :     // 状态(public 供 Facade 引用别名访问)
      53              :     uint32_t platInfoMode_;
      54              :     bool isAdcEnv_;
      55              :     uint32_t chipType_;
      56              :     std::string hostSoPath_;
      57              :     std::string packageName_[static_cast<uint32_t>(TsdLoadPackageType::TSD_PKG_TYPE_MAX)];
      58              :     std::string packagePath_[static_cast<uint32_t>(TsdLoadPackageType::TSD_PKG_TYPE_MAX)];
      59              :     std::string packagePattern_[static_cast<uint32_t>(TsdLoadPackageType::TSD_PKG_TYPE_MAX)];
      60              : 
      61              :     bool CheckPackageExistsOnce(const uint32_t packageType);
      62              :     bool GetPackagePath(std::string& packagePath, const uint32_t packageType) const;
      63              :     std::vector<std::string> ScanAndMatchPackages(const std::string& pkgPath, const uint32_t packageType) const;
      64              : 
      65              : private:
      66              :     uint32_t logicDeviceId_;
      67              : };
      68              : 
      69              : } // namespace tsd
      70              : 
      71              : #endif // TSD_PACKAGE_ENV_INFO_H
        

Generated by: LCOV version 2.0-1