KiCad PCB EDA Suite
Loading...
Searching...
No Matches
NETINFO_MAPPING Class Reference

#include <netinfo.h>

Classes

class  iterator
 Wrapper class, so you can iterate through NETINFO_ITEM*s, not std::pair<int/wxString, NETINFO_ITEM*> More...
 

Public Member Functions

 NETINFO_MAPPING ()
 
void SetBoard (const BOARD *aBoard)
 Set a BOARD object that is used to prepare the net code map.
 
void Update ()
 Prepare a mapping for net codes so they can be saved as consecutive numbers.
 
int Translate (int aNetCode) const
 Translate net number according to the map prepared by Update() function.
 
iterator begin () const
 Return iterator to the first entry in the mapping.
 
iterator end () const
 Return iterator to the last entry in the mapping.
 
int GetSize () const
 

Private Attributes

const BOARDm_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)
 

Detailed Description

Definition at line 211 of file netinfo.h.

Constructor & Destructor Documentation

◆ NETINFO_MAPPING()

NETINFO_MAPPING::NETINFO_MAPPING ( )
inline

Definition at line 214 of file netinfo.h.

References m_board.

Member Function Documentation

◆ begin()

iterator NETINFO_MAPPING::begin ( ) const
inline

Return iterator to the first entry in the mapping.

Note
The entry is a pointer to the original NETINFO_ITEM object, this it contains not mapped net code.

Definition at line 298 of file netinfo.h.

References m_netMapping.

◆ end()

iterator NETINFO_MAPPING::end ( ) const
inline

Return iterator to the last entry in the mapping.

Note
The entry is a pointer to the original NETINFO_ITEM object, this it contains not mapped net code.

Definition at line 309 of file netinfo.h.

References m_netMapping.

◆ GetSize()

int NETINFO_MAPPING::GetSize ( ) const
inline
Returns
Number of mapped nets (i.e. not empty nets for a given BOARD object).

Definition at line 317 of file netinfo.h.

References m_netMapping.

◆ SetBoard()

void NETINFO_MAPPING::SetBoard ( const BOARD aBoard)
inline

Set a BOARD object that is used to prepare the net code map.

Definition at line 223 of file netinfo.h.

References m_board, and Update().

Referenced by CLIPBOARD_IO::SaveBoard(), PCB_IO_KICAD_SEXPR::SaveBoard(), and CLIPBOARD_IO::SaveSelection().

◆ Translate()

int NETINFO_MAPPING::Translate ( int  aNetCode) const

Translate net number according to the map prepared by Update() function.

It allows one to have items stored with consecutive net codes.

Parameters
aNetCodeis an old net code.
Returns
Net code that follows the mapping.

Definition at line 275 of file netinfo_list.cpp.

References m_netMapping.

Referenced by PCB_IO_KICAD_SEXPR::format(), and PCB_IO_KICAD_SEXPR::formatNetInformation().

◆ Update()

void NETINFO_MAPPING::Update ( )

Prepare a mapping for net codes so they can be saved as consecutive numbers.

To retrieve a mapped net code, use translateNet() function after calling this.

Definition at line 287 of file netinfo_list.cpp.

References BOARD::Drawings(), BOARD::Footprints(), BOARD_CONNECTED_ITEM::GetNetCode(), m_board, m_netMapping, pad, PCB_SHAPE_T, BOARD::Tracks(), and BOARD::Zones().

Referenced by SetBoard().

Member Data Documentation

◆ m_board

const BOARD* NETINFO_MAPPING::m_board
private

Board for which mapping is prepared.

Definition at line 323 of file netinfo.h.

Referenced by NETINFO_MAPPING(), NETINFO_MAPPING::iterator::operator*(), SetBoard(), and Update().

◆ m_netMapping

std::map<int, int> NETINFO_MAPPING::m_netMapping
private

Map that allows saving net codes with consecutive numbers (for compatibility reasons)

Definition at line 324 of file netinfo.h.

Referenced by begin(), end(), GetSize(), Translate(), and Update().


The documentation for this class was generated from the following files: