KiCad PCB EDA Suite
Loading...
Searching...
No Matches
erc_sch_pin_context.h
Go to the documentation of this file.
1/*
2* This program source code file is part of KiCad, a free EDA CAD application.
3*
4* Copyright (C) 2009 Jean-Pierre Charras, jp.charras at wanadoo.fr
5* Copyright (C) 2011 Wayne Stambaugh <[email protected]>
6* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
7*
8* This program is free software; you can redistribute it and/or
9* modify it under the terms of the GNU General Public License
10* as published by the Free Software Foundation; either version 2
11* of the License, or (at your option) any later version.
12*
13* This program is distributed in the hope that it will be useful,
14* but WITHOUT ANY WARRANTY; without even the implied warranty of
15* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16* GNU General Public License for more details.
17*
18* You should have received a copy of the GNU General Public License
19* along with this program. If not, see <https://www.gnu.org/licenses/>.
20*/
21
25
26#ifndef _ERC_ITEM_CONTEXT_H
27#define _ERC_ITEM_CONTEXT_H
28
29#include <sch_pin.h>
30
36{
37public:
39 m_pin( nullptr ),
40 m_sheet(),
41 m_hash( 0 )
42 {}
43
45 m_pin( pin ),
46 m_sheet( sheet )
47 {
48 rehash();
49 }
50
51 ERC_SCH_PIN_CONTEXT( const ERC_SCH_PIN_CONTEXT& other ) = default;
52
54
56
60 SCH_PIN* Pin() const;
61
65 const SCH_SHEET_PATH& Sheet() const;
66
70 bool operator==( const ERC_SCH_PIN_CONTEXT& other ) const;
71
75 bool operator<( const ERC_SCH_PIN_CONTEXT& other ) const;
76
77protected:
81 void rehash();
82
85 size_t m_hash;
86};
87
88#endif //_ERC_ITEM_CONTEXT_H
ERC_SCH_PIN_CONTEXT(SCH_PIN *pin, const SCH_SHEET_PATH &sheet)
void rehash()
Calculate the deterministic hash for this context.
bool operator<(const ERC_SCH_PIN_CONTEXT &other) const
Provide a deterministic ordering for item contexts based on hash value.
ERC_SCH_PIN_CONTEXT & operator=(const ERC_SCH_PIN_CONTEXT &other)=default
~ERC_SCH_PIN_CONTEXT()=default
const SCH_SHEET_PATH & Sheet() const
Get the SCH_SHEET_PATH context for the paired SCH_PIN.
ERC_SCH_PIN_CONTEXT(const ERC_SCH_PIN_CONTEXT &other)=default
SCH_PIN * Pin() const
Get the SCH_PIN for this context.
bool operator==(const ERC_SCH_PIN_CONTEXT &other) const
Test two pin contexts for equality based on the deterministic hash.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
KIBIS_PIN * pin