KiCad PCB EDA Suite
typeinfo.h File Reference
#include <type_traits>

Go to the source code of this file.

Enumerations

enum  KICAD_T {
  NOT_USED = -1, EOT = 0, TYPE_NOT_INIT = 0, PCB_T,
  SCREEN_T, PCB_FOOTPRINT_T, PCB_PAD_T, PCB_SHAPE_T,
  PCB_TEXT_T, PCB_FP_TEXT_T, PCB_FP_SHAPE_T, PCB_FP_ZONE_T,
  PCB_TRACE_T, PCB_VIA_T, PCB_ARC_T, PCB_MARKER_T,
  PCB_DIMENSION_T, PCB_DIM_ALIGNED_T, PCB_DIM_LEADER_T, PCB_DIM_CENTER_T,
  PCB_DIM_ORTHOGONAL_T, PCB_TARGET_T, PCB_ZONE_T, PCB_ITEM_LIST_T,
  PCB_NETINFO_T, PCB_GROUP_T, PCB_LOCATE_STDVIA_T, PCB_LOCATE_UVIA_T,
  PCB_LOCATE_BBVIA_T, PCB_LOCATE_TEXT_T, PCB_LOCATE_GRAPHIC_T, PCB_LOCATE_HOLE_T,
  PCB_LOCATE_PTH_T, PCB_LOCATE_NPTH_T, PCB_LOCATE_BOARD_EDGE_T, SCH_MARKER_T,
  SCH_JUNCTION_T, SCH_NO_CONNECT_T, SCH_BUS_WIRE_ENTRY_T, SCH_BUS_BUS_ENTRY_T,
  SCH_LINE_T, SCH_BITMAP_T, SCH_TEXT_T, SCH_LABEL_T,
  SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_FIELD_T, SCH_COMPONENT_T,
  SCH_SHEET_PIN_T, SCH_SHEET_T, SCH_PIN_T, SCH_FIELD_LOCATE_REFERENCE_T,
  SCH_FIELD_LOCATE_VALUE_T, SCH_FIELD_LOCATE_FOOTPRINT_T, SCH_FIELD_LOCATE_DATASHEET_T, SCH_LINE_LOCATE_WIRE_T,
  SCH_LINE_LOCATE_BUS_T, SCH_LINE_LOCATE_GRAPHIC_LINE_T, SCH_LABEL_LOCATE_WIRE_T, SCH_LABEL_LOCATE_BUS_T,
  SCH_COMPONENT_LOCATE_POWER_T, SCH_LOCATE_ANY_T, SCH_SCREEN_T, SCHEMATIC_T,
  LIB_PART_T, LIB_ALIAS_T, LIB_ARC_T, LIB_CIRCLE_T,
  LIB_TEXT_T, LIB_RECTANGLE_T, LIB_POLYLINE_T, LIB_BEZIER_T,
  LIB_PIN_T, LIB_FIELD_T, GERBER_LAYOUT_T, GERBER_DRAW_ITEM_T,
  GERBER_IMAGE_T, WSG_LINE_T, WSG_RECT_T, WSG_POLY_T,
  WSG_TEXT_T, WSG_BITMAP_T, WSG_PAGE_T, WS_PROXY_UNDO_ITEM_T,
  WS_PROXY_UNDO_ITEM_PLUS_T, SYMBOL_LIB_TABLE_T, FP_LIB_TABLE_T, PART_LIBS_T,
  SEARCH_STACK_T, S3D_CACHE_T, MAX_STRUCT_TYPE_ID
}
 Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_structType. More...
 

Functions

template<class T , class I >
bool IsA (const I *aObject)
 Function IsA() More...
 
template<class T , class I >
bool IsA (const I &aObject)
 
template<class Casted , class From >
Casted dyn_cast (From aObject)
 Function dyn_cast() More...
 
constexpr KICAD_T BaseType (const KICAD_T aType)
 Returns the underlying type of the given type. More...
 

Enumeration Type Documentation

◆ KICAD_T

enum KICAD_T

Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_structType.

Enumerator
NOT_USED 

the 3d code uses this value

EOT 

search types array terminator (End Of Types)

TYPE_NOT_INIT 
PCB_T 
SCREEN_T 

not really an item, used to identify a screen

PCB_FOOTPRINT_T 

class FOOTPRINT, a footprint

PCB_PAD_T 

class PAD, a pad in a footprint

PCB_SHAPE_T 

class PCB_SHAPE, a segment not on copper layers

