22#ifndef KICAD_NET_SETTINGS_H
23#define KICAD_NET_SETTINGS_H
91 void SetDefaultNetclass( std::shared_ptr<NETCLASS> netclass );
94 std::shared_ptr<NETCLASS> GetDefaultNetclass()
const;
97 bool HasNetclass(
const wxString& netclassName )
const;
101 void SetNetclass(
const wxString& netclassName, std::shared_ptr<NETCLASS>& netclass );
105 void SetNetclasses(
const std::map<wxString, std::shared_ptr<NETCLASS>>& netclasses );
108 const std::map<wxString, std::shared_ptr<NETCLASS>>& GetNetclasses()
const;
113 const std::map<wxString, std::shared_ptr<NETCLASS>>& GetCompositeNetclasses()
const;
117 void ClearNetclasses();
120 const std::map<wxString, std::set<wxString>>& GetNetclassLabelAssignments()
const;
124 void ClearNetclassLabelAssignments();
128 void ClearNetclassLabelAssignment(
const wxString& netName );
132 void SetNetclassLabelAssignment(
const wxString& netName,
133 const std::set<wxString>& netclasses );
137 void AppendNetclassLabelAssignment(
const wxString& netName,
138 const std::set<wxString>& netclasses );
141 bool HasNetclassLabelAssignment(
const wxString& netName )
const;
145 void SetNetclassPatternAssignment(
const wxString& pattern,
const wxString& netclass );
149 void SetNetclassPatternAssignments(
150 std::vector<std::pair<std::unique_ptr<EDA_COMBINED_MATCHER>, wxString>>&&
154 std::vector<std::pair<std::unique_ptr<EDA_COMBINED_MATCHER>, wxString>>&
155 GetNetclassPatternAssignments();
158 void ClearNetclassPatternAssignments();
166 void SetChainPatternAssignment(
NET_CHAIN_SOURCE aSource,
const wxString& pattern,
167 const wxString& netclass );
182 void ClearCacheForNet(
const wxString& netName );
185 void ClearAllCaches();
189 void SetNetColorAssignment(
const wxString& netName,
const KIGFX::COLOR4D& color );
192 const std::map<wxString, KIGFX::COLOR4D>& GetNetColorAssignments()
const;
196 void ClearNetColorAssignments();
201 bool RenameNetPathPrefix(
const wxString& aOldPrefix,
const wxString& aNewPrefix );
206 if( aClass.IsEmpty() )
233 if( aNetclass.IsEmpty() )
258 bool HasEffectiveNetClass(
const wxString& aNetName )
const;
262 std::shared_ptr<NETCLASS> GetCachedEffectiveNetClass(
const wxString& aNetName )
const;
266 std::shared_ptr<NETCLASS> GetEffectiveNetClass(
const wxString& aNetName );
271 void RecomputeEffectiveNetclasses();
279 std::shared_ptr<NETCLASS> GetNetClassByName(
const wxString& aNetName )
const;
291 static bool ParseBusVector(
const wxString& aBus, wxString* aName,
292 std::vector<wxString>* aMemberList );
302 static bool ParseBusGroup(
const wxString& aGroup, wxString*
name,
303 std::vector<wxString>* aMemberList );
317 static void ForEachBusMember(
const wxString& aBusPattern,
318 const std::function<
void(
const wxString& )>& aFunction );
321 bool migrateSchema0to1();
322 bool migrateSchema1to2();
323 bool migrateSchema2to3();
324 bool migrateSchema3to4();
325 bool migrateSchema4to5();
336 void makeEffectiveNetclass( std::shared_ptr<NETCLASS>& effectiveNetclass,
337 std::vector<NETCLASS*>& netclasses )
const;
341 bool addMissingDefaults(
NETCLASS* nc )
const;
344 void addSinglePatternAssignment(
const wxString& pattern,
const wxString& netclass );
347 void addSingleChainPatternAssignment(
NET_CHAIN_SOURCE aSource,
const wxString& pattern,
348 const wxString& netclass );
360 std::vector<std::pair<std::unique_ptr<EDA_COMBINED_MATCHER>, wxString>>
370 std::vector<std::pair<std::unique_ptr<EDA_COMBINED_MATCHER>, wxString>>>
bool operator==(const wxAuiPaneInfo &aLhs, const wxAuiPaneInfo &aRhs)
Information pertinent to a Pcbnew printed circuit board.
JSON_SETTINGS(const wxString &aFilename, SETTINGS_LOC aLocation, int aSchemaVersion)
A color representation with 4 components: red, green, blue, alpha.
NESTED_SETTINGS(const std::string &aName, int aSchemaVersion, JSON_SETTINGS *aParent, const std::string &aPath, bool aLoadFromFile=true)
A collection of nets and the parameters used to route or test these nets.
NET_SETTINGS stores various net-related settings in a project context.
std::map< wxString, std::shared_ptr< NETCLASS > > m_compositeNetClasses
Map of netclass names to netclass definitions for.
const std::map< wxString, wxString > & GetNetChainNetClasses() const
void SetNetChainClass(const wxString &aChain, const wxString &aClass)
Assign a net chain to a named class (used by inNetChainClass() DRC scope).
void SetNetChainNetClass(const wxString &aChain, const wxString &aNetclass)
Assign the netclass a net chain applies to all of its member nets.
wxString GetNetChainClass(const wxString &aChain) const
Look up the class assigned to a chain. Empty string means "no class".
std::map< wxString, KIGFX::COLOR4D > m_netColorAssignments
A map of fully-qualified net names to colors used in the board context.
std::shared_ptr< NETCLASS > m_defaultNetClass
The default netclass.
std::map< wxString, wxString > m_netChainNetClasses
Map of net-chain name -> netclass name applied to every net in the chain.
std::map< wxString, std::shared_ptr< NETCLASS > > m_impicitNetClasses
Map of netclass names to netclass definitions for implicit netclasses.
std::map< NET_CHAIN_SOURCE, std::vector< std::pair< std::unique_ptr< EDA_COMBINED_MATCHER >, wxString > > > m_netClassChainPatternAssignments
Chain-derived netclass pattern assignments, keyed by the editor that derived them.
std::vector< std::pair< std::unique_ptr< EDA_COMBINED_MATCHER >, wxString > > m_netClassPatternAssignments
List of net class pattern assignments.
wxString GetNetChainNetClass(const wxString &aChain) const
Look up the netclass a chain applies to its members. Empty string means "none".
std::map< wxString, std::shared_ptr< NETCLASS > > m_effectiveNetclassCache
Cache of nets to pattern-matched netclasses.
std::map< wxString, std::shared_ptr< NETCLASS > > m_netClasses
Map of netclass names to netclass definitions.
const std::map< wxString, wxString > & GetNetChainClasses() const
bool operator!=(const NET_SETTINGS &aOther) const
void ClearNetChainClasses()
Removes all chain-to-class assignments.
void ClearNetChainNetClasses()
Removes all chain-to-netclass assignments.
bool HasChainPatternAssignments(NET_CHAIN_SOURCE aSource) const
Returns true if aSource has contributed any chain-derived pattern assignment.
std::map< wxString, std::set< wxString > > m_netClassLabelAssignments
Map of net names to resolved netclasses.
NET_SETTINGS(JSON_SETTINGS *aParent, const std::string &aPath)
std::map< wxString, wxString > m_netChainClasses
Map of net-chain name -> chain-class name.
Holds all the data relating to one schematic.
Abstract pattern-matching tool and implementations.
NET_CHAIN_SOURCE
Owner of a set of chain-derived netclass pattern assignments.