KiCad PCB EDA Suite
NETCLASS Class Reference

Class 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

Class 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

typedef STRINGSET::const_iterator NETCLASS::const_iterator

Definition at line 135 of file netclass.h.

typedef STRINGSET::iterator NETCLASS::iterator

Definition at line 131 of file netclass.h.

Constructor & Destructor Documentation

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 56 of file netclass.cpp.

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().

56  :
57  m_Name( aName )
58 {
59  // Default settings
63  // These defaults will be overwritten by SetParams,
64  // from the board design parameters, later
71 }
void SetDiffPairWidth(int aSize)
Definition: netclass.h:181
const int DEFAULT_VIA_DIAMETER
Definition: netclass.cpp:46
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:48
const int DEFAULT_CLEARANCE
Definition: netclass.cpp:45
const int DEFAULT_DIFF_PAIR_VIAGAP
Definition: netclass.cpp:53
const int DEFAULT_DIFF_PAIR_GAP
Definition: netclass.cpp:52
void SetuViaDiameter(int aSize)
Definition: netclass.h:175
void SetDiffPairViaGap(int aSize)
Definition: netclass.h:187
const int DEFAULT_VIA_DRILL
Definition: netclass.cpp:47
void SetuViaDrill(int aSize)
Definition: netclass.h:178
const int DEFAULT_DIFF_PAIR_WIDTH
Definition: netclass.cpp:51
const int DEFAULT_TRACK_WIDTH
Definition: netclass.cpp:50
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:49
NETCLASS::~NETCLASS ( )

Definition at line 88 of file netclass.cpp.

89 {
90 }

Member Function Documentation

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
iterator NETCLASS::begin ( )
inline

Definition at line 132 of file netclass.h.

Referenced by filterNetClass(), Format(), and BOARD::SynchronizeNetsAndNetClasses().

132 { return m_Members.begin(); }
STRINGSET m_Members
names of NET members of this class
Definition: netclass.h:61
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
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
iterator NETCLASS::end ( )
inline

Definition at line 133 of file netclass.h.

Referenced by filterNetClass(), Format(), and BOARD::SynchronizeNetsAndNetClasses().

133 { return m_Members.end(); }
STRINGSET m_Members
names of NET members of this class
Definition: netclass.h:61
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
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 258 of file netclass.cpp.

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

Referenced by PCB_IO::formatNetInformation().

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

Definition at line 91 of file netclass.h.

Referenced by BOARD::SynchronizeNetsAndNetClasses().

92  {
93  return wxT( "NETCLASS" );
94  }
int NETCLASS::GetClearance ( ) const
inline

Definition at line 162 of file netclass.h.

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

162 { return m_Clearance; }
int m_Clearance
The units on these parameters is Internal Units (1 nm)
Definition: netclass.h:65
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
const wxString& NETCLASS::GetDescription ( ) const
inline

Definition at line 159 of file netclass.h.

References m_Description.

Referenced by Format().

159 { return m_Description; }
wxString m_Description
what this NETCLASS is for.
Definition: netclass.h:59
int NETCLASS::GetDiffPairGap ( ) const
inline

Definition at line 183 of file netclass.h.

Referenced by Format(), and SetParams().

183 { return m_diffPairGap; }
int m_diffPairGap
Definition: netclass.h:75
int NETCLASS::GetDiffPairViaGap ( ) const
inline

Definition at line 186 of file netclass.h.

Referenced by SetParams().

186 { return m_diffPairViaGap; }
int m_diffPairViaGap
Definition: netclass.h:76
int NETCLASS::GetDiffPairWidth ( ) const
inline

Definition at line 180 of file netclass.h.

Referenced by Format(), and SetParams().

180 { return m_diffPairWidth; }
int m_diffPairWidth
Definition: netclass.h:74
const wxString& NETCLASS::GetName ( ) const
inline

Definition at line 96 of file netclass.h.

Referenced by Format().

97  {
98  return m_Name;
99  }
wxString m_Name
Name of the net class.
Definition: netclass.h:58
int NETCLASS::GetTrackWidth ( ) const
inline

Definition at line 165 of file netclass.h.

Referenced by Format(), and SetParams().

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

Definition at line 174 of file netclass.h.

Referenced by Format(), and SetParams().

174 { return m_uViaDia; }
int m_uViaDia
microvia diameter
Definition: netclass.h:71
int NETCLASS::GetuViaDrill ( ) const
inline

Definition at line 177 of file netclass.h.

Referenced by Format(), and SetParams().