PCB_TEXT_T 

class PCB_TEXT, text on a layer

PCB_FP_TEXT_T 

class FP_TEXT, text in a footprint

PCB_FP_SHAPE_T 

class FP_SHAPE, a footprint edge

PCB_FP_ZONE_T 

class ZONE, managed by a footprint

PCB_TRACE_T 

class TRACK, a track segment (segment on a copper layer)

PCB_VIA_T 

class VIA, a via (like a track segment on a copper layer)

PCB_ARC_T 

class ARC, an arc track segment on a copper layer

PCB_MARKER_T 

class MARKER_PCB, a marker used to show something

PCB_DIMENSION_T 

class DIMENSION_BASE: abstract dimension meta-type

PCB_DIM_ALIGNED_T 

class ALIGNED_DIMENSION, a linear dimension (graphic item)

PCB_DIM_LEADER_T 

class LEADER, a leader dimension (graphic item)

PCB_DIM_CENTER_T 

class CENTER_DIMENSION, a center point marking (graphic item)

PCB_DIM_ORTHOGONAL_T 

class ORTHOGONAL_DIMENSION, a linear dimension constrained to x/y

PCB_TARGET_T 

class PCB_TARGET, a target (graphic item)

PCB_ZONE_T 

class ZONE, a copper pour area

PCB_ITEM_LIST_T 

class BOARD_ITEM_LIST, a list of board items

PCB_NETINFO_T 

class NETINFO_ITEM, a description of a net

PCB_GROUP_T 

class PCB_GROUP, a set of BOARD_ITEMs

PCB_LOCATE_STDVIA_T 
PCB_LOCATE_UVIA_T 
PCB_LOCATE_BBVIA_T 
PCB_LOCATE_TEXT_T 
PCB_LOCATE_GRAPHIC_T 
PCB_LOCATE_HOLE_T 
PCB_LOCATE_PTH_T 
PCB_LOCATE_NPTH_T 
PCB_LOCATE_BOARD_EDGE_T 
SCH_MARKER_T 
SCH_JUNCTION_T 
SCH_NO_CONNECT_T 
SCH_BUS_WIRE_ENTRY_T 
SCH_BUS_BUS_ENTRY_T 
SCH_LINE_T 
SCH_BITMAP_T 
SCH_TEXT_T 
SCH_LABEL_T 
SCH_GLOBAL_LABEL_T 
SCH_HIER_LABEL_T 
SCH_FIELD_T 
SCH_COMPONENT_T 
SCH_SHEET_PIN_T 
SCH_SHEET_T 
SCH_PIN_T 
SCH_FIELD_LOCATE_REFERENCE_T 
SCH_FIELD_LOCATE_VALUE_T 
SCH_FIELD_LOCATE_FOOTPRINT_T 
SCH_FIELD_LOCATE_DATASHEET_T 
SCH_LINE_LOCATE_WIRE_T 
SCH_LINE_LOCATE_BUS_T 
SCH_LINE_LOCATE_GRAPHIC_LINE_T 
SCH_LABEL_LOCATE_WIRE_T 
SCH_LABEL_LOCATE_BUS_T 
SCH_COMPONENT_LOCATE_POWER_T 
SCH_LOCATE_ANY_T 
SCH_SCREEN_T 
SCHEMATIC_T 
LIB_PART_T 
LIB_ALIAS_T 
LIB_ARC_T 
LIB_CIRCLE_T 
LIB_TEXT_T 
LIB_RECTANGLE_T 
LIB_POLYLINE_T 
LIB_BEZIER_T 
LIB_PIN_T 
LIB_FIELD_T 
GERBER_LAYOUT_T 
GERBER_DRAW_ITEM_T 
GERBER_IMAGE_T 
WSG_LINE_T 
WSG_RECT_T 
WSG_POLY_T 
WSG_TEXT_T 
WSG_BITMAP_T 
WSG_PAGE_T 
WS_PROXY_UNDO_ITEM_T 
WS_PROXY_UNDO_ITEM_PLUS_T 
SYMBOL_LIB_TABLE_T 
FP_LIB_TABLE_T 
PART_LIBS_T 
SEARCH_STACK_T 
S3D_CACHE_T 
MAX_STRUCT_TYPE_ID 

Definition at line 78 of file typeinfo.h.

