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 <class_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)
 
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 throw ( IO_ERROR )
 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
 

Static Private Attributes

static const int DEFAULT_CLEARANCE = Millimeter2iu( 0.2 )
 
static const int DEFAULT_VIA_DRILL = Millimeter2iu( 0.4 )
 
static const int DEFAULT_UVIA_DRILL = Millimeter2iu( 0.1 )
 
static const int DEFAULT_VIA_DIAMETER = Millimeter2iu( 0.8 )
 
static const int DEFAULT_UVIA_DIAMETER = Millimeter2iu( 0.3 )
 
static const int DEFAULT_TRACK_WIDTH = Millimeter2iu( 0.25 )
 
static const int DEFAULT_DIFF_PAIR_WIDTH = Millimeter2iu( 0.2 )
 
static const int DEFAULT_DIFF_PAIR_GAP = Millimeter2iu( 0.25 )
 

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 class_netclass.h.

Member Typedef Documentation

typedef STRINGSET::const_iterator NETCLASS::const_iterator

Definition at line 145 of file class_netclass.h.

typedef STRINGSET::iterator NETCLASS::iterator

Definition at line 141 of file class_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 51 of file class_netclass.cpp.

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

51  :
52  m_Name( aName )
53 {
54  // Default settings
58  // These defaults will be overwritten by SetParams,
59  // from the board design parameters, later
65 }
void SetDiffPairWidth(int aSize)
static const int DEFAULT_UVIA_DIAMETER
static const int DEFAULT_DIFF_PAIR_GAP
void SetTrackWidth(int aWidth)
void SetViaDrill(int aSize)
void SetDiffPairGap(int aSize)
void SetClearance(int aClearance)
static const int DEFAULT_UVIA_DRILL
void SetuViaDiameter(int aSize)
static const int DEFAULT_VIA_DIAMETER
static const int DEFAULT_VIA_DRILL
void SetuViaDrill(int aSize)
wxString m_Name
Name of the net class.
static const int DEFAULT_TRACK_WIDTH
void SetViaDiameter(int aDia)
static const int DEFAULT_DIFF_PAIR_WIDTH
static const int DEFAULT_CLEARANCE
NETCLASS::~NETCLASS ( )

Definition at line 82 of file class_netclass.cpp.

83 {
84 }

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 136 of file class_netclass.h.

137  {
138  m_Members.insert( aNetname );
139  }
STRINGSET m_Members
names of NET members of this class
iterator NETCLASS::begin ( )
inline

Definition at line 142 of file class_netclass.h.

Referenced by filterNetClass().

142 { return m_Members.begin(); }
STRINGSET m_Members
names of NET members of this class
const_iterator NETCLASS::begin ( ) const
inline

Definition at line 146 of file class_netclass.h.

146 { return m_Members.begin(); }
STRINGSET m_Members
names of NET members of this class
void NETCLASS::Clear ( )
inline

Function Clear empties the collection of members.

Definition at line 126 of file class_netclass.h.

127  {
128  m_Members.clear();
129  }
STRINGSET m_Members
names of NET members of this class
iterator NETCLASS::end ( )
inline

Definition at line 143 of file class_netclass.h.

Referenced by filterNetClass().

143 { return m_Members.end(); }
STRINGSET m_Members
names of NET members of this class
const_iterator NETCLASS::end ( ) const
inline

Definition at line 147 of file class_netclass.h.

147 { return m_Members.end(); }
STRINGSET m_Members
names of NET members of this class
void NETCLASS::Format ( OUTPUTFORMATTER aFormatter,
int  aNestLevel,
int  aControlBits 
) const
throw (IO_ERROR
)

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 251 of file class_netclass.cpp.

References FMT_IU.

Referenced by PCB_IO::format().

