KiCad PCB EDA Suite
NETCLASS Class Reference

NETCLASS handles a collection of nets and the parameters used to route or test these nets. More...

#include <netclass.h>

Public Types

typedef STRINGSET::iterator iterator
 
typedef STRINGSET::const_iterator const_iterator
 

Public Member Functions

 NETCLASS (const wxString &aName)
 Constructor stuffs a NETCLASS instance with aParent, aName, and optionally the initialParameters. More...
 
 ~NETCLASS ()
 
wxString GetClass () const
 
const wxString & GetName () const
 
void SetName (const wxString &aName)
 
unsigned GetCount () const
 Function GetCount returns the number of nets in this NETCLASS, i.e. More...
 
void Clear ()
 Function Clear empties the collection of members. More...
 
void Add (const wxString &aNetname)
 Function Add adds aNetname to this NETCLASS if it is not already in this NETCLASS. More...
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
void Remove (iterator aName)
 Function Remove will remove NET name aName from the collection of members. More...
 
void Remove (const wxString &aName)
 Function Remove will remove NET name aName from the collection of members. More...
 
STRINGSET & NetNames ()
 for SWIG More...
 
const wxString & GetDescription () const
 
void SetDescription (const wxString &aDesc)
 
int GetClearance () const
 
void SetClearance (int aClearance)
 
int GetTrackWidth () const
 
void SetTrackWidth (int aWidth)
 
int GetViaDiameter () const
 
void SetViaDiameter (int aDia)
 
int GetViaDrill () const
 
void SetViaDrill (int aSize)
 
int GetuViaDiameter () const
 
void SetuViaDiameter (int aSize)
 
int GetuViaDrill () const
 
void SetuViaDrill (int aSize)
 
int GetDiffPairWidth () const
 
void SetDiffPairWidth (int aSize)
 
int GetDiffPairGap () const
 
void SetDiffPairGap (int aSize)
 
int GetDiffPairViaGap () const
 
void SetDiffPairViaGap (int aSize)
 
void SetParams (const NETCLASS &aDefaults)
 Function SetParams will set all the parameters by copying them from defaults. More...
 
void Format (OUTPUTFORMATTER *aFormatter, int aNestLevel, int aControlBits) const
 Function Format outputs the net class to aFormatter in s-expression form. More...
 

Static Public Attributes

static const char Default [] = "Default"
 the name of the default NETCLASS More...
 

Protected Attributes

wxString m_Name
 Name of the net class. More...
 
wxString m_Description
 what this NETCLASS is for. More...
 
STRINGSET m_Members
 names of NET members of this class More...
 
int m_Clearance
 The units on these parameters is Internal Units (1 nm) More...
 
int m_TrackWidth
 track width used to route NETs in this NETCLASS More...
 
int m_ViaDia
 via diameter More...
 
int m_ViaDrill
 via drill hole diameter More...
 
int m_uViaDia
 microvia diameter More...
 
int m_uViaDrill
 microvia drill hole diameter More...
 
int m_diffPairWidth
 
int m_diffPairGap
 
int m_diffPairViaGap
 

Detailed Description

NETCLASS handles a collection of nets and the parameters used to route or test these nets.

Definition at line 55 of file netclass.h.

Member Typedef Documentation

◆ const_iterator

typedef STRINGSET::const_iterator NETCLASS::const_iterator

Definition at line 135 of file netclass.h.

◆ iterator

typedef STRINGSET::iterator NETCLASS::iterator

Definition at line 131 of file netclass.h.

Constructor & Destructor Documentation

◆ NETCLASS()

NETCLASS::NETCLASS ( const wxString &  aName)

Constructor stuffs a NETCLASS instance with aParent, aName, and optionally the initialParameters.

Parameters
aName= the name of this new netclass

Definition at line 51 of file netclass.cpp.

