LCOV - code coverage report
Current view: top level - app - ConcreteClusterPath.h (source / functions) Hit Total Coverage
Test: lcov_final.info Lines: 7 7 100.0 %
Date: 2024-02-15 08:20:41 Functions: 6 6 100.0 %

          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       10025 :     ConcreteClusterPath(EndpointId aEndpointId, ClusterId aClusterId) : mEndpointId(aEndpointId), mClusterId(aClusterId) {}
      33             : 
      34         171 :     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        3707 :     bool HasValidIds() const { return IsValidEndpointId(mEndpointId) && IsValidClusterId(mClusterId); }
      42             : 
      43       17375 :     bool operator==(const ConcreteClusterPath & aOther) const
      44             :     {
      45       17375 :         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
      56             :     ClusterId mClusterId = 0;
      57             : };
      58             : 
      59             : } // namespace app
      60             : } // namespace chip

Generated by: LCOV version 1.14