Matter SDK Coverage Report
Current view: top level - lib/core - ScopedNodeId.h (source / functions) Coverage Total Hit
Test: SHA:b879ecb8e99e175eea0a293a888bda853da2b19c Lines: 83.3 % 6 5
Test Date: 2025-01-17 19:00:11 Functions: 83.3 % 6 5

            Line data    Source code
       1              : /*
       2              :  *    Copyright (c) 2022 Project CHIP Authors
       3              :  *
       4              :  *    Licensed under the Apache License, Version 2.0 (the "License");
       5              :  *    you may not use this file except in compliance with the License.
       6              :  *    You may obtain a copy of the License at
       7              :  *
       8              :  *        http://www.apache.org/licenses/LICENSE-2.0
       9              :  *
      10              :  *    Unless required by applicable law or agreed to in writing, software
      11              :  *    distributed under the License is distributed on an "AS IS" BASIS,
      12              :  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      13              :  *    See the License for the specific language governing permissions and
      14              :  *    limitations under the License.
      15              :  */
      16              : 
      17              : #pragma once
      18              : 
      19              : #include <lib/core/DataModelTypes.h>
      20              : #include <lib/core/NodeId.h>
      21              : 
      22              : namespace chip {
      23              : 
      24              : /// The ScopedNodeId provides an identifier for an operational node on the network that is only valid for use within the current
      25              : /// Matter stack instance. It is not to be exchanged or directly used remotely over the network.
      26              : class ScopedNodeId
      27              : {
      28              : public:
      29          472 :     ScopedNodeId() : mNodeId(kUndefinedNodeId), mFabricIndex(kUndefinedFabricIndex) {}
      30            0 :     ScopedNodeId(NodeId nodeId, FabricIndex fabricIndex) : mNodeId(nodeId), mFabricIndex(fabricIndex) {}
      31              : 
      32        28995 :     NodeId GetNodeId() const { return mNodeId; }
      33          256 :     FabricIndex GetFabricIndex() const { return mFabricIndex; }
      34              : 
      35              :     bool IsOperational() const { return mFabricIndex != kUndefinedFabricIndex && IsOperationalNodeId(mNodeId); }
      36          500 :     bool operator==(const ScopedNodeId & that) const { return (mNodeId == that.mNodeId) && (mFabricIndex == that.mFabricIndex); }
      37          222 :     bool operator!=(const ScopedNodeId & that) const { return !(*this == that); }
      38              : 
      39              : private:
      40              :     NodeId mNodeId;
      41              :     FabricIndex mFabricIndex;
      42              : };
      43              : 
      44              : } // namespace chip
        

Generated by: LCOV version 2.0-1