KiCad PCB EDA Suite
LSET Class Reference

Class 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

Class 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 379 of file layers_id_colors_and_visibility.h.

Constructor & Destructor Documentation

LSET::LSET ( )
inline

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

Definition at line 397 of file layers_id_colors_and_visibility.h.

Referenced by AllLayersMask(), and AllNonCuMask().

397  :
398  BASE_SET() // all bits are set to zero in BASE_SET()
399  {
400  }
std::bitset< PCB_LAYER_ID_COUNT > BASE_SET
LSET::LSET ( const BASE_SET aOther)
inline

Definition at line 402 of file layers_id_colors_and_visibility.h.

402  :
403  BASE_SET( aOther )
404  {
405  }
std::bitset< PCB_LAYER_ID_COUNT > BASE_SET
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 422 of file layers_id_colors_and_visibility.h.

References MAX_CU_LAYERS.

422  : // PCB_LAYER_ID deliberately exludes int and relatives
423  BASE_SET()
424  {
425  set( aLayer );
426  }
std::bitset< PCB_LAYER_ID_COUNT > BASE_SET
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 33 of file lset.cpp.

References i.

33  :
34  BASE_SET()
35 {
36  for( unsigned i=0; i<aCount; ++i )
37  set( aArray[i] );
38 }
std::bitset< PCB_LAYER_ID_COUNT > BASE_SET
size_t i
Definition: json11.cpp:597
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 41 of file lset.cpp.

References i, and PCB_LAYER_ID_COUNT.

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

629  {
630  // not usable, it's private.
631  }

Member Function Documentation

LSET LSET::AllBoardTechMask ( )
static

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

Definition at line 750 of file lset.cpp.

References BackBoardTechMask(), and FrontBoardTechMask().

Referenced by BRDITEMS_PLOTTER::PlotPad().