51  :
52  m_Name( aName )
53 {
54  // Default settings
58  // These defaults will be overwritten by SetParams,
59  // from the board design parameters, later
66 }
void SetDiffPairWidth(int aSize)
Definition: netclass.h:181
const int DEFAULT_VIA_DIAMETER
Definition: netclass.cpp:41
void SetTrackWidth(int aWidth)
Definition: netclass.h:166
void SetViaDrill(int aSize)
Definition: netclass.h:172
void SetDiffPairGap(int aSize)
Definition: netclass.h:184
void SetClearance(int aClearance)
Definition: netclass.h:163
const int DEFAULT_UVIA_DIAMETER
Definition: netclass.cpp:43
const int DEFAULT_CLEARANCE
Definition: netclass.cpp:40
const int DEFAULT_DIFF_PAIR_VIAGAP
Definition: netclass.cpp:48
const int DEFAULT_DIFF_PAIR_GAP
Definition: netclass.cpp:47
void SetuViaDiameter(int aSize)
Definition: netclass.h:175
void SetDiffPairViaGap(int aSize)
Definition: netclass.h:187
const int DEFAULT_VIA_DRILL
Definition: netclass.cpp:42
void SetuViaDrill(int aSize)
Definition: netclass.h:178
const int DEFAULT_DIFF_PAIR_WIDTH
Definition: netclass.cpp:46
const int DEFAULT_TRACK_WIDTH
Definition: netclass.cpp:45
wxString m_Name
Name of the net class.
Definition: netclass.h:58
void SetViaDiameter(int aDia)
Definition: netclass.h:169
const int DEFAULT_UVIA_DRILL
Definition: netclass.cpp:44

References DEFAULT_CLEARANCE, DEFAULT_DIFF_PAIR_GAP, DEFAULT_DIFF_PAIR_VIAGAP, DEFAULT_DIFF_PAIR_WIDTH, DEFAULT_TRACK_WIDTH, DEFAULT_UVIA_DIAMETER, DEFAULT_UVIA_DRILL, DEFAULT_VIA_DIAMETER, DEFAULT_VIA_DRILL, SetClearance(), SetDiffPairGap(), SetDiffPairViaGap(), SetDiffPairWidth(), SetTrackWidth(), SetuViaDiameter(), SetuViaDrill(), SetViaDiameter(), and SetViaDrill().

◆ ~NETCLASS()

NETCLASS::~NETCLASS ( )

Definition at line 83 of file netclass.cpp.

84 {
85 }

Member Function Documentation

◆ Add()

void NETCLASS::Add ( const wxString &  aNetname)
inline

Function Add adds aNetname to this NETCLASS if it is not already in this NETCLASS.

It is harmless to try and add a second identical name.

Definition at line 126 of file netclass.h.

127  {
128  m_Members.insert( aNetname );
129  }
STRINGSET m_Members
names of NET members of this class
Definition: netclass.h:61

◆ begin() [1/2]

iterator NETCLASS::begin ( )
inline

Definition at line 132 of file netclass.h.

132 { return m_Members.begin(); }
STRINGSET m_Members
names of NET members of this class
Definition: netclass.h:61

Referenced by filterNetClass(), and Format().

◆ begin() [2/2]

const_iterator NETCLASS::begin ( ) const
inline

Definition at line 136 of file netclass.h.

136 { return m_Members.begin(); }
STRINGSET m_Members
names of NET members of this class
Definition: netclass.h:61

◆ Clear()

void NETCLASS::Clear ( )
inline

Function Clear empties the collection of members.

Definition at line 116 of file netclass.h.

117  {
118  m_Members.clear();
119  }
STRINGSET m_Members
names of NET members of this class
Definition: netclass.h:61

◆ end() [1/2]

iterator NETCLASS::end ( )
inline

Definition at line 133 of file netclass.h.

133 { return m_Members.end(); }
STRINGSET m_Members
names of NET members of this class
Definition: netclass.h:61

Referenced by filterNetClass(), and Format().

◆ end() [2/2]

const_iterator NETCLASS::end ( ) const
inline

Definition at line 137 of file netclass.h.

137 { return m_Members.end(); }
STRINGSET m_Members
names of NET members of this class
Definition: netclass.h:61

◆ Format()

void NETCLASS::Format ( OUTPUTFORMATTER aFormatter,
int  aNestLevel,
int  aControlBits 
) const

Function Format outputs the net class to aFormatter in s-expression form.

