LCOV - code coverage report
Current view: top level - coll_communicator_mgr/rank_graph/rank_table_info - rank_level_info.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 2 2
Test Date: 2026-08-18 17:47:01 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 RANK_LEVEL_INFO_H
      12              : #define RANK_LEVEL_INFO_H
      13              : 
      14              : #include <string>
      15              : #include <vector>
      16              : #include <unordered_map>
      17              : #include <map>
      18              : #include <unordered_set>
      19              : #include <regex>
      20              : #include "topo_common_types.h"
      21              : #include "address_info.h"
      22              : 
      23              : namespace Hccl {
      24              : constexpr unsigned int MIN_VALUE_NETLAYER = 0;
      25              : constexpr unsigned int MAX_VALUE_NETLAYER = 7;
      26              : constexpr unsigned int MIN_VALUE_NETID = 1;
      27              : constexpr unsigned int MAX_VALUE_NETID = 1024;
      28              : constexpr unsigned int MIN_VALUE_RANKADDR_SIZE = 0;
      29              : constexpr unsigned int MAX_VALUE_RANKADDR_SIZE = 24;
      30              : constexpr unsigned int MIN_VALUE_U32 = 0;
      31              : 
      32              : class RankLevelInfo {
      33              : public:
      34          155 :     RankLevelInfo() {};
      35              :     u32 netLayer{0};
      36              :     std::string netInstId;
      37              :     NetType netType{NetType::CLOS};
      38              :     std::string netAttr;
      39              :     std::vector<AddressInfo> rankAddrs;
      40              :     std::string Describe() const;
      41              :     std::map<std::string, std::vector<IpAddress>> portAddrMap;
      42              :     void Deserialize(const nlohmann::json& rankLevelInfoJson);
      43              :     explicit RankLevelInfo(BinaryStream& binaStream);
      44              :     void GetBinStream(BinaryStream& binaStream) const;
      45              : 
      46              : private:
      47              :     static const std::unordered_map<std::string, NetType> strToNetType;
      48              : 
      49          100 :     static bool IsStringInNetType(std::string str) { return strToNetType.count(str) > 0; }
      50              : };
      51              : 
      52              : } // namespace Hccl
      53              : 
      54              : #endif // RANK_LEVEL_INFO_H
        

Generated by: LCOV version 2.0-1