LCOV - code coverage report
Current view: top level - legacy/ascend950/unified_platform/ccu/ccu_representation/reps/arithmetic - ccu_operator.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 10 10
Test Date: 2026-07-28 12:11:00 Functions: 100.0 % 8 8

            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_OPERATOR
      12              : #define HCCL_CCU_OPERATOR
      13              : 
      14              : #include "exception_util.h"
      15              : #include "ccu_api_exception.h"
      16              : 
      17              : namespace Hccl {
      18              : namespace CcuRep {
      19              : 
      20              : template <typename lhsT, typename rhsT> class CcuOperator {
      21              : public:
      22           72 :     CcuOperator(lhsT lhs, rhsT rhs) : lhs(lhs), rhs(rhs)
      23              :     {
      24           72 :     }
      25              :     lhsT lhs;
      26              :     rhsT rhs;
      27              : };
      28              : 
      29              : enum class CcuArithmeticOperatorType { ADDITION, INVALID };
      30              : 
      31              : template <typename lhsT, typename rhsT> class CcuArithmeticOperator : public CcuOperator<lhsT, rhsT> {
      32              : public:
      33           10 :     CcuArithmeticOperator(lhsT lhs, rhsT rhs, CcuArithmeticOperatorType type)
      34           10 :         : CcuOperator<lhsT, rhsT>(lhs, rhs), type(type)
      35              :     {
      36           10 :         Check();
      37           10 :     }
      38              :     void Check() const
      39              :     {
      40              :         THROW<CcuApiException>("Invalid Arithmetic Operator");
      41              :     }
      42              : 
      43              :     CcuArithmeticOperatorType type{CcuArithmeticOperatorType::INVALID};
      44              : };
      45              : 
      46              : enum class CcuRelationalOperatorType { EQUAL, NOT_EQUAL, INVALID };
      47              : 
      48              : template <typename lhsT, typename rhsT> class CcuRelationalOperator : public CcuOperator<lhsT, rhsT> {
      49              : public:
      50           62 :     CcuRelationalOperator(lhsT lhs, rhsT rhs, CcuRelationalOperatorType type)
      51           62 :         : CcuOperator<lhsT, rhsT>(lhs, rhs), type(type)
      52              :     {
      53           62 :         Check();
      54           62 :     }
      55              :     void Check() const
      56              :     {
      57              :         THROW<CcuApiException>("Invalid Relational Operator");
      58              :     }
      59              : 
      60              :     CcuRelationalOperatorType type{CcuRelationalOperatorType::INVALID};
      61              : };
      62              : 
      63              : }; // namespace CcuRep
      64              : }; // namespace Hccl
      65              : 
      66              : #endif // HCCL_CCU_OPERATOR
        

Generated by: LCOV version 2.0-1