253 {
254  aFormatter->Print( aNestLevel, "(net_class %s %s\n",
255  aFormatter->Quotew( GetName() ).c_str(),
256  aFormatter->Quotew( GetDescription() ).c_str() );
257 
258  aFormatter->Print( aNestLevel+1, "(clearance %s)\n", FMT_IU( GetClearance() ).c_str() );
259  aFormatter->Print( aNestLevel+1, "(trace_width %s)\n", FMT_IU( GetTrackWidth() ).c_str() );
260 
261  aFormatter->Print( aNestLevel+1, "(via_dia %s)\n", FMT_IU( GetViaDiameter() ).c_str() );
262  aFormatter->Print( aNestLevel+1, "(via_drill %s)\n", FMT_IU( GetViaDrill() ).c_str() );
263 
264  aFormatter->Print( aNestLevel+1, "(uvia_dia %s)\n", FMT_IU( GetuViaDiameter() ).c_str() );
265  aFormatter->Print( aNestLevel+1, "(uvia_drill %s)\n", FMT_IU( GetuViaDrill() ).c_str() );
266 
267  // Save the diff_pair_gap and diff_pair_width values only if not the default, to avoid unnecessary
268  // incompatibility with previous Pcbnew versions.
271  {
272  aFormatter->Print( aNestLevel+1, "(diff_pair_gap %s)\n", FMT_IU( GetDiffPairGap() ).c_str() );
273  aFormatter->Print( aNestLevel+1, "(diff_pair_width %s)\n", FMT_IU( GetDiffPairWidth() ).c_str() );
274  }
275 
276 
277  for( NETCLASS::const_iterator it = begin(); it != end(); ++it )
278  aFormatter->Print( aNestLevel+1, "(add_net %s)\n", aFormatter->Quotew( *it ).c_str() );
279 
280  aFormatter->Print( aNestLevel, ")\n\n" );
281 }
const wxString & GetName() const
int GetuViaDrill() const
int GetuViaDiameter() const
int GetClearance() const
static const int DEFAULT_DIFF_PAIR_GAP
int GetTrackWidth() const
iterator begin()
int GetDiffPairGap() const
iterator end()
#define FMT_IU
const wxString & GetDescription() const
std::string Quotew(const wxString &aWrapee)
Definition: richio.cpp:486
int GetViaDiameter() const
int GetDiffPairWidth() const
int GetViaDrill() const
STRINGSET::const_iterator const_iterator
int PRINTF_FUNC Print(int nestLevel, const char *fmt,...)
Function Print formats and writes text to the output stream.
Definition: richio.cpp:408
static const int DEFAULT_DIFF_PAIR_WIDTH
wxString NETCLASS::GetClass ( ) const
inline

Definition at line 101 of file class_netclass.h.

102  {
103  return wxT( "NETCLASS" );
104  }
int NETCLASS::GetClearance ( ) const
inline

Definition at line 172 of file class_netclass.h.

Referenced by SetParams().

172 { return m_Clearance; }
int m_Clearance
The units on these parameters is Internal Units (1 nm)
unsigned NETCLASS::GetCount ( ) const
inline

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

using these rules.

Definition at line 117 of file class_netclass.h.

118  {
119  return m_Members.size();
120  }
STRINGSET m_Members
names of NET members of this class
const wxString& NETCLASS::GetDescription ( ) const
inline

Definition at line 169 of file class_netclass.h.

References m_Description.

169 { return m_Description; }
wxString m_Description
what this NETCLASS is for.
int NETCLASS::GetDiffPairGap ( ) const
inline

Definition at line 193 of file class_netclass.h.

Referenced by SetParams().

193 { return m_diffPairGap; }
int m_diffPairGap
int NETCLASS::GetDiffPairWidth ( ) const
inline

Definition at line 190 of file class_netclass.h.

Referenced by SetParams().

190 { return m_diffPairWidth; }
int m_diffPairWidth
const wxString& NETCLASS::GetName ( ) const
inline

Definition at line 106 of file class_netclass.h.

107  {
108  return m_Name;
109  }
wxString m_Name
Name of the net class.
int NETCLASS::GetTrackWidth ( ) const
inline

Definition at line 175 of file class_netclass.h.

Referenced by SetParams().

175 { return m_TrackWidth; }
int m_TrackWidth
track width used to route NETs in this NETCLASS
int NETCLASS::GetuViaDiameter ( ) const
inline

