LCOV - code coverage report
Current view: top level - adcore/log - adx_log.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 6 0
Test Date: 2026-07-28 10:54:24 Functions: 0.0 % 1 0

            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 ADX_LOG_H
      12              : #define ADX_LOG_H
      13              : #include <memory>
      14              : #include "hdc_log.h"
      15              : 
      16              : #define IDE_CTRL_VALUE_FAILED(err, action, logText, ...) do {          \
      17              :     if (!(err)) {                                                      \
      18              :         IDE_LOGE(logText, ##__VA_ARGS__);                              \
      19              :         action;                                                        \
      20              :     }                                                                  \
      21              : } while (0)
      22              : 
      23              : #define IDE_CTRL_VALUE_FAILED_NODO(err, action, logText, ...)         \
      24              :     if (!(err)) {                                                     \
      25              :         IDE_LOGE(logText, ##__VA_ARGS__);                             \
      26              :         action;                                                       \
      27              :     }
      28              : 
      29              : #define IDE_CTRL_VALUE_WARN(err, action, logText, ...) do {            \
      30              :     if (!(err)) {                                                      \
      31              :         IDE_LOGW(logText, ##__VA_ARGS__);                              \
      32              :         action;                                                        \
      33              :     }                                                                  \
      34              : } while (0)
      35              : 
      36              : #define IDE_CTRL_VALUE_WARN_NODO(err, action, logText, ...)            \
      37              :     if (!(err)) {                                                      \
      38              :         IDE_LOGW(logText, ##__VA_ARGS__);                              \
      39              :         action;                                                        \
      40              :     }
      41              : 
      42              : template <typename T, typename... Args>
      43            0 : std::shared_ptr<T> MakeSharedInstance(Args&&... args) {
      44              :     try {
      45            0 :         std::shared_ptr<T> instance = std::make_shared<T>(std::forward<Args>(args)...);
      46            0 :         return instance;
      47            0 :     } catch (std::exception &ex) {
      48            0 :         IDE_LOGE("Make shared failed, message: %s", ex.what());
      49            0 :         return nullptr;
      50              :     }
      51              : }
      52              : 
      53              : #ifndef UNUSED
      54              : #define UNUSED(x)   do {(void)(x);} while (0)
      55              : #endif
      56              : #endif
        

Generated by: LCOV version 2.0-1