KiCad PCB EDA Suite
LSET Class Reference

LSET is a set of PCB_LAYER_IDs. More...

#include <layers_id_colors_and_visibility.h>

Inheritance diagram for LSET:

Public Member Functions

 LSET ()
 Constructor LSET() creates an empty (cleared) set. More...
 
 LSET (const BASE_SET &aOther)
 
 LSET (PCB_LAYER_ID aLayer)
 Constructor LSET( PCB_LAYER_ID ) takes a PCB_LAYER_ID and sets that bit. More...
 
 LSET (const PCB_LAYER_ID *aArray, unsigned aCount)
 Constructor LSET( const PCB_LAYER_ID* aArray, unsigned aCount ) works well with an array or LSEQ. More...
 
 LSET (unsigned aIdCount, int aFirst,...)
 Constructor LSET( unsigned, PCB_LAYER_ID, ...) takes one or more PCB_LAYER_IDs in the argument list to construct the set. More...
 
LSEQ CuStack () const
 Function CuStack returns a sequence of copper layers in starting from the front/top and extending to the back/bottom. More...
 
LSEQ Technicals (LSET aSubToOmit=LSET()) const
 Function Technicals returns a sequence of technical layers. More...
 
LSEQ Users () const
 *_User layers. More...
 
LSEQ TechAndUserUIOrder () const
 Returns the technical and user layers in the order shown in layer widget. More...
 
LSEQ UIOrder () const
 