Definition at line 184 of file class_netclass.h.

Referenced by SetParams().

184 { return m_uViaDia; }
int m_uViaDia
microvia diameter
int NETCLASS::GetuViaDrill ( ) const
inline

Definition at line 187 of file class_netclass.h.

Referenced by SetParams().

187 { return m_uViaDrill; }
int m_uViaDrill
microvia drill hole diameter
int NETCLASS::GetViaDiameter ( ) const
inline

Definition at line 178 of file class_netclass.h.

Referenced by SetParams().

178 { return m_ViaDia; }
int m_ViaDia
via diameter
int NETCLASS::GetViaDrill ( ) const
inline

Definition at line 181 of file class_netclass.h.

Referenced by SetParams().

181 { return m_ViaDrill; }
int m_ViaDrill
via drill hole diameter
STRINGSET& NETCLASS::NetNames ( )
inline

for SWIG

Definition at line 167 of file class_netclass.h.

void NETCLASS::Remove ( iterator  aName)
inline

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

Definition at line 153 of file class_netclass.h.

Referenced by filterNetClass().

154  {
155  m_Members.erase( aName );
156  }
STRINGSET m_Members
names of NET members of this class
void NETCLASS::Remove ( const wxString &  aName)
inline

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

Definition at line 162 of file class_netclass.h.

163  {
164  m_Members.erase( aName );
165  }
STRINGSET m_Members
names of NET members of this class
void NETCLASS::SetClearance ( int  aClearance)
inline

Definition at line 173 of file class_netclass.h.

Referenced by NETCLASS(), and SetParams().

173 { m_Clearance = aClearance; }
int m_Clearance
The units on these parameters is Internal Units (1 nm)
void NETCLASS::SetDescription ( const wxString &  aDesc)
inline

Definition at line 170 of file class_netclass.h.

170 { m_Description = aDesc; }
wxString m_Description
what this NETCLASS is for.
void NETCLASS::SetDiffPairGap ( int  aSize)
inline

Definition at line 194 of file class_netclass.h.

Referenced by NETCLASS(), and SetParams().

194 { m_diffPairGap = aSize; }
int m_diffPairGap
void NETCLASS::SetDiffPairWidth ( int  aSize)
inline

Definition at line 191 of file class_netclass.h.

Referenced by NETCLASS(), and SetParams().

191 { m_diffPairWidth = aSize; }
int m_diffPairWidth
void NETCLASS::SetName ( const wxString &  aName)
inline

Definition at line 111 of file class_netclass.h.

111 { m_Name = aName; }
wxString m_Name
Name of the net class.
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 68 of file class_netclass.cpp.

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

69 {
70  SetClearance( aDefaults.GetClearance() );
71  SetTrackWidth( aDefaults.GetTrackWidth() );
72  SetViaDiameter( aDefaults.GetViaDiameter() );
73  SetViaDrill( aDefaults.GetViaDrill() );
74  SetuViaDiameter( aDefaults.GetuViaDiameter() );
75  SetuViaDrill( aDefaults.GetuViaDrill() );
76  SetDiffPairWidth( aDefaults.GetDiffPairWidth() );
77  SetDiffPairGap( aDefaults.GetDiffPairGap() );
78 
79 }
void SetDiffPairWidth(int aSize)
int GetuViaDrill() const
int GetuViaDiameter() const
int GetClearance() const
void SetTrackWidth(int aWidth)
int GetTrackWidth() const
void SetViaDrill(int aSize)
int GetDiffPairGap() const
void SetDiffPairGap(int aSize)
void SetClearance(int aClearance)
void SetuViaDiameter(int aSize)
int GetViaDiameter() const
int GetDiffPairWidth() const
int GetViaDrill() const
void SetuViaDrill(int aSize)
void SetViaDiameter(int aDia)
void NETCLASS::SetTrackWidth ( int  aWidth)
inline

Definition at line 176 of file class_netclass.h.

Referenced by NETCLASS(), and SetParams().