Parameters
aFormatterThe OUTPUTFORMATTER object to write to.
aNestLevelThe indentation next level.
aControlBitsThe control bit definition for object specific formatting.
Exceptions
IO_ERRORon write error.

Definition at line 253 of file netclass.cpp.

254 {
255  aFormatter->Print( aNestLevel, "(net_class %s %s\n",
256  aFormatter->Quotew( GetName() ).c_str(),
257  aFormatter->Quotew( GetDescription() ).c_str() );
258 
259  aFormatter->Print( aNestLevel+1, "(clearance %s)\n", FormatInternalUnits( GetClearance() ).c_str() );
260  aFormatter->Print( aNestLevel+1, "(trace_width %s)\n", FormatInternalUnits( GetTrackWidth() ).c_str() );
261 
262  aFormatter->Print( aNestLevel+1, "(via_dia %s)\n", FormatInternalUnits( GetViaDiameter() ).c_str() );
263  aFormatter->Print( aNestLevel+1, "(via_drill %s)\n", FormatInternalUnits( GetViaDrill() ).c_str() );
264 
265  aFormatter->Print( aNestLevel+1, "(uvia_dia %s)\n", FormatInternalUnits( GetuViaDiameter() ).c_str() );
266  aFormatter->Print( aNestLevel+1, "(uvia_drill %s)\n", FormatInternalUnits( GetuViaDrill() ).c_str() );
267 
268  // Save the diff_pair_gap and diff_pair_width values only if not the default, to avoid unnecessary
269  // incompatibility with previous Pcbnew versions.
272  {
273  aFormatter->Print( aNestLevel+1, "(diff_pair_width %s)\n",
274  FormatInternalUnits( GetDiffPairWidth() ).c_str() );
275  aFormatter->Print( aNestLevel+1, "(diff_pair_gap %s)\n",
276  FormatInternalUnits( GetDiffPairGap() ).c_str() );
277 
278  // 6.0 TODO: figure out what to do with DiffPairViaGap...
279  }
280 
281  for( NETCLASS::const_iterator it = begin(); it != end(); ++it )
282  aFormatter->Print( aNestLevel+1, "(add_net %s)\n", aFormatter->Quotew( *it ).c_str() );
283 
284  aFormatter->Print( aNestLevel, ")\n\n" );
285 }
int GetDiffPairGap() const
Definition: netclass.h:183
const wxString & GetName() const
Definition: netclass.h:96
iterator begin()
Definition: netclass.h:132
int GetTrackWidth() const
Definition: netclass.h:165
iterator end()
Definition: netclass.h:133
int GetViaDrill() const
Definition: netclass.h:171
std::string Quotew(const wxString &aWrapee)
Definition: richio.cpp:472
int GetuViaDiameter() const
Definition: netclass.h:174
const int DEFAULT_DIFF_PAIR_GAP
Definition: netclass.cpp:47
int GetDiffPairWidth() const
Definition: netclass.h:180
const int DEFAULT_DIFF_PAIR_WIDTH
Definition: netclass.cpp:46
int GetClearance() const
Definition: netclass.h:162
int GetViaDiameter() const
Definition: netclass.h:168
const wxString & GetDescription() const
Definition: netclass.h:159
STRINGSET::const_iterator const_iterator
Definition: netclass.h:135
int GetuViaDrill() const
Definition: netclass.h:177
int PRINTF_FUNC Print(int nestLevel, const char *fmt,...)
Function Print formats and writes text to the output stream.
Definition: richio.cpp:404
std::string FormatInternalUnits(int aValue)
Function FormatInternalUnits converts aValue from internal units to a string appropriate for writing ...
Definition: base_units.cpp:523

References begin(), DEFAULT_DIFF_PAIR_GAP, DEFAULT_DIFF_PAIR_WIDTH, end(), FormatInternalUnits(), GetClearance(), GetDescription(), GetDiffPairGap(), GetDiffPairWidth(), GetName(), GetTrackWidth(), GetuViaDiameter(), GetuViaDrill(), GetViaDiameter(), GetViaDrill(), OUTPUTFORMATTER::Print(), and OUTPUTFORMATTER::Quotew().

