LCOV - code coverage report
Current view: top level - adcore/component - adx_component.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 75.0 % 4 3
Test Date: 2026-08-12 11:04:53 Functions: 60.0 % 5 3

            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              : #ifndef ADX_COMMON_COMPONENT_H
      11              : #define ADX_COMMON_COMPONENT_H
      12              : #include <cstdint>
      13              : #include <string>
      14              : #include "adx_service_config.h"
      15              : #include "common_utils.h"
      16              : #include "ide_tlv.h"
      17              : #include "adx_msg.h"
      18              : namespace Adx {
      19              : struct AdxComponentMap {
      20              :     ComponentType cmptType; // component type
      21              :     CmdClassT cmdType;      // request type
      22              :     std::string cmptName;   // name of request
      23              :     std::string oprtName;   // name of record opreate log
      24              : };
      25              : 
      26              : const AdxComponentMap g_componentsInfo[] = {
      27              :     {ComponentType::COMPONENT_GETD_FILE, IDE_FILE_GETD_REQ, "file_getd", "TransferFile"},
      28              :     {ComponentType::COMPONENT_LOG_BACKHAUL, IDE_LOG_BACKHAUL_REQ, "log_backhaul", "BackhaulLog"},
      29              :     {ComponentType::COMPONENT_LOG_LEVEL, IDE_LOG_LEVEL_REQ, "log_level", "OperateLevel"},
      30              :     {ComponentType::COMPONENT_DUMP, IDE_DUMP_REQ, "dump", "DataDump"},
      31              :     {ComponentType::COMPONENT_TRACE, IDE_TRACE_REQ, "trace", "Trace"},
      32              :     {ComponentType::COMPONENT_MSNPUREPORT, IDE_MSN_REQ, "msnpureport", "Msnpureport"},
      33              :     {ComponentType::COMPONENT_HBM_DETECT, IDE_HBM_REQ, "hbm_detect", "HbmDetect"},
      34              :     {ComponentType::COMPONENT_SYS_GET, IDE_SYS_GET_REQ, "sys_get", "SysGet"},
      35              :     {ComponentType::COMPONENT_SYS_REPORT, IDE_SYS_REPORT_REQ, "sys_report", "SysReport"},
      36              :     {ComponentType::COMPONENT_FILE_REPORT, IDE_FILE_REPORT_REQ, "file_report", "FileReport"},
      37              :     {ComponentType::COMPONENT_CPU_DETECT, IDE_CPU_DETECT_REQ, "cpu_detect", "CpuDetect"},
      38              :     {ComponentType::COMPONENT_DETECT_LIB_LOAD, IDE_DETECT_LIB_LOAD_REQ, "lib_load", "LibLoad"}};
      39              : 
      40              : class AdxComponent {
      41              : public:
      42           39 :     AdxComponent() {}
      43           39 :     virtual ~AdxComponent() {}
      44              :     virtual int32_t Init() = 0;
      45            0 :     virtual const std::string GetInfo() { return "None"; }
      46              :     virtual ComponentType GetType() = 0;
      47              :     virtual int32_t Process(const CommHandle& handle, const SharedPtr<MsgProto>& req) = 0;
      48              :     virtual int32_t UnInit() = 0;
      49            8 :     virtual int32_t Terminate() { return 0; }
      50              : };
      51              : } // namespace Adx
      52              : #endif // ADX_COMMON_COMPONENT_H
        

Generated by: LCOV version 2.0-1