KiCad PCB EDA Suite
LAYER_RANGE Class Reference

Class LAYER_RANGE. 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 ()
 
const 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)
 
bool operator== (const LAYER_RANGE &aOther) const
 
bool operator!= (const LAYER_RANGE &aOther) const
 

Static Public Member Functions

static LAYER_RANGE All ()
 

Shortcut for comparisons/overlap tests

More...
 

Private Attributes

int m_start
 
int m_end
 

Detailed Description

Class LAYER_RANGE.

Represents a contiguous set of PCB layers.

Definition at line 32 of file pns_layerset.h.

Constructor & Destructor Documentation

LAYER_RANGE::LAYER_RANGE ( )
inline

Definition at line 35 of file pns_layerset.h.

Referenced by All().

35  :
36  m_start( -1 ),
37  m_end( -1 )
38  {};
LAYER_RANGE::LAYER_RANGE ( int  aStart,
int  aEnd 
)
inline

Definition at line 40 of file pns_layerset.h.

References m_end, and m_start.

41  {
42  if( aStart > aEnd )
43  std::swap( aStart, aEnd );
44 
45  m_start = aStart;
46  m_end = aEnd;
47  }
LAYER_RANGE::LAYER_RANGE ( int  aLayer)
inline

Definition at line 49 of file pns_layerset.h.

References m_end, and m_start.

50  {
51  m_start = m_end = aLayer;
52  }
LAYER_RANGE::LAYER_RANGE ( const LAYER_RANGE aB)
inline

Definition at line 54 of file pns_layerset.h.

54  :
55  m_start( aB.m_start ),
56  m_end( aB.m_end )
57  {}
LAYER_RANGE::~LAYER_RANGE ( )
inline

Definition at line 59 of file pns_layerset.h.

59 {};

Member Function Documentation

static LAYER_RANGE LAYER_RANGE::All ( )
inlinestatic

Shortcut for comparisons/overlap tests

Definition at line 110 of file pns_layerset.h.

References LAYER_RANGE().

111  {
112  return LAYER_RANGE( 0, 256 ); // fixme: use layer IDs header
113  }
int LAYER_RANGE::End ( ) const
inline

Definition at line 88 of file pns_layerset.h.

References m_end.

Referenced by PNS_KICAD_IFACE::AddItem(), PNS::JOINT::Dump(), PNS::LOGGER::Log(), and PNS::INDEX::Query().

89  {
90  return m_end;
91  }
bool LAYER_RANGE::IsMultilayer ( ) const
inline

Definition at line 78 of file pns_layerset.h.

References m_end, and m_start.

Referenced by PNS::INDEX::getSubindex(), and PNS::INDEX::Query().

79  {
80  return m_start != m_end;
81  }
void LAYER_RANGE::Merge ( const LAYER_RANGE aOther)
inline

Definition at line 93 of file pns_layerset.h.

References m_end, and m_start.

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

94  {
95  if( m_start < 0 || m_end < 0 )
96  {
97  m_start = aOther.m_start;
98  m_end = aOther.m_end;
99  return;
100  }
101 
102  if( aOther.m_start < m_start )
103  m_start = aOther.m_start;
104 
105  if( aOther.m_end > m_end )
106  m_end = aOther.m_end;
107  }
bool LAYER_RANGE::operator!= ( const LAYER_RANGE aOther) const
inline

Definition at line 120 of file pns_layerset.h.

References m_end, and m_start.

121  {
122  return ( m_start != aOther.m_start ) || ( m_end != aOther.m_end );
123  }
const LAYER_RANGE& LAYER_RANGE::operator= ( const LAYER_RANGE aB)
inline

Definition at line 61 of file pns_layerset.h.

References m_end, and m_start.

62  {
63  m_start = aB.m_start;
64  m_end = aB.m_end;
65  return *this;
66  }
bool LAYER_RANGE::operator== ( const LAYER_RANGE aOther) const
inline

Definition at line 115 of file pns_layerset.h.

References m_end, and m_start.

116  {
117  return ( m_start == aOther.m_start ) && ( m_end == aOther.m_end );
118  }
bool LAYER_RANGE::Overlaps ( const int  aLayer) const
inline

Definition at line 73 of file pns_layerset.h.

References m_end, and m_start.

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

Member Data Documentation

int LAYER_RANGE::m_end
private
int LAYER_RANGE::m_start
private

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