Matter SDK Coverage Report
Current view: top level - app - ConcreteClusterPath.h (source / functions) Coverage Total Hit
Test: SHA:b879ecb8e99e175eea0a293a888bda853da2b19c Lines: 100.0 % 7 7
Test Date: 2025-01-17 19:00:11 Functions: 100.0 % 6 6

            Line data    Source code
       1              : /*
       2              :  *
       3              :  *    Copyright (c) 2021 Project CHIP Authors
       4              :  *    All rights reserved.
       5              :  *
       6              :  *    Licensed under the Apache License, Version 2.0 (the "License");
       7              :  *    you may not use this file except in compliance with the License.
       8              :  *    You may obtain a copy of the License at
       9              :  *
      10              :  *        http://www.apache.org/licenses/LICENSE-2.0
      11              :  *
      12              :  *    Unless required by applicable law or agreed to in writing, software
      13              :  *    distributed under the License is distributed on an "AS IS" BASIS,
      14              :  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      15              :  *    See the License for the specific language governing permissions and
      16              :  *    limitations under the License.
      17              :  */
      18              : 
      19              : #pragma once
      20              : 
      21              : #include <app/util/basic-types.h>
      22              : 
      23              : namespace chip {
      24              : namespace app {
      25              : 
      26              : /**
      27              :  * A representation of a concrete cluster path.  This identifies a specific
      28              :  * cluster instance.
      29              :  */
      30              : struct ConcreteClusterPath
      31              : {
      32         7273 :     ConcreteClusterPath(EndpointId aEndpointId, ClusterId aClusterId) : mEndpointId(aEndpointId), mClusterId(aClusterId) {}
      33              : 
      34        24780 :     ConcreteClusterPath() {}
      35              : 
      36              :     ConcreteClusterPath(const ConcreteClusterPath & aOther)             = default;
      37              :     ConcreteClusterPath & operator=(const ConcreteClusterPath & aOther) = default;
      38              : 
      39          149 :     bool IsValidConcreteClusterPath() const { return !(mEndpointId == kInvalidEndpointId || mClusterId == kInvalidClusterId); }
      40              : 
      41         7805 :     bool HasValidIds() const { return IsValidEndpointId(mEndpointId) && IsValidClusterId(mClusterId); }
      42              : 
      43        31526 :     bool operator==(const ConcreteClusterPath & aOther) const
      44              :     {
      45        31526 :         return mEndpointId == aOther.mEndpointId && mClusterId == aOther.mClusterId;
      46              :     }
      47              : 
      48           58 :     bool operator!=(const ConcreteClusterPath & aOther) const { return !(*this == aOther); }
      49              : 
      50              :     EndpointId mEndpointId = 0;
      51              :     // Note: not all subclasses of ConcreteClusterPath need mExpanded, but due
      52              :     // to alignment requirements it's "free" in the sense of not needing more
      53              :     // memory to put it here.  But we don't initialize it, because that
      54              :     // increases codesize for the non-consumers.
      55              :     bool mExpanded; // NOTE: in between larger members, NOT initialized (see above)
      56              :     ClusterId mClusterId = 0;
      57              : };
      58              : 
      59              : } // namespace app
      60              : } // namespace chip
        

Generated by: LCOV version 2.0-1