177 { return m_uViaDrill; }
int m_uViaDrill
microvia drill hole diameter
Definition: netclass.h:72
int NETCLASS::GetViaDiameter ( ) const
inline

Definition at line 168 of file netclass.h.

Referenced by Format(), and SetParams().

168 { return m_ViaDia; }
int m_ViaDia
via diameter
Definition: netclass.h:68
int NETCLASS::GetViaDrill ( ) const
inline

Definition at line 171 of file netclass.h.

Referenced by Format(), and SetParams().

171 { return m_ViaDrill; }
int m_ViaDrill
via drill hole diameter
Definition: netclass.h:69
STRINGSET& NETCLASS::NetNames ( )
inline

for SWIG

Definition at line 157 of file netclass.h.

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.

Referenced by filterNetClass().

144  {
145  m_Members.erase( aName );
146  }
STRINGSET m_Members
names of NET members of this class
Definition: netclass.h:61
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
void NETCLASS::SetClearance ( int  aClearance)
inline

Definition at line 163 of file netclass.h.

Referenced by NETCLASS(), and SetParams().

163 { m_Clearance = aClearance; }
int m_Clearance
The units on these parameters is Internal Units (1 nm)
Definition: netclass.h:65
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
void NETCLASS::SetDiffPairGap ( int  aSize)
inline

Definition at line 184 of file netclass.h.

Referenced by NETCLASS(), and SetParams().

184 { m_diffPairGap = aSize; }
int m_diffPairGap
Definition: netclass.h:75
void NETCLASS::SetDiffPairViaGap ( int  aSize)
inline

Definition at line 187 of file netclass.h.

References DECL_MAP_FOR_SWIG, DECL_SPTR_FOR_SWIG, and Format().

Referenced by NETCLASS(), and SetParams().

187 { m_diffPairViaGap = aSize; }
int m_diffPairViaGap
Definition: netclass.h:76
void NETCLASS::SetDiffPairWidth ( int  aSize)
inline

Definition at line 181 of file netclass.h.

Referenced by NETCLASS(), and SetParams().

181 { m_diffPairWidth = aSize; }
int m_diffPairWidth
Definition: netclass.h:74
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
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 74 of file netclass.cpp.

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

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

Definition at line 166 of file netclass.h.

Referenced by NETCLASS(), and SetParams().

166 { m_TrackWidth = aWidth; }
int m_TrackWidth
track width used to route NETs in this NETCLASS
Definition: netclass.h:67
void NETCLASS::SetuViaDiameter ( int  aSize)
inline

Definition at line 175 of file netclass.h.

Referenced by NETCLASS(), and SetParams().

175 { m_uViaDia = aSize; }
int m_uViaDia
microvia diameter
Definition: netclass.h:71
void NETCLASS::SetuViaDrill ( int  aSize)
inline

Definition at line 178 of file netclass.h.

Referenced by NETCLASS(), and SetParams().

178 { m_uViaDrill = aSize; }
int m_uViaDrill
microvia drill hole diameter
Definition: netclass.h:72
void NETCLASS::SetViaDiameter ( int  aDia)
inline

Definition at line 169 of file netclass.h.

Referenced by NETCLASS(), and SetParams().

169 { m_ViaDia = aDia; }
int m_ViaDia
via diameter
Definition: netclass.h:68
void NETCLASS::SetViaDrill ( int  aSize)
inline

Definition at line 172 of file netclass.h.

Referenced by NETCLASS(), and SetParams().

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

Member Data Documentation

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.

wxString NETCLASS::m_Description
protected

what this NETCLASS is for.

Definition at line 59 of file netclass.h.

int NETCLASS::m_diffPairGap
protected

Definition at line 75 of file netclass.h.

int NETCLASS::m_diffPairViaGap
protected

Definition at line 76 of file netclass.h.

int NETCLASS::m_diffPairWidth
protected

Definition at line 74 of file netclass.h.

STRINGSET NETCLASS::m_Members
protected

names of NET members of this class

Definition at line 61 of file netclass.h.

wxString NETCLASS::m_Name
protected

Name of the net class.

Definition at line 58 of file netclass.h.

int NETCLASS::m_TrackWidth
protected

track width used to route NETs in this NETCLASS

Definition at line 67 of file netclass.h.

int NETCLASS::m_uViaDia
protected

microvia diameter

Definition at line 71 of file netclass.h.

int NETCLASS::m_uViaDrill
protected

microvia drill hole diameter

Definition at line 72 of file netclass.h.

int NETCLASS::m_ViaDia
protected

via diameter

Definition at line 68 of file netclass.h.

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: