KiCad PCB EDA Suite
Loading...
Searching...
No Matches
api_sch_enums.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 * @author Jon Evans <[email protected]>
6 *
7 * This program is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
21#include <api/api_enums.h>
22#include <wx/wx.h>
23
24#include <core/typeinfo.h>
25#include <erc/erc_settings.h>
26#include <layer_ids.h>
27#include <lib_symbol.h>
28#include <pin_type.h>
29#include <sch_symbol.h>
30#include <sch_label.h>
31#include <sch_sheet_pin.h>
32#include <symbol.h>
33#include <api/schematic/schematic_rules.pb.h>
34#include <api/schematic/schematic_types.pb.h>
35
36using namespace kiapi::schematic;
37
38
39template<>
40types::SchematicLabelShape ToProtoEnum( LABEL_FLAG_SHAPE aValue )
41{
42 switch( aValue )
43 {
44 case LABEL_FLAG_SHAPE::L_INPUT: return types::SchematicLabelShape::SLSH_INPUT;
45 case LABEL_FLAG_SHAPE::L_OUTPUT: return types::SchematicLabelShape::SLSH_OUTPUT;
46 case LABEL_FLAG_SHAPE::L_BIDI: return types::SchematicLabelShape::SLSH_BIDI;
47 case LABEL_FLAG_SHAPE::L_TRISTATE: return types::SchematicLabelShape::SLSH_TRISTATE;
48 case LABEL_FLAG_SHAPE::L_UNSPECIFIED: return types::SchematicLabelShape::SLSH_PASSIVE;
49 case LABEL_FLAG_SHAPE::F_DOT: return types::SchematicLabelShape::SLSH_DOT;
50 case LABEL_FLAG_SHAPE::F_ROUND: return types::SchematicLabelShape::SLSH_CIRCLE;
51 case LABEL_FLAG_SHAPE::F_DIAMOND: return types::SchematicLabelShape::SLSH_DIAMOND;
52 case LABEL_FLAG_SHAPE::F_RECTANGLE: return types::SchematicLabelShape::SLSH_RECTANGLE;
53
54 default:
55 wxCHECK_MSG( false, types::SchematicLabelShape::SLSH_UNKNOWN,
56 "Unhandled case in ToProtoEnum<LABEL_FLAG_SHAPE>" );
57 }
58}
59
60
61template<>
62LABEL_FLAG_SHAPE FromProtoEnum( types::SchematicLabelShape aValue )
63{
64 switch( aValue )
65 {
66 case types::SchematicLabelShape::SLSH_UNKNOWN:
67 case types::SchematicLabelShape::SLSH_PASSIVE: return LABEL_FLAG_SHAPE::L_UNSPECIFIED;
68 case types::SchematicLabelShape::SLSH_INPUT: return LABEL_FLAG_SHAPE::L_INPUT;
69 case types::SchematicLabelShape::SLSH_OUTPUT: return LABEL_FLAG_SHAPE::L_OUTPUT;
70 case types::SchematicLabelShape::SLSH_BIDI: return LABEL_FLAG_SHAPE::L_BIDI;
71 case types::SchematicLabelShape::SLSH_TRISTATE: return LABEL_FLAG_SHAPE::L_TRISTATE;
72 case types::SchematicLabelShape::SLSH_DOT: return LABEL_FLAG_SHAPE::F_DOT;
73 case types::SchematicLabelShape::SLSH_CIRCLE: return LABEL_FLAG_SHAPE::F_ROUND;
74 case types::SchematicLabelShape::SLSH_DIAMOND: return LABEL_FLAG_SHAPE::F_DIAMOND;
75 case types::SchematicLabelShape::SLSH_RECTANGLE: return LABEL_FLAG_SHAPE::F_RECTANGLE;
76
77 default:
78 wxCHECK_MSG( false, LABEL_FLAG_SHAPE::L_UNSPECIFIED,
79 "Unhandled case in FromProtoEnum<types::SchematicLabelShape>" );
80 }
81}
82
83
84template<>
85types::SchematicLabelSpinStyle ToProtoEnum( SPIN_STYLE::SPIN aValue )
86{
87 switch( aValue )
88 {
89 case SPIN_STYLE::SPIN::LEFT: return types::SchematicLabelSpinStyle::SLSS_LEFT;
90 case SPIN_STYLE::SPIN::UP: return types::SchematicLabelSpinStyle::SLSS_UP;
91 case SPIN_STYLE::SPIN::RIGHT: return types::SchematicLabelSpinStyle::SLSS_RIGHT;
92 case SPIN_STYLE::SPIN::BOTTOM: return types::SchematicLabelSpinStyle::SLSS_BOTTOM;
93
94 default:
95 wxCHECK_MSG( false, types::SchematicLabelSpinStyle::SLSS_UNKNOWN,
96 "Unhandled case in ToProtoEnum<SPIN_STYLE::SPIN>" );
97 }
98}
99
100
101template<>
102SPIN_STYLE::SPIN FromProtoEnum( types::SchematicLabelSpinStyle aValue )
103{
104 switch( aValue )
105 {
106 case types::SchematicLabelSpinStyle::SLSS_UNKNOWN:
107 case types::SchematicLabelSpinStyle::SLSS_LEFT: return SPIN_STYLE::SPIN::LEFT;
108 case types::SchematicLabelSpinStyle::SLSS_UP: return SPIN_STYLE::SPIN::UP;
109 case types::SchematicLabelSpinStyle::SLSS_RIGHT: return SPIN_STYLE::SPIN::RIGHT;
110 case types::SchematicLabelSpinStyle::SLSS_BOTTOM: return SPIN_STYLE::SPIN::BOTTOM;
111
112 default:
113 wxCHECK_MSG( false, SPIN_STYLE::SPIN::LEFT,
114 "Unhandled case in FromProtoEnum<types::SchematicLabelSpinStyle>" );
115 }
116}
117
118
119template<>
120types::SheetSide ToProtoEnum( SHEET_SIDE aValue )
121{
122 switch( aValue )
123 {
124 case SHEET_SIDE::LEFT: return types::SheetSide::SHS_LEFT;
125 case SHEET_SIDE::RIGHT: return types::SheetSide::SHS_RIGHT;
126 case SHEET_SIDE::TOP: return types::SheetSide::SHS_TOP;
127 case SHEET_SIDE::BOTTOM: return types::SheetSide::SHS_BOTTOM;
128
129 default:
130 wxCHECK_MSG( false, types::SheetSide::SHS_UNKNOWN,
131 "Unhandled case in ToProtoEnum<SHEET_SIDE>" );
132 }
133}
134
135
136template<>
137SHEET_SIDE FromProtoEnum( types::SheetSide aValue )
138{
139 switch( aValue )
140 {
141 case types::SheetSide::SHS_UNKNOWN: return SHEET_SIDE::UNDEFINED;
142 case types::SheetSide::SHS_LEFT: return SHEET_SIDE::LEFT;
143 case types::SheetSide::SHS_RIGHT: return SHEET_SIDE::RIGHT;
144 case types::SheetSide::SHS_TOP: return SHEET_SIDE::TOP;
145 case types::SheetSide::SHS_BOTTOM: return SHEET_SIDE::BOTTOM;
146
147 default:
148 wxCHECK_MSG( false, SHEET_SIDE::UNDEFINED,
149 "Unhandled case in FromProtoEnum<types::SheetSide>" );
150 }
151}
152
153
154template<>
155types::SchematicSymbolType ToProtoEnum( LIBRENTRYOPTIONS aValue )
156{
157 switch( aValue )
158 {
159 case LIBRENTRYOPTIONS::ENTRY_NORMAL: return types::SchematicSymbolType::SST_NORMAL;
160 case LIBRENTRYOPTIONS::ENTRY_GLOBAL_POWER: return types::SchematicSymbolType::SST_GLOBAL_POWER;
161 case LIBRENTRYOPTIONS::ENTRY_LOCAL_POWER: return types::SchematicSymbolType::SST_LOCAL_POWER;
162
163 default:
164 wxCHECK_MSG( false, types::SchematicSymbolType::SST_UNKNOWN,
165 "Unhandled case in ToProtoEnum<SHEET_SIDE>" );
166 }
167}
168
169
170template<>
171LIBRENTRYOPTIONS FromProtoEnum( types::SchematicSymbolType aValue )
172{
173 switch( aValue )
174 {
175 case types::SchematicSymbolType::SST_UNKNOWN:
176 case types::SchematicSymbolType::SST_NORMAL: return LIBRENTRYOPTIONS::ENTRY_NORMAL;
177 case types::SchematicSymbolType::SST_GLOBAL_POWER: return LIBRENTRYOPTIONS::ENTRY_GLOBAL_POWER;
178 case types::SchematicSymbolType::SST_LOCAL_POWER: return LIBRENTRYOPTIONS::ENTRY_LOCAL_POWER;
179
180 default:
181 wxCHECK_MSG( false, LIBRENTRYOPTIONS::ENTRY_NORMAL,
182 "Unhandled case in FromProtoEnum<types::SchematicSymbolType>" );
183 }
184}
185
186
187template<>
188types::SchematicSymbolOrientation ToProtoEnum( SYMBOL_ORIENTATION_PROP aValue )
189{
190 switch( aValue )
191 {
192 case SYMBOL_ORIENTATION_PROP::SYMBOL_ANGLE_0: return types::SchematicSymbolOrientation::SSO_0;
193 case SYMBOL_ORIENTATION_PROP::SYMBOL_ANGLE_90: return types::SchematicSymbolOrientation::SSO_90;
194 case SYMBOL_ORIENTATION_PROP::SYMBOL_ANGLE_180: return types::SchematicSymbolOrientation::SSO_180;
195 case SYMBOL_ORIENTATION_PROP::SYMBOL_ANGLE_270: return types::SchematicSymbolOrientation::SSO_270;
196
197 default:
198 wxCHECK_MSG( false, types::SchematicSymbolOrientation::SSO_UNKNOWN,
199 "Unhandled case in ToProtoEnum<SYMBOL_ORIENTATION_PROP>" );
200 }
201}
202
203
204template<>
205SYMBOL_ORIENTATION_PROP FromProtoEnum( types::SchematicSymbolOrientation aValue )
206{
207 switch( aValue )
208 {
209 case types::SchematicSymbolOrientation::SSO_UNKNOWN:
210 case types::SchematicSymbolOrientation::SSO_0: return SYMBOL_ORIENTATION_PROP::SYMBOL_ANGLE_0;
211 case types::SchematicSymbolOrientation::SSO_90: return SYMBOL_ORIENTATION_PROP::SYMBOL_ANGLE_90;
212 case types::SchematicSymbolOrientation::SSO_180: return SYMBOL_ORIENTATION_PROP::SYMBOL_ANGLE_180;
213 case types::SchematicSymbolOrientation::SSO_270: return SYMBOL_ORIENTATION_PROP::SYMBOL_ANGLE_270;
214
215 default:
216 wxCHECK_MSG( false, SYMBOL_ORIENTATION_PROP::SYMBOL_ANGLE_0,
217 "Unhandled case in FromProtoEnum<types::SchematicSymbolOrientation>" );
218 }
219}
220
221
222template<>
223types::SchematicPinOrientation ToProtoEnum( PIN_ORIENTATION aValue )
224{
225 switch( aValue )
226 {
227 case PIN_ORIENTATION::PIN_RIGHT: return types::SchematicPinOrientation::SPO_RIGHT;
228 case PIN_ORIENTATION::PIN_LEFT: return types::SchematicPinOrientation::SPO_LEFT;
229 case PIN_ORIENTATION::PIN_UP: return types::SchematicPinOrientation::SPO_UP;
230 case PIN_ORIENTATION::PIN_DOWN: return types::SchematicPinOrientation::SPO_DOWN;
231
232 default:
233 wxCHECK_MSG( false, types::SchematicPinOrientation::SPO_UNKNOWN,
234 "Unhandled case in ToProtoEnum<PIN_ORIENTATION>" );
235 }
236}
237
238
239template<>
240PIN_ORIENTATION FromProtoEnum( types::SchematicPinOrientation aValue )
241{
242 switch( aValue )
243 {
244 case types::SchematicPinOrientation::SPO_UNKNOWN:
245 case types::SchematicPinOrientation::SPO_LEFT: return PIN_ORIENTATION::PIN_LEFT;
246 case types::SchematicPinOrientation::SPO_RIGHT: return PIN_ORIENTATION::PIN_RIGHT;
247 case types::SchematicPinOrientation::SPO_UP: return PIN_ORIENTATION::PIN_UP;
248 case types::SchematicPinOrientation::SPO_DOWN: return PIN_ORIENTATION::PIN_DOWN;
249
250 default:
251 wxCHECK_MSG( false, PIN_ORIENTATION::PIN_LEFT,
252 "Unhandled case in FromProtoEnum<types::SheetSide>" );
253 }
254}
255
256
257template<>
258types::SchematicPinShape ToProtoEnum( GRAPHIC_PINSHAPE aValue )
259{
260 switch( aValue )
261 {
262 case GRAPHIC_PINSHAPE::LINE: return types::SchematicPinShape::SPS_LINE;
263 case GRAPHIC_PINSHAPE::INVERTED: return types::SchematicPinShape::SPS_INVERTED;
264 case GRAPHIC_PINSHAPE::CLOCK: return types::SchematicPinShape::SPS_CLOCK;
265 case GRAPHIC_PINSHAPE::INVERTED_CLOCK: return types::SchematicPinShape::SPS_INVERTED_CLOCK;
266 case GRAPHIC_PINSHAPE::INPUT_LOW: return types::SchematicPinShape::SPS_INPUT_LOW;
267 case GRAPHIC_PINSHAPE::CLOCK_LOW: return types::SchematicPinShape::SPS_CLOCK_LOW;
268 case GRAPHIC_PINSHAPE::OUTPUT_LOW: return types::SchematicPinShape::SPS_OUTPUT_LOW;
269 case GRAPHIC_PINSHAPE::FALLING_EDGE_CLOCK: return types::SchematicPinShape::SPS_FALLING_EDGE_CLOCK;
270 case GRAPHIC_PINSHAPE::NONLOGIC: return types::SchematicPinShape::SPS_NONLOGIC;
271
272 default:
273 wxCHECK_MSG( false, types::SchematicPinShape::SPS_UNKNOWN,
274 "Unhandled case in ToProtoEnum<GRAPHIC_PINSHAPE>" );
275 }
276}
277
278
279template<>
280GRAPHIC_PINSHAPE FromProtoEnum( types::SchematicPinShape aValue )
281{
282 switch( aValue )
283 {
284 case types::SchematicPinShape::SPS_UNKNOWN:
285 case types::SchematicPinShape::SPS_LINE: return GRAPHIC_PINSHAPE::LINE;
286 case types::SchematicPinShape::SPS_INVERTED: return GRAPHIC_PINSHAPE::INVERTED;
287 case types::SchematicPinShape::SPS_CLOCK: return GRAPHIC_PINSHAPE::CLOCK;
288 case types::SchematicPinShape::SPS_INVERTED_CLOCK: return GRAPHIC_PINSHAPE::INVERTED_CLOCK;
289 case types::SchematicPinShape::SPS_INPUT_LOW: return GRAPHIC_PINSHAPE::INPUT_LOW;
290 case types::SchematicPinShape::SPS_CLOCK_LOW: return GRAPHIC_PINSHAPE::CLOCK_LOW;
291 case types::SchematicPinShape::SPS_OUTPUT_LOW: return GRAPHIC_PINSHAPE::OUTPUT_LOW;
292 case types::SchematicPinShape::SPS_FALLING_EDGE_CLOCK: return GRAPHIC_PINSHAPE::FALLING_EDGE_CLOCK;
293 case types::SchematicPinShape::SPS_NONLOGIC: return GRAPHIC_PINSHAPE::NONLOGIC;
294
295 default:
296 wxCHECK_MSG( false, GRAPHIC_PINSHAPE::LINE,
297 "Unhandled case in FromProtoEnum<types::SchematicPinShape>" );
298 }
299}
300
301
302template <>
303types::PinMapOverrideMode ToProtoEnum( PIN_MAP_OVERRIDE_MODE aValue )
304{
305 switch( aValue )
306 {
307 case PIN_MAP_OVERRIDE_MODE::USE_LIBRARY_DEFAULT: return types::PinMapOverrideMode::PMOM_USE_LIBRARY_DEFAULT;
308 case PIN_MAP_OVERRIDE_MODE::USE_NAMED_MAP: return types::PinMapOverrideMode::PMOM_USE_NAMED_MAP;
309 case PIN_MAP_OVERRIDE_MODE::FORCE_IDENTITY: return types::PinMapOverrideMode::PMOM_FORCE_IDENTITY;
310 case PIN_MAP_OVERRIDE_MODE::DELEGATE_TO_UNIT_1: return types::PinMapOverrideMode::PMOM_DELEGATE_TO_UNIT_1;
311
312 default:
313 wxCHECK_MSG( false, types::PinMapOverrideMode::PMOM_USE_LIBRARY_DEFAULT,
314 "Unhandled case in ToProtoEnum<PIN_MAP_OVERRIDE_MODE>" );
315 }
316}
317
318
319template <>
320PIN_MAP_OVERRIDE_MODE FromProtoEnum( types::PinMapOverrideMode aValue )
321{
322 switch( aValue )
323 {
324 case types::PinMapOverrideMode::PMOM_UNKNOWN:
325 case types::PinMapOverrideMode::PMOM_USE_LIBRARY_DEFAULT: return PIN_MAP_OVERRIDE_MODE::USE_LIBRARY_DEFAULT;
326 case types::PinMapOverrideMode::PMOM_USE_NAMED_MAP: return PIN_MAP_OVERRIDE_MODE::USE_NAMED_MAP;
327 case types::PinMapOverrideMode::PMOM_FORCE_IDENTITY: return PIN_MAP_OVERRIDE_MODE::FORCE_IDENTITY;
328 case types::PinMapOverrideMode::PMOM_DELEGATE_TO_UNIT_1: return PIN_MAP_OVERRIDE_MODE::DELEGATE_TO_UNIT_1;
329
330 default:
332 "Unhandled case in FromProtoEnum<types::PinMapOverrideMode>" );
333 }
334}
335
336
337template<>
338types::SchematicPassthroughMode ToProtoEnum( SCH_SYMBOL::PASSTHROUGH_MODE aValue )
339{
340 switch( aValue )
341 {
342 case SCH_SYMBOL::PASSTHROUGH_MODE::DEFAULT: return types::SchematicPassthroughMode::SPM_DEFAULT;
343 case SCH_SYMBOL::PASSTHROUGH_MODE::BLOCK: return types::SchematicPassthroughMode::SPM_BLOCK;
344 case SCH_SYMBOL::PASSTHROUGH_MODE::FORCE: return types::SchematicPassthroughMode::SPM_FORCE;
345
346 default:
347 wxCHECK_MSG( false, types::SchematicPassthroughMode::SPM_DEFAULT,
348 "Unhandled case in ToProtoEnum<SCH_SYMBOL::PASSTHROUGH_MODE>" );
349 }
350}
351
352
353template<>
354SCH_SYMBOL::PASSTHROUGH_MODE FromProtoEnum( types::SchematicPassthroughMode aValue )
355{
356 switch( aValue )
357 {
358 case types::SchematicPassthroughMode::SPM_UNKNOWN:
359 case types::SchematicPassthroughMode::SPM_DEFAULT: return SCH_SYMBOL::PASSTHROUGH_MODE::DEFAULT;
360 case types::SchematicPassthroughMode::SPM_BLOCK: return SCH_SYMBOL::PASSTHROUGH_MODE::BLOCK;
361 case types::SchematicPassthroughMode::SPM_FORCE: return SCH_SYMBOL::PASSTHROUGH_MODE::FORCE;
362
363 default:
364 wxCHECK_MSG( false, SCH_SYMBOL::PASSTHROUGH_MODE::DEFAULT,
365 "Unhandled case in FromProtoEnum<types::SchematicPassthroughMode>" );
366 }
367}
368
369
370template<>
371ErcErrorType ToProtoEnum( ERCE_T aValue )
372{
373 switch( aValue )
374 {
375 case ERCE_DUPLICATE_SHEET_NAME: return ErcErrorType::ERCET_DUPLICATE_SHEET_NAME;
376 case ERCE_ENDPOINT_OFF_GRID: return ErcErrorType::ERCET_ENDPOINT_OFF_GRID;
377 case ERCE_PIN_NOT_CONNECTED: return ErcErrorType::ERCET_PIN_NOT_CONNECTED;
378 case ERCE_PIN_NOT_DRIVEN: return ErcErrorType::ERCET_PIN_NOT_DRIVEN;
379 case ERCE_POWERPIN_NOT_DRIVEN: return ErcErrorType::ERCET_POWERPIN_NOT_DRIVEN;
380 case ERCE_HIERACHICAL_LABEL: return ErcErrorType::ERCET_HIERARCHICAL_LABEL;
381 case ERCE_NOCONNECT_CONNECTED: return ErcErrorType::ERCET_NOCONNECT_CONNECTED;
382 case ERCE_NOCONNECT_NOT_CONNECTED: return ErcErrorType::ERCET_NOCONNECT_NOT_CONNECTED;
383 case ERCE_LABEL_NOT_CONNECTED: return ErcErrorType::ERCET_LABEL_NOT_CONNECTED;
384 case ERCE_SIMILAR_LABELS: return ErcErrorType::ERCET_SIMILAR_LABELS;
385 case ERCE_SIMILAR_POWER: return ErcErrorType::ERCET_SIMILAR_POWER;
386 case ERCE_SIMILAR_LABEL_AND_POWER: return ErcErrorType::ERCET_SIMILAR_LABEL_AND_POWER;
387 case ERCE_SINGLE_GLOBAL_LABEL: return ErcErrorType::ERCET_SINGLE_GLOBAL_LABEL;
388 case ERCE_SAME_LOCAL_GLOBAL_LABEL: return ErcErrorType::ERCET_SAME_LOCAL_GLOBAL_LABEL;
389 case ERCE_SAME_LOCAL_GLOBAL_POWER: return ErcErrorType::ERCET_SAME_LOCAL_GLOBAL_POWER;
390 case ERCE_DIFFERENT_UNIT_FP: return ErcErrorType::ERCET_DIFFERENT_UNIT_FP;
391 case ERCE_MISSING_POWER_INPUT_PIN: return ErcErrorType::ERCET_MISSING_POWER_INPUT_PIN;
392 case ERCE_MISSING_INPUT_PIN: return ErcErrorType::ERCET_MISSING_INPUT_PIN;
393 case ERCE_MISSING_BIDI_PIN: return ErcErrorType::ERCET_MISSING_BIDI_PIN;
394 case ERCE_MISSING_UNIT: return ErcErrorType::ERCET_MISSING_UNIT;
395 case ERCE_DIFFERENT_UNIT_NET: return ErcErrorType::ERCET_DIFFERENT_UNIT_NET;
396 case ERCE_BUS_ALIAS_CONFLICT: return ErcErrorType::ERCET_BUS_ALIAS_CONFLICT;
397 case ERCE_DRIVER_CONFLICT: return ErcErrorType::ERCET_DRIVER_CONFLICT;
398 case ERCE_BUS_ENTRY_CONFLICT: return ErcErrorType::ERCET_BUS_ENTRY_CONFLICT;
399 case ERCE_BUS_TO_BUS_CONFLICT: return ErcErrorType::ERCET_BUS_TO_BUS_CONFLICT;
400 case ERCE_BUS_TO_NET_CONFLICT: return ErcErrorType::ERCET_BUS_TO_NET_CONFLICT;
401 case ERCE_GROUND_PIN_NOT_GROUND: return ErcErrorType::ERCET_GROUND_PIN_NOT_GROUND;
402 case ERCE_LABEL_SINGLE_PIN: return ErcErrorType::ERCET_LABEL_SINGLE_PIN;
403 case ERCE_UNRESOLVED_VARIABLE: return ErcErrorType::ERCET_UNRESOLVED_VARIABLE;
404 case ERCE_UNDEFINED_NETCLASS: return ErcErrorType::ERCET_UNDEFINED_NETCLASS;
405 case ERCE_SIMULATION_MODEL: return ErcErrorType::ERCET_SIMULATION_MODEL;
406 case ERCE_WIRE_DANGLING: return ErcErrorType::ERCET_WIRE_DANGLING;
407 case ERCE_LIB_SYMBOL_ISSUES: return ErcErrorType::ERCET_LIB_SYMBOL_ISSUES;
408 case ERCE_LIB_SYMBOL_MISMATCH: return ErcErrorType::ERCET_LIB_SYMBOL_MISMATCH;
409 case ERCE_FOOTPRINT_LINK_ISSUES: return ErcErrorType::ERCET_FOOTPRINT_LINK_ISSUES;
410 case ERCE_FOOTPRINT_FILTERS: return ErcErrorType::ERCET_FOOTPRINT_FILTERS;
411 case ERCE_UNANNOTATED: return ErcErrorType::ERCET_UNANNOTATED;
412 case ERCE_EXTRA_UNITS: return ErcErrorType::ERCET_EXTRA_UNITS;
413 case ERCE_DIFFERENT_UNIT_VALUE: return ErcErrorType::ERCET_DIFFERENT_UNIT_VALUE;
414 case ERCE_DUPLICATE_REFERENCE: return ErcErrorType::ERCET_DUPLICATE_REFERENCE;
415 case ERCE_BUS_ENTRY_NEEDED: return ErcErrorType::ERCET_BUS_ENTRY_NEEDED;
416 case ERCE_FOUR_WAY_JUNCTION: return ErcErrorType::ERCET_FOUR_WAY_JUNCTION;
417 case ERCE_LABEL_MULTIPLE_WIRES: return ErcErrorType::ERCET_LABEL_MULTIPLE_WIRES;
418 case ERCE_UNCONNECTED_WIRE_ENDPOINT: return ErcErrorType::ERCET_UNCONNECTED_WIRE_ENDPOINT;
419 case ERCE_STACKED_PIN_SYNTAX: return ErcErrorType::ERCET_STACKED_PIN_SYNTAX;
420 case ERCE_PIN_MAP_BAD_PAD: return ErcErrorType::ERCET_PIN_MAP_BAD_PAD;
421 case ERCE_PIN_MAP_UNMAPPED_PIN: return ErcErrorType::ERCET_PIN_MAP_UNMAPPED_PIN;
422 case ERCE_PIN_MAP_DUPLICATE_PAD: return ErcErrorType::ERCET_PIN_MAP_DUPLICATE_PAD;
423 case ERCE_PIN_MAP_STALE_PIN: return ErcErrorType::ERCET_PIN_MAP_STALE_PIN;
424 case ERCE_EMPTY_LABEL_NAME: return ErcErrorType::ERCET_EMPTY_LABEL_NAME;
425 case ERCE_VARIANT_SYMBOL_INVALID: return ErcErrorType::ERCET_VARIANT_SYMBOL_INVALID;
426 case ERCE_VARIANT_SYMBOL_INCOMPATIBLE: return ErcErrorType::ERCET_VARIANT_SYMBOL_INCOMPATIBLE;
427 case ERCE_DUPLICATE_PIN_ERROR: return ErcErrorType::ERCET_DUPLICATE_PIN_ERROR;
428 case ERCE_PIN_TO_PIN_WARNING: return ErcErrorType::ERCET_PIN_TO_PIN_WARNING;
429 case ERCE_PIN_TO_PIN_ERROR: return ErcErrorType::ERCET_PIN_TO_PIN_ERROR;
430 case ERCE_ANNOTATION_ACTION: return ErcErrorType::ERCET_ANNOTATION_ACTION;
431 case ERCE_GENERIC_WARNING: return ErcErrorType::ERCET_GENERIC_WARNING;
432 case ERCE_GENERIC_ERROR: return ErcErrorType::ERCET_GENERIC_ERROR;
433 case ERCE_FIELD_NAME_WHITESPACE: return ErcErrorType::ERCET_FIELD_NAME_WHITESPACE;
434
435 case ERCE_UNSPECIFIED:
436 default:
437 wxCHECK_MSG( false, ErcErrorType::ERCET_UNKNOWN,
438 "Unhandled case in ToProtoEnum<ERCE_T>" );
439 }
440}
441
442
443template<>
444ERCE_T FromProtoEnum( ErcErrorType aValue )
445{
446 switch( aValue )
447 {
448 case ErcErrorType::ERCET_DUPLICATE_SHEET_NAME: return ERCE_DUPLICATE_SHEET_NAME;
449 case ErcErrorType::ERCET_ENDPOINT_OFF_GRID: return ERCE_ENDPOINT_OFF_GRID;
450 case ErcErrorType::ERCET_PIN_NOT_CONNECTED: return ERCE_PIN_NOT_CONNECTED;
451 case ErcErrorType::ERCET_PIN_NOT_DRIVEN: return ERCE_PIN_NOT_DRIVEN;
452 case ErcErrorType::ERCET_POWERPIN_NOT_DRIVEN: return ERCE_POWERPIN_NOT_DRIVEN;
453 case ErcErrorType::ERCET_HIERARCHICAL_LABEL: return ERCE_HIERACHICAL_LABEL;
454 case ErcErrorType::ERCET_NOCONNECT_CONNECTED: return ERCE_NOCONNECT_CONNECTED;
455 case ErcErrorType::ERCET_NOCONNECT_NOT_CONNECTED: return ERCE_NOCONNECT_NOT_CONNECTED;
456 case ErcErrorType::ERCET_LABEL_NOT_CONNECTED: return ERCE_LABEL_NOT_CONNECTED;
457 case ErcErrorType::ERCET_SIMILAR_LABELS: return ERCE_SIMILAR_LABELS;
458 case ErcErrorType::ERCET_SIMILAR_POWER: return ERCE_SIMILAR_POWER;
459 case ErcErrorType::ERCET_SIMILAR_LABEL_AND_POWER: return ERCE_SIMILAR_LABEL_AND_POWER;
460 case ErcErrorType::ERCET_SINGLE_GLOBAL_LABEL: return ERCE_SINGLE_GLOBAL_LABEL;
461 case ErcErrorType::ERCET_SAME_LOCAL_GLOBAL_LABEL: return ERCE_SAME_LOCAL_GLOBAL_LABEL;
462 case ErcErrorType::ERCET_SAME_LOCAL_GLOBAL_POWER: return ERCE_SAME_LOCAL_GLOBAL_POWER;
463 case ErcErrorType::ERCET_DIFFERENT_UNIT_FP: return ERCE_DIFFERENT_UNIT_FP;
464 case ErcErrorType::ERCET_MISSING_POWER_INPUT_PIN: return ERCE_MISSING_POWER_INPUT_PIN;
465 case ErcErrorType::ERCET_MISSING_INPUT_PIN: return ERCE_MISSING_INPUT_PIN;
466 case ErcErrorType::ERCET_MISSING_BIDI_PIN: return ERCE_MISSING_BIDI_PIN;
467 case ErcErrorType::ERCET_MISSING_UNIT: return ERCE_MISSING_UNIT;
468 case ErcErrorType::ERCET_DIFFERENT_UNIT_NET: return ERCE_DIFFERENT_UNIT_NET;
469 case ErcErrorType::ERCET_BUS_ALIAS_CONFLICT: return ERCE_BUS_ALIAS_CONFLICT;
470 case ErcErrorType::ERCET_DRIVER_CONFLICT: return ERCE_DRIVER_CONFLICT;
471 case ErcErrorType::ERCET_BUS_ENTRY_CONFLICT: return ERCE_BUS_ENTRY_CONFLICT;
472 case ErcErrorType::ERCET_BUS_TO_BUS_CONFLICT: return ERCE_BUS_TO_BUS_CONFLICT;
473 case ErcErrorType::ERCET_BUS_TO_NET_CONFLICT: return ERCE_BUS_TO_NET_CONFLICT;
474 case ErcErrorType::ERCET_GROUND_PIN_NOT_GROUND: return ERCE_GROUND_PIN_NOT_GROUND;
475 case ErcErrorType::ERCET_LABEL_SINGLE_PIN: return ERCE_LABEL_SINGLE_PIN;
476 case ErcErrorType::ERCET_UNRESOLVED_VARIABLE: return ERCE_UNRESOLVED_VARIABLE;
477 case ErcErrorType::ERCET_UNDEFINED_NETCLASS: return ERCE_UNDEFINED_NETCLASS;
478 case ErcErrorType::ERCET_SIMULATION_MODEL: return ERCE_SIMULATION_MODEL;
479 case ErcErrorType::ERCET_WIRE_DANGLING: return ERCE_WIRE_DANGLING;
480 case ErcErrorType::ERCET_LIB_SYMBOL_ISSUES: return ERCE_LIB_SYMBOL_ISSUES;
481 case ErcErrorType::ERCET_LIB_SYMBOL_MISMATCH: return ERCE_LIB_SYMBOL_MISMATCH;
482 case ErcErrorType::ERCET_FOOTPRINT_LINK_ISSUES: return ERCE_FOOTPRINT_LINK_ISSUES;
483 case ErcErrorType::ERCET_FOOTPRINT_FILTERS: return ERCE_FOOTPRINT_FILTERS;
484 case ErcErrorType::ERCET_UNANNOTATED: return ERCE_UNANNOTATED;
485 case ErcErrorType::ERCET_EXTRA_UNITS: return ERCE_EXTRA_UNITS;
486 case ErcErrorType::ERCET_DIFFERENT_UNIT_VALUE: return ERCE_DIFFERENT_UNIT_VALUE;
487 case ErcErrorType::ERCET_DUPLICATE_REFERENCE: return ERCE_DUPLICATE_REFERENCE;
488 case ErcErrorType::ERCET_BUS_ENTRY_NEEDED: return ERCE_BUS_ENTRY_NEEDED;
489 case ErcErrorType::ERCET_FOUR_WAY_JUNCTION: return ERCE_FOUR_WAY_JUNCTION;
490 case ErcErrorType::ERCET_LABEL_MULTIPLE_WIRES: return ERCE_LABEL_MULTIPLE_WIRES;
491 case ErcErrorType::ERCET_UNCONNECTED_WIRE_ENDPOINT: return ERCE_UNCONNECTED_WIRE_ENDPOINT;
492 case ErcErrorType::ERCET_STACKED_PIN_SYNTAX: return ERCE_STACKED_PIN_SYNTAX;
493 case ErcErrorType::ERCET_PIN_MAP_BAD_PAD: return ERCE_PIN_MAP_BAD_PAD;
494 case ErcErrorType::ERCET_PIN_MAP_UNMAPPED_PIN: return ERCE_PIN_MAP_UNMAPPED_PIN;
495 case ErcErrorType::ERCET_PIN_MAP_DUPLICATE_PAD: return ERCE_PIN_MAP_DUPLICATE_PAD;
496 case ErcErrorType::ERCET_PIN_MAP_STALE_PIN: return ERCE_PIN_MAP_STALE_PIN;
497 case ErcErrorType::ERCET_EMPTY_LABEL_NAME: return ERCE_EMPTY_LABEL_NAME;
498 case ErcErrorType::ERCET_VARIANT_SYMBOL_INVALID: return ERCE_VARIANT_SYMBOL_INVALID;
499 case ErcErrorType::ERCET_VARIANT_SYMBOL_INCOMPATIBLE: return ERCE_VARIANT_SYMBOL_INCOMPATIBLE;
500 case ErcErrorType::ERCET_DUPLICATE_PIN_ERROR: return ERCE_DUPLICATE_PIN_ERROR;
501 case ErcErrorType::ERCET_PIN_TO_PIN_WARNING: return ERCE_PIN_TO_PIN_WARNING;
502 case ErcErrorType::ERCET_PIN_TO_PIN_ERROR: return ERCE_PIN_TO_PIN_ERROR;
503 case ErcErrorType::ERCET_ANNOTATION_ACTION: return ERCE_ANNOTATION_ACTION;
504 case ErcErrorType::ERCET_GENERIC_WARNING: return ERCE_GENERIC_WARNING;
505 case ErcErrorType::ERCET_GENERIC_ERROR: return ERCE_GENERIC_ERROR;
506 case ErcErrorType::ERCET_FIELD_NAME_WHITESPACE: return ERCE_FIELD_NAME_WHITESPACE;
507
508 case ErcErrorType::ERCET_UNKNOWN:
509 default:
510 return ERCE_UNSPECIFIED;
511 }
512}
types::SchematicLabelShape ToProtoEnum(LABEL_FLAG_SHAPE aValue)
LABEL_FLAG_SHAPE FromProtoEnum(types::SchematicLabelShape aValue)
ERCE_T
ERC error codes.
@ ERCE_UNSPECIFIED
@ ERCE_UNANNOTATED
Symbol has not been annotated.
@ ERCE_POWERPIN_NOT_DRIVEN
Power input pin connected to some others pins but no power out pin to drive it.
@ ERCE_DRIVER_CONFLICT
Conflicting drivers (labels, etc) on a subgraph.
@ ERCE_SIMILAR_POWER
2 power pins are equal for case insensitive comparisons.
@ ERCE_MISSING_POWER_INPUT_PIN
Symbol has power input pins that are not placed on the schematic.
@ ERCE_UNCONNECTED_WIRE_ENDPOINT
A label is connected to more than one wire.
@ ERCE_GROUND_PIN_NOT_GROUND
A ground-labeled pin is not on a ground net while another pin is.
@ ERCE_SIMILAR_LABELS
2 labels are equal for case insensitive comparisons.
@ ERCE_VARIANT_SYMBOL_INCOMPATIBLE
Variant symbol override fails pin compatibility.
@ ERCE_STACKED_PIN_SYNTAX
Pin name resembles stacked pin notation.
@ ERCE_ANNOTATION_ACTION
@ ERCE_LABEL_NOT_CONNECTED
Label not connected to any pins.
@ ERCE_ENDPOINT_OFF_GRID
Pin or wire-end off grid.
@ ERCE_DUPLICATE_REFERENCE
More than one symbol with the same reference.
@ ERCE_EMPTY_LABEL_NAME
Label has an empty or whitespace-only name.
@ ERCE_EXTRA_UNITS
Symbol has more units than are defined.
@ ERCE_SAME_LOCAL_GLOBAL_LABEL
2 labels are equal for case insensitive comparisons.
@ ERCE_BUS_TO_BUS_CONFLICT
A connection between bus objects doesn't share at least one net.
@ ERCE_SIMILAR_LABEL_AND_POWER
label and pin are equal for case insensitive comparisons.
@ ERCE_SAME_LOCAL_GLOBAL_POWER
Local power port and global power port have the same name.
@ ERCE_PIN_MAP_BAD_PAD
Pin map references a pad absent from the footprint.
@ ERCE_LABEL_SINGLE_PIN
A label is connected only to a single pin.
@ ERCE_BUS_ENTRY_CONFLICT
A wire connected to a bus doesn't match the bus.
@ ERCE_FOOTPRINT_LINK_ISSUES
The footprint link is invalid, or points to a missing (or inactive) footprint or library.
@ ERCE_PIN_MAP_DUPLICATE_PAD
Two symbol pins map to one pad (not stacked/jumper).
@ ERCE_BUS_TO_NET_CONFLICT
A bus wire is graphically connected to a net port/pin (or vice versa).
@ ERCE_DUPLICATE_PIN_ERROR
@ ERCE_NOCONNECT_NOT_CONNECTED
A no connect symbol is not connected to anything.
@ ERCE_DIFFERENT_UNIT_NET
Shared pin in a multi-unit symbol is connected to more than one net.
@ ERCE_FOUR_WAY_JUNCTION
A four-way junction was found.
@ ERCE_PIN_NOT_CONNECTED
Pin not connected and not no connect symbol.
@ ERCE_UNDEFINED_NETCLASS
A netclass was referenced but not defined.
@ ERCE_BUS_ENTRY_NEEDED
Importer failed to auto-place a bus entry.
@ ERCE_UNRESOLVED_VARIABLE
A text variable could not be resolved.
@ ERCE_SIMULATION_MODEL
An error was found in the simulation model.
@ ERCE_LIB_SYMBOL_MISMATCH
Symbol doesn't match copy in library.
@ ERCE_GENERIC_ERROR
@ ERCE_DIFFERENT_UNIT_FP
Different units of the same symbol have different footprints assigned.
@ ERCE_NOCONNECT_CONNECTED
A no connect symbol is connected to more than 1 pin.
@ ERCE_PIN_TO_PIN_WARNING
@ ERCE_PIN_NOT_DRIVEN
Pin connected to some others pins but no pin to drive it.
@ ERCE_MISSING_INPUT_PIN
Symbol has input pins that are not placed.
@ ERCE_MISSING_UNIT
Symbol has units that are not placed on the schematic.
@ ERCE_FIELD_NAME_WHITESPACE
Field name has leading or trailing whitespace.
@ ERCE_DUPLICATE_SHEET_NAME
Duplicate sheet names within a given sheet.
@ ERCE_PIN_MAP_STALE_PIN
Pin map references a pin number not on the symbol.
@ ERCE_MISSING_BIDI_PIN
Symbol has bi-directional pins that are not placed.
@ ERCE_LIB_SYMBOL_ISSUES
Symbol not found in active libraries.
@ ERCE_FOOTPRINT_FILTERS
The assigned footprint doesn't match the footprint filters.
@ ERCE_HIERACHICAL_LABEL
Mismatch between hierarchical labels and pins sheets.
@ ERCE_WIRE_DANGLING
Some wires are not connected to anything else.
@ ERCE_BUS_ALIAS_CONFLICT
Conflicting bus alias definitions across sheets.
@ ERCE_GENERIC_WARNING
@ ERCE_VARIANT_SYMBOL_INVALID
Variant symbol override LIB_ID cannot be resolved.
@ ERCE_SINGLE_GLOBAL_LABEL
A label only exists once in the schematic.
@ ERCE_PIN_MAP_UNMAPPED_PIN
A connected pin resolves to no footprint pad.
@ ERCE_LABEL_MULTIPLE_WIRES
A label is connected to more than one wire.
@ ERCE_DIFFERENT_UNIT_VALUE
Units of same symbol have different values.
@ ERCE_PIN_TO_PIN_ERROR
LIBRENTRYOPTIONS
Definition lib_symbol.h:61
@ ENTRY_NORMAL
Definition lib_symbol.h:62
@ ENTRY_LOCAL_POWER
Definition lib_symbol.h:64
@ ENTRY_GLOBAL_POWER
Definition lib_symbol.h:63
PIN_MAP_OVERRIDE_MODE
Override mode stored on a SCH_SYMBOL_INSTANCE.
Definition pin_map.h:178
PIN_ORIENTATION
The symbol library pin object orientations.
Definition pin_type.h:101
@ PIN_UP
The pin extends upwards from the connection point: Probably on the bottom side of the symbol.
Definition pin_type.h:123
@ PIN_RIGHT
The pin extends rightwards from the connection point.
Definition pin_type.h:107
@ PIN_LEFT
The pin extends leftwards from the connection point: Probably on the right side of the symbol.
Definition pin_type.h:114
@ PIN_DOWN
The pin extends downwards from the connection: Probably on the top side of the symbol.
Definition pin_type.h:131
GRAPHIC_PINSHAPE
Definition pin_type.h:80
LABEL_FLAG_SHAPE
Definition sch_label.h:97
@ L_BIDI
Definition sch_label.h:100
@ L_TRISTATE
Definition sch_label.h:101
@ L_UNSPECIFIED
Definition sch_label.h:102
@ F_DOT
Definition sch_label.h:105
@ F_ROUND
Definition sch_label.h:106
@ L_OUTPUT
Definition sch_label.h:99
@ F_DIAMOND
Definition sch_label.h:107
@ L_INPUT
Definition sch_label.h:98
@ F_RECTANGLE
Definition sch_label.h:108
SHEET_SIDE
Define the edge of the sheet that the sheet pin is positioned.
SYMBOL_ORIENTATION_PROP
Definition symbol.h:47
@ SYMBOL_ANGLE_180
Definition symbol.h:50
@ SYMBOL_ANGLE_0
Definition symbol.h:48
@ SYMBOL_ANGLE_90
Definition symbol.h:49
@ SYMBOL_ANGLE_270
Definition symbol.h:51