Horizon
Public Member Functions | Static Public Member Functions | List of all members
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.
 
 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.
 
 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.
 
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.
 
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.
 
PCB_LAYER_ID ExtractLayer () const
 Find the first set PCB_LAYER_ID. More...
 

Static Public Member Functions

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

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.

Constructor & Destructor Documentation

◆ LSET() [1/2]

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.

◆ LSET() [2/2]

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.

Member Function Documentation

◆ 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.

◆ 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.

◆ 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

◆ Seq() [1/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.

◆ Seq() [2/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.

◆ 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.

◆ 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.

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