24#include <wx/tokenzr.h> 
   35#include <boost/algorithm/string/join.hpp> 
  117    for( 
const std::shared_ptr<SCH_CONNECTION>& member : 
m_members )
 
  118        member->SetDriver( aItem );
 
 
  129    for( 
const std::shared_ptr<SCH_CONNECTION>& member : 
m_members )
 
  130        member->SetSheet( aSheet );
 
 
  136    return !( aOther == *this );
 
 
  149    std::vector<wxString> members;
 
  160        for( 
const wxString& vector_member : members )
 
  162            std::shared_ptr<SCH_CONNECTION> member = std::make_shared<SCH_CONNECTION>( 
m_parent, 
m_sheet );
 
  166            member->m_local_name   = vector_member;
 
  168            member->m_vector_index = i++;
 
  169            member->SetName( vector_member );
 
  171            m_members.push_back( std::move( member ) );
 
  180        if( !prefix.IsEmpty() )
 
  181            prefix += wxT( 
"." );
 
  183        for( 
const wxString& group_member : members )
 
  186            if( 
auto alias = 
m_graph->GetBusAlias( group_member ) )
 
  188                for( 
const wxString& alias_member : alias->Members() )
 
  190                    std::shared_ptr<SCH_CONNECTION> member = std::make_shared<SCH_CONNECTION>( 
m_parent, 
m_sheet );
 
  191                    member->SetPrefix( prefix );
 
  194                    m_members.push_back( std::move( member ) );
 
  199                std::shared_ptr<SCH_CONNECTION> member = std::make_shared<SCH_CONNECTION>( 
m_parent, 
m_sheet );
 
  200                member->SetPrefix( prefix );
 
  202                member->ConfigureFromLabel( group_member );
 
  203                m_members.push_back( std::move( member ) );
 
 
  275    const std::vector<std::shared_ptr<SCH_CONNECTION>>& otherMembers = aOther.
