LCOV - code coverage report
Current view: top level - base_comm/resources/ccu/ccu_representation/reps/common - ccu_rep_arg_v1.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 22 22
Test Date: 2026-07-28 12:11:00 Functions: 100.0 % 8 8

            Line data    Source code
       1              : /*
       2              :  * Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved.
       3              :  * Description: ccu representation base header file
       4              :  * Create: 2025-02-18
       5              :  */
       6              : 
       7              : #ifndef HCOMM_CCU_REPRESENTATION_ARG_H
       8              : #define HCOMM_CCU_REPRESENTATION_ARG_H
       9              : 
      10              : #include <vector>
      11              : #include <memory>
      12              : 
      13              : #include "ccu_datatype_v1.h"
      14              : 
      15              : namespace hcomm {
      16              : namespace CcuRep {
      17              : 
      18              : enum class CcuArgType {
      19              :     VARIABLE,
      20              :     MEMORY,
      21              :     VARIABLE_LIST,
      22              :     MEMORY_LIST,
      23              :     LOCAL_ADDR,       //1. 新增枚举值
      24              :     LOCAL_ADDR_LIST,  // 2. List 类型,以防后面需要 vector<LocalAddr>
      25              :     REMOTE_ADDR,
      26              :     REMOTE_ADDR_LIST,
      27              : };
      28              :  
      29              : struct CcuRepArg {
      30           26 :     explicit CcuRepArg(const Variable &var) : type(CcuArgType::VARIABLE), var(var)
      31              :     {
      32           26 :     }
      33            2 :     explicit CcuRepArg(const Memory &mem) : type(CcuArgType::MEMORY), mem(mem)
      34              :     {
      35            2 :     }
      36            6 :     explicit CcuRepArg(const std::vector<Variable> &varList)
      37            6 :         : type(CcuArgType::VARIABLE_LIST), varList(varList)
      38              :     {
      39            6 :     }
      40            2 :     explicit CcuRepArg(const std::vector<Memory> &memList)
      41            2 :         : type(CcuArgType::MEMORY_LIST), memList(memList)
      42              :     {
      43            2 :     }
      44              :     // 新增:LocalAddr 的构造函数
      45            4 :     explicit CcuRepArg(const LocalAddr &addr) 
      46            4 :         : type(CcuArgType::LOCAL_ADDR), localAddr(addr)
      47              :     {
      48            4 :     }
      49              :     // 新增:LocalAddr 列表的构造函数
      50            2 :     explicit CcuRepArg(const std::vector<LocalAddr> &addrList)
      51            2 :         : type(CcuArgType::LOCAL_ADDR_LIST), localAddrList(addrList)
      52              :     {
      53            2 :     }
      54            2 :     explicit CcuRepArg(const RemoteAddr &addr) 
      55            2 :         : type(CcuArgType::REMOTE_ADDR), remoteAddr(addr) 
      56              :     {
      57            2 :     }
      58            2 :     explicit CcuRepArg(const std::vector<RemoteAddr> &addrList)
      59            2 :         : type(CcuArgType::REMOTE_ADDR_LIST), remoteAddrList(addrList) 
      60              :     {
      61            2 :     }
      62              :  
      63              :     CcuArgType            type;
      64              :     Variable              var;
      65              :     Memory                mem;
      66              :     std::vector<Variable> varList;
      67              :     std::vector<Memory>   memList;
      68              :     LocalAddr             localAddr; // 3. 新增成员变量来存储
      69              :     std::vector<LocalAddr>  localAddrList; // 新增成员变量
      70              :     RemoteAddr              remoteAddr;
      71              :     std::vector<RemoteAddr> remoteAddrList;
      72              : };
      73              : 
      74              : }; // namespace CcuRep
      75              : }; // namespace hcomm
      76              : #endif // HCOMM_CCU_REPRESENTATION_ARG_H
        

Generated by: LCOV version 2.0-1