LCOV - code coverage report
Current view: top level - legacy/ascend950/unified_platform/ccu/ccu_representation/interface - ccu_funccall.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 6 6
Test Date: 2026-08-04 10:52:23 Functions: 50.0 % 4 2

            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 HCCL_CCU_FUNC_CALL_H
      12              : #define HCCL_CCU_FUNC_CALL_H
      13              : 
      14              : #include "ccu_rep_funccall.h"
      15              : #include "ccu_rep_context.h"
      16              : 
      17              : namespace Hccl {
      18              : 
      19              : namespace CcuRep {
      20              : 
      21              : class FuncCall {
      22              : public:
      23              :     FuncCall(CcuRepContext *context, std::string label);
      24              :     FuncCall(CcuRepContext *context, const Variable &funcAddr);
      25              : 
      26              :     template <typename... Arguments> FuncCall &operator()(const Arguments &...args)
      27              :     {
      28              :         SetArgHelper(args...);
      29              :         AppendToContext();
      30              :         return *this;
      31              :     }
      32              : 
      33              :     FuncCall &operator()()
      34              :     {
      35              :         AppendToContext();
      36              :         return *this;
      37              :     }
      38              : 
      39              :     void AppendToContext();
      40              : 
      41           66 :     template <typename T> void SetInArg(T &&arg)
      42              :     {
      43           66 :         repFuncCall->SetInArg(std::forward<T>(arg));
      44           66 :     }
      45              : 
      46            2 :     template <typename T> void SetOutArg(T &&arg)
      47              :     {
      48            2 :         repFuncCall->SetOutArg(std::forward<T>(arg));
      49            2 :     }
      50              : 
      51              : private:
      52              :     template <typename First> void SetArgHelper(const First &first)
      53              :     {
      54              :         repFuncCall->SetInArg(first);
      55              :     }
      56              : 
      57              :     template <typename First, typename... Rest> void SetArgHelper(const First &first, const Rest &...rest)
      58              :     {
      59              :         repFuncCall->SetInArg(first);
      60              :         SetArgHelper(rest...);
      61              :     }
      62              : 
      63              :     CcuRepContext *context{nullptr};
      64              :     std::string    label;
      65              : 
      66              :     std::shared_ptr<CcuRepFuncCall> repFuncCall{nullptr};
      67              : };
      68              : 
      69              : }; // namespace CcuRep
      70              : }; // namespace Hccl
      71              : #endif // HCCL_CCU_FUNC_CALL_H
        

Generated by: LCOV version 2.0-1