79 {
80  NOT_USED = -1,
81 
82  EOT = 0,
83 
84  TYPE_NOT_INIT = 0,
85  PCB_T,
86  SCREEN_T,
87 
88  // Items in pcb
90  PCB_PAD_T,
91  PCB_SHAPE_T,
92  PCB_TEXT_T,
96  PCB_TRACE_T,
97  PCB_VIA_T,
98  PCB_ARC_T,
99  PCB_MARKER_T,
105  PCB_TARGET_T,
106  PCB_ZONE_T,
108  PCB_NETINFO_T,
109  PCB_GROUP_T,
110 
120 
121  // Schematic draw Items. The order of these items effects the sort order.
122  // It is currently ordered to mimic the old Eeschema locate behavior where
123  // the smallest item is the selected item.
124  SCH_MARKER_T,
129  SCH_LINE_T,
130  SCH_BITMAP_T,
131  SCH_TEXT_T,
132  SCH_LABEL_T,
135  SCH_FIELD_T,
138  SCH_SHEET_T,
139  SCH_PIN_T,
140 
141  // Be prudent with these types:
142  // they should be used only to locate a specific field type among SCH_FIELD_Ts
143  // N.B. If you add a type here, be sure to add it below to the BaseType()
148 
149  // Same for picking wires and buses from SCH_LINE_T items
153 
154  // Same for picking labels attached to wires and/or buses
157 
158  // Same for picking components which are power symbols
160 
161  // matches any type
163 
164  // General
165  SCH_SCREEN_T,
166 
167  SCHEMATIC_T,
168 
169  /*
170  * Draw items in library component.
171  *
172  * The order of these items effects the sort order for items inside the
173  * "DRAW/ENDDRAW" section of the component definition in a library file.
174  * If you add a new draw item, type, please make sure you add it so the
175  * sort order is logical.
176  */
177  LIB_PART_T,
178  LIB_ALIAS_T,
179  LIB_ARC_T,
180  LIB_CIRCLE_T,
181  LIB_TEXT_T,
184  LIB_BEZIER_T,
185  LIB_PIN_T,
186 
187  /*
188  * Fields are not saved inside the "DRAW/ENDDRAW". Add new draw item
189  * types before this line.
190  */
191  LIB_FIELD_T,
192 
193  /*
194  * For GerbView: item types:
195  */
199 
200  /*
201  * For Pl_Editor: item types:
202  */
203  WSG_LINE_T,
204  WSG_RECT_T,
205  WSG_POLY_T,
206  WSG_TEXT_T,
207  WSG_BITMAP_T,
208  WSG_PAGE_T,
209 
210  // serialized layout used in undo/redo commands
211  WS_PROXY_UNDO_ITEM_T, // serialized layout used in undo/redo commands
212  WS_PROXY_UNDO_ITEM_PLUS_T, // serialized layout plus page and title block settings
213 
214  /*
215  * FOR PROJECT::_ELEMs
216  */
219  PART_LIBS_T,
221  S3D_CACHE_T,
222 
223  // End value
225 };
class ALIGNED_DIMENSION, a linear dimension (graphic item)
Definition: typeinfo.h:101
class LEADER, a leader dimension (graphic item)
Definition: typeinfo.h:102
Definition: typeinfo.h:85
class FP_TEXT, text in a footprint
Definition: typeinfo.h:93
class PCB_GROUP, a set of BOARD_ITEMs
Definition: typeinfo.h:109
class CENTER_DIMENSION, a center point marking (graphic item)
Definition: typeinfo.h:103
the 3d code uses this value
Definition: typeinfo.h:80
class PCB_TEXT, text on a layer
Definition: typeinfo.h:92
class ARC, an arc track segment on a copper layer
Definition: typeinfo.h:98
class FP_SHAPE, a footprint edge
Definition: typeinfo.h:94
class PAD, a pad in a footprint
Definition: typeinfo.h:90
search types array terminator (End Of Types)
Definition: typeinfo.h:82
not really an item, used to identify a screen
Definition: typeinfo.h:86
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:96
class BOARD_ITEM_LIST, a list of board items
Definition: typeinfo.h:107
class ZONE, a copper pour area
Definition: typeinfo.h:106
class DIMENSION_BASE: abstract dimension meta-type
Definition: typeinfo.h:100
class PCB_TARGET, a target (graphic item)
Definition: typeinfo.h:105
class FOOTPRINT, a footprint
Definition: typeinfo.h:89
class MARKER_PCB, a marker used to show something
Definition: typeinfo.h:99
class NETINFO_ITEM, a description of a net
Definition: typeinfo.h:108
class ZONE, managed by a footprint
Definition: typeinfo.h:95
class ORTHOGONAL_DIMENSION, a linear dimension constrained to x/y
Definition: typeinfo.h:104
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97
class PCB_SHAPE, a segment not on copper layers
Definition: typeinfo.h:91

