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_MODULE_T, PCB_PAD_T, PCB_LINE_T,
  PCB_TEXT_T, PCB_MODULE_TEXT_T, PCB_MODULE_EDGE_T, PCB_MODULE_ZONE_AREA_T,
  PCB_TRACE_T, PCB_VIA_T, PCB_MARKER_T, PCB_DIMENSION_T,
  PCB_TARGET_T, PCB_ZONE_AREA_T, PCB_ITEM_LIST_T, PCB_NETINFO_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_LOCATE_ANY_T, SCH_SCREEN_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_MODULE_T 

class MODULE, a footprint

PCB_PAD_T 

class D_PAD, a pad in a footprint

PCB_LINE_T 

class DRAWSEGMENT, a segment not on copper layers

PCB_TEXT_T 

class TEXTE_PCB, text on a layer

PCB_MODULE_TEXT_T 

class TEXTE_MODULE, text in a footprint

PCB_MODULE_EDGE_T 

class EDGE_MODULE, a footprint edge

PCB_MODULE_ZONE_AREA_T 

class ZONE_CONTAINER, 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_MARKER_T 

class MARKER_PCB, a marker used to show something

PCB_DIMENSION_T 

class DIMENSION, a dimension (graphic item)

PCB_TARGET_T 

class PCB_TARGET, a target (graphic item)

PCB_ZONE_AREA_T 

class ZONE_CONTAINER, a zone 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

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_LOCATE_ANY_T 
SCH_SCREEN_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
89  PCB_MODULE_T,
90  PCB_PAD_T,
91  PCB_LINE_T,
92  PCB_TEXT_T,
96  PCB_TRACE_T,
97  PCB_VIA_T,
98  PCB_MARKER_T,
100  PCB_TARGET_T,
103  PCB_NETINFO_T,
104 
105  // Schematic draw Items. The order of these items effects the sort order.
106  // It is currently ordered to mimic the old Eeschema locate behavior where
107  // the smallest item is the selected item.
108  SCH_MARKER_T,
113  SCH_LINE_T,
114  SCH_BITMAP_T,
115  SCH_TEXT_T,
116  SCH_LABEL_T,
119  SCH_FIELD_T,
122  SCH_SHEET_T,
123  SCH_PIN_T,
124 
125  // Be prudent with these types:
126  // they should be used only to locate a specific field type
127  // among SCH_FIELD_T items types
128  // N.B. If you add a type here, be sure to add it below to the BaseType()
133 
134  // Same for picking wires and busses from SCH_LINE_T items
138 
139  // Same for picking labels attached to wires and/or busses
142 
143  // matches any type
145 
146  // General
147  SCH_SCREEN_T,
148 
149  /*
150  * Draw items in library component.
151  *
152  * The order of these items effects the sort order for items inside the
153  * "DRAW/ENDDRAW" section of the component definition in a library file.
154  * If you add a new draw item, type, please make sure you add it so the
155  * sort order is logical.
156  */
157  LIB_PART_T,
158  LIB_ALIAS_T,
159  LIB_ARC_T,
160  LIB_CIRCLE_T,
161  LIB_TEXT_T,
164  LIB_BEZIER_T,
165  LIB_PIN_T,
166 
167  /*
168  * Fields are not saved inside the "DRAW/ENDDRAW". Add new draw item
169  * types before this line.
170  */
171  LIB_FIELD_T,
172 
173  /*
174  * For GerbView: item types:
175  */
179 
180  /*
181  * For Pl_Editor: item types:
182  */
183  WSG_LINE_T,
184  WSG_RECT_T,
185  WSG_POLY_T,
186  WSG_TEXT_T,
187  WSG_BITMAP_T,
188  WSG_PAGE_T,
189 
190  // serialized layout used in undo/redo commands
191  WS_PROXY_UNDO_ITEM_T, // serialized layout used in undo/redo commands
192  WS_PROXY_UNDO_ITEM_PLUS_T, // serialized layout plus page and title block settings
193 
194  /*
195  * FOR PROJECT::_ELEMs
196  */
199  PART_LIBS_T,
201  S3D_CACHE_T,
202 
203  // End value
205 };
Definition: typeinfo.h:85
the 3d code uses this value
Definition: typeinfo.h:80
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:101
class TEXTE_PCB, text on a layer
Definition: typeinfo.h:92
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
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 MODULE, a footprint
Definition: typeinfo.h:89
class BOARD_ITEM_LIST, a list of board items
Definition: typeinfo.h:102
class DIMENSION, a dimension (graphic item)
Definition: typeinfo.h:99
class PCB_TARGET, a target (graphic item)
Definition: typeinfo.h:100
class TEXTE_MODULE, text in a footprint
Definition: typeinfo.h:93
class MARKER_PCB, a marker used to show something
Definition: typeinfo.h:98
class NETINFO_ITEM, a description of a net
Definition: typeinfo.h:103
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97
class ZONE_CONTAINER, managed by a footprint
Definition: typeinfo.h:95
class DRAWSEGMENT, 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 213 of file typeinfo.h.

References 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 EE_RTREE::EE_TYPE::EE_TYPE().

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