void NETCLASS::SetParams( const NETCLASS& aDefaults ) { SetClearance( aDefaults.GetClearance() ); SetTrackWidth( aDefaults.GetTrackWidth() ); SetViaDiameter( aDefaults.GetViaDiameter() ); SetViaDrill( aDefaults.GetViaDrill() ); SetuViaDiameter( aDefaults.GetuViaDiameter() ); SetuViaDrill( aDefaults.GetuViaDrill() ); }
void NETCLASS::SetParams( const NETCLASS* defaults ) { if( defaults ) { SetClearance( defaults->GetClearance() ); SetTrackWidth( defaults->GetTrackWidth() ); SetViaDiameter( defaults->GetViaDiameter() ); SetViaDrill( defaults->GetViaDrill() ); SetuViaDiameter( defaults->GetuViaDiameter() ); SetuViaDrill( defaults->GetuViaDrill() ); } else { /* Dick 5-Feb-2012: I do not believe this comment to be true with current code. It is certainly not a constructor race. Normally items are initialized within a class according to the order of their appearance. // Note: // We use m_Parent->GetDesignSettings() to get some default values // But when this function is called when instantiating a BOARD class, // by the NETCLASSES constructor that calls NETCLASS constructor, // the BOARD constructor (see BOARD::BOARD) is not yet run, // and BOARD::m_designSettings contains not yet initialized values. // So inside the BOARD constructor itself, you SHOULD recall SetParams */ const BOARD_DESIGN_SETTINGS& g = m_Parent->GetDesignSettings(); SetTrackWidth( g.m_TrackMinWidth ); SetViaDiameter( g.m_ViasMinSize ); SetuViaDiameter(g.m_MicroViasMinSize ); // Use default values for next parameters: SetClearance( DEFAULT_CLEARANCE ); SetViaDrill( DEFAULT_VIA_DRILL ); SetuViaDrill( DEFAULT_UVIA_DRILL ); } }
NETCLASS::NETCLASS( const wxString& aName ) : m_Name( aName ) { // Default settings SetClearance( DEFAULT_CLEARANCE ); SetViaDrill( DEFAULT_VIA_DRILL ); SetuViaDrill( DEFAULT_UVIA_DRILL ); // These defaults will be overwritten by SetParams, // from the board design parameters, later SetTrackWidth( DEFAULT_TRACK_WIDTH ); SetViaDiameter( DEFAULT_VIA_DIAMETER ); SetuViaDiameter( DEFAULT_UVIA_DIAMETER ); }