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 (C) 2009-2023 KiCad Developers, see change_log.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, you may find one here:
20* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21* or you may search the http://www.gnu.org website for the version 2 license,
22* or you may write to the Free Software Foundation, Inc.,
23* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24*/
25
30#ifndef _ERC_ITEM_CONTEXT_H
31#define _ERC_ITEM_CONTEXT_H
32
33#include <sch_pin.h>
34#include <boost/functional/hash.hpp>
35
41{
42protected:
45 size_t m_hash;
46
47public:
48 ERC_SCH_PIN_CONTEXT() : m_pin( nullptr ), m_sheet(), m_hash( 0 ) {}
49
51 {
52 rehash();
53 }
54
55 ERC_SCH_PIN_CONTEXT( const ERC_SCH_PIN_CONTEXT& other ) = default;
56
58
60
64 SCH_PIN* Pin();
65
70
71 bool operator==( const ERC_SCH_PIN_CONTEXT& other ) const;
72
73 bool operator<( const ERC_SCH_PIN_CONTEXT& other ) const;
74
75protected:
79 void rehash();
80};
81
82#endif //_ERC_ITEM_CONTEXT_H
A class used to associate a SCH_PIN with its owning SCH_SHEET_PATH, in order to handle ERC checks acr...
SCH_PIN * Pin()
Gets the SCH_PIN for this context.
SCH_SHEET_PATH & Sheet()
Gets the SCH_SHEET_PATH context for the paired SCH_PIN.
void rehash()
Calculates the deterministic hash for this context.
bool operator<(const ERC_SCH_PIN_CONTEXT &other) const
Provides a deterministic ordering for item contexts based on hash value.
ERC_SCH_PIN_CONTEXT(SCH_PIN *pin, SCH_SHEET_PATH sheet)
ERC_SCH_PIN_CONTEXT & operator=(const ERC_SCH_PIN_CONTEXT &other)=default
~ERC_SCH_PIN_CONTEXT()=default
ERC_SCH_PIN_CONTEXT(const ERC_SCH_PIN_CONTEXT &other)=default
bool operator==(const ERC_SCH_PIN_CONTEXT &other) const
Tests 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...