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
}
 The set of class identification values stored in EDA_ITEM::m_structType. More...
 

Functions

template<class T , class I >
bool IsA (const I *aObject)
 Checks if the type of aObject is T. More...
 
template<class T , class I >
bool IsA (const I &aObject)
 
template<class Casted , class From >
Casted dyn_cast (From aObject)
 A lightweight dynamic downcast. 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

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 77 of file typeinfo.h.

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

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 235 of file typeinfo.h.

236 {
237  switch( aType )
238  {
243  return SCH_FIELD_T;
244 
248  return SCH_LINE_T;
249 
252  return SCH_LABEL_T;
253 
255  return SCH_COMPONENT_T;
256 
257  case PCB_LOCATE_HOLE_T:
258  case PCB_LOCATE_PTH_T:
259  case PCB_LOCATE_NPTH_T:
260  return PCB_LOCATE_HOLE_T;
261 
262  case PCB_DIM_ALIGNED_T:
263  case PCB_DIM_CENTER_T:
265  case PCB_DIM_LEADER_T:
266  return PCB_DIMENSION_T;
267 
268  default:
269  return aType;
270  }
271 }
class ALIGNED_DIMENSION, a linear dimension (graphic item)
Definition: typeinfo.h:100
class LEADER, a leader dimension (graphic item)
Definition: typeinfo.h:101
class CENTER_DIMENSION, a center point marking (graphic item)
Definition: typeinfo.h:102
class DIMENSION_BASE: abstract dimension meta-type
Definition: typeinfo.h:99
class ORTHOGONAL_DIMENSION, a linear dimension constrained to x/y
Definition: typeinfo.h:103

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(), PCB_POINT_EDITOR::OnSelectionChange(), and PCB_VIEWER_TOOLS::TextOutlines().

◆ dyn_cast()

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

A lightweight dynamic downcast.

Cast 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)

Checks if the type of aObject is T.

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

Definition at line 40 of file typeinfo.h.

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

◆ IsA() [2/2]

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

Definition at line 46 of file typeinfo.h.

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