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, see <https://www.gnu.org/licenses/>.
18 */
19
20#ifndef DRC_RE_PANEL_MATCHER_H_
21#define DRC_RE_PANEL_MATCHER_H_
22
23#include <set>
24#include <vector>
25
26#include <drc/drc_rule.h>
28
29
37{
39 std::set<DRC_CONSTRAINT_T> requiredConstraints;
40 std::set<DRC_CONSTRAINT_T> optionalConstraints;
42
44 std::set<DRC_CONSTRAINT_T> aRequired,
45 std::set<DRC_CONSTRAINT_T> aOptional,
46 int aPriority ) :
47 panelType( aPanel ),
48 requiredConstraints( std::move( aRequired ) ),
49 optionalConstraints( std::move( aOptional ) ),
50 priority( aPriority )
51 {
52 }
53};
54
55
60{
62 std::set<DRC_CONSTRAINT_T> claimedConstraints;
63
65 std::set<DRC_CONSTRAINT_T> aClaimed ) :
66 panelType( aPanel ),
67 claimedConstraints( std::move( aClaimed ) )
68 {
69 }
70};
71
72
86{
87public:
89
101 std::vector<DRC_PANEL_MATCH> MatchRule( const DRC_RULE& aRule );
102
111 const std::set<DRC_CONSTRAINT_T>& aConstraints );
112
122
123private:
124 void initClaims();
125
126 bool matchesClaim( const DRC_PANEL_CLAIM& aClaim,
127 const std::set<DRC_CONSTRAINT_T>& aConstraints,
128 std::set<DRC_CONSTRAINT_T>* aClaimedOut );
129
130 std::vector<DRC_PANEL_CLAIM> m_claims;
131};
132
133
134#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:49
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