LCOV - code coverage report
Current view: top level - base_comm/resources/ccu/ccu_representation/interface - ccu_interface_assist.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 95.0 % 20 19
Test Date: 2026-07-28 12:11:00 Functions: 100.0 % 4 4

            Line data    Source code
       1              : /*
       2              :  * Copyright (c) Huawei Technologies Co., Ltd. 2024-2024. All rights reserved.
       3              :  * Description: ccu representation implementation file
       4              :  * Author: sunzhepeng
       5              :  * Create: 2024-06-17
       6              :  */
       7              : 
       8              : #include "ccu_interface_assist_v1.h"
       9              : #include "ccu_kernel.h"
      10              : 
      11              : #include "exception_util.h"
      12              : #include "ccu_api_exception.h"
      13              : 
      14              : namespace hcomm {
      15              : namespace CcuRep {
      16              : 
      17          283 : void AppendToContext(CcuRepContext* context, std::shared_ptr<CcuRep::CcuRepBase> rep)
      18              : {
      19          283 :     if (context == nullptr) {
      20            2 :         Hccl::THROW<Hccl::CcuApiException>("context is nullptr, AppendToContext assist[%d]", rep->Type());
      21              :     }
      22              :     else {
      23          281 :         return context->Append(rep);
      24              :     }
      25              : }
      26              : 
      27            5 : std::shared_ptr<CcuRep::CcuRepBlock> CurrentBlock(CcuRepContext* context)
      28              : {
      29            5 :     if (context == nullptr) {
      30            1 :         Hccl::THROW<Hccl::CcuApiException>("context is nullptr, currentBlock");
      31              :     }
      32            4 :     return context->CurrentBlock();
      33              : }
      34              : 
      35            3 : void SetCurrentBlock(CcuRepContext* context, std::shared_ptr<CcuRep::CcuRepBlock> repBlock)
      36              : {
      37            3 :     if (context == nullptr) {
      38            1 :         Hccl::THROW<Hccl::CcuApiException>("context is nullptr, set currentBlock");
      39              :     }
      40            2 :     context->SetCurrentBlock(repBlock);
      41            2 : }
      42              : 
      43           47 : Variable CreateVariable(CcuRepContext* context)
      44              : {
      45           47 :     if (context == nullptr) {
      46            1 :         Hccl::THROW<Hccl::CcuApiException>("context is nullptr, CreateVar");
      47              :     }
      48           46 :     auto ctx = dynamic_cast<CcuKernel *>(context);
      49           46 :     if (ctx == nullptr) {
      50            0 :         Hccl::THROW<Hccl::CcuApiException>("Invalid context");
      51              :     }
      52           46 :     return ctx->CreateVariable();
      53              : }
      54              : 
      55              : }; // namespace CcuRep
      56              : }; // namespace hcomm
        

Generated by: LCOV version 2.0-1