176 { m_TrackWidth = aWidth; }
int m_TrackWidth
track width used to route NETs in this NETCLASS
void NETCLASS::SetuViaDiameter ( int  aSize)
inline

Definition at line 185 of file class_netclass.h.

Referenced by NETCLASS(), and SetParams().

185 { m_uViaDia = aSize; }
int m_uViaDia
microvia diameter
void NETCLASS::SetuViaDrill ( int  aSize)
inline

Definition at line 188 of file class_netclass.h.

Referenced by NETCLASS(), and SetParams().

188 { m_uViaDrill = aSize; }
int m_uViaDrill
microvia drill hole diameter
void NETCLASS::SetViaDiameter ( int  aDia)
inline

Definition at line 179 of file class_netclass.h.

Referenced by NETCLASS(), and SetParams().

179 { m_ViaDia = aDia; }
int m_ViaDia
via diameter
void NETCLASS::SetViaDrill ( int  aSize)
inline

Definition at line 182 of file class_netclass.h.

Referenced by NETCLASS(), and SetParams().

182 { m_ViaDrill = aSize; }
int m_ViaDrill
via drill hole diameter

Member Data Documentation

const int NETCLASS::DEFAULT_CLEARANCE = Millimeter2iu( 0.2 )
staticprivate

Definition at line 59 of file class_netclass.h.

Referenced by NETCLASS().

const int NETCLASS::DEFAULT_DIFF_PAIR_GAP = Millimeter2iu( 0.25 )
staticprivate

Definition at line 66 of file class_netclass.h.

Referenced by NETCLASS().

const int NETCLASS::DEFAULT_DIFF_PAIR_WIDTH = Millimeter2iu( 0.2 )
staticprivate

Definition at line 65 of file class_netclass.h.

Referenced by NETCLASS().

const int NETCLASS::DEFAULT_TRACK_WIDTH = Millimeter2iu( 0.25 )
staticprivate

Definition at line 64 of file class_netclass.h.

Referenced by NETCLASS().

const int NETCLASS::DEFAULT_UVIA_DIAMETER = Millimeter2iu( 0.3 )
staticprivate

Definition at line 63 of file class_netclass.h.

Referenced by NETCLASS().

const int NETCLASS::DEFAULT_UVIA_DRILL = Millimeter2iu( 0.1 )
staticprivate

Definition at line 61 of file class_netclass.h.

Referenced by NETCLASS().

const int NETCLASS::DEFAULT_VIA_DIAMETER = Millimeter2iu( 0.8 )
staticprivate

Definition at line 62 of file class_netclass.h.

Referenced by NETCLASS().

const int NETCLASS::DEFAULT_VIA_DRILL = Millimeter2iu( 0.4 )
staticprivate

Definition at line 60 of file class_netclass.h.

Referenced by NETCLASS().

int NETCLASS::m_Clearance
protected

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

clearance when routing

Definition at line 76 of file class_netclass.h.

wxString NETCLASS::m_Description
protected

what this NETCLASS is for.

Definition at line 70 of file class_netclass.h.

int NETCLASS::m_diffPairGap
protected

Definition at line 86 of file class_netclass.h.

int NETCLASS::m_diffPairWidth
protected

Definition at line 85 of file class_netclass.h.

STRINGSET NETCLASS::m_Members
protected

names of NET members of this class

Definition at line 72 of file class_netclass.h.

wxString NETCLASS::m_Name
protected

Name of the net class.

Definition at line 69 of file class_netclass.h.

int NETCLASS::m_TrackWidth
protected

track width used to route NETs in this NETCLASS

Definition at line 78 of file class_netclass.h.

int NETCLASS::m_uViaDia
protected

microvia diameter

Definition at line 82 of file class_netclass.h.

int NETCLASS::m_uViaDrill
protected

microvia drill hole diameter

Definition at line 83 of file class_netclass.h.

int NETCLASS::m_ViaDia
protected

via diameter

Definition at line 79 of file class_netclass.h.

int NETCLASS::m_ViaDrill
protected

via drill hole diameter

Definition at line 80 of file class_netclass.h.


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