Referenced by PCB_IO::formatNetInformation().

◆ GetClass()

wxString NETCLASS::GetClass ( ) const
inline

Definition at line 91 of file netclass.h.

92  {
93  return wxT( "NETCLASS" );
94  }

◆ GetClearance()

int NETCLASS::GetClearance ( ) const
inline

Definition at line 162 of file netclass.h.

162 { return m_Clearance; }
int m_Clearance
The units on these parameters is Internal Units (1 nm)
Definition: netclass.h:65

Referenced by GERBER_JOBFILE_WRITER::addJSONDesignRules(), Format(), and SetParams().

◆ GetCount()

unsigned NETCLASS::GetCount ( ) const
inline

Function GetCount returns the number of nets in this NETCLASS, i.e.

using these rules.

Definition at line 107 of file netclass.h.

108  {
109  return m_Members.size();
110  }
STRINGSET m_Members
names of NET members of this class
Definition: netclass.h:61

◆ GetDescription()

const wxString& NETCLASS::GetDescription ( ) const
inline

Definition at line 159 of file netclass.h.

159 { return m_Description; }
wxString m_Description
what this NETCLASS is for.
Definition: netclass.h:59

Referenced by Format().

◆ GetDiffPairGap()

int NETCLASS::GetDiffPairGap ( ) const
inline

Definition at line 183 of file netclass.h.

183 { return m_diffPairGap; }
int m_diffPairGap
Definition: netclass.h:75

Referenced by Format(), and SetParams().

◆ GetDiffPairViaGap()

int NETCLASS::GetDiffPairViaGap ( ) const
inline

Definition at line 186 of file netclass.h.

186 { return m_diffPairViaGap; }
int m_diffPairViaGap
Definition: netclass.h:76

Referenced by SetParams().

◆ GetDiffPairWidth()

int NETCLASS::GetDiffPairWidth ( ) const
inline

Definition at line 180 of file netclass.h.

180 { return m_diffPairWidth; }
int m_diffPairWidth
Definition: netclass.h:74

Referenced by Format(), and SetParams().

◆ GetName()

const wxString& NETCLASS::GetName ( void  ) const
inline

Definition at line 96 of file netclass.h.

97  {
98  return m_Name;
99  }
wxString m_Name
Name of the net class.
Definition: netclass.h:58

Referenced by Format().

◆ GetTrackWidth()

int NETCLASS::GetTrackWidth ( ) const
inline

Definition at line 165 of file netclass.h.

165 { return m_TrackWidth; }
int m_TrackWidth
track width used to route NETs in this NETCLASS
Definition: netclass.h:67

Referenced by Format(), and SetParams().

◆ GetuViaDiameter()

int NETCLASS::GetuViaDiameter ( ) const
inline

Definition at line 174 of file netclass.h.

174 { return m_uViaDia; }
int m_uViaDia
microvia diameter
Definition: netclass.h:71

Referenced by Format(), and SetParams().

◆ GetuViaDrill()

int NETCLASS::GetuViaDrill ( ) const
inline

Definition at line 177 of file netclass.h.

177 { return m_uViaDrill; }
int m_uViaDrill
microvia drill hole diameter
Definition: netclass.h:72

Referenced by Format(), and SetParams().

◆ GetViaDiameter()

int NETCLASS::GetViaDiameter ( ) const
inline

Definition at line 168 of file netclass.h.

168 { return m_ViaDia; }
int m_ViaDia
via diameter
Definition: netclass.h:68

Referenced by Format(), and SetParams().

◆ GetViaDrill()

int NETCLASS::GetViaDrill ( ) const
inline

Definition at line 171 of file netclass.h.

171 { return m_ViaDrill; }
int m_ViaDrill
via drill hole diameter
Definition: netclass.h:69

Referenced by Format(), and SetParams().

◆ NetNames()

STRINGSET& NETCLASS::NetNames ( )
inline

for SWIG

Definition at line 157 of file netclass.h.

◆ Remove() [1/2]

void NETCLASS::Remove ( iterator  aName)
inline

Function Remove will remove NET name aName from the collection of members.

Definition at line 143 of file netclass.h.

