24 #include <wx/tokenzr.h> 105 for(
const std::shared_ptr<SCH_CONNECTION>& member :
m_members )
106 member->SetDriver( aItem );
116 for(
const std::shared_ptr<SCH_CONNECTION>& member :
m_members )
117 member->SetSheet( aSheet );
123 return !( aOther == *this );
135 std::vector<wxString> members;
146 for(
const wxString& vector_member : members )
151 member->m_local_name = vector_member;
152 member->m_vector_index = i++;
153 member->SetName( vector_member );
164 if( !prefix.IsEmpty() )
165 prefix += wxT(
"." );
167 for(
const wxString& group_member : members )
172 for(
const wxString& alias_member : alias->Members() )
175 member->SetPrefix( prefix );
177 member->ConfigureFromLabel( alias_member );
184 member->SetPrefix( prefix );
186 member->ConfigureFromLabel( group_member );
248 std::vector<std::shared_ptr<SCH_CONNECTION>>& otherMembers = aOther.
Members();
251 m_members.size() == otherMembers.size() )
253 for(
size_t i = 0; i <
m_members.size(); ++i )
285 auto pin = static_cast<SCH_PIN*>(
Parent() );
288 return pin->IsPowerConnection() || pin->GetParentSymbol()->IsAnnotated( &
m_sheet );
321 bool prepend_path =
true;
324 prepend_path =
false;
334 prepend_path =
false;
353 for(
const auto& m :
Members() )
354 m->SetPrefix( aPrefix );
364 for(
const auto& m :
Members() )
365 m->SetSuffix( aSuffix );
371 wxString msg, group_name;
372 std::vector<wxString> group_members;
389 msg.Printf(
_(
"Bus Alias %s Members" ),
m_name );
393 for(
const auto& member : alias->Members() )
394 members << member <<
" ";
400 for(
const auto& group_member : group_members )
404 msg.Printf(
_(
"Bus Alias %s Members" ), group_alias->GetName() );
408 for(
const auto& member : group_alias->Members() )
409 members << member <<
" ";
431 if(
auto driver =
Driver() )
454 return label.Contains( wxT(
"[" ) ) || label.Contains( wxT(
"{" ) );
460 std::vector< std::shared_ptr< SCH_CONNECTION > > ret(
m_members );
463 if( member->IsBus() )
464 ret.insert( ret.end(), member->Members().begin(), member->Members().end() );
472 return c ==
'_' || c ==
'^';
478 size_t groupLen = aGroup.length();
481 int braceNesting = 0;
482 int tildeNesting = 0;
486 for( ; i < groupLen; ++i )
488 if(
isSuperSub( aGroup[i] ) && i + 1 < groupLen && aGroup[i+1] ==
'{' )
494 else if( aGroup[i] ==
'~' )
506 else if( aGroup[i] ==
'}' )
514 if( aGroup[i] ==
'{' )
522 for( ; i < groupLen; ++i )
524 if(
isSuperSub( aGroup[i] ) && i + 1 < groupLen && aGroup[i+1] ==
'{' )
530 else if( aGroup[i] ==
'~' )
542 else if( aGroup[i] ==
'}' )
550 if( aGroup[i] ==
'}' )
560 if( !aOther->
IsBus() )
563 for(
const auto& member : aOther->
Members() )
575 if( !aOther->
IsBus() )
578 auto me =
Name(
true );
580 for(
const auto& m : aOther->
Members() )
581 if( m->Name(
true ) == me )
static wxString PrintBusForUI(const wxString &aString)
int m_subgraph_code
Groups directly-connected items.
static bool MightBeBusLabel(const wxString &aLabel)
Test if aLabel looks like a bus notation.
wxString m_cached_name
Full name, including prefix and suffix.
std::vector< std::shared_ptr< SCH_CONNECTION > > m_members
For bus connections, store a list of member connections.
std::shared_ptr< BUS_ALIAS > GetBusAlias(const wxString &aName)
Returns a bus alias pointer for the given name if it exists (from cache)
Calculates the connectivity of a schematic and generates netlists.
wxString m_name
Name of the connection.
SCH_ITEM * m_driver
The SCH_ITEM that drives this connection's net.
static bool IsBusLabel(const wxString &aLabel)
Test if aLabel has a bus notation.
This item represents a bus group.
wxString m_bus_prefix
Optional prefix of a bux group (always empty for nets and vector buses)
wxString PathHumanReadable(bool aUseShortRootName=true) const
Return the sheet path in a human readable form made from the sheet names.
SCH_CONNECTION(SCH_ITEM *aParent=nullptr, SCH_SHEET_PATH aPath=SCH_SHEET_PATH())
Buses can be defined in multiple ways.
bool IsMemberOfBus(SCH_CONNECTION *aOther) const
Returns true if this connection is a member of bus connection aOther.
void ConfigureFromLabel(const wxString &aLabel)
Configures the connection given a label.
void SetDriver(SCH_ITEM *aItem)
void SetSheet(SCH_SHEET_PATH aSheet)
wxString m_cached_name_with_path
Full name including sheet path (if not global)
wxString LocalName() const
bool HasDriverChanged() const
No connection to this item.
static bool ParseBusGroup(wxString aGroup, wxString *name, std::vector< wxString > *aMemberList)
Parses a bus group label into the name and a list of components.
wxString Name(bool aIgnoreSheet=false) const
const std::vector< std::shared_ptr< SCH_CONNECTION > > AllMembers() const
void Reset()
Clears connectivity information.
SCH_ITEM * Driver() const
wxString m_prefix
Prefix if connection is member of a labeled bus group (or "" if not)
CONNECTION_GRAPH * m_graph
Pointer to the connection graph for the schematic this connection exists on.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
wxString FullLocalName() const
void Clone(SCH_CONNECTION &aOther)
Copies connectivity information (but not parent) from another connection.
bool IsDriver() const
Checks if the SCH_ITEM this connection is attached to can drive connections Drivers can be labels,...
SCH_SHEET_PATH m_sheet
The hierarchical sheet this connection is on.
This item represents a net.
wxString m_suffix
Name suffix (used only for disambiguation)
static bool m_allowRealTime
wxString m_local_name
For bus members, we want to keep track of the "local" name of a member, that is, the name it takes on...
SCH_SHEET_PATH Sheet() const
void AppendInfoToMsgPanel(MSG_PANEL_ITEMS &aList) const
Adds information about the connection object to aList.
void ClearDriverChanged()
long m_vector_start
Highest member of a vector bus.
wxString VectorPrefix() const
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
void SetSuffix(const wxString &aSuffix)
wxString UnescapeString(const wxString &aSource)
void SetPrefix(const wxString &aPrefix)
static bool ParseBusVector(const wxString &aBus, wxString *aName, std::vector< wxString > *aMemberList)
Parses a bus vector (e.g.
bool operator!=(const SCH_CONNECTION &aOther) const
wxString BusPrefix() const
SCH_ITEM * Parent() const
std::vector< MSG_PANEL_ITEM > MSG_PANEL_ITEMS
std::vector< std::shared_ptr< SCH_CONNECTION > > & Members()
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
long m_vector_index
Index of bus vector member nets.
static bool isSuperSub(wxChar c)
long m_vector_end
Lowest member of a vector bus.
EDA_MSG_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
bool IsSubsetOf(SCH_CONNECTION *aOther) const
Returns true if this connection is contained within aOther (but not the same as aOther)
void * m_lastDriver
WEAK POINTER (there is no guarantee it is still allocated) Equality comparisons are OK,...
CONNECTION_TYPE Type() const
Base class for any item which can be embedded within the SCHEMATIC container class,...
SCH_ITEM * m_parent
The SCH_ITEM this connection is owned by.
bool operator==(const SCH_CONNECTION &aOther) const
Note: the equality operator for SCH_CONNECTION only tests the net properties, not the ownership / she...
This item represents a bus vector.
KICAD_T Type() const
Returns the type of object.