LCOV - code coverage report
Current view: top level - coll_communicator_mgr/rank_graph/topo_info - peer_info.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 92.9 % 14 13
Test Date: 2026-07-28 12:11:00 Functions: 100.0 % 4 4

            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              : #include "peer_info.h"
      12              : #include "json_parser.h"
      13              : #include "invalid_params_exception.h"
      14              : 
      15              : namespace Hccl {
      16              : 
      17          115 : void PeerInfo::Deserialize(const nlohmann::json &peerInfoJson)
      18              : {
      19          115 :     std::string msgId = "[PeerInfo::Deserialize] error occurs when parser object of propName \"local_id\"";
      20          117 :     TRY_CATCH_THROW(InvalidParamsException, msgId, localId = GetJsonPropertyUInt(peerInfoJson, "local_id"););
      21              : 
      22          113 :     if (localId > MAX_PEER_LOCAL_ID) {
      23            0 :         THROW<InvalidParamsException>("[PeerInfo::%s] localId[%u] is out of range [0, %u].", __func__, localId, MAX_PEER_LOCAL_ID);
      24              :     }
      25          115 : }
      26              : 
      27            4 : std::string PeerInfo::Describe() const
      28              : {
      29            4 :     return StringFormat("PeerInfo{local_id=%u}", localId);
      30              : }
      31              : 
      32           90 : void PeerInfo::GetBinStream(BinaryStream &binaryStream) const
      33              : {
      34           90 :     binaryStream << localId;
      35           90 : }
      36              : 
      37           70 : PeerInfo::PeerInfo(BinaryStream &binaryStream)
      38              : {
      39           70 :     binaryStream >> localId;
      40           70 : }
      41              : 
      42              : } // namespace Hccl
        

Generated by: LCOV version 2.0-1