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_ZONE_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_HIERARCHICAL_LABEL_T, SCH_FIELD_T,
  SCH_COMPONENT_T, SCH_SHEET_PIN_T, SCH_SHEET_T, SCH_FIELD_LOCATE_REFERENCE_T,
  SCH_FIELD_LOCATE_VALUE_T, SCH_FIELD_LOCATE_FOOTPRINT_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, 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

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_ZONE_T 

class SEGZONE, a segment used to fill a zone area (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_HIERARCHICAL_LABEL_T 
SCH_FIELD_T 
SCH_COMPONENT_T 
SCH_SHEET_PIN_T 
SCH_SHEET_T 
SCH_FIELD_LOCATE_REFERENCE_T 
SCH_FIELD_LOCATE_VALUE_T 
SCH_FIELD_LOCATE_FOOTPRINT_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 
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_ZONE_T,
98  PCB_MARKER_T,
101  PCB_TARGET_T,
104  PCB_NETINFO_T,
105 
106  // Schematic draw Items. The order of these items effects the sort order.
107  // It is currently ordered to mimic the old Eeschema locate behavior where
108  // the smallest item is the selected item.
109  SCH_MARKER_T,
114  SCH_LINE_T,
115  SCH_BITMAP_T,
116  SCH_TEXT_T,
117  SCH_LABEL_T,
120  SCH_FIELD_T,
123  SCH_SHEET_T,
124 
125  // Be prudent with these 3 types:
126  // they should be used only to locate a specific field type
127  // among SCH_FIELD_T items types
131 
132  // General
133  SCH_SCREEN_T,
134 
135  /*
136  * Draw items in library component.
137  *
138  * The order of these items effects the sort order for items inside the
139  * "DRAW/ENDDRAW" section of the component definition in a library file.
140  * If you add a new draw item, type, please make sure you add it so the
141  * sort order is logical.
142  */
143  LIB_PART_T,
144  LIB_ALIAS_T,
145  LIB_ARC_T,
146  LIB_CIRCLE_T,
147  LIB_TEXT_T,
150  LIB_BEZIER_T,
151  LIB_PIN_T,
152 
153  /*
154  * Fields are not saved inside the "DRAW/ENDDRAW". Add new draw item
155  * types before this line.
156  */
157  LIB_FIELD_T,
158 
159  /*
160  * For GerbView: items type:
161  */
166 
167  /*
168  * for Pl_Editor, in undo/redo commands
169  */
171 
172  // End value
174 };
Definition: typeinfo.h:85
the 3d code uses this value
Definition: typeinfo.h:80
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:102
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:103
class SEGZONE, a segment used to fill a zone area (segment on a copper layer)
Definition: typeinfo.h:97
class DIMENSION, a dimension (graphic item)
Definition: typeinfo.h:100
class PCB_TARGET, a target (graphic item)
Definition: typeinfo.h:101
class TEXTE_MODULE, text in a footprint
Definition: typeinfo.h:93
class MARKER_PCB, a marker used to show something
Definition: typeinfo.h:99
class NETINFO_ITEM, a description of a net
Definition: typeinfo.h:104
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

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.

Referenced by Abort_Create_Track(), PNS::TOPOLOGY::AssembleTrivialPath(), CmpHoleSorting(), GERBER_WRITER::createDrillFile(), PCB_TOOL::doInteractiveItemPlacement(), FOOTPRINT_EDIT_FRAME::Edit_Edge_Layer(), FOOTPRINT_EDIT_FRAME::Edit_Edge_Width(), PCB_EDIT_FRAME::Edit_Zone_Params(), MODULE::GetFootprintRect(), DRAWING_TOOL::getSourceZoneForAction(), BRDITEMS_PLOTTER::Plot_Edges_Modules(), BRDITEMS_PLOTTER::PlotAllTextsModule(), BRDITEMS_PLOTTER::PlotDrillMarks(), PlotLayerOutlines(), PlotSolderMaskLayer(), PlotStandardLayer(), PNS::OPTIMIZER::smartPadsSingle(), EDIT_TOOL::uniqueSelected(), and PCB_EDITOR_CONTROL::ZoneDuplicate().

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