Naming conventions.

This commit is contained in:
Jeff Young 2020-12-08 12:28:26 +00:00
parent 9407e6dc83
commit 20ad2bee2f
3 changed files with 52 additions and 55 deletions

View File

@ -67,18 +67,15 @@ 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
wxString m_ShortNetname; ///< short net name, like vout from /mysheet/mysubsheet/vout
NETCLASSPTR m_NetClass;
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.
BOARD* m_parent; ///< The parent board the net belongs to.
@ -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; }
@ -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<int, int> m_netMapping;
const BOARD* m_board; ///> Board for which mapping is prepared
std::map<int, int> 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,7 +577,8 @@ private:
*/
int getFreeNetCode();
BOARD* m_Parent;
private:
BOARD* m_parent;
NETNAMES_MAP m_netNames; ///< map of <wxString, NETINFO_ITEM*>, is NETINFO_ITEM owner
NETCODES_MAP m_netCodes; ///< map of <int, NETINFO_ITEM*> is NOT owner

View File

@ -41,17 +41,17 @@
NETINFO_ITEM::NETINFO_ITEM( BOARD* aParent, const wxString& aNetName, int aNetCode ) :
BOARD_ITEM( aParent, PCB_NETINFO_T ),
m_NetCode( aNetCode ),
m_netCode( aNetCode ),
m_isCurrent( true ),
m_Netname( aNetName ),
m_ShortNetname( m_Netname.AfterLast( '/' ) )
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<NETCLASS>( "<invalid>" );
m_netClass = std::make_shared<NETCLASS>( "<invalid>" );
}
@ -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();
}

View File

@ -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();
}