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_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_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_LIST_T, GERBER_IMAGE_T, TYPE_PL_EDITOR_LAYOUT, SYMBOL_LIB_TABLE_T,
  FP_LIB_TABLE_T, PART_LIBS_T, SEARCH_STACK_T, CACHE_WRAPPER_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...
 

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_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_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_LIST_T 
GERBER_IMAGE_T 
TYPE_PL_EDITOR_LAYOUT 
SYMBOL_LIB_TABLE_T 
FP_LIB_TABLE_T 
PART_LIBS_T 
SEARCH_STACK_T 
CACHE_WRAPPER_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,
95  PCB_TRACE_T,
96  PCB_VIA_T,
97  PCB_MARKER_T,
99  PCB_TARGET_T,
102  PCB_NETINFO_T,
103 
104  // Schematic draw Items. The order of these items effects the sort order.
105  // It is currently ordered to mimic the old Eeschema locate behavior where
106  // the smallest item is the selected item.
107  SCH_MARKER_T,
112  SCH_LINE_T,
113  SCH_BITMAP_T,
114  SCH_TEXT_T,
115  SCH_LABEL_T,
118  SCH_FIELD_T,
121  SCH_SHEET_T,
122  SCH_PIN_T,
123 
124  // Be prudent with these 3 types:
125  // they should be used only to locate a specific field type
126  // among SCH_FIELD_T items types
131 
132  // Same for picking wires and busses from SCH_LINE_T items
136 
137  // matches any type
139 
140  // General
141  SCH_SCREEN_T,
142 
143  /*
144  * Draw items in library component.
145  *
146  * The order of these items effects the sort order for items inside the
147  * "DRAW/ENDDRAW" section of the component definition in a library file.
148  * If you add a new draw item, type, please make sure you add it so the
149  * sort order is logical.
150  */
151  LIB_PART_T,
152  LIB_ALIAS_T,
153  LIB_ARC_T,
154  LIB_CIRCLE_T,
155  LIB_TEXT_T,
158  LIB_BEZIER_T,
159  LIB_PIN_T,
160 
161  /*
162  * Fields are not saved inside the "DRAW/ENDDRAW". Add new draw item
163  * types before this line.
164  */
165  LIB_FIELD_T,
166 
167  /*
168  * For GerbView: items type:
169  */
174 
175  /*
176  * for Pl_Editor, in undo/redo commands
177  */
179 
180  /*
181  * FOR PROJECT::_ELEMs
182  */
185  PART_LIBS_T,
188 
189  // End value
191 };
Definition: typeinfo.h:85
the 3d code uses this value
Definition: typeinfo.h:80
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:100
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:95
class MODULE, a footprint
Definition: typeinfo.h:89
class BOARD_ITEM_LIST, a list of board items
Definition: typeinfo.h:101
class DIMENSION, a dimension (graphic item)
Definition: typeinfo.h:98
class PCB_TARGET, a target (graphic item)
Definition: typeinfo.h:99
class TEXTE_MODULE, text in a footprint
Definition: typeinfo.h:93
class MARKER_PCB, a marker used to show something
Definition: typeinfo.h:97
class NETINFO_ITEM, a description of a net
Definition: typeinfo.h:102
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
class DRAWSEGMENT, a segment not on copper layers
Definition: typeinfo.h:91

Function Documentation

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