KiCad PCB EDA Suite
Loading...
Searching...
No Matches
drc_re_panel_matcher.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) 2024 KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24#ifndef DRC_RE_PANEL_MATCHER_H_
25#define DRC_RE_PANEL_MATCHER_H_
26
27#include <set>
28#include <vector>
29
30#include <drc/drc_rule.h>
32
33
41{
43 std::set<DRC_CONSTRAINT_T> requiredConstraints;
44 std::set<DRC_CONSTRAINT_T> optionalConstraints;
46
48 std::set<DRC_CONSTRAINT_T> aRequired,
49 std::set<DRC_CONSTRAINT_T> aOptional,
50 int aPriority ) :
51 panelType( aPanel ),
52 requiredConstraints( std::move( aRequired ) ),
53 optionalConstraints( std::move( aOptional ) ),
54 priority( aPriority )
55 {
56 }
57};
58
59
64{
66 std::set<DRC_CONSTRAINT_T> claimedConstraints;
67
69 std::set<DRC_CONSTRAINT_T> aClaimed ) :
70 panelType( aPanel ),
71 claimedConstraints( std::move( aClaimed ) )
72 {
73 }
74};
75
76
90{
91public:
93
105 std::vector<DRC_PANEL_MATCH> MatchRule( const DRC_RULE& aRule );
106
115 const std::set<DRC_CONSTRAINT_T>& aConstraints );
116
126
127private:
128 void initClaims();
129
130 bool matchesClaim( const DRC_PANEL_CLAIM& aClaim,
131 const std::set<DRC_CONSTRAINT_T>& aConstraints,
132 std::set<DRC_CONSTRAINT_T>* aClaimedOut );
133
134 std::vector<DRC_PANEL_CLAIM> m_claims;
135};
136
137
138#endif // DRC_RE_PANEL_MATCHER_H_
DRC_RULE_EDITOR_CONSTRAINT_NAME GetPanelForConstraint(DRC_CONSTRAINT_T aConstraintType)
Get the panel type for a single constraint.
bool CanPanelLoad(DRC_RULE_EDITOR_CONSTRAINT_NAME aPanel, const std::set< DRC_CONSTRAINT_T > &aConstraints)
Check if a specific panel type can load a set of constraints.
std::vector< DRC_PANEL_MATCH > MatchRule(const DRC_RULE &aRule)
Match a DRC rule to one or more panel types.
bool matchesClaim(const DRC_PANEL_CLAIM &aClaim, const std::set< DRC_CONSTRAINT_T > &aConstraints, std::set< DRC_CONSTRAINT_T > *aClaimedOut)
std::vector< DRC_PANEL_CLAIM > m_claims
DRC_PANEL_MATCHER()
Panel Claim Priority System.
DRC_CONSTRAINT_T
Definition drc_rule.h:47
DRC_RULE_EDITOR_CONSTRAINT_NAME
STL namespace.
Defines which constraint types a panel can claim.
std::set< DRC_CONSTRAINT_T > optionalConstraints
std::set< DRC_CONSTRAINT_T > requiredConstraints
DRC_RULE_EDITOR_CONSTRAINT_NAME panelType
DRC_PANEL_CLAIM(DRC_RULE_EDITOR_CONSTRAINT_NAME aPanel, std::set< DRC_CONSTRAINT_T > aRequired, std::set< DRC_CONSTRAINT_T > aOptional, int aPriority)
DRC_PANEL_MATCH(DRC_RULE_EDITOR_CONSTRAINT_NAME aPanel, std::set< DRC_CONSTRAINT_T > aClaimed)
std::set< DRC_CONSTRAINT_T > claimedConstraints
DRC_RULE_EDITOR_CONSTRAINT_NAME panelType