751 {
752  static const LSET saved = BackBoardTechMask() | FrontBoardTechMask();
753  return saved;
754 }
static LSET FrontBoardTechMask()
Function FrontBoardTechMask returns a mask holding technical layers used in a board fabrication (no C...
Definition: lset.cpp:736
Class 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:723
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 673 of file lset.cpp.

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

Referenced by PCAD2KICAD::PCB_PAD::AddToModule(), AllNonCuMask(), DIALOG_PLOT::applyPlotSettings(), Autoroute_One_Track(), TRACKS_CLEANER::cleanupVias(), compute_layer_Zs(), compute_pad_access_code(), CINFO3D_VISU::createLayers(), DIALOG_EXPORT_SVG::CreateSVGFile(), PANEL_SETUP_LAYERS::DenyChangeCheckBox(), DIALOG_DXF_IMPORT::DIALOG_DXF_IMPORT(), DRC::doPadToPadsDrc(), DRC::doTrackDrc(), D_PAD::Draw(), BOARD::Draw(), fmt_mask(), PCB_IO::formatLayers(), GENDRILL_WRITER_BASE::GenDrillReportFile(), VIA::GetLayerSet(), BOARD::GetPad(), D_PAD::GetSolderMaskMargin(), D_PAD::GetSolderPasteMargin(), MODULE::GetUniquePadCount(), PCB_EDITOR_CONTROL::HighlightNetCursor(), KIGFX::PCB_RENDER_SETTINGS::ImportLegacyColors(), PCB_PARSER::init(), D_PAD::IsAperturePad(), CN_ANCHOR::IsDangling(), ZONE_CONTAINER::IsOnCopperLayer(), DSN::isRoundKeepout(), 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::PlotDrawSegment(), BRDITEMS_PLOTTER::PlotPad(), PlotStandardLayer(), PCB_EDIT_FRAME::Process_Special_Functions(), PARAM_CFG_LAYERS::ReadParam(), PARAM_CFG_LAYERS::SaveParam(), 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(), and D_PAD::UnplatedHoleMask().

674 {
675  // retain all in static as the full set, which is a common case.
676  static const LSET all = InternalCuMask().set( F_Cu ).set( B_Cu );
677 
678  if( aCuLayerCount == MAX_CU_LAYERS )
679  return all;
680 
681  // subtract out some Cu layers not wanted in the mask.
682  LSET ret = all;
683  int clear_count = MAX_CU_LAYERS - aCuLayerCount;
684 
685  clear_count = Clamp( 0, clear_count, MAX_CU_LAYERS - 2 );
686 
687  for( LAYER_NUM elem=In30_Cu; clear_count; --elem, --clear_count )
688  {
689  ret.set( elem, false );
690  }
691 
692  return ret;
693 }
const T & Clamp(const T &lower, const T &value, const T &upper)
Function Clamp limits value within the range lower <= value <= upper.
Definition: macros.h:127
Class 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:633
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
LSET LSET::AllLayersMask ( )
static

Definition at line 710 of file lset.cpp.

References LSET().

Referenced by GRID_HELPER::BestDragOrigin(), GRID_HELPER::BestSnapAnchor(), POINT_EDITOR::OnSelectionChange(), MODULE::Reference(), PICKER_TOOL::reset(), and PCB_LAYER_BOX_SELECTOR::Resync().

711 {
712  static const LSET saved = LSET().set();
713  return saved;
714 }
Class LSET is a set of PCB_LAYER_IDs.
LSET()
Constructor LSET() creates an empty (cleared) set.
LSET LSET::AllNonCuMask ( )
static

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

Definition at line 696 of file lset.cpp.

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(), PCB_EDIT_FRAME::Process_Special_Functions(), ZONE_SETTINGS::SetupLayersList(), and DIALOG_SWAP_LAYERS::TransferDataToWindow().

697 {
698  static const LSET saved = LSET().set() & ~AllCuMask();
699  return saved;
700 }
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:673
Class LSET is a set of PCB_LAYER_IDs.
LSET()
Constructor LSET() creates an empty (cleared) set.
LSET LSET::AllTechMask ( )
static

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

Definition at line 743 of file lset.cpp.

References BackTechMask(), and FrontTechMask().

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

744 {
745  static const LSET saved = BackTechMask() | FrontTechMask();
746  return saved;
747 }
static LSET BackTechMask()
Function BackTechMask returns a mask holding all technical layers (no CU layer) on back side...
Definition: lset.cpp:717
static LSET FrontTechMask()
Function FrontTechMask returns a mask holding all technical layers (no CU layer) on front side...
Definition: lset.cpp:729
Class LSET is a set of PCB_LAYER_IDs.
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 723 of file lset.cpp.

References B_Adhes, B_Mask, B_Paste, and B_SilkS.

Referenced by AllBoardTechMask().

724 {
725  static const LSET saved( 4, B_SilkS, B_Mask, B_Adhes, B_Paste );
726  return saved;
727 }
Class LSET is a set of PCB_LAYER_IDs.
LSET LSET::BackMask ( )
static

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

Definition at line 779 of file lset.cpp.

References B_Cu, and BackTechMask().

Referenced by D_PAD::Draw().

780 {
781  static const LSET saved = BackTechMask().set( B_Cu );
782  return saved;
783 }
static LSET BackTechMask()
Function BackTechMask returns a mask holding all technical layers (no CU layer) on back side...
Definition: lset.cpp:717
Class LSET is a set of PCB_LAYER_IDs.
LSET LSET::BackTechMask ( )
static

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

Definition at line 717 of file lset.cpp.

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

Referenced by AllTechMask(), and BackMask().

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 147 of file lset.cpp.

References B_Cu, DIM, 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(), LayerMaskDescribe(), PCB_LAYER_WIDGET::ReFill(), and UIOrder().

148 {
149  // desired sequence
150  static const PCB_LAYER_ID sequence[] = {
151  F_Cu,
152  In1_Cu,
153  In2_Cu,
154  In3_Cu,
155  In4_Cu,
156  In5_Cu,
157  In6_Cu,
158  In7_Cu,
159  In8_Cu,
160  In9_Cu,
161  In10_Cu,
162  In11_Cu,
163  In12_Cu,
164  In13_Cu,
165  In14_Cu,
166  In15_Cu,
167  In16_Cu,
168  In17_Cu,
169  In18_Cu,
170  In19_Cu,
171  In20_Cu,
172  In21_Cu,
173  In22_Cu,
174  In23_Cu,
175  In24_Cu,
176  In25_Cu,
177  In26_Cu,
178  In27_Cu,
179  In28_Cu,
180  In29_Cu,
181  In30_Cu,
182  B_Cu, // 31
183  };
184 
185  return Seq( sequence, DIM( sequence ) );
186 }
#define DIM(x)
of elements in an array
Definition: macros.h:98
LSEQ Seq() const
Function Seq returns a LSEQ from this LSET in ascending PCB_LAYER_ID order.
Definition: lset.cpp:398
PCB_LAYER_ID
A quick note on layer IDs:
LSET LSET::ExternalCuMask ( )
static

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

Definition at line 703 of file lset.cpp.

References B_Cu, and F_Cu.

Referenced by GERBER_JOBFILE_WRITER::addJSONDesignRules(), and BRDITEMS_PLOTTER::PlotPad().

704 {
705  static const LSET saved( 2, F_Cu, B_Cu );
706  return saved;
707 }
Class LSET is a set of PCB_LAYER_IDs.
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 612 of file lset.cpp.

References i, UNDEFINED_LAYER, and UNSELECTED_LAYER.

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

613 {
614  unsigned set_count = count();
615 
616  if( !set_count )
617  return UNSELECTED_LAYER;
618  else if( set_count > 1 )
619  return UNDEFINED_LAYER;
620 
621  for( unsigned i=0; i < size(); ++i )
622  {
623  if( test( i ) )
624  return PCB_LAYER_ID( i );
625  }
626 
627  wxASSERT( 0 ); // set_count was verified as 1 above, what did you break?
628 
629  return UNDEFINED_LAYER;
630 }
PCB_LAYER_ID
A quick note on layer IDs:
size_t i
Definition: json11.cpp:597
std::string LSET::FmtBin ( ) const

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

Definition at line 256 of file lset.cpp.

References bit.

Referenced by ViaSort().

257 {
258  std::string ret;
259 
260  int bit_count = size();
261 
262  for( int bit=0; bit<bit_count; ++bit )
263  {
264  if( bit )
265  {
266  if( !( bit % 8 ) )
267  ret += '|';
268  else if( !( bit % 4 ) )
269  ret += '_';
270  }
271 
272  ret += (*this)[bit] ? '1' : '0';
273  }
274 
275  // reverse of string
276  return std::string( ret.rbegin(), ret.rend() );
277 }
static long bit[8][9]
Definition: solve.cpp:826
std::string LSET::FmtHex ( ) const

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

Definition at line 280 of file lset.cpp.

References DIM.

Referenced by fmt_mask().

281 {
282  std::string ret;
283 
284  static const char hex[] = "0123456789abcdef";
285 
286  int nibble_count = ( size() + 3 ) / 4;
287 
288  for( int nibble=0; nibble<nibble_count; ++nibble )
289  {
290  unsigned ndx = 0;
291 
292  // test 4 consecutive bits and set ndx to 0-15:
293  for( int nibble_bit=0; nibble_bit<4; ++nibble_bit )
294  {
295  if( (*this)[nibble_bit + nibble*4] )
296  ndx |= (1 << nibble_bit);
297  }
298 
299  if( nibble && !( nibble % 8 ) )
300  ret += '_';
301 
302  assert( ndx < DIM( hex ) );
303 
304  ret += hex[ndx];
305  }
306 
307  // reverse of string
308  return std::string( ret.rbegin(), ret.rend() );
309 }
#define DIM(x)
of elements in an array
Definition: macros.h:98
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 786 of file lset.cpp.

References Edge_Cuts, InternalCuMask(), and Margin.

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

787 {
788  static const LSET saved = InternalCuMask().set( Edge_Cuts ).set( Margin );
789  return saved;
790 }
Class 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:633
LSET LSET::ForbiddenTextLayers ( )
static

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

Currently Edge.Cuts and Margin.

Definition at line 793 of file lset.cpp.

References Edge_Cuts.

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

794 {
795  static const LSET saved( 1, Edge_Cuts );
796  return saved;
797 }
Class LSET is a set of PCB_LAYER_IDs.
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 736 of file lset.cpp.

References F_Adhes, F_Mask, F_Paste, and F_SilkS.

Referenced by AllBoardTechMask().

737 {
738  static const LSET saved( 4, F_SilkS, F_Mask, F_Adhes, F_Paste );
739  return saved;
740 }
Class LSET is a set of PCB_LAYER_IDs.
LSET LSET::FrontMask ( )
static

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

Definition at line 772 of file lset.cpp.

References F_Cu, and FrontTechMask().

Referenced by D_PAD::Draw().

773 {
774  static const LSET saved = FrontTechMask().set( F_Cu );
775  return saved;
776 }
static LSET FrontTechMask()
Function FrontTechMask returns a mask holding all technical layers (no CU layer) on front side...
Definition: lset.cpp:729
Class LSET is a set of PCB_LAYER_IDs.
LSET LSET::FrontTechMask ( )
static

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

Definition at line 729 of file lset.cpp.

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

Referenced by AllTechMask(), and FrontMask().

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 633 of file lset.cpp.

References DIM, 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(), DIALOG_PAD_PROPERTIES::padValuesOK(), and PANEL_SETUP_LAYERS::setCopperLayerCheckBoxes().

634 {
635  static const PCB_LAYER_ID cu_internals[] = {
636  In1_Cu,
637  In2_Cu,
638  In3_Cu,
639  In4_Cu,
640  In5_Cu,
641  In6_Cu,
642  In7_Cu,
643  In8_Cu,
644  In9_Cu,
645  In10_Cu,
646  In11_Cu,
647  In12_Cu,
648  In13_Cu,
649  In14_Cu,
650  In15_Cu,
651  In16_Cu,
652  In17_Cu,
653  In18_Cu,
654  In19_Cu,
655  In20_Cu,
656  In21_Cu,
657  In22_Cu,
658  In23_Cu,
659  In24_Cu,
660  In25_Cu,
661  In26_Cu,
662  In27_Cu,
663  In28_Cu,
664  In29_Cu,
665  In30_Cu,
666  };
667 
668  static const LSET saved( cu_internals, DIM( cu_internals ) );
669  return saved;
670 }
#define DIM(x)
of elements in an array
Definition: macros.h:98
PCB_LAYER_ID
A quick note on layer IDs:
Class LSET is a set of PCB_LAYER_IDs.
const wxChar * LSET::Name ( PCB_LAYER_ID  aLayerId)
static

Function Name returns the fixed name association with aLayerId.

Definition at line 73 of file lset.cpp.

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, and Margin.

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

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

References bit.

Referenced by PCB_PLOT_PARAMS_PARSER::Parse().

313 {
314  LSET tmp;
315 
316  const char* rstart = aStart + aCount - 1;
317  const char* rend = aStart - 1;
318 
319  const int bitcount = size();
320 
321  int nibble_ndx = 0;
322 
323  while( rstart > rend )
324  {
325  int cc = *rstart--;
326 
327  if( cc == '_' )
328  continue;
329 
330  int nibble;
331 
332  if( cc >= '0' && cc <= '9' )
333  nibble = cc - '0';
334  else if( cc >= 'a' && cc <= 'f' )
335  nibble = cc - 'a' + 10;
336  else if( cc >= 'A' && cc <= 'F' )
337  nibble = cc - 'A' + 10;
338  else
339  break;
340 
341  int bit = nibble_ndx * 4;
342 
343  for( int ndx=0; bit<bitcount && ndx<4; ++bit, ++ndx )
344  if( nibble & (1<<ndx) )
345  tmp.set( bit );
346 
347  if( bit >= bitcount )
348  break;
349 
350  ++nibble_ndx;
351  }
352 
353  int byte_count = aStart + aCount - 1 - rstart;
354 
355  assert( byte_count >= 0 );
356 
357  if( byte_count > 0 )
358  *this = tmp;
359 
360  return byte_count;
361 }
Class LSET is a set of PCB_LAYER_IDs.
static long bit[8][9]
Definition: solve.cpp:826
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 364 of file lset.cpp.

References i.

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

365 {
366  LSEQ ret;
367 
368 #if defined(DEBUG) && 0
369  LSET dup_detector;
370 
371  for( unsigned i=0; i<aCount; ++i )
372  {
373  PCB_LAYER_ID id = aWishListSequence[i];
374 
375  if( test( id ) )
376  {
377  wxASSERT_MSG( !dup_detector[id], wxT( "Duplicate in aWishListSequence" ) );
378  dup_detector[id] = true;
379 
380  ret.push_back( id );
381  }
382  }
383 #else
384 
385  for( unsigned i=0; i<aCount; ++i )
386  {
387  PCB_LAYER_ID id = aWishListSequence[i];
388 
389  if( test( id ) )
390  ret.push_back( id );
391  }
392 #endif
393 
394  return ret;
395 }
PCB_LAYER_ID
A quick note on layer IDs:
Class LSET is a set of PCB_LAYER_IDs.
Class LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
size_t i
Definition: json11.cpp:597
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 398 of file lset.cpp.

References i.

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

399 {
400  LSEQ ret;
401 
402  for( unsigned i=0; i<size(); ++i )
403  {
404  if( test(i) )
405  ret.push_back( PCB_LAYER_ID( i ) );
406  }
407 
408  return ret;
409 }
PCB_LAYER_ID
A quick note on layer IDs:
Class LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
size_t i
Definition: json11.cpp:597
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 412 of file lset.cpp.

References B_Adhes, B_CrtYd, B_Cu, B_Fab, B_Mask, B_Paste, B_SilkS, Cmts_User, DIM, 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 GERBER_JOBFILE_WRITER::addJSONMaterialStackup(), and DIALOG_EXPORT_SVG::CreateSVGFile().

413 {
414  // bottom-to-top stack-up layers
415  static const PCB_LAYER_ID sequence[] = {
416  B_Fab,
417  B_CrtYd,
418  B_Adhes,
419  B_SilkS,
420  B_Paste,
421  B_Mask,
422  B_Cu,
423  In30_Cu,
424  In29_Cu,
425  In28_Cu,
426  In27_Cu,
427  In26_Cu,
428  In25_Cu,
429  In24_Cu,
430  In23_Cu,
431  In22_Cu,
432  In21_Cu,
433  In20_Cu,
434  In19_Cu,
435  In18_Cu,
436  In17_Cu,
437  In16_Cu,
438  In15_Cu,
439  In14_Cu,
440  In13_Cu,
441  In12_Cu,
442  In11_Cu,
443  In10_Cu,
444  In9_Cu,
445  In8_Cu,
446  In7_Cu,
447  In6_Cu,
448  In5_Cu,
449  In4_Cu,
450  In3_Cu,
451  In2_Cu,
452  In1_Cu,
453  F_Cu,
454  F_Mask,
455  F_Paste,
456  F_SilkS,
457  F_Adhes,
458  F_CrtYd,
459  F_Fab,
460  Dwgs_User,
461  Cmts_User,
462  Eco1_User,
463  Eco2_User,
464  Margin,
465  Edge_Cuts,
466  };
467 
468  return Seq( sequence, DIM( sequence ) );
469 }
#define DIM(x)
of elements in an array
Definition: macros.h:98
LSEQ Seq() const
Function Seq returns a LSEQ from this LSET in ascending PCB_LAYER_ID order.
Definition: lset.cpp:398
PCB_LAYER_ID
A quick note on layer IDs:
LSEQ LSET::TechAndUserUIOrder ( ) const

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

Definition at line 229 of file lset.cpp.

References B_Adhes, B_CrtYd, B_Fab, B_Mask, B_Paste, B_SilkS, Cmts_User, DIM, 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().

230 {
231  static const PCB_LAYER_ID sequence[] = {
232  F_Adhes,
233  B_Adhes,
234  F_Paste,
235  B_Paste,
236  F_SilkS,
237  B_SilkS,
238  F_Mask,
239  B_Mask,
240  Dwgs_User,
241  Cmts_User,
242  Eco1_User,
243  Eco2_User,
244  Edge_Cuts,
245  Margin,
246  F_CrtYd,
247  B_CrtYd,
248  F_Fab,
249  B_Fab,
250  };
251 
252  return Seq( sequence, DIM( sequence ) );
253 }
#define DIM(x)
of elements in an array
Definition: macros.h:98
LSEQ Seq() const
Function Seq returns a LSEQ from this LSET in ascending PCB_LAYER_ID order.
Definition: lset.cpp:398
PCB_LAYER_ID
A quick note on layer IDs:
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 189 of file lset.cpp.

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

Referenced by LayerMaskDescribe().

190 {
191  // desired sequence
192  static const PCB_LAYER_ID sequence[] = {
193  F_Adhes,
194  B_Adhes,
195  F_Paste,
196  B_Paste,
197  F_SilkS,
198  B_SilkS,
199  F_Mask,
200  B_Mask,
201  F_CrtYd,
202  B_CrtYd,
203  F_Fab,
204  B_Fab,
205  };
206 
207  LSET subset = ~aSetToOmit & *this;
208 
209  return subset.Seq( sequence, DIM( sequence ) );
210 }
#define DIM(x)
of elements in an array
Definition: macros.h:98
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:364
PCB_LAYER_ID
A quick note on layer IDs:
Class LSET is a set of PCB_LAYER_IDs.
LSEQ LSET::UIOrder ( ) const

Definition at line 800 of file lset.cpp.

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().

801 {
802  LSEQ order = CuStack();
803  LSEQ techuser = TechAndUserUIOrder();
804  order.insert( order.end(), techuser.begin(), techuser.end() );
805 
806  return order;
807 }
LSEQ TechAndUserUIOrder() const
Returns the technical and user layers in the order shown in layer widget.
Definition: lset.cpp:229
LSEQ CuStack() const
Function CuStack returns a sequence of copper layers in starting from the front/top and extending to ...
Definition: lset.cpp:147
Class LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
LSET LSET::UserMask ( )
static

Definition at line 757 of file lset.cpp.

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

758 {
759  static const LSET saved( 6,
760  Dwgs_User,
761  Cmts_User,
762  Eco1_User,
763  Eco2_User,
764  Edge_Cuts,
765  Margin
766  );
767 
768  return saved;
769 }
Class LSET is a set of PCB_LAYER_IDs.
LSEQ LSET::Users ( ) const

*_User layers.

Definition at line 213 of file lset.cpp.

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

214 {
215  // desired
216  static const PCB_LAYER_ID sequence[] = {
217  Dwgs_User,
218  Cmts_User,
219  Eco1_User,
220  Eco2_User,
221  Edge_Cuts,
222  Margin,
223  };
224 
225  return Seq( sequence, DIM( sequence ) );
226 }
#define DIM(x)
of elements in an array
Definition: macros.h:98
LSEQ Seq() const
Function Seq returns a LSEQ from this LSET in ascending PCB_LAYER_ID order.
Definition: lset.cpp:398
PCB_LAYER_ID
A quick note on layer IDs:

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