Members();
 
  285            size_t cloneLimit = std::min( 
m_members.size(), otherMembers.size() );
 
  287            for( 
size_t i = 0; i < cloneLimit; ++i )
 
  300            for( std::shared_ptr<SCH_CONNECTION>& member : 
m_members )
 
  302                auto it = std::find_if( otherMembers.begin(), otherMembers.end(),
 
  303                                        [&]( 
const std::shared_ptr<SCH_CONNECTION>& aTest )
 
  305                                            return aTest->LocalName() == member->LocalName();
 
  308                if( it != otherMembers.end() )
 
  309                    member->Clone( **it );
 
 
  340            return pin->IsPower() || symbol->IsAnnotated( &
m_sheet );
 
 
  393    bool prepend_path = 
true;
 
  396        prepend_path = 
false;
 
  403            prepend_path = 
false;
 
  410            prepend_path = 
pin->IsLocalPower();
 
 
  430    for( 
const std::shared_ptr<SCH_CONNECTION>& m : 
Members() )
 
  431        m->SetPrefix( aPrefix );
 
 
  441    for( 
const std::shared_ptr<SCH_CONNECTION>& m : 
Members() )
 
  442        m->SetSuffix( aSuffix );
 
 
  448    wxString msg, group_name;
 
  449    std::vector<wxString> group_members;
 
  455        if( std::shared_ptr<BUS_ALIAS> alias = 
m_graph->GetBusAlias( 
m_name ) )
 
  457            msg.Printf( 
_( 
"Bus Alias %s Members" ), 
m_name );
 
  458            aList.emplace_back( msg, boost::algorithm::join( alias->Members(), 
" " ) );
 
  462            for( 
const wxString& group_member : group_members )
 
  464                if( std::shared_ptr<BUS_ALIAS> group_alias = 
m_graph->GetBusAlias( group_member ) )
 
  466                    msg.Printf( 
_( 
"Bus Alias %s Members" ), group_alias->GetName() );
 
  467                    aList.emplace_back( msg, boost::algorithm::join( group_alias->Members(), 
" " ) );
 
  477        aList.emplace_back( wxT( 
"Bus Code" ), wxString::Format( 
"%d", 
m_bus_code ) );
 
  479    aList.emplace_back( wxT( 
"Subgraph Code" ), wxString::Format( 
"%d", 
m_subgraph_code ) );
 
  485        msg.Printf( wxS( 
"%s at %p" ),
 
  486                    driver->GetItemDescription( &unitsProvider, 
false ),
 
  488        aList.emplace_back( wxT( 
"Connection Source" ), msg );
 
 
  508    return label.Contains( wxT( 
"[" ) ) || label.Contains( wxT( 
"{" ) );
 
 
  514    std::vector< std::shared_ptr< SCH_CONNECTION > > ret( 
m_members );
 
  516    for( 
const std::shared_ptr<SCH_CONNECTION>& member : 
m_members )
 
  518        if( member->IsBus() )
 
  519            ret.insert( ret.end(), member->Members().begin(), member->Members().end() );
 
 
  528    return c == 
'_' || c == 
'^' || c == 
'~';
 
 
  534    size_t   groupLen = aGroup.length();
 
  540    for( ; i < groupLen; ++i )
 
  547        else if( aGroup[i] == 
'}' )
 
  554        if( aGroup[i] == 
'{' )
 
  562    for( ; i < groupLen; ++i )
 
  569        else if( aGroup[i] == 
'}' )
 
  576        if( aGroup[i] == 
'}' )
 
 
  586    if( !aOther->
IsBus() )
 
  591        for( 
const std::shared_ptr<SCH_CONNECTION>& otherMember : aOther->
Members() )
 
  601    for( 
const std::shared_ptr<SCH_CONNECTION>& member : 
m_members )
 
  605        for( 
const std::shared_ptr<SCH_CONNECTION>& otherMember : aOther->
Members() )
 
  607            if( member->FullLocalName() == otherMember->FullLocalName() )
 
 
  625    if( !aOther->
IsBus() )
 
  628    wxString me = 
Name( 
true );
 
  630    for( 
const std::shared_ptr<SCH_CONNECTION>& m : aOther->
Members() )
 
  632        if( m->Name( 
true ) == me )
 
 
constexpr EDA_IU_SCALE schIUScale
 
Calculate the connectivity of a schematic and generates netlists.
 
A subgraph is a set of items that are electrically connected on a single sheet.
 
wxString GetNetName() const
Return the fully-qualified net name for this subgraph (if one exists)
 
static bool ParseBusGroup(const wxString &aGroup, wxString *name, std::vector< wxString > *aMemberList)
Parse a bus group label into the name and a list of components.
 
static bool ParseBusVector(const wxString &aBus, wxString *aName, std::vector< wxString > *aMemberList)
Parse a bus vector (e.g.
 
wxString FullLocalName() const
 
long m_vector_start
Highest member of a vector bus.
 
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.
 
SCH_ITEM * m_parent
The SCH_ITEM this connection is owned by.
 
SCH_SHEET_PATH m_sheet
The hierarchical sheet this connection is on.
 
bool operator!=(const SCH_CONNECTION &aOther) const
 
void SetSuffix(const wxString &aSuffix)
 
wxString m_name
Name of the connection.
 
SCH_ITEM * Parent() const
 
wxString GetNetName() const
 
long m_vector_end
Lowest member of a vector bus.
 
SCH_SHEET_PATH Sheet() const
 
CONNECTION_TYPE Type() const
 
bool HasDriverChanged() const
 
const std::vector< std::shared_ptr< SCH_CONNECTION > > AllMembers() const
 
SCH_CONNECTION(SCH_ITEM *aParent=nullptr, const SCH_SHEET_PATH &aPath=SCH_SHEET_PATH())
Buses can be defined in multiple ways.
 
void Reset()
Clears connectivity information.
 
bool operator==(const SCH_CONNECTION &aOther) const
Note: the equality operator for SCH_CONNECTION only tests the net properties, not the ownership / she...
 
std::vector< std::shared_ptr< SCH_CONNECTION > > m_members
For bus connections, store a list of member connections.
 
wxString m_local_prefix
Local prefix for group bus members (used with m_local_name)
 
SCH_ITEM * m_driver
The SCH_ITEM that drives this connection's net.
 
bool IsDriver() const
Checks if the SCH_ITEM this connection is attached to can drive connections Drivers can be labels,...
 
void SetPrefix(const wxString &aPrefix)
 
wxString LocalName() const
 
wxString Name(bool aIgnoreSheet=false) const
 
bool IsSubsetOf(SCH_CONNECTION *aOther) const
Returns true if this connection is contained within aOther (but not the same as aOther)
 
void SetDriver(SCH_ITEM *aItem)
 
SCH_SHEET_PATH m_local_sheet
When a connection is overridden by one on a different hierarchical sheet, it will be cloned and m_she...
 
wxString m_prefix
Prefix if connection is member of a labeled bus group (or "" if not)
 
void Clone(const SCH_CONNECTION &aOther)
Copies connectivity information (but not parent) from another connection.
 
void * m_lastDriver
WEAK POINTER (there is no guarantee it is still allocated) Equality comparisons are OK,...
 
wxString m_cached_name_with_path
Full name including sheet path (if not global)
 
long m_vector_index
Index of bus vector member nets.
 
wxString VectorPrefix() const
 
SCH_ITEM * Driver() const
 
void AppendInfoToMsgPanel(std::vector< MSG_PANEL_ITEM > &aList) const
Adds information about the connection object to aList.
 
static bool IsBusLabel(const wxString &aLabel)
Test if aLabel has a bus notation.
 
wxString m_suffix
Name suffix (used only for disambiguation)
 
wxString m_bus_prefix
Optional prefix of a bus group (always empty for nets and vector buses)
 
const std::vector< std::shared_ptr< SCH_CONNECTION > > & Members() const
 
wxString m_cached_name
Full name, including prefix and suffix.
 
CONNECTION_GRAPH * m_graph
Pointer to the connection graph for the schematic this connection exists on.
 
static wxString PrintBusForUI(const wxString &aString)
 
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...
 
void SetSheet(const SCH_SHEET_PATH &aSheet)
 
void ClearDriverChanged()
 
int m_subgraph_code
Groups directly-connected items.
 
wxString m_vector_prefix
Prefix name of the vector, if m_type == CONNECTION_BUS (or "" if not).
 
static bool MightBeBusLabel(const wxString &aLabel)
Test if aLabel looks like a bus notation.
 
Base class for any item which can be embedded within the SCHEMATIC container class,...
 
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
 
static bool isSuperSubOverbar(wxChar c)
 
static bool isSuperSubOverbar(wxChar c)
 
@ BUS
This item represents a bus vector.
 
@ NET
This item represents a net.
 
@ NONE
No connection to this item.
 
@ BUS_GROUP
This item represents a bus group.
 
wxString UnescapeString(const wxString &aSource)
 
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...