From 20ad2bee2f19e240b6b01f09dbb15ac105bb4279 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Tue, 8 Dec 2020 12:28:26 +0000 Subject: [PATCH] Naming conventions. --- pcbnew/netinfo.h | 76 +++++++++++++++++++---------------------- pcbnew/netinfo_item.cpp | 16 ++++----- pcbnew/netinfo_list.cpp | 15 ++++---- 3 files changed, 52 insertions(+), 55 deletions(-) diff --git a/pcbnew/netinfo.h b/pcbnew/netinfo.h index df93e24adb..eedef5bd44 100644 --- a/pcbnew/netinfo.h +++ b/pcbnew/netinfo.h @@ -67,20 +67,17 @@ class NETINFO_ITEM : public BOARD_ITEM friend class NETINFO_LIST; private: - int m_NetCode; ///< A number equivalent to the net name. - ///< Used for fast comparisons in ratsnest and DRC computations. + int m_netCode; ///< A number equivalent to the net name. + wxString m_netname; ///< Full net name like /sheet/subsheet/vout used by Eeschema. + wxString m_shortNetname; ///< short net name, like vout from /sheet/subsheet/vout. - bool m_isCurrent; ///< Indicates the net is currently in use. We still store those - ///< that are not during a session for undo/redo and to keep - ///< netclass membership information. + NETCLASSPTR m_netClass; - wxString m_Netname; ///< Full net name like /mysheet/mysubsheet/vout used by Eeschema + bool m_isCurrent; ///< Indicates the net is currently in use. We still store + ///< those that are not during a session for undo/redo and to + ///< keep netclass membership information. - wxString m_ShortNetname; ///< short net name, like vout from /mysheet/mysubsheet/vout - - NETCLASSPTR m_NetClass; - - BOARD* m_parent; ///< The parent board the net belongs to. + BOARD* m_parent; ///< The parent board the net belongs to. public: @@ -127,7 +124,7 @@ public: */ NETCLASS* GetNetClass() { - return m_NetClass.get(); + return m_netClass.get(); } /** @@ -136,7 +133,7 @@ public: */ wxString GetClassName() const { - return m_NetClass ? m_NetClass->GetName() : NETCLASS::Default; + return m_netClass ? m_netClass->GetName() : NETCLASS::Default; } #if 1 @@ -147,8 +144,8 @@ public: */ int GetTrackWidth() { - wxASSERT( m_NetClass ); - return m_NetClass->GetTrackWidth(); + wxASSERT( m_netClass ); + return m_netClass->GetTrackWidth(); } /** @@ -157,8 +154,8 @@ public: */ int GetViaSize() { - wxASSERT( m_NetClass ); - return m_NetClass->GetViaDiameter(); + wxASSERT( m_netClass ); + return m_netClass->GetViaDiameter(); } /** @@ -167,8 +164,8 @@ public: */ int GetMicroViaSize() { - wxASSERT( m_NetClass ); - return m_NetClass->GetuViaDiameter(); + wxASSERT( m_netClass ); + return m_netClass->GetuViaDiameter(); } /** @@ -177,8 +174,8 @@ public: */ int GetViaDrillSize() { - wxASSERT( m_NetClass ); - return m_NetClass->GetViaDrill(); + wxASSERT( m_netClass ); + return m_netClass->GetViaDrill(); } /** @@ -187,8 +184,8 @@ public: */ int GetMicroViaDrillSize() { - wxASSERT( m_NetClass ); - return m_NetClass->GetuViaDrill(); + wxASSERT( m_netClass ); + return m_netClass->GetuViaDrill(); } @@ -211,7 +208,7 @@ public: */ int GetClearance() { - return m_NetClass ? m_NetClass->GetClearance() : 0; + return m_netClass ? m_netClass->GetClearance() : 0; } #endif @@ -220,21 +217,21 @@ public: * Function GetNet * @return int - the netcode */ - int GetNet() const { return m_NetCode; } + int GetNet() const { return m_netCode; } - void SetNetCode( int aNetCode ) { m_NetCode = aNetCode; } + void SetNetCode( int aNetCode ) { m_netCode = aNetCode; } /** * Function GetNetname * @return const wxString&, a reference to the full netname */ - const wxString& GetNetname() const { return m_Netname; } + const wxString& GetNetname() const { return m_netname; } /** * Function GetShortNetname * @return const wxString &, a reference to the short netname */ - const wxString& GetShortNetname() const { return m_ShortNetname; } + const wxString& GetShortNetname() const { return m_shortNetname; } /** * Function SetNetname @@ -243,12 +240,12 @@ public: */ void SetNetname( const wxString& aNewName ) { - m_Netname = aNewName; + m_netname = aNewName; if( aNewName.Contains( "/" ) ) - m_ShortNetname = aNewName.AfterLast( '/' ); + m_shortNetname = aNewName.AfterLast( '/' ); else - m_ShortNetname = aNewName; + m_shortNetname = aNewName; } bool IsCurrent() const { return m_isCurrent; } @@ -358,7 +355,7 @@ public: private: std::map::const_iterator m_iterator; - const NETINFO_MAPPING* m_mapping; + const NETINFO_MAPPING* m_mapping; }; /** @@ -393,11 +390,9 @@ public: } private: - ///> Board for which mapping is prepared - const BOARD* m_board; - - ///> Map that allows saving net codes with consecutive numbers (for compatibility reasons) - std::map m_netMapping; + const BOARD* m_board; ///> Board for which mapping is prepared + std::map m_netMapping; ///> Map that allows saving net codes with consecutive + ///> numbers (for compatibility reasons) }; @@ -559,7 +554,7 @@ public: BOARD* GetParent() const { - return m_Parent; + return m_parent; } private: @@ -582,12 +577,13 @@ private: */ int getFreeNetCode(); - BOARD* m_Parent; +private: + BOARD* m_parent; NETNAMES_MAP m_netNames; ///< map of , is NETINFO_ITEM owner NETCODES_MAP m_netCodes; ///< map of is NOT owner - int m_newNetCode; ///< possible value for new net code assignment + int m_newNetCode; ///< possible value for new net code assignment }; #endif // CLASS_NETINFO_ diff --git a/pcbnew/netinfo_item.cpp b/pcbnew/netinfo_item.cpp index 26a1c59f3a..351790ddf8 100644 --- a/pcbnew/netinfo_item.cpp +++ b/pcbnew/netinfo_item.cpp @@ -40,18 +40,18 @@ /*********************************************************/ NETINFO_ITEM::NETINFO_ITEM( BOARD* aParent, const wxString& aNetName, int aNetCode ) : - BOARD_ITEM( aParent, PCB_NETINFO_T ), - m_NetCode( aNetCode ), - m_isCurrent( true ), - m_Netname( aNetName ), - m_ShortNetname( m_Netname.AfterLast( '/' ) ) + BOARD_ITEM( aParent, PCB_NETINFO_T ), + m_netCode( aNetCode ), + m_isCurrent( true ), + m_netname( aNetName ), + m_shortNetname( m_netname.AfterLast( '/' ) ) { m_parent = aParent; if( aParent ) - m_NetClass = aParent->GetDesignSettings().GetNetClasses().GetDefault(); + m_netClass = aParent->GetDesignSettings().GetNetClasses().GetDefault(); else - m_NetClass = std::make_shared( "" ); + m_netClass = std::make_shared( "" ); } @@ -64,7 +64,7 @@ NETINFO_ITEM::~NETINFO_ITEM() void NETINFO_ITEM::SetClass( const NETCLASSPTR& aNetClass ) { wxCHECK( m_parent, /* void */ ); - m_NetClass = aNetClass ? aNetClass : m_parent->GetDesignSettings().GetNetClasses().GetDefault(); + m_netClass = aNetClass ? aNetClass : m_parent->GetDesignSettings().GetNetClasses().GetDefault(); } diff --git a/pcbnew/netinfo_list.cpp b/pcbnew/netinfo_list.cpp index 24f628655a..4201471e7a 100644 --- a/pcbnew/netinfo_list.cpp +++ b/pcbnew/netinfo_list.cpp @@ -30,7 +30,8 @@ // Constructor and destructor -NETINFO_LIST::NETINFO_LIST( BOARD* aParent ) : m_Parent( aParent ) +NETINFO_LIST::NETINFO_LIST( BOARD* aParent ) : + m_parent( aParent ) { // Make sure that the unconnected net has number 0 AppendNet( new NETINFO_ITEM( aParent, wxEmptyString, 0 ) ); @@ -99,7 +100,7 @@ void NETINFO_LIST::RemoveNet( NETINFO_ITEM* aNet ) } } - m_newNetCode = std::min( m_newNetCode, aNet->m_NetCode - 1 ); + m_newNetCode = std::min( m_newNetCode, aNet->m_netCode - 1 ); } @@ -128,15 +129,15 @@ void NETINFO_LIST::AppendNet( NETINFO_ITEM* aNewElement ) if( sameName != NULL ) { - aNewElement->m_NetCode = sameName->GetNet(); + aNewElement->m_netCode = sameName->GetNet(); return; } // be sure that net codes are consecutive // negative net code means that it has to be auto assigned - else if( ( aNewElement->m_NetCode != (int) m_netCodes.size() ) || ( aNewElement->m_NetCode < 0 ) ) + else if( aNewElement->m_netCode != (int) m_netCodes.size() || aNewElement->m_netCode < 0 ) { - aNewElement->m_NetCode = getFreeNetCode(); + aNewElement->m_netCode = getFreeNetCode(); } // net names & codes are supposed to be unique @@ -155,8 +156,8 @@ void NETINFO_LIST::buildListOfNets() for( NETINFO_ITEM* net : *this ) net->Clear(); - m_Parent->SynchronizeNetsAndNetClasses( ); - m_Parent->SetAreasNetCodesFromNetNames(); + m_parent->SynchronizeNetsAndNetClasses( ); + m_parent->SetAreasNetCodesFromNetNames(); }