LCOV - code coverage report
Current view: top level - legacy/ascend910/platform/resource/notify - remote_notify.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 79.1 % 43 34
Test Date: 2026-08-18 17:47:01 Functions: 90.0 % 10 9

            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 "remote_notify.h"
      12              : #include "remote_notify_impl.h"
      13              : 
      14              : namespace hccl {
      15              : 
      16         1127 : RemoteNotify::RemoteNotify() {}
      17              : 
      18         1127 : RemoteNotify::~RemoteNotify() {}
      19              : 
      20            1 : HcclResult RemoteNotify::Init(const std::vector<u8>& byteVector)
      21              : {
      22            1 :     pimpl_.reset((new (std::nothrow) RemoteNotifyImpl()));
      23            1 :     CHK_SMART_PTR_NULL(pimpl_);
      24            1 :     HcclResult ret = pimpl_->Init(byteVector);
      25            1 :     if (ret != HCCL_SUCCESS) {
      26            0 :         pimpl_ = nullptr;
      27            0 :         HCCL_ERROR("[RemoteNotify]Init failed, ret[%p]", ret);
      28            0 :         return ret;
      29              :     }
      30              : 
      31            1 :     return HCCL_SUCCESS;
      32              : }
      33              : 
      34         1126 : HcclResult RemoteNotify::Init(const HcclSignalInfo& notifyInfo, const NotifyLoadType type)
      35              : {
      36         1126 :     pimpl_.reset((new (std::nothrow) RemoteNotifyImpl()));
      37         1126 :     CHK_SMART_PTR_NULL(pimpl_);
      38         1126 :     HcclResult ret = pimpl_->Init(notifyInfo, type);
      39         1126 :     if (ret != HCCL_SUCCESS) {
      40            0 :         pimpl_ = nullptr;
      41            0 :         HCCL_ERROR("[LocalNotify]Init failed, ret[%d]", ret);
      42            0 :         return ret;
      43              :     }
      44              : 
      45         1126 :     notifyPtr = pimpl_->ptr();
      46         1126 :     return HCCL_SUCCESS;
      47              : }
      48              : 
      49            1 : HcclResult RemoteNotify::Open()
      50              : {
      51            1 :     CHK_RET(pimpl_->Open());
      52              : 
      53            1 :     notifyPtr = pimpl_->ptr();
      54              : 
      55            1 :     return HCCL_SUCCESS;
      56              : }
      57              : 
      58            4 : HcclResult RemoteNotify::Close()
      59              : {
      60            4 :     if (pimpl_ != nullptr) {
      61            4 :         pimpl_->Close();
      62            4 :         pimpl_ = nullptr;
      63            4 :         notifyPtr = nullptr;
      64              :     }
      65            4 :     return HCCL_SUCCESS;
      66              : }
      67              : 
      68            0 : HcclResult RemoteNotify::Post(Stream& stream, HcclDispatcher dispatcher, s32 stage)
      69              : {
      70            0 :     CHK_SMART_PTR_NULL(pimpl_);
      71            0 :     return pimpl_->Post(stream, dispatcher, stage);
      72              : }
      73              : 
      74         1131 : HcclResult RemoteNotify::GetNotifyData(HcclSignalInfo& notifyInfo)
      75              : {
      76         1131 :     CHK_SMART_PTR_NULL(pimpl_);
      77         1131 :     return pimpl_->GetNotifyData(notifyInfo);
      78              : }
      79              : 
      80            3 : HcclResult RemoteNotify::SetNotifyData(HcclSignalInfo& notifyInfo)
      81              : {
      82            3 :     CHK_SMART_PTR_NULL(pimpl_);
      83            3 :     return pimpl_->SetNotifyData(notifyInfo);
      84              : }
      85              : 
      86            4 : HcclResult RemoteNotify::GetNotifyOffset(u64& notifyOffset)
      87              : {
      88            4 :     CHK_SMART_PTR_NULL(pimpl_);
      89            4 :     return pimpl_->GetNotifyOffset(notifyOffset);
      90              : }
      91              : } // namespace hccl
        

Generated by: LCOV version 2.0-1