LCOV - code coverage report
Current view: top level - adump - adx_dump_process.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 16 16
Test Date: 2026-07-28 10:54:24 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              : #include "adx_dump_process.h"
      11              : #include <string>
      12              : #include "log/adx_log.h"
      13              : namespace Adx {
      14           17 : void AdxDumpProcess::MessageCallbackRegister(const MessageCallback callbackFun)
      15              : {
      16           17 :     if (init_) {
      17            4 :         IDE_LOGE("MessageCallback function has been registered, The registration does not take effect.");
      18            4 :         return;
      19              :     }
      20           13 :     messageCallback_ = callbackFun;
      21           13 :     init_ = true;
      22              : }
      23              : 
      24            4 : const std::function<int32_t(const struct DumpChunk *, int32_t)>& AdxDumpProcess::GetCallbackFun() const
      25              : {
      26            4 :     return messageCallback_;
      27              : }
      28              : 
      29            5 : bool AdxDumpProcess::IsRegistered() const
      30              : {
      31            5 :     return init_;
      32              : }
      33              : 
      34           42 : void AdxDumpProcess::MessageCallbackUnRegister()
      35              : {
      36           42 :     if (!init_) {
      37           30 :         IDE_LOGW("MessageCallback is not registered!");
      38           30 :         return;
      39              :     }
      40           12 :     init_ = false;
      41           12 :     messageCallback_ = nullptr;
      42              : }
      43              : }
        

Generated by: LCOV version 2.0-1