144  {
145  m_Members.erase( aName );
146  }
STRINGSET m_Members
names of NET members of this class
Definition: netclass.h:61

Referenced by filterNetClass().

◆ Remove() [2/2]

void NETCLASS::Remove ( const wxString &  aName)
inline

Function Remove will remove NET name aName from the collection of members.

Definition at line 152 of file netclass.h.

153  {
154  m_Members.erase( aName );
155  }
STRINGSET m_Members
names of NET members of this class
Definition: netclass.h:61

◆ SetClearance()

void NETCLASS::SetClearance ( int  aClearance)
inline

Definition at line 163 of file netclass.h.

163 { m_Clearance = aClearance; }
int m_Clearance
The units on these parameters is Internal Units (1 nm)
Definition: netclass.h:65

Referenced by NETCLASS(), and SetParams().

◆ SetDescription()

void NETCLASS::SetDescription ( const wxString &  aDesc)
inline

Definition at line 160 of file netclass.h.

160 { m_Description = aDesc; }
wxString m_Description
what this NETCLASS is for.
Definition: netclass.h:59

◆ SetDiffPairGap()

void NETCLASS::SetDiffPairGap ( int  aSize)
inline

Definition at line 184 of file netclass.h.

184 { m_diffPairGap = aSize; }
int m_diffPairGap
Definition: netclass.h:75

Referenced by NETCLASS(), and SetParams().

◆ SetDiffPairViaGap()

void NETCLASS::SetDiffPairViaGap ( int  aSize)
inline

Definition at line 187 of file netclass.h.

187 { m_diffPairViaGap = aSize; }
int m_diffPairViaGap
Definition: netclass.h:76

Referenced by NETCLASS(), and SetParams().

◆ SetDiffPairWidth()

void NETCLASS::SetDiffPairWidth ( int  aSize)
inline

Definition at line 181 of file netclass.h.

181 { m_diffPairWidth = aSize; }
int m_diffPairWidth
Definition: netclass.h:74

Referenced by NETCLASS(), and SetParams().

◆ SetName()

void NETCLASS::SetName ( const wxString &  aName)
inline

Definition at line 101 of file netclass.h.

101 { m_Name = aName; }
wxString m_Name
Name of the net class.
Definition: netclass.h:58

◆ SetParams()

void NETCLASS::SetParams ( const NETCLASS aDefaults)

Function SetParams will set all the parameters by copying them from defaults.

Parameters are the values like m_ViaSize, etc, but do not include m_Description.

Parameters
aDefaultsis another NETCLASS object to copy from.

Definition at line 69 of file netclass.cpp.

70 {
71  SetClearance( aDefaults.GetClearance() );
72  SetTrackWidth( aDefaults.GetTrackWidth() );
73  SetViaDiameter( aDefaults.GetViaDiameter() );
74  SetViaDrill( aDefaults.GetViaDrill() );
75  SetuViaDiameter( aDefaults.GetuViaDiameter() );
76  SetuViaDrill( aDefaults.GetuViaDrill() );
77  SetDiffPairWidth( aDefaults.GetDiffPairWidth() );
78  SetDiffPairGap( aDefaults.GetDiffPairGap() );
79  SetDiffPairViaGap( aDefaults.GetDiffPairViaGap() );
80 }
void SetDiffPairWidth(int aSize)
Definition: netclass.h:181
int GetDiffPairGap() const
Definition: netclass.h:183
void SetTrackWidth(int aWidth)
Definition: netclass.h:166
void SetViaDrill(int aSize)
Definition: netclass.h:172
void SetDiffPairGap(int aSize)
Definition: netclass.h:184
int GetTrackWidth() const
Definition: netclass.h:165
int GetDiffPairViaGap() const
Definition: netclass.h:186
void SetClearance(int aClearance)
Definition: netclass.h:163
int GetViaDrill() const
Definition: netclass.h:171
int GetuViaDiameter() const
Definition: netclass.h:174
void SetuViaDiameter(int aSize)
Definition: netclass.h:175
int GetDiffPairWidth() const
Definition: netclass.h:180
void SetDiffPairViaGap(int aSize)
Definition: netclass.h:187
void SetuViaDrill(int aSize)
Definition: netclass.h:178
int GetClearance() const
Definition: netclass.h:162
int GetViaDiameter() const
Definition: netclass.h:168
void SetViaDiameter(int aDia)
Definition: netclass.h:169
int GetuViaDrill() const
Definition: netclass.h:177