LSEQ Seq (const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
 Function Seq returns an LSEQ from the union of this LSET and a desired sequence. More...
 
LSEQ Seq () const
 Function Seq returns a LSEQ from this LSET in ascending PCB_LAYER_ID order. More...
 
LSEQ SeqStackupBottom2Top () const
 Function SeqStackBottom2Top returns the sequence that is typical for a bottom-to-top stack-up. More...
 
std::string FmtHex () const
 Function FmtHex returns a hex string showing contents of this LSEQ. More...
 
int ParseHex (const char *aStart, int aCount)
 Function ParseHex understands the output of FmtHex() and replaces this set's values with those given in the input string. More...
 
std::string FmtBin () const
 Function FmtBin returns a binary string showing contents of this LSEQ. More...
 
PCB_LAYER_ID ExtractLayer () const
 Find the first set PCB_LAYER_ID. More...
 

Static Public Member Functions

static const wxChar * Name (PCB_LAYER_ID aLayerId)
 Function Name returns the fixed name association with aLayerId. More...
 
static LSET InternalCuMask ()
 Function InternalCuMask() returns a complete set of internal copper layers, which is all Cu layers except F_Cu and B_Cu. More...
 
static LSET AllCuMask (int aCuLayerCount=MAX_CU_LAYERS)
 Function AllCuMask returns a mask holding the requested number of Cu PCB_LAYER_IDs. More...
 
static LSET ExternalCuMask ()
 Function ExternalCuMask returns a mask holding the Front and Bottom layers. More...
 
static LSET AllNonCuMask ()
 Function AllNonCuMask returns a mask holding all layer minus CU layers. More...
 
static LSET AllLayersMask ()
 
static LSET FrontTechMask ()
 Function FrontTechMask returns a mask holding all technical layers (no CU layer) on front side. More...
 
static LSET FrontBoardTechMask ()
 Function FrontBoardTechMask returns a mask holding technical layers used in a board fabrication (no CU layer) on front side. More...
 
static LSET BackTechMask ()
 Function BackTechMask returns a mask holding all technical layers (no CU layer) on back side. More...
 
static LSET BackBoardTechMask ()
 Function BackBoardTechMask returns a mask holding technical layers used in a board fabrication (no CU layer) on Back side. More...
 
static LSET AllTechMask ()
 Function AllTechMask returns a mask holding all technical layers (no CU layer) on both side. More...
 
static LSET AllBoardTechMask ()
 Function AllTechMask returns a mask holding board technical layers (no CU layer) on both side. More...
 
static LSET FrontMask ()
 Function FrontMask returns a mask holding all technical layers and the external CU layer on front side. More...
 
static LSET BackMask ()
 Function BackMask returns a mask holding all technical layers and the external CU layer on back side. More...
 
static LSET UserMask ()
 
static LSET ForbiddenFootprintLayers ()
 Function ForbiddenFootprintLayers Layers which are not allowed within footprint definitions. More...
 
static LSET ForbiddenTextLayers ()
 Function ForbiddenTextLayers Layers which are now allowed to have text on them. More...
 

Private Member Functions

 LSET (unsigned long __val)
 Take this off the market, it may not be used because of LSET( PCB_LAYER_ID ). More...
 

Detailed Description

LSET is a set of PCB_LAYER_IDs.

It can be converted to numerous purpose LSEQs using the various member functions, most of which are based on Seq(). The advantage of converting to LSEQ using purposeful code, is it removes any dependency on order/sequence inherent in this set.

Definition at line 386 of file layers_id_colors_and_visibility.h.

Constructor & Destructor Documentation

◆ LSET() [1/6]

LSET::LSET ( )
inline

Constructor LSET() creates an empty (cleared) set.

Definition at line 404 of file layers_id_colors_and_visibility.h.

404  :
405  BASE_SET() // all bits are set to zero in BASE_SET()
406  {
407  }
std::bitset< PCB_LAYER_ID_COUNT > BASE_SET

Referenced by AllLayersMask(), and AllNonCuMask().

◆ LSET() [2/6]

LSET::LSET ( const BASE_SET aOther)
inline

Definition at line 409 of file layers_id_colors_and_visibility.h.

409  :
410  BASE_SET( aOther )
411  {
412  }
std::bitset< PCB_LAYER_ID_COUNT > BASE_SET

◆ LSET() [3/6]

LSET::LSET ( PCB_LAYER_ID  aLayer)
inline

Constructor LSET( PCB_LAYER_ID ) takes a PCB_LAYER_ID and sets that bit.

This makes the following code into a bug:

LSET s = 0;

Instead use:

LSET s;

for an empty set.

Definition at line 429 of file layers_id_colors_and_visibility.h.

429  : // PCB_LAYER_ID deliberately exludes int and relatives
430  BASE_SET()
431  {
432  set( aLayer );
433  }
std::bitset< PCB_LAYER_ID_COUNT > BASE_SET

◆ LSET() [4/6]

LSET::LSET ( const PCB_LAYER_ID aArray,
unsigned  aCount 
)

Constructor LSET( const PCB_LAYER_ID* aArray, unsigned aCount ) works well with an array or LSEQ.

Definition at line 38 of file lset.cpp.

38  :
39  BASE_SET()
40 {
41  for( unsigned i=0; i<aCount; ++i )
42  set( aArray[i] );
43 }
std::bitset< PCB_LAYER_ID_COUNT > BASE_SET

◆ LSET() [5/6]

LSET::LSET ( unsigned  aIdCount,
int  aFirst,
  ... 
)

Constructor LSET( unsigned, PCB_LAYER_ID, ...) takes one or more PCB_LAYER_IDs in the argument list to construct the set.

Typically only used in static construction.

Parameters
aIdCountis the number of PCB_LAYER_IDs which follow.
aFirstis the first included in aIdCount and must always be present, and can be followed by any number of additional PCB_LAYER_IDs so long as aIdCount accurately reflects the count.

Parameter is 'int' to avoid va_start undefined behavior.

Definition at line 46 of file lset.cpp.

46  :
47  BASE_SET()
48 {
49  // The constructor, without the mandatory aFirst argument, could have been confused
50  // by the compiler with the LSET( PCB_LAYER_ID ). With aFirst, that ambiguity is not
51  // present. Therefore aIdCount must always be >=1.
52  wxASSERT_MSG( aIdCount > 0, wxT( "aIdCount must be >= 1" ) );
53 
54  set( aFirst );
55 
56  if( --aIdCount )
57  {
58  va_list ap;
59 
60  va_start( ap, aFirst );
61 
62  for( unsigned i=0; i<aIdCount; ++i )
63  {
64  PCB_LAYER_ID id = (PCB_LAYER_ID) va_arg( ap, int );
65 
66  // printf( "%s: id:%d PCB_LAYER_ID_COUNT:%d\n", __func__, id, PCB_LAYER_ID_COUNT );
67 
68  assert( unsigned( id ) < PCB_LAYER_ID_COUNT );
69 
70  set( id );
71  }
72 
73  va_end( ap );
74  }
75 }
std::bitset< PCB_LAYER_ID_COUNT > BASE_SET
PCB_LAYER_ID
A quick note on layer IDs:

References PCB_LAYER_ID_COUNT.

◆ LSET() [6/6]

LSET::LSET ( unsigned long  __val)
inlineprivate

Take this off the market, it may not be used because of LSET( PCB_LAYER_ID ).

Definition at line 635 of file layers_id_colors_and_visibility.h.

636  {
637  // not usable, it's private.
638  }

Member Function Documentation

◆ AllBoardTechMask()

LSET LSET::AllBoardTechMask ( )
static

Function AllTechMask returns a mask holding board technical layers (no CU layer) on both side.

Definition at line 763 of file lset.cpp.

764 {
765  static const LSET saved = BackBoardTechMask() | FrontBoardTechMask();
766  return saved;
767 }
static LSET FrontBoardTechMask()
Function FrontBoardTechMask returns a mask holding technical layers used in a board fabrication (no C...
Definition: lset.cpp:749
LSET is a set of PCB_LAYER_IDs.
static LSET BackBoardTechMask()
Function BackBoardTechMask returns a mask holding technical layers used in a board fabrication (no CU...
Definition: lset.cpp:736

References BackBoardTechMask(), and FrontBoardTechMask().

Referenced by BRDITEMS_PLOTTER::PlotPad().

◆ AllCuMask()

LSET LSET::AllCuMask ( int  aCuLayerCount = MAX_CU_LAYERS)
static

Function AllCuMask returns a mask holding the requested number of Cu PCB_LAYER_IDs.

Definition at line 686 of file lset.cpp.

687 {
688  // retain all in static as the full set, which is a common case.
689  static const LSET all = InternalCuMask().set( F_Cu ).set( B_Cu );
690 
691  if( aCuLayerCount == MAX_CU_LAYERS )
692  return all;
693 
694  // subtract out some Cu layers not wanted in the mask.
695  LSET ret = all;
696  int clear_count = MAX_CU_LAYERS - aCuLayerCount;
697 
698  clear_count = Clamp( 0, clear_count, MAX_CU_LAYERS - 2 );
699 
700  for( LAYER_NUM elem=In30_Cu; clear_count; --elem, --clear_count )
701  {
702  ret.set( elem, false );
703  }
704 
705  return ret;
706 }
LSET is a set of PCB_LAYER_IDs.
static LSET InternalCuMask()
Function InternalCuMask() returns a complete set of internal copper layers, which is all Cu layers ex...
Definition: lset.cpp:646
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
const T & Clamp(const T &lower, const T &value, const T &upper)
Function Clamp limits value within the range lower <= value <= upper.
Definition: util.h:45

References B_Cu, Clamp(), F_Cu, In30_Cu, InternalCuMask(), and MAX_CU_LAYERS.

Referenced by PCAD2KICAD::PCB_PAD::AddToModule(), AllNonCuMask(), DIALOG_PLOT::applyPlotSettings(), TRACKS_CLEANER::cleanupVias(), HYPERLYNX_EXPORTER::collectNetObjects(), compute_layer_Zs(), compute_pad_access_code(), CINFO3D_VISU::createLayers(), DIALOG_EXPORT_SVG::CreateSVGFile(), PANEL_SETUP_LAYERS::DenyChangeCheckBox(), DIALOG_IMPORT_GFX::DIALOG_IMPORT_GFX(), DRC::doPadToPadsDrc(), DRC::doTrackDrc(), fmt_mask(), PCB_IO::formatLayers(), GENDRILL_WRITER_BASE::GenDrillReportFile(), VIA::GetLayerSet(), BOARD::GetPad(), HYPERLYNX_PAD_STACK::getSMDLayer(), D_PAD::GetSolderMaskMargin(), D_PAD::GetSolderPasteMargin(), MODULE::GetUniquePadCount(), PCB_INSPECTION_TOOL::highlightNet(), PCB_INSPECTION_TOOL::HighlightNetTool(), HYPERLYNX_PAD_STACK::HYPERLYNX_PAD_STACK(), KIGFX::PCB_RENDER_SETTINGS::ImportLegacyColors(), PCB_PARSER::init(), D_PAD::IsAperturePad(), HYPERLYNX_PAD_STACK::isEmpty(), ZONE_CONTAINER::IsOnCopperLayer(), D_PAD::IsOnCopperLayer(), DSN::isRoundKeepout(), LayerMaskDescribe(), LEGACY_PLUGIN::leg_mask2new(), DSN::SPECCTRA_DB::makeIMAGE(), DSN::SPECCTRA_DB::makePADSTACK(), DIALOG_PLOT::OnPopUpLayers(), PANEL_SETUP_LAYERS::OnPresetsChoice(), DIALOG_PAD_PROPERTIES::OnUpdateUINonCopperWarning(), EAGLE_PLUGIN::packageHole(), EAGLE_PLUGIN::packagePad(), PCB_PLOT_PARAMS_PARSER::Parse(), GPCB_FPL_CACHE::parseMODULE(), PCB_PLOT_PARAMS::PCB_PLOT_PARAMS(), DIALOG_PLOT::Plot(), BRDITEMS_PLOTTER::Plot_1_EdgeModule(), BRDITEMS_PLOTTER::PlotPad(), PlotStandardLayer(), D_PAD::Print(), BOARD_DESIGN_SETTINGS::SetCopperLayerCount(), BOARD_DESIGN_SETTINGS::SetEnabledLayers(), ZONE_CONTAINER::SetLayerSet(), DIALOG_PAD_PROPERTIES::setPadLayersList(), ZONE_SETTINGS::SetupLayersList(), PCBNEW_PRINTOUT::setupViewLayers(), PANEL_SETUP_LAYERS::showLayerTypes(), D_PAD::StandardMask(), PNS_KICAD_IFACE::syncPad(), DRC::testDisabledLayers(), PANEL_SETUP_LAYERS::testLayerNames(), DIALOG_SWAP_LAYERS::TransferDataFromWindow(), PANEL_SETUP_LAYERS::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::transferDataToPad(), DIALOG_SWAP_LAYERS::TransferDataToWindow(), D_PAD::UnplatedHoleMask(), and HYPERLYNX_EXPORTER::writeSinglePadStack().

◆ AllLayersMask()

LSET LSET::AllLayersMask ( )
static

◆ AllNonCuMask()

LSET LSET::AllNonCuMask ( )
static

Function AllNonCuMask returns a mask holding all layer minus CU layers.

Definition at line 709 of file lset.cpp.

710 {
711  static const LSET saved = LSET().set() & ~AllCuMask();
712  return saved;
713 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:686
LSET is a set of PCB_LAYER_IDs.
LSET()
Constructor LSET() creates an empty (cleared) set.

References AllCuMask(), and LSET().

Referenced by DIALOG_GLOBAL_DELETION::AcceptPcbDelete(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::buildFilterLists(), CINFO3D_VISU::createLayers(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), ROUTER_TOOL::onViaCommand(), ZONE_SETTINGS::SetupLayersList(), and DIALOG_SWAP_LAYERS::TransferDataToWindow().

◆ AllTechMask()

LSET LSET::AllTechMask ( )
static

Function AllTechMask returns a mask holding all technical layers (no CU layer) on both side.

Definition at line 756 of file lset.cpp.

757 {
758  static const LSET saved = BackTechMask() | FrontTechMask();
759  return saved;
760 }
static LSET BackTechMask()
Function BackTechMask returns a mask holding all technical layers (no CU layer) on back side.
Definition: lset.cpp:730
static LSET FrontTechMask()
Function FrontTechMask returns a mask holding all technical layers (no CU layer) on front side.
Definition: lset.cpp:742
LSET is a set of PCB_LAYER_IDs.

References BackTechMask(), and FrontTechMask().

Referenced by PCB_LAYER_WIDGET::isLayerAllowedInFpMode(), LayerMaskDescribe(), DIALOG_FOOTPRINT_FP_EDITOR::OnAddField(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnAddField(), and DIALOG_PLOT::OnPopUpLayers().

◆ BackBoardTechMask()

LSET LSET::BackBoardTechMask ( )
static

Function BackBoardTechMask returns a mask holding technical layers used in a board fabrication (no CU layer) on Back side.

Definition at line 736 of file lset.cpp.

737 {
738  static const LSET saved( 4, B_SilkS, B_Mask, B_Adhes, B_Paste );
739  return saved;
740 }
LSET is a set of PCB_LAYER_IDs.

References B_Adhes, B_Mask, B_Paste, and B_SilkS.

Referenced by AllBoardTechMask().

◆ BackMask()

LSET LSET::BackMask ( )
static

Function BackMask returns a mask holding all technical layers and the external CU layer on back side.

Definition at line 792 of file lset.cpp.

793 {
794  static const LSET saved = BackTechMask().set( B_Cu );
795  return saved;
796 }
static LSET BackTechMask()
Function BackTechMask returns a mask holding all technical layers (no CU layer) on back side.
Definition: lset.cpp:730
LSET is a set of PCB_LAYER_IDs.

References B_Cu, and BackTechMask().

Referenced by D_PAD::Print().

◆ BackTechMask()

LSET LSET::BackTechMask ( )
static

Function BackTechMask returns a mask holding all technical layers (no CU layer) on back side.

Definition at line 730 of file lset.cpp.

References B_Adhes, B_CrtYd, B_Fab, B_Mask, B_Paste, and B_SilkS.

Referenced by AllTechMask(), and BackMask().

◆ CuStack()

LSEQ LSET::CuStack ( ) const

Function CuStack returns a sequence of copper layers in starting from the front/top and extending to the back/bottom.

This specific sequence is depended upon in numerous places.

Definition at line 155 of file lset.cpp.

156 {
157  // desired sequence
158  static const PCB_LAYER_ID sequence[] = {
159  F_Cu,
160  In1_Cu,
161  In2_Cu,
162  In3_Cu,
163  In4_Cu,
164  In5_Cu,
165  In6_Cu,
166  In7_Cu,
167  In8_Cu,
168  In9_Cu,
169  In10_Cu,
170  In11_Cu,
171  In12_Cu,
172  In13_Cu,
173  In14_Cu,
174  In15_Cu,
175  In16_Cu,
176  In17_Cu,
177  In18_Cu,
178  In19_Cu,
179  In20_Cu,
180  In21_Cu,
181  In22_Cu,
182  In23_Cu,
183  In24_Cu,
184  In25_Cu,
185  In26_Cu,
186  In27_Cu,
187  In28_Cu,
188  In29_Cu,
189  In30_Cu,
190  B_Cu, // 31
191  };
192 
193  return Seq( sequence, arrayDim( sequence ) );
194 }
LSEQ Seq() const
Function Seq returns a LSEQ from this LSET in ascending PCB_LAYER_ID order.
Definition: lset.cpp:411
PCB_LAYER_ID
A quick note on layer IDs:
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Definition: macros.h:108

References arrayDim(), B_Cu, F_Cu, In10_Cu, In11_Cu, In12_Cu, In13_Cu, In14_Cu, In15_Cu, In16_Cu, In17_Cu, In18_Cu, In19_Cu, In1_Cu, In20_Cu, In21_Cu, In22_Cu, In23_Cu, In24_Cu, In25_Cu, In26_Cu, In27_Cu, In28_Cu, In29_Cu, In2_Cu, In30_Cu, In3_Cu, In4_Cu, In5_Cu, In6_Cu, In7_Cu, In8_Cu, In9_Cu, and Seq().

Referenced by PCB_IO::formatBoardLayers(), PCB_LAYER_WIDGET::ReFill(), UIOrder(), and HYPERLYNX_EXPORTER::writeStackupInfo().

◆ ExternalCuMask()

LSET LSET::ExternalCuMask ( )
static

Function ExternalCuMask returns a mask holding the Front and Bottom layers.

Definition at line 716 of file lset.cpp.

717 {
718  static const LSET saved( 2, F_Cu, B_Cu );
719  return saved;
720 }
LSET is a set of PCB_LAYER_IDs.

References B_Cu, and F_Cu.

Referenced by GERBER_JOBFILE_WRITER::addJSONDesignRules(), BRDITEMS_PLOTTER::PlotPad(), PANEL_SETUP_BOARD_STACKUP::showOnlyActiveLayers(), and BOARD_STACKUP::StackupAllowedBrdLayers().

◆ ExtractLayer()

PCB_LAYER_ID LSET::ExtractLayer ( ) const

Find the first set PCB_LAYER_ID.

Returns UNDEFINED_LAYER if more than one is set or UNSELECTED_LAYER if none is set.

Definition at line 625 of file lset.cpp.

626 {
627  unsigned set_count = count();
628 
629  if( !set_count )
630  return UNSELECTED_LAYER;
631  else if( set_count > 1 )
632  return UNDEFINED_LAYER;
633 
634  for( unsigned i=0; i < size(); ++i )
635  {
636  if( test( i ) )
637  return PCB_LAYER_ID( i );
638  }
639 
640  wxASSERT( 0 ); // set_count was verified as 1 above, what did you break?
641 
642  return UNDEFINED_LAYER;
643 }
PCB_LAYER_ID
A quick note on layer IDs:

References UNDEFINED_LAYER, and UNSELECTED_LAYER.

Referenced by PCBNEW_PRINTOUT::OnPrintPage(), and D_PAD::Print().

◆ FmtBin()

std::string LSET::FmtBin ( ) const

Function FmtBin returns a binary string showing contents of this LSEQ.

Definition at line 264 of file lset.cpp.

265 {
266  std::string ret;
267 
268  int bit_count = size();
269 
270  for( int bit=0; bit<bit_count; ++bit )
271  {
272  if( bit )
273  {
274  if( !( bit % 8 ) )
275  ret += '|';
276  else if( !( bit % 4 ) )
277  ret += '_';
278  }
279 
280  ret += (*this)[bit] ? '1' : '0';
281  }
282 
283  // reverse of string
284  return std::string( ret.rbegin(), ret.rend() );
285 }

Referenced by ViaSort().

◆ FmtHex()

std::string LSET::FmtHex ( ) const

Function FmtHex returns a hex string showing contents of this LSEQ.

Definition at line 288 of file lset.cpp.

289 {
290  std::string ret;
291 
292  static const char hex[] = "0123456789abcdef";
293 
294  size_t nibble_count = ( size() + 3 ) / 4;
295 
296  for( size_t nibble = 0; nibble < nibble_count; ++nibble )
297  {
298  unsigned int ndx = 0;
299 
300  // test 4 consecutive bits and set ndx to 0-15
301  for( size_t nibble_bit = 0; nibble_bit < 4; ++nibble_bit )
302  {
303  size_t nibble_pos = nibble_bit + ( nibble * 4 );
304  // make sure it's not extra bits that dont exist in the bitset but need to in the hex format
305  if( nibble_pos >= size() )
306  break;
307 
308  if( ( *this )[nibble_pos] )
309  ndx |= ( 1 << nibble_bit );
310  }
311 
312  if( nibble && !( nibble % 8 ) )
313  ret += '_';
314 
315  assert( ndx < arrayDim( hex ) );
316 
317  ret += hex[ndx];
318  }
319 
320  // reverse of string
321  return std::string( ret.rbegin(), ret.rend() );
322 }
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Definition: macros.h:108

References arrayDim().

Referenced by fmt_mask().

◆ ForbiddenFootprintLayers()

LSET LSET::ForbiddenFootprintLayers ( )
static

Function ForbiddenFootprintLayers Layers which are not allowed within footprint definitions.

Currently internal copper layers, Edge.Cuts and Margin.

Definition at line 799 of file lset.cpp.

800 {
801  static const LSET saved = InternalCuMask().set( Edge_Cuts ).set( Margin );
802  return saved;
803 }
LSET is a set of PCB_LAYER_IDs.
static LSET InternalCuMask()
Function InternalCuMask() returns a complete set of internal copper layers, which is all Cu layers ex...
Definition: lset.cpp:646

References Edge_Cuts, InternalCuMask(), and Margin.

Referenced by DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES(), PCB_LAYER_WIDGET::OnLayerSelect(), FOOTPRINT_EDIT_FRAME::ReCreateHToolbar(), and PCB_LAYER_WIDGET::ReFill().

◆ ForbiddenTextLayers()

LSET LSET::ForbiddenTextLayers ( )
static

Function ForbiddenTextLayers Layers which are now allowed to have text on them.

Currently Edge.Cuts and Margin.

Definition at line 806 of file lset.cpp.

807 {
808  static const LSET saved( 1, Edge_Cuts );
809  return saved;
810 }
LSET is a set of PCB_LAYER_IDs.

References Edge_Cuts.

Referenced by DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), and TEXT_MOD_GRID_TABLE::TEXT_MOD_GRID_TABLE().

◆ FrontBoardTechMask()

LSET LSET::FrontBoardTechMask ( )
static

Function FrontBoardTechMask returns a mask holding technical layers used in a board fabrication (no CU layer) on front side.

Definition at line 749 of file lset.cpp.

750 {
751  static const LSET saved( 4, F_SilkS, F_Mask, F_Adhes, F_Paste );
752  return saved;
753 }
LSET is a set of PCB_LAYER_IDs.

References F_Adhes, F_Mask, F_Paste, and F_SilkS.

Referenced by AllBoardTechMask().

◆ FrontMask()

LSET LSET::FrontMask ( )
static

Function FrontMask returns a mask holding all technical layers and the external CU layer on front side.

Definition at line 785 of file lset.cpp.

786 {
787  static const LSET saved = FrontTechMask().set( F_Cu );
788  return saved;
789 }
static LSET FrontTechMask()
Function FrontTechMask returns a mask holding all technical layers (no CU layer) on front side.
Definition: lset.cpp:742
LSET is a set of PCB_LAYER_IDs.

References F_Cu, and FrontTechMask().

Referenced by D_PAD::Print().

◆ FrontTechMask()

LSET LSET::FrontTechMask ( )
static

Function FrontTechMask returns a mask holding all technical layers (no CU layer) on front side.

Definition at line 742 of file lset.cpp.

References F_Adhes, F_CrtYd, F_Fab, F_Mask, F_Paste, and F_SilkS.

Referenced by AllTechMask(), and FrontMask().

◆ InternalCuMask()

LSET LSET::InternalCuMask ( )
static

Function InternalCuMask() returns a complete set of internal copper layers, which is all Cu layers except F_Cu and B_Cu.

Definition at line 646 of file lset.cpp.

647 {
648  static const PCB_LAYER_ID cu_internals[] = {
649  In1_Cu,
650  In2_Cu,
651  In3_Cu,
652  In4_Cu,
653  In5_Cu,
654  In6_Cu,
655  In7_Cu,
656  In8_Cu,
657  In9_Cu,
658  In10_Cu,
659  In11_Cu,
660  In12_Cu,
661  In13_Cu,
662  In14_Cu,
663  In15_Cu,
664  In16_Cu,
665  In17_Cu,
666  In18_Cu,
667  In19_Cu,
668  In20_Cu,
669  In21_Cu,
670  In22_Cu,
671  In23_Cu,
672  In24_Cu,
673  In25_Cu,
674  In26_Cu,
675  In27_Cu,
676  In28_Cu,
677  In29_Cu,
678  In30_Cu,
679  };
680 
681  static const LSET saved( cu_internals, arrayDim( cu_internals ) );
682  return saved;
683 }
PCB_LAYER_ID
A quick note on layer IDs:
LSET is a set of PCB_LAYER_IDs.
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Definition: macros.h:108

References arrayDim(), In10_Cu, In11_Cu, In12_Cu, In13_Cu, In14_Cu, In15_Cu, In16_Cu, In17_Cu, In18_Cu, In19_Cu, In1_Cu, In20_Cu, In21_Cu, In22_Cu, In23_Cu, In24_Cu, In25_Cu, In26_Cu, In27_Cu, In28_Cu, In29_Cu, In2_Cu, In30_Cu, In3_Cu, In4_Cu, In5_Cu, In6_Cu, In7_Cu, In8_Cu, and In9_Cu.

Referenced by GERBER_JOBFILE_WRITER::addJSONDesignRules(), AllCuMask(), FlipLayerMask(), ForbiddenFootprintLayers(), PCB_PARSER::init(), DIALOG_KEEPOUT_AREA_PROPERTIES::OnLayerSelection(), DIALOG_PAD_PROPERTIES::padValuesOK(), PANEL_SETUP_LAYERS::setCopperLayerCheckBoxes(), PANEL_SETUP_BOARD_STACKUP::showOnlyActiveLayers(), and BOARD_STACKUP::StackupAllowedBrdLayers().

◆ Name()

const wxChar * LSET::Name ( PCB_LAYER_ID  aLayerId)
static

Function Name returns the fixed name association with aLayerId.

Definition at line 78 of file lset.cpp.

79 {
80  const wxChar* txt;
81 
82  // using a switch to explicitly show the mapping more clearly
83  switch( aLayerId )
84  {
85  case F_Cu: txt = wxT( "F.Cu" ); break;
86  case In1_Cu: txt = wxT( "In1.Cu" ); break;
87  case In2_Cu: txt = wxT( "In2.Cu" ); break;
88  case In3_Cu: txt = wxT( "In3.Cu" ); break;
89  case In4_Cu: txt = wxT( "In4.Cu" ); break;
90  case In5_Cu: txt = wxT( "In5.Cu" ); break;
91  case In6_Cu: txt = wxT( "In6.Cu" ); break;
92  case In7_Cu: txt = wxT( "In7.Cu" ); break;
93  case In8_Cu: txt = wxT( "In8.Cu" ); break;
94  case In9_Cu: txt = wxT( "In9.Cu" ); break;
95  case In10_Cu: txt = wxT( "In10.Cu" ); break;
96  case In11_Cu: txt = wxT( "In11.Cu" ); break;
97  case In12_Cu: txt = wxT( "In12.Cu" ); break;
98  case In13_Cu: txt = wxT( "In13.Cu" ); break;
99  case In14_Cu: txt = wxT( "In14.Cu" ); break;
100  case In15_Cu: txt = wxT( "In15.Cu" ); break;
101  case In16_Cu: txt = wxT( "In16.Cu" ); break;
102  case In17_Cu: txt = wxT( "In17.Cu" ); break;
103  case In18_Cu: txt = wxT( "In18.Cu" ); break;
104  case In19_Cu: txt = wxT( "In19.Cu" ); break;
105  case In20_Cu: txt = wxT( "In20.Cu" ); break;
106  case In21_Cu: txt = wxT( "In21.Cu" ); break;
107  case In22_Cu: txt = wxT( "In22.Cu" ); break;
108  case In23_Cu: txt = wxT( "In23.Cu" ); break;
109  case In24_Cu: txt = wxT( "In24.Cu" ); break;
110  case In25_Cu: txt = wxT( "In25.Cu" ); break;
111  case In26_Cu: txt = wxT( "In26.Cu" ); break;
112  case In27_Cu: txt = wxT( "In27.Cu" ); break;
113  case In28_Cu: txt = wxT( "In28.Cu" ); break;
114  case In29_Cu: txt = wxT( "In29.Cu" ); break;
115  case In30_Cu: txt = wxT( "In30.Cu" ); break;
116  case B_Cu: txt = wxT( "B.Cu" ); break;
117 
118  // Technicals
119  case B_Adhes: txt = wxT( "B.Adhes" ); break;
120  case F_Adhes: txt = wxT( "F.Adhes" ); break;
121  case B_Paste: txt = wxT( "B.Paste" ); break;
122  case F_Paste: txt = wxT( "F.Paste" ); break;
123  case B_SilkS: txt = wxT( "B.SilkS" ); break;
124  case F_SilkS: txt = wxT( "F.SilkS" ); break;
125  case B_Mask: txt = wxT( "B.Mask" ); break;
126  case F_Mask: txt = wxT( "F.Mask" ); break;
127 
128  // Users
129  case Dwgs_User: txt = wxT( "Dwgs.User" ); break;
130  case Cmts_User: txt = wxT( "Cmts.User" ); break;
131  case Eco1_User: txt = wxT( "Eco1.User" ); break;
132  case Eco2_User: txt = wxT( "Eco2.User" ); break;
133  case Edge_Cuts: txt = wxT( "Edge.Cuts" ); break;
134  case Margin: txt = wxT( "Margin" ); break;
135 
136  // Footprint
137  case F_CrtYd: txt = wxT( "F.CrtYd" ); break;
138  case B_CrtYd: txt = wxT( "B.CrtYd" ); break;
139  case F_Fab: txt = wxT( "F.Fab" ); break;
140  case B_Fab: txt = wxT( "B.Fab" ); break;
141 
142  // Rescue
143  case Rescue: txt = wxT( "Rescue" ); break;
144 
145  default:
146  std::cout << aLayerId << std::endl;
147  wxASSERT_MSG( 0, wxT( "aLayerId out of range" ) );
148  txt = wxT( "BAD INDEX!" ); break;
149  }
150 
151  return txt;
152 }

References B_Adhes, B_CrtYd, B_Cu, B_Fab, B_Mask, B_Paste, B_SilkS, Cmts_User, Dwgs_User, Eco1_User, Eco2_User, Edge_Cuts, F_Adhes, F_CrtYd, F_Cu, F_Fab, F_Mask, F_Paste, F_SilkS, In10_Cu, In11_Cu, In12_Cu, In13_Cu, In14_Cu, In15_Cu, In16_Cu, In17_Cu, In18_Cu, In19_Cu, In1_Cu, In20_Cu, In21_Cu, In22_Cu, In23_Cu, In24_Cu, In25_Cu, In26_Cu, In27_Cu, In28_Cu, In29_Cu, In2_Cu, In30_Cu, In3_Cu, In4_Cu, In5_Cu, In6_Cu, In7_Cu, In8_Cu, In9_Cu, Margin, and Rescue.

Referenced by BOARD::GetStandardLayerName(), PCB_PARSER::init(), PCBNEW_PRINTOUT::OnPrintPage(), and COLORS_DESIGN_SETTINGS::setupConfigParams().

◆ ParseHex()

int LSET::ParseHex ( const char *  aStart,
int  aCount 
)

Function ParseHex understands the output of FmtHex() and replaces this set's values with those given in the input string.

Parsing stops at the first non hex ASCII byte, except that marker bytes output from FmtHex are not terminators.

Returns
int - number of bytes consumed

Definition at line 325 of file lset.cpp.

326 {
327  LSET tmp;
328 
329  const char* rstart = aStart + aCount - 1;
330  const char* rend = aStart - 1;
331 
332  const int bitcount = size();
333 
334  int nibble_ndx = 0;
335 
336  while( rstart > rend )
337  {
338  int cc = *rstart--;
339 
340  if( cc == '_' )
341  continue;
342 
343  int nibble;
344 
345  if( cc >= '0' && cc <= '9' )
346  nibble = cc - '0';
347  else if( cc >= 'a' && cc <= 'f' )
348  nibble = cc - 'a' + 10;
349  else if( cc >= 'A' && cc <= 'F' )
350  nibble = cc - 'A' + 10;
351  else
352  break;
353 
354  int bit = nibble_ndx * 4;
355 
356  for( int ndx=0; bit<bitcount && ndx<4; ++bit, ++ndx )
357  if( nibble & (1<<ndx) )
358  tmp.set( bit );
359 
360  if( bit >= bitcount )
361  break;
362 
363  ++nibble_ndx;
364  }
365 
366  int byte_count = aStart + aCount - 1 - rstart;
367 
368  assert( byte_count >= 0 );
369 
370  if( byte_count > 0 )
371  *this = tmp;
372 
373  return byte_count;
374 }
LSET is a set of PCB_LAYER_IDs.

Referenced by PCB_PLOT_PARAMS_PARSER::Parse().

◆ Seq() [1/2]

LSEQ LSET::Seq ( const PCB_LAYER_ID aWishListSequence,
unsigned  aCount 
) const

Function Seq returns an LSEQ from the union of this LSET and a desired sequence.

The LSEQ element will be in the same sequence as aWishListSequence if they are present.

Parameters
aWishListSequenceestablishes the order of the returned LSEQ, and the LSEQ will only contain PCB_LAYER_IDs which are present in this set.
aCountis the length of aWishListSequence array.

Definition at line 377 of file lset.cpp.

378 {
379  LSEQ ret;
380 
381 #if defined(DEBUG) && 0
382  LSET dup_detector;
383 
384  for( unsigned i=0; i<aCount; ++i )
385  {
386  PCB_LAYER_ID id = aWishListSequence[i];
387 
388  if( test( id ) )
389  {
390  wxASSERT_MSG( !dup_detector[id], wxT( "Duplicate in aWishListSequence" ) );
391  dup_detector[id] = true;
392 
393  ret.push_back( id );
394  }
395  }
396 #else
397 
398  for( unsigned i=0; i<aCount; ++i )
399  {
400  PCB_LAYER_ID id = aWishListSequence[i];
401 
402  if( test( id ) )
403  ret.push_back( id );
404  }
405 #endif
406 
407  return ret;
408 }
PCB_LAYER_ID
A quick note on layer IDs:
LSET is a set of PCB_LAYER_IDs.
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.

Referenced by CINFO3D_VISU::createLayers(), CreatePadsShapesSection(), DIALOG_EXPORT_SVG::ExportSVGFile(), PCB_IO::formatBoardLayers(), GENDRILL_WRITER_BASE::GenDrillReportFile(), PANEL_SETUP_LAYERS::getNonRemovableLayers(), PANEL_SETUP_LAYERS::getRemovedLayersWithItems(), PlotLayerOutlines(), ZONE_CONTAINER::Print(), PARAM_CFG_LAYERS::SaveParam(), ZONE_CONTAINER::SetLayerSet(), GERBVIEW_PRINTOUT::setupViewLayers(), PCBNEW_PRINTOUT::setupViewLayers(), Technicals(), ZONE_CONTAINER::ViewGetLayers(), and HYPERLYNX_EXPORTER::writeSinglePadStack().

◆ Seq() [2/2]

LSEQ LSET::Seq ( ) const

Function Seq returns a LSEQ from this LSET in ascending PCB_LAYER_ID order.

Each LSEQ element will be in the same sequence as in PCB_LAYER_ID and only present in the resultant LSEQ if present in this set. Therefore the sequence is subject to change, use it only when enumeration and not order is important.

Definition at line 411 of file lset.cpp.

412 {
413  LSEQ ret;
414 
415  for( unsigned i=0; i<size(); ++i )
416  {
417  if( test(i) )
418  ret.push_back( PCB_LAYER_ID( i ) );
419  }
420 
421  return ret;
422 }
PCB_LAYER_ID
A quick note on layer IDs:
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.

Referenced by CuStack(), SeqStackupBottom2Top(), TechAndUserUIOrder(), and Users().

◆ SeqStackupBottom2Top()

LSEQ LSET::SeqStackupBottom2Top ( ) const

Function SeqStackBottom2Top returns the sequence that is typical for a bottom-to-top stack-up.

For instance, to plot multiple layers in a single image, the top layers output last.

Definition at line 425 of file lset.cpp.

426 {
427  // bottom-to-top stack-up layers
428  static const PCB_LAYER_ID sequence[] = {
429  B_Fab,
430  B_CrtYd,
431  B_Adhes,
432  B_SilkS,
433  B_Paste,
434  B_Mask,
435  B_Cu,
436  In30_Cu,
437  In29_Cu,
438  In28_Cu,
439  In27_Cu,
440  In26_Cu,
441  In25_Cu,
442  In24_Cu,
443  In23_Cu,
444  In22_Cu,
445  In21_Cu,
446  In20_Cu,
447  In19_Cu,
448  In18_Cu,
449  In17_Cu,
450  In16_Cu,
451  In15_Cu,
452  In14_Cu,
453  In13_Cu,
454  In12_Cu,
455  In11_Cu,
456  In10_Cu,
457  In9_Cu,
458  In8_Cu,
459  In7_Cu,
460  In6_Cu,
461  In5_Cu,
462  In4_Cu,
463  In3_Cu,
464  In2_Cu,
465  In1_Cu,
466  F_Cu,
467  F_Mask,
468  F_Paste,
469  F_SilkS,
470  F_Adhes,
471  F_CrtYd,
472  F_Fab,
473  Dwgs_User,
474  Cmts_User,
475  Eco1_User,
476  Eco2_User,
477  Margin,
478  Edge_Cuts,
479  };
480 
481  return Seq( sequence, arrayDim( sequence ) );
482 }
LSEQ Seq() const
Function Seq returns a LSEQ from this LSET in ascending PCB_LAYER_ID order.
Definition: lset.cpp:411
PCB_LAYER_ID
A quick note on layer IDs:
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Definition: macros.h:108

References arrayDim(), B_Adhes, B_CrtYd, B_Cu, B_Fab, B_Mask, B_Paste, B_SilkS, Cmts_User, Dwgs_User, Eco1_User, Eco2_User, Edge_Cuts, F_Adhes, F_CrtYd, F_Cu, F_Fab, F_Mask, F_Paste, F_SilkS, In10_Cu, In11_Cu, In12_Cu, In13_Cu, In14_Cu, In15_Cu, In16_Cu, In17_Cu, In18_Cu, In19_Cu, In1_Cu, In20_Cu, In21_Cu, In22_Cu, In23_Cu, In24_Cu, In25_Cu, In26_Cu, In27_Cu, In28_Cu, In29_Cu, In2_Cu, In30_Cu, In3_Cu, In4_Cu, In5_Cu, In6_Cu, In7_Cu, In8_Cu, In9_Cu, Margin, and Seq().

Referenced by DIALOG_EXPORT_SVG::CreateSVGFile().

◆ TechAndUserUIOrder()

LSEQ LSET::TechAndUserUIOrder ( ) const

Returns the technical and user layers in the order shown in layer widget.

Definition at line 237 of file lset.cpp.

238 {
239  static const PCB_LAYER_ID sequence[] = {
240  F_Adhes,
241  B_Adhes,
242  F_Paste,
243  B_Paste,
244  F_SilkS,
245  B_SilkS,
246  F_Mask,
247  B_Mask,
248  Dwgs_User,
249  Cmts_User,
250  Eco1_User,
251  Eco2_User,
252  Edge_Cuts,
253  Margin,
254  F_CrtYd,
255  B_CrtYd,
256  F_Fab,
257  B_Fab,
258  };
259 
260  return Seq( sequence, arrayDim( sequence ) );
261 }
LSEQ Seq() const
Function Seq returns a LSEQ from this LSET in ascending PCB_LAYER_ID order.
Definition: lset.cpp:411
PCB_LAYER_ID
A quick note on layer IDs:
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Definition: macros.h:108

References arrayDim(), B_Adhes, B_CrtYd, B_Fab, B_Mask, B_Paste, B_SilkS, Cmts_User, Dwgs_User, Eco1_User, Eco2_User, Edge_Cuts, F_Adhes, F_CrtYd, F_Fab, F_Mask, F_Paste, F_SilkS, Margin, and Seq().

Referenced by UIOrder().

◆ Technicals()

LSEQ LSET::Technicals ( LSET  aSubToOmit = LSET()) const

Function Technicals returns a sequence of technical layers.

A sequence provides a certain order.

Parameters
aSubToOmitis the subset of the techical layers to omit, defaults to none.

Definition at line 197 of file lset.cpp.

198 {
199  // desired sequence
200  static const PCB_LAYER_ID sequence[] = {
201  F_Adhes,
202  B_Adhes,
203  F_Paste,
204  B_Paste,
205  F_SilkS,
206  B_SilkS,
207  F_Mask,
208  B_Mask,
209  F_CrtYd,
210  B_CrtYd,
211  F_Fab,
212  B_Fab,
213  };
214 
215  LSET subset = ~aSetToOmit & *this;
216 
217  return subset.Seq( sequence, arrayDim( sequence ) );
218 }
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Function Seq returns an LSEQ from the union of this LSET and a desired sequence.
Definition: lset.cpp:377
PCB_LAYER_ID
A quick note on layer IDs:
LSET is a set of PCB_LAYER_IDs.
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Definition: macros.h:108

References arrayDim(), B_Adhes, B_CrtYd, B_Fab, B_Mask, B_Paste, B_SilkS, F_Adhes, F_CrtYd, F_Fab, F_Mask, F_Paste, F_SilkS, and Seq().

◆ UIOrder()

LSEQ LSET::UIOrder ( ) const

Definition at line 813 of file lset.cpp.

814 {
815  LSEQ order = CuStack();
816  LSEQ techuser = TechAndUserUIOrder();
817  order.insert( order.end(), techuser.begin(), techuser.end() );
818 
819  return order;
820 }
LSEQ CuStack() const
Function CuStack returns a sequence of copper layers in starting from the front/top and extending to ...
Definition: lset.cpp:155
LSEQ TechAndUserUIOrder() const
Returns the technical and user layers in the order shown in layer widget.
Definition: lset.cpp:237
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.

References CuStack(), and TechAndUserUIOrder().

Referenced by PCB_ONE_LAYER_SELECTOR::buildList(), SELECT_COPPER_LAYERS_PAIR_DIALOG::buildList(), DIALOG_PLOT::init_Dialog(), DIALOG_EXPORT_SVG::initDialog(), GERBVIEW_PRINTOUT::OnPrintPage(), PCBNEW_PRINTOUT::OnPrintPage(), DIALOG_PLOT::Plot(), PCB_LAYER_BOX_SELECTOR::Resync(), ZONE_SETTINGS::SetupLayersList(), and DIALOG_PRINT_PCBNEW::TransferDataToWindow().

◆ UserMask()

LSET LSET::UserMask ( )
static

Definition at line 770 of file lset.cpp.

771 {
772  static const LSET saved( 6,
773  Dwgs_User,
774  Cmts_User,
775  Eco1_User,
776  Eco2_User,
777  Edge_Cuts,
778  Margin
779  );
780 
781  return saved;
782 }
LSET is a set of PCB_LAYER_IDs.

References Cmts_User, Dwgs_User, Eco1_User, Eco2_User, Edge_Cuts, and Margin.

◆ Users()

LSEQ LSET::Users ( ) const

*_User layers.

Definition at line 221 of file lset.cpp.

222 {
223  // desired
224  static const PCB_LAYER_ID sequence[] = {
225  Dwgs_User,
226  Cmts_User,
227  Eco1_User,
228  Eco2_User,
229  Edge_Cuts,
230  Margin,
231  };
232 
233  return Seq( sequence, arrayDim( sequence ) );
234 }
LSEQ Seq() const
Function Seq returns a LSEQ from this LSET in ascending PCB_LAYER_ID order.
Definition: lset.cpp:411
PCB_LAYER_ID
A quick note on layer IDs:
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Definition: macros.h:108

References arrayDim(), Cmts_User, Dwgs_User, Eco1_User, Eco2_User, Edge_Cuts, Margin, and Seq().


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