KiCad PCB EDA Suite
LAYER_RANGE Class Reference

Represent a contiguous set of PCB layers. More...

#include <pns_layerset.h>

Public Member Functions

 LAYER_RANGE ()
 
 LAYER_RANGE (int aStart, int aEnd)
 
 LAYER_RANGE (int aLayer)
 
 LAYER_RANGE (const LAYER_RANGE &aB)
 
 ~LAYER_RANGE ()
 
LAYER_RANGEoperator= (const LAYER_RANGE &aB)
 
bool Overlaps (const LAYER_RANGE &aOther) const
 
bool Overlaps (const int aLayer) const
 
bool IsMultilayer () const
 
int Start () const
 
int End () const
 
void Merge (const LAYER_RANGE &aOther)
 
LAYER_RANGE Intersection (const LAYER_RANGE &aOther) const
 Shortcut for comparisons/overlap tests. More...
 
bool operator== (const LAYER_RANGE &aOther) const
 
bool operator!= (const LAYER_RANGE &aOther) const
 

Static Public Member Functions

static LAYER_RANGE All ()
 

Private Attributes

int m_start
 
int m_end
 

Detailed Description

Represent a contiguous set of PCB layers.

Definition at line 31 of file pns_layerset.h.

Constructor & Destructor Documentation

◆ LAYER_RANGE() [1/4]

LAYER_RANGE::LAYER_RANGE ( )
inline

Definition at line 34 of file pns_layerset.h.

34 :
35 m_start( -1 ),
36 m_end( -1 )
37 {};

Referenced by All().

◆ LAYER_RANGE() [2/4]

LAYER_RANGE::LAYER_RANGE ( int  aStart,
int  aEnd 
)
inline

Definition at line 39 of file pns_layerset.h.

40 {
41 if( aStart > aEnd )
42 std::swap( aStart, aEnd );
43
44 m_start = aStart;
45 m_end = aEnd;
46 }

References m_end, and m_start.

◆ LAYER_RANGE() [3/4]

LAYER_RANGE::LAYER_RANGE ( int  aLayer)
inline

Definition at line 48 of file pns_layerset.h.

49 {
50 m_start = m_end = aLayer;
51 }

References m_end, and m_start.

◆ LAYER_RANGE() [4/4]

LAYER_RANGE::LAYER_RANGE ( const LAYER_RANGE aB)
inline

Definition at line 53 of file pns_layerset.h.

53 :
54 m_start( aB.m_start ),
55 m_end( aB.m_end )
56 {}

◆ ~LAYER_RANGE()

LAYER_RANGE::~LAYER_RANGE ( )
inline

Definition at line 58 of file pns_layerset.h.

58{};

Member Function Documentation

◆ All()

static LAYER_RANGE LAYER_RANGE::All ( )
inlinestatic

Definition at line 125 of file pns_layerset.h.

126 {
127 return LAYER_RANGE( 0, 256 ); // fixme: use layer IDs header
128 }

References LAYER_RANGE().

Referenced by PNS::ROUTER::QueryHoverItems().

◆ End()

◆ Intersection()

LAYER_RANGE LAYER_RANGE::Intersection ( const LAYER_RANGE aOther) const
inline

Shortcut for comparisons/overlap tests.

Definition at line 108 of file pns_layerset.h.

References m_end, and m_start.

Referenced by PNS_PCBNEW_RULE_RESOLVER::Clearance().

◆ IsMultilayer()

bool LAYER_RANGE::IsMultilayer ( ) const
inline

◆ Merge()

void LAYER_RANGE::Merge ( const LAYER_RANGE aOther)
inline

Definition at line 92 of file pns_layerset.h.

93 {
94 if( m_start < 0 || m_end < 0 )
95 {
96 m_start = aOther.m_start;
97 m_end = aOther.m_end;
98 return;
99 }
100
101 if( aOther.m_start < m_start )
102 m_start = aOther.m_start;
103
104 if( aOther.m_end > m_end )
105 m_end = aOther.m_end;
106 }

References m_end, and m_start.

Referenced by PNS::JOINT::Merge().

◆ operator!=()

bool LAYER_RANGE::operator!= ( const LAYER_RANGE aOther) const
inline

Definition at line 135 of file pns_layerset.h.

136 {
137 return ( m_start != aOther.m_start ) || ( m_end != aOther.m_end );
138 }

References m_end, and m_start.

◆ operator=()

LAYER_RANGE & LAYER_RANGE::operator= ( const LAYER_RANGE aB)
inline

Definition at line 60 of file pns_layerset.h.

61 {
62 m_start = aB.m_start;
63 m_end = aB.m_end;
64 return *this;
65 }

References m_end, and m_start.

◆ operator==()

bool LAYER_RANGE::operator== ( const LAYER_RANGE aOther) const
inline

Definition at line 130 of file pns_layerset.h.

131 {
132 return ( m_start == aOther.m_start ) && ( m_end == aOther.m_end );
133 }

References m_end, and m_start.

◆ Overlaps() [1/2]

bool LAYER_RANGE::Overlaps ( const int  aLayer) const
inline

Definition at line 72 of file pns_layerset.h.

73 {
74 return aLayer >= m_start && aLayer <= m_end;
75 }

References m_end, and m_start.

◆ Overlaps() [2/2]

◆ Start()

Member Data Documentation

◆ m_end

int LAYER_RANGE::m_end
private

◆ m_start

int LAYER_RANGE::m_start
private

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