Function Documentation

◆ BaseType()

constexpr KICAD_T BaseType ( const KICAD_T  aType)

Returns the underlying type of the given type.

This is useful for finding the element type given one of the "non-type" types such as SCH_LINE_LOCATE_WIRE_T

Parameters
aTypeGiven type to resolve
Returns
Base type

Definition at line 233 of file typeinfo.h.

234 {
235  switch( aType )
236  {
241  return SCH_FIELD_T;
242 
246  return SCH_LINE_T;
247 
250  return SCH_LABEL_T;
251 
253  return SCH_COMPONENT_T;
254 
255  case PCB_LOCATE_HOLE_T:
256  case PCB_LOCATE_PTH_T:
257  case PCB_LOCATE_NPTH_T:
258  return PCB_LOCATE_HOLE_T;
259 
260  case PCB_DIM_ALIGNED_T:
261  case PCB_DIM_CENTER_T:
263  case PCB_DIM_LEADER_T:
264  return PCB_DIMENSION_T;
265 
266  default:
267  return aType;
268  }
269 }
class ALIGNED_DIMENSION, a linear dimension (graphic item)
Definition: typeinfo.h:101
class LEADER, a leader dimension (graphic item)
Definition: typeinfo.h:102
class CENTER_DIMENSION, a center point marking (graphic item)
Definition: typeinfo.h:103
class DIMENSION_BASE: abstract dimension meta-type
Definition: typeinfo.h:100
class ORTHOGONAL_DIMENSION, a linear dimension constrained to x/y
Definition: typeinfo.h:104

References PCB_DIM_ALIGNED_T, PCB_DIM_CENTER_T, PCB_DIM_LEADER_T, PCB_DIM_ORTHOGONAL_T, PCB_DIMENSION_T, PCB_LOCATE_HOLE_T, PCB_LOCATE_NPTH_T, PCB_LOCATE_PTH_T, SCH_COMPONENT_LOCATE_POWER_T, SCH_COMPONENT_T, SCH_FIELD_LOCATE_DATASHEET_T, SCH_FIELD_LOCATE_FOOTPRINT_T, SCH_FIELD_LOCATE_REFERENCE_T, SCH_FIELD_LOCATE_VALUE_T, SCH_FIELD_T, SCH_LABEL_LOCATE_BUS_T, SCH_LABEL_LOCATE_WIRE_T, SCH_LABEL_T, SCH_LINE_LOCATE_BUS_T, SCH_LINE_LOCATE_GRAPHIC_LINE_T, SCH_LINE_LOCATE_WIRE_T, and SCH_LINE_T.

Referenced by DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES(), EE_RTREE::EE_TYPE::EE_TYPE(), DRC_TEST_PROVIDER::forEachGeometryItem(), PCB_VIEWER_TOOLS::GraphicOutlines(), POINT_EDITOR::OnSelectionChange(), and PCB_VIEWER_TOOLS::TextOutlines().

◆ dyn_cast()

template<class Casted , class From >
Casted dyn_cast ( From  aObject)

Function dyn_cast()

A lightweight dynamic downcast. Casts aObject to type Casted*. Uses EDA_ITEM::Type() and EDA_ITEM::ClassOf() to check if type matches.

Parameters
aObjectobject to be casted
Returns
down-casted object or NULL if type doesn't match Casted.

Definition at line 61 of file typeinfo.h.

62 {
63  if( std::remove_pointer<Casted>::type::ClassOf ( aObject ) )
64  return static_cast<Casted>( aObject );
65 
66  return nullptr;
67 }

◆ IsA() [1/2]

template<class T , class I >
bool IsA ( const I aObject)

Function IsA()

Checks if the type of aObject is T.

Parameters
aObjectobject for type check
Returns
true, if aObject type equals T.

Definition at line 41 of file typeinfo.h.

42 {
43  return aObject && std::remove_pointer<T>::type::ClassOf( aObject );
44 }

◆ IsA() [2/2]

template<class T , class I >
bool IsA ( const I aObject)

Definition at line 47 of file typeinfo.h.

48 {
49  return std::remove_pointer<T>::type::ClassOf( &aObject );
50 }