References GetClearance(), GetDiffPairGap(), GetDiffPairViaGap(), GetDiffPairWidth(), GetTrackWidth(), GetuViaDiameter(), GetuViaDrill(), GetViaDiameter(), GetViaDrill(), SetClearance(), SetDiffPairGap(), SetDiffPairViaGap(), SetDiffPairWidth(), SetTrackWidth(), SetuViaDiameter(), SetuViaDrill(), SetViaDiameter(), and SetViaDrill().

◆ SetTrackWidth()

void NETCLASS::SetTrackWidth ( int  aWidth)
inline

Definition at line 166 of file netclass.h.

166 { m_TrackWidth = aWidth; }
int m_TrackWidth
track width used to route NETs in this NETCLASS
Definition: netclass.h:67

Referenced by NETCLASS(), and SetParams().

◆ SetuViaDiameter()

void NETCLASS::SetuViaDiameter ( int  aSize)
inline

Definition at line 175 of file netclass.h.

175 { m_uViaDia = aSize; }
int m_uViaDia
microvia diameter
Definition: netclass.h:71

Referenced by NETCLASS(), and SetParams().

◆ SetuViaDrill()

void NETCLASS::SetuViaDrill ( int  aSize)
inline

Definition at line 178 of file netclass.h.

178 { m_uViaDrill = aSize; }
int m_uViaDrill
microvia drill hole diameter
Definition: netclass.h:72

Referenced by NETCLASS(), and SetParams().

◆ SetViaDiameter()

void NETCLASS::SetViaDiameter ( int  aDia)
inline

Definition at line 169 of file netclass.h.

169 { m_ViaDia = aDia; }
int m_ViaDia
via diameter
Definition: netclass.h:68

Referenced by NETCLASS(), and SetParams().

◆ SetViaDrill()

void NETCLASS::SetViaDrill ( int  aSize)
inline

Definition at line 172 of file netclass.h.

172 { m_ViaDrill = aSize; }
int m_ViaDrill
via drill hole diameter
Definition: netclass.h:69

Referenced by NETCLASS(), and SetParams().

Member Data Documentation

◆ Default

◆ m_Clearance

int NETCLASS::m_Clearance
protected

The units on these parameters is Internal Units (1 nm)

clearance when routing

Definition at line 65 of file netclass.h.

◆ m_Description

wxString NETCLASS::m_Description
protected

what this NETCLASS is for.

Definition at line 59 of file netclass.h.

◆ m_diffPairGap

int NETCLASS::m_diffPairGap
protected

Definition at line 75 of file netclass.h.

◆ m_diffPairViaGap

int NETCLASS::m_diffPairViaGap
protected

Definition at line 76 of file netclass.h.

◆ m_diffPairWidth

int NETCLASS::m_diffPairWidth
protected

Definition at line 74 of file netclass.h.

◆ m_Members

STRINGSET NETCLASS::m_Members
protected

names of NET members of this class

Definition at line 61 of file netclass.h.

◆ m_Name

wxString NETCLASS::m_Name
protected

Name of the net class.

Definition at line 58 of file netclass.h.

◆ m_TrackWidth

int NETCLASS::m_TrackWidth
protected

track width used to route NETs in this NETCLASS

Definition at line 67 of file netclass.h.

◆ m_uViaDia

int NETCLASS::m_uViaDia
protected

microvia diameter

Definition at line 71 of file netclass.h.

◆ m_uViaDrill

int NETCLASS::m_uViaDrill
protected

microvia drill hole diameter

Definition at line 72 of file netclass.h.

◆ m_ViaDia

int NETCLASS::m_ViaDia
protected

via diameter

Definition at line 68 of file netclass.h.

◆ m_ViaDrill

int NETCLASS::m_ViaDrill
protected

via drill hole diameter

Definition at line 69 of file netclass.h.


The documentation for this class was generated from the following files: