KiCad PCB EDA Suite
Loading...
Searching...
No Matches
drc_rule.cpp
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) 2020 KiCad Developers, see change_log.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
25#include <board.h>
26#include <board_item.h>
27#include <drc/drc_rule.h>
29
30
32 m_Unary( false ),
33 m_Implicit( false ),
34 m_ImplicitItemId( 0 ),
35 m_LayerCondition( LSET::AllLayersMask() ),
36 m_Condition( nullptr ),
37 m_Severity( RPT_SEVERITY_UNDEFINED )
38{
39}
40
41
42DRC_RULE::DRC_RULE( const wxString& aName ) :
43 m_Unary( false ),
44 m_Implicit( false ),
45 m_ImplicitItemId( 0 ),
46 m_Name( aName ),
47 m_LayerCondition( LSET::AllLayersMask() ),
48 m_Condition( nullptr ),
49 m_Severity( RPT_SEVERITY_UNDEFINED )
50{
51}
52
53
55{
56 delete m_Condition;
57}
58
59
61{
62 aConstraint.SetParentRule( this );
63 m_Constraints.push_back( aConstraint );
64}
65
66
67std::optional<DRC_CONSTRAINT> DRC_RULE::FindConstraint( DRC_CONSTRAINT_T aType )
68{
70 {
71 if( c.m_Type == aType )
72 return c;
73 }
74
75 return std::optional<DRC_CONSTRAINT>();
76}
void SetParentRule(DRC_RULE *aParentRule)
Definition: drc_rule.h:155
DRC_RULE_CONDITION * m_Condition
Definition: drc_rule.h:120
DRC_RULE()
Definition: drc_rule.cpp:31
std::vector< DRC_CONSTRAINT > m_Constraints
Definition: drc_rule.h:121
void AddConstraint(DRC_CONSTRAINT &aConstraint)
Definition: drc_rule.cpp:60
virtual ~DRC_RULE()
Definition: drc_rule.cpp:54
std::optional< DRC_CONSTRAINT > FindConstraint(DRC_CONSTRAINT_T aType)
Definition: drc_rule.cpp:67
LSET is a set of PCB_LAYER_IDs.
Definition: lset.h:36
DRC_CONSTRAINT_T
Definition: drc_rule.h:47
@ RPT_SEVERITY_UNDEFINED