KiCad PCB EDA Suite
netclass.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 SoftPLC Corporation, Dick Hollenbeck <[email protected]>
5 * Copyright (C) 2009 Jean-Pierre Charras, [email protected]
6 * Copyright (C) 2009-2022 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
26#ifndef CLASS_NETCLASS_H
27#define CLASS_NETCLASS_H
28
29
30#include <gal/color4d.h>
31#include <optional>
32#include <macros_swig.h>
33
34class LINE_READER;
35class BOARD;
37using KIGFX::COLOR4D;
38
39
41
42
43
47{
48public:
49 static const char Default[];
50
56 NETCLASS( const wxString& aName );
57
58 ~NETCLASS();
59
60 wxString GetClass() const
61 {
62 return wxT( "NETCLASS" );
63 }
64
65 const wxString GetName() const { return m_Name; }
66 void SetName( const wxString& aName ) { m_Name = aName; }
67
68 const wxString& GetDescription() const { return m_Description; }
69 void SetDescription( const wxString& aDesc ) { m_Description = aDesc; }
70
71 bool HasClearance() const { return (bool) m_Clearance; }
72 int GetClearance() const { return m_Clearance.value_or(-1); }
73 void SetClearance( int aClearance ) { m_Clearance = aClearance; }
74
75 bool HasTrackWidth() const { return (bool) m_TrackWidth; }
76 int GetTrackWidth() const { return m_TrackWidth.value_or( -1 ); }
77 void SetTrackWidth( int aWidth ) { m_TrackWidth = aWidth; }
78
79 bool HasViaDiameter() const { return (bool) m_ViaDia; }
80 int GetViaDiameter() const { return m_ViaDia.value_or( -1 ); }
81 void SetViaDiameter( int aDia ) { m_ViaDia = aDia; }
82
83 int HasViaDrill() const { return (bool) m_ViaDrill; }
84 int GetViaDrill() const { return m_ViaDrill.value_or( -1 ); }
85 void SetViaDrill( int aSize ) { m_ViaDrill = aSize; }
86
87 bool HasuViaDiameter() const { return (bool) m_uViaDia; }
88 int GetuViaDiameter() const { return m_uViaDia.value_or( -1 ); }
89 void SetuViaDiameter( int aSize ) { m_uViaDia = aSize; }
90
91 bool HasuViaDrill() const { return (bool) m_uViaDrill; }
92 int GetuViaDrill() const { return m_uViaDrill.value_or( -1 ); }
93 void SetuViaDrill( int aSize ) { m_uViaDrill = aSize; }
94
95 bool HasDiffPairWidth() const { return (bool) m_diffPairWidth; }
96 int GetDiffPairWidth() const { return m_diffPairWidth.value_or( -1 ); }
97 void SetDiffPairWidth( int aSize ) { m_diffPairWidth = aSize; }
98
99 bool HasDiffPairGap() const { return (bool) m_diffPairGap; }
100 int GetDiffPairGap() const { return m_diffPairGap.value_or( -1 ); }
101 void SetDiffPairGap( int aSize ) { m_diffPairGap = aSize; }
102
103 bool HasDiffPairViaGap() const { return (bool) m_diffPairViaGap; }
104 int GetDiffPairViaGap() const { return m_diffPairViaGap.value_or( -1 ); }
105 void SetDiffPairViaGap( int aSize ) { m_diffPairViaGap = aSize; }
106
107 COLOR4D GetPcbColor() const { return m_PcbColor; }
108 void SetPcbColor( const COLOR4D& aColor ) { m_PcbColor = aColor; }
109
110 int GetWireWidth() const { return m_wireWidth; }
111 void SetWireWidth( int aWidth ) { m_wireWidth = aWidth; }
112
113 int GetBusWidth() const { return m_busWidth; }
114 void SetBusWidth( int aWidth ) { m_busWidth = aWidth; }
115
116 COLOR4D GetSchematicColor() const { return m_schematicColor; }
117 void SetSchematicColor( COLOR4D aColor ) { m_schematicColor = aColor; }
118
119 int GetLineStyle() const { return m_lineStyle; }
120 void SetLineStyle( int aStyle ) { m_lineStyle = aStyle; }
121
122protected:
123 wxString m_Name;
124 wxString m_Description;
125
127
128 std::optional<int> m_Clearance;
129
130 std::optional<int> m_TrackWidth;
131 std::optional<int> m_ViaDia;
132 std::optional<int> m_ViaDrill;
133
134 std::optional<int> m_uViaDia;
135 std::optional<int> m_uViaDrill;
136
137 std::optional<int> m_diffPairWidth;
138 std::optional<int> m_diffPairGap;
139 std::optional<int> m_diffPairViaGap;
140
145
147};
148
149
150
151#endif // CLASS_NETCLASS_H
Container for design settings for a BOARD object.
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:265
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
An abstract class from which implementation specific LINE_READERs may be derived to read single lines...
Definition: richio.h:81
A collection of nets and the parameters used to route or test these nets.
Definition: netclass.h:47
void SetViaDiameter(int aDia)
Definition: netclass.h:81
void SetViaDrill(int aSize)
Definition: netclass.h:85
int GetViaDiameter() const
Definition: netclass.h:80
int GetViaDrill() const
Definition: netclass.h:84
int m_lineStyle
Definition: netclass.h:144
bool HasuViaDrill() const
Definition: netclass.h:91
void SetuViaDiameter(int aSize)
Definition: netclass.h:89
void SetDiffPairWidth(int aSize)
Definition: netclass.h:97
std::optional< int > m_ViaDrill
via drill hole diameter
Definition: netclass.h:132
int HasViaDrill() const
Definition: netclass.h:83
int GetDiffPairViaGap() const
Definition: netclass.h:104
int GetDiffPairGap() const
Definition: netclass.h:100
int GetuViaDrill() const
Definition: netclass.h:92
void SetLineStyle(int aStyle)
Definition: netclass.h:120
bool HasViaDiameter() const
Definition: netclass.h:79
std::optional< int > m_TrackWidth
track width used to route NETs in this NETCLASS
Definition: netclass.h:130
COLOR4D GetSchematicColor() const
Definition: netclass.h:116
int GetLineStyle() const
Definition: netclass.h:119
COLOR4D m_PcbColor
Optional color override for this netclass (PCB context)
Definition: netclass.h:146
void SetSchematicColor(COLOR4D aColor)
Definition: netclass.h:117
std::optional< int > m_diffPairWidth
Definition: netclass.h:137
bool HasDiffPairWidth() const
Definition: netclass.h:95
const wxString GetName() const
Definition: netclass.h:65
COLOR4D m_schematicColor
Definition: netclass.h:143
std::optional< int > m_diffPairViaGap
Definition: netclass.h:139
std::optional< int > m_ViaDia
via diameter
Definition: netclass.h:131
void SetDiffPairViaGap(int aSize)
Definition: netclass.h:105
bool HasuViaDiameter() const
Definition: netclass.h:87
int GetuViaDiameter() const
Definition: netclass.h:88
wxString GetClass() const
Definition: netclass.h:60
bool HasTrackWidth() const
Definition: netclass.h:75
void SetPcbColor(const COLOR4D &aColor)
Definition: netclass.h:108
std::optional< int > m_Clearance
The units on these parameters is Internal Units (1 nm)
Definition: netclass.h:128
std::optional< int > m_uViaDia
microvia diameter
Definition: netclass.h:134
int GetDiffPairWidth() const
Definition: netclass.h:96
void SetuViaDrill(int aSize)
Definition: netclass.h:93
int GetWireWidth() const
Definition: netclass.h:110
void SetDiffPairGap(int aSize)
Definition: netclass.h:101
void SetClearance(int aClearance)
Definition: netclass.h:73
bool HasDiffPairGap() const
Definition: netclass.h:99
void SetDescription(const wxString &aDesc)
Definition: netclass.h:69
const wxString & GetDescription() const
Definition: netclass.h:68
std::optional< int > m_uViaDrill
microvia drill hole diameter
Definition: netclass.h:135
int m_wireWidth
Definition: netclass.h:141
void SetBusWidth(int aWidth)
Definition: netclass.h:114
int GetTrackWidth() const
Definition: netclass.h:76
void SetWireWidth(int aWidth)
Definition: netclass.h:111
int GetClearance() const
Definition: netclass.h:72
COLOR4D GetPcbColor() const
Definition: netclass.h:107
void SetName(const wxString &aName)
Definition: netclass.h:66
void SetTrackWidth(int aWidth)
Definition: netclass.h:77
std::optional< int > m_diffPairGap
Definition: netclass.h:138
int m_busWidth
Definition: netclass.h:142
bool HasDiffPairViaGap() const
Definition: netclass.h:103
int GetBusWidth() const
Definition: netclass.h:113
bool HasClearance() const
Definition: netclass.h:71
wxString m_Name
Name of the net class.
Definition: netclass.h:123
wxString m_Description
what this NETCLASS is for.
Definition: netclass.h:124
This file contains macros just for swig binding.
#define DECL_SET_FOR_SWIG(TypeName, MemberType)
Definition: macros_swig.h:54
std::set< std::string > STRINGSET