KiCad PCB EDA Suite
Loading...
Searching...
No Matches
allegro_pcb_structs.h
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 Quilter
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 3
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU 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, you may find one here:
19 * http://www.gnu.org/licenses/gpl-3.0.html
20 * or you may search the http://www.gnu.org website for the version 3 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25#pragma once
26
27#include "string_any_map.h"
28
29
30#include <array>
31#include <cstdint>
32#include <optional>
33#include <memory>
34#include <string>
35#include <unordered_map>
36#include <variant>
37#include <vector>
38
39
40namespace ALLEGRO
41{
42
53{
54public:
55 BLOCK_BASE( uint8_t aBlockType, size_t aOffset ) :
56 m_blockType( aBlockType ),
57 m_offset( aOffset )
58 {}
59
60 virtual ~BLOCK_BASE() = default;
61
62 uint8_t GetBlockType() const { return m_blockType; }
63 size_t GetOffset() const { return m_offset; }
64
65 // If this block data has a key, return it, else 0
66 uint32_t GetKey() const;
67
68private:
69 uint8_t m_blockType;
70 size_t m_offset;
71};
72
73
74template <typename T>
75class BLOCK : public BLOCK_BASE
76{
77public:
78 BLOCK( uint8_t aBlockType, size_t aOffset ) :
79 BLOCK_BASE( aBlockType, aOffset )
80 {}
81
82 const T& GetData() const { return m_data; }
83 T& GetData() { return m_data; }
84
85private:
87};
88
89
91{
92 x1B_NET = 0x1B,
93};
94
95
106enum class FMT_VER
107{
109 V_PRE_V16, // Allegro versions before 16.0 (unsupported binary format)
110 V_160, // Allegro 16.0, 0x00130000
111 V_162, // Allegro 16.2 0x00130400
112 V_164, // Allegro 16.4, 0x00130C00
113 V_165, // Allegro 16.5, 0x00131000
114 V_166, // Allegro 16.6, 0x00131500
115 V_172, // Allegro 17.2, 0x00140400
116 V_174, // Allegro 17.4, 0x00140900
117 V_175, // Allegro 17.5, 0x00141500
118 V_180, // Allegro 18.0, 0x00150000
119};
120
121constexpr bool operator>=( FMT_VER lhs, FMT_VER rhs )
122{
123 return static_cast<uint32_t>( lhs ) >= static_cast<uint32_t>( rhs );
124}
125
126
127template <typename T>
129{
130 using value_type = T;
131
136 virtual bool exists( FMT_VER ver ) const = 0;
137
138 // Access to the value (use std::optional-like semantics)
139 T& value() { return *m_Value; }
140 const T& value() const { return *m_Value; }
141 bool has_value() const { return m_Value.has_value(); }
142
143 const T& value_or( const T& aDefault ) const { return has_value() ? value() : aDefault; }
144
145 T& operator*() { return *m_Value; }
146 const T& operator*() const { return *m_Value; }
147
148 T* operator->() { return m_Value.operator->(); }
149 const T* operator->() const { return m_Value.operator->(); }
150
151 // Assigmnent operator
153 {
154 m_Value = value;
155 return *this;
156 }
158 {
159 m_Value = std::move( value );
160 return *this;
161 }
162
163private:
164 std::optional<T> m_Value;
165};
166
167
172template <FMT_VER MinVersion, typename T>
173struct COND_GE : public COND_FIELD_BASE<T>
174{
175 constexpr bool exists( FMT_VER ver ) const { return ver >= MinVersion; }
176
177 using COND_FIELD_BASE<T>::operator=;
178};
179
180
185template <FMT_VER MaxVersion, typename T>
186struct COND_LT : public COND_FIELD_BASE<T>
187{
188 constexpr bool exists( FMT_VER ver ) const { return ver < MaxVersion; }
189
190 using COND_FIELD_BASE<T>::operator=;
191};
192
193
198template <FMT_VER GEVersion, FMT_VER LTVersion, typename T>
199struct COND_GE_LT : public COND_FIELD_BASE<T>
200{
201 constexpr bool exists( FMT_VER ver ) const { return ver >= GEVersion && ver < LTVersion; }
202
203 using COND_FIELD_BASE<T>::operator=;
204};
205
206
208{
209 IMPERIAL = 0x01,
210 METRIC = 0x03,
211};
212
213
222{
224 {
225 uint32_t m_A;
227 };
228
235 {
236 uint32_t m_Tail;
237 uint32_t m_Head;
238 };
239
240 uint32_t m_Magic;
241
242 uint32_t m_Unknown1a; // 0x03
243 uint32_t m_FileRole; // 0x01 (.brd) or 0x02 (.dra) (?)
244 uint32_t m_Unknown1b; // 0x03
245 uint32_t m_WriterProgram; // 0x09 (Allegro) or 0x130000 (DB Doctor) (?)
246
248
249 uint32_t m_UnknownMagic; // This is always 0x000a0d0a?
250 uint32_t m_UnknownFlags; // This looks like flags: 0x01000000, 0x0400000, 0x06000000
251
252 // In this block of 7 uint32s, it seems they have very different meanings pre and post v18
253
254 // Pre v18, these are all unknown
255 // - 3 and 4 are the same.
256 // - 5 and 6 arer of a similar size
258
259 // V18
260 COND_GE<FMT_VER::V_180, uint32_t> m_Unknown2a_V18; // Looks like an 'end pointer' like 0x27_end
267
268 // V180 has 6 additional linked lists in the header
269 // 5 of them are at the start
275
276 // Linked lists grouping top-level elements by type
277 LINKED_LIST m_LL_0x04; // Net assignments
278 LINKED_LIST m_LL_0x06; // Component definitions
279 LINKED_LIST m_LL_0x0C; // Pin definitions
280 LINKED_LIST m_LL_Shapes; // Shape segments (0x0E) and shapes (0x28)
283 LINKED_LIST m_LL_0x1C; // Padstacks
284 LINKED_LIST m_LL_0x24_0x28; // Rects and shapes
286 LINKED_LIST m_LL_0x2B; // Footprint definitions
287 LINKED_LIST m_LL_0x03_0x30; // Fields (0x03) and string wrappers (0x30)
288 LINKED_LIST m_LL_0x0A; // DRC elements
289 LINKED_LIST m_LL_0x1D_0x1E_0x1F; // Constraint sets, SI models, padstack dims
293 LINKED_LIST m_LL_0x0C_2; // Secondary pin definitions
295
296 // For some reason the 0x35 extents are recorded in the header
299
303
306
308
310
313
314 // Fixed length string field
315 std::array<char, 60> m_AllegroVersion;
316
317 uint32_t m_Unknown4;
318
319 uint32_t m_MaxKey;
320
323
325 // 3 empty bytes here?
326
327 uint32_t m_Unknown6;
329
330 // The end of the 0x27 object(?)
331 // In V18, this is relocated to m_0x27_End_V18
333
334 uint32_t m_Unknown8;
335
337
338 std::array<uint32_t, 50> m_Unknown9;
339
340 uint32_t m_Unknown10a; // Often 0x000500FF
341 uint32_t m_Unknown10b; // Similar to 0xFFA60000
342 uint32_t m_Unknown10c; // Usually 0x01
343
344 // E.g. 1000 for mils
346
353 std::array<LAYER_MAP_ENTRY, 25> m_LayerMap;
354
355 uint32_t GetStringsCount() const
356 {
357 if( m_StringCount_V18.has_value() )
358 return m_StringCount_V18.value();
359
360 return m_StringCount_preV18.value();
361 }
362
363 uint32_t Get_0x27_End() const
364 {
365 if( m_0x27_End_V18.has_value() )
366 return m_0x27_End_V18.value();
367
368 return m_0x27_End_preV18.value();
369 }
370
372 {
373 if( m_LL_Unknown5_V18.has_value() )
374 return m_LL_Unknown5_V18.value();
375
376 return m_LL_Unknown5_preV18.value();
377 }
378};
379
380
382{
407
414 {
415 // BOARD_GEOMETRY
435
436 // COMPONENT_VALUE / DEVICE_TYPE / USER_PART_NUMBER
437 // REF_DES / TOLERANCE
444
445 // ANALYSIS
452
453 // DRAWING_FORMAT
459
460 // PACKAGE_GEOMETRY
476
477 // MANUFACTURING
491 };
492
493 uint8_t m_Class;
494 uint8_t m_Subclass;
495
496 bool operator==( const LAYER_INFO& ) const = default;
497};
498
499
506{
508 uint8_t m_SubType;
509 uint32_t m_Key;
510 uint32_t m_Next;
511 uint32_t m_Parent;
512 uint32_t m_Unknown1;
513
515
516 uint32_t m_Width;
517
518 int32_t m_StartX;
519 int32_t m_StartY;
520 int32_t m_EndX;
521 int32_t m_EndY;
522
523 double m_CenterX; // Center
524 double m_CenterY;
525 double m_Radius;
526
527 std::array<int32_t, 4> m_BoundingBoxCoords;
528};
529
530
536{
537 struct SUB_0x6C
538 {
539 uint32_t m_NumEntries;
540 std::vector<uint32_t> m_Entries;
541 };
542
544 {
545 uint16_t m_X0;
546 uint16_t m_X1;
547 std::vector<uint32_t> m_Entries;
548 };
549
550 struct SUB_0xF6
551 {
552 std::array<uint32_t, 20> m_Entries;
553 };
554
555 uint16_t m_Hdr1;
556
557 uint32_t m_Key;
558 uint32_t m_Next;
559
560
562
563 uint8_t m_SubType;
564 uint8_t m_Hdr2;
565 uint16_t m_Size;
566
568
569 std::variant<uint32_t, std::array<uint32_t, 2>, std::string, SUB_0x6C, SUB_0x70_0x74, SUB_0xF6> m_Substruct;
570};
571
585
586
593{
594 uint8_t m_Type;
595 uint16_t m_R;
596 uint32_t m_Key;
597 uint32_t m_Next;
598 uint32_t m_Net;
599 uint32_t m_ConnItem;
600
602};
603
604
633
634
640{
641 uint32_t m_Key;
642
643 // Pointer to the next BLK_0x06_COMPONENT
644 uint32_t m_Next;
645 // Pointer to COMP_DEVICE_TYPE string
647 // Pointer to SYM_NAME string
648 uint32_t m_SymbolName;
649 // Points to 0x07, first instance
651 // Points to 0x0F, function slot
653 // Points to 0x08, pin number
655
656 // Points to 0x03, first 'field'
657 uint32_t m_Fields;
658
660};
661
662
688
689
715
716
737
738
743{
744 uint8_t m_T;
746 uint32_t m_Key;
747 uint32_t m_Next;
748 uint32_t m_Unknown1;
749
751
752 std::array<int32_t, 4> m_Coords;
753 std::array<uint32_t, 4> m_Unknown4;
754 std::array<uint32_t, 5> m_Unknown5;
755
757};
758
759
791
792
817
818
824{
825 uint8_t m_T;
827 uint32_t m_Key;
828 uint32_t m_Next;
829 uint32_t m_FpPtr;
830
831 uint32_t m_Unknown1;
832 uint32_t m_Unknown2;
833 uint32_t m_Unknown3;
834
837
838 std::array<int32_t, 4> m_Coords;
839
840 std::array<uint32_t, 4> m_UnknownArr;
841};
842
843
866
867
874{
875 uint32_t m_Key;
876
878
880
882
883 uint32_t m_PtrX12;
884 uint32_t m_Unknown3;
886 uint32_t m_Slots; // 0x0F?
887 uint32_t m_Fields; // Presumably a pointer to a string
888};
889
890
910
911
929
930
951
952
961{
962 uint32_t m_Key;
963 uint32_t m_Next;
964 uint32_t m_Parent;
965 uint32_t m_Flags;
966
968
969 uint32_t m_Width;
970
971 int32_t m_StartX;
972 int32_t m_StartY;
973 int32_t m_EndX;
974 int32_t m_EndY;
975};
976
983{
984 uint32_t m_Key;
985 uint32_t m_Next;
986 uint32_t m_NetName;
987
988 uint32_t m_Unknown1;
989
991
992 uint32_t m_Type;
993
994 uint32_t m_Assignment;
995 uint32_t m_Ratline;
997 uint32_t m_FieldsPtr;
999 uint32_t m_ModelPtr;
1003};
1004
1005
1019
1020
1026{
1050
1051 uint8_t m_Type;
1055
1057
1058 int32_t m_W;
1059 int32_t m_H;
1060
1062
1063 int32_t m_X3;
1064 int32_t m_X4;
1065
1067
1074 uint32_t m_StrPtr;
1075
1076 // In versions < 17.2, seems to be not present in the last entry.
1077 std::optional<uint32_t> m_Z2;
1078};
1079
1080
1089{
1091
1095 uint8_t m_N;
1097 uint32_t m_Key;
1098 uint32_t m_Next;
1099 uint32_t m_PadStr;
1100
1105 uint32_t m_Drill;
1106 uint32_t m_Unknown2;
1107 uint32_t m_PadPath;
1108
1113
1115
1116 // Not sure if this is really a substruct
1117 // Only lower 4 bits (top 4 are type)
1118 uint8_t m_A;
1119 uint8_t m_B;
1120 uint8_t m_C;
1121 uint8_t m_D;
1122
1126
1128
1130
1131 // Presumably the counterpart to m_Unknown10
1132 // Or just padding (?)
1134
1141 std::array<uint32_t, 8> m_DrillArr;
1142
1150
1152
1158
1178 {
1179 // V<172 verified slots
1183
1184 // V>=172 verified slots
1186 };
1187
1193 {
1194 // First slot: Antipad
1196 // Thermal relief shape
1198 // Pad shape
1199 PAD = 2,
1200 // Unsure what this layer component slot is
1201 // But I suspect it's keepout, as that was added in V172.
1203 };
1204
1217 std::vector<PADSTACK_COMPONENT> m_Components;
1218
1224
1231 std::vector<uint32_t> m_UnknownArrN;
1232};
1233
1234
1239{
1240 uint32_t m_Key;
1241 uint32_t m_Next;
1242 uint32_t m_NameStrKey;
1243 uint32_t m_FieldPtr;
1244 uint16_t m_SizeA;
1245 uint16_t m_SizeB;
1246
1252 std::vector<std::array<uint8_t, 56>> m_DataB;
1257 std::vector<std::array<uint8_t, 256>> m_DataA;
1258
1260};
1261
1262
1268{
1269 uint8_t m_Type;
1270 uint16_t m_T2;
1271 uint32_t m_Key;
1272 uint32_t m_Next;
1273
1274 // Versioning seems unsure here
1275 // At least it is in Kinoma (V_164)
1278
1279 uint32_t m_StrPtr;
1280 uint32_t m_Size;
1281
1282 std::string m_String;
1283
1285};
1286
1287
1292{
1293 uint32_t m_Key;
1294 uint32_t m_Next;
1295 uint32_t m_Unknown2;
1296 uint32_t m_Unknown3;
1297 uint32_t m_Unknown4;
1298 uint16_t m_Unknown5;
1299 uint16_t m_Size;
1300
1304 std::vector<uint8_t> m_Substruct;
1305};
1306
1307
1328
1335{
1336 uint8_t m_Type;
1337 uint16_t m_R;
1338 uint32_t m_Size;
1339 uint32_t m_Key;
1340
1346 std::vector<uint8_t> m_Data;
1347};
1348
1349
1354{
1355 uint8_t m_Type;
1356 uint16_t m_T2;
1357 uint32_t m_Key;
1358
1360
1361 std::array<uint32_t, 8> m_UnknownArray;
1362};
1363
1364
1369{
1370 uint8_t m_Type;
1372 uint32_t m_Key;
1373 uint32_t m_Next;
1374
1375 std::array<uint32_t, 2> m_Flags;
1376
1377 uint32_t m_Ptr1;
1378 uint32_t m_Ptr2;
1379 uint32_t m_Ptr3;
1380
1381 std::array<int32_t, 5> m_Coords;
1382
1383 std::array<uint32_t, 4> m_Unknown1;
1384
1386
1388};
1389
1390
1396{
1397 uint8_t m_Type;
1399 uint32_t m_Key;
1400 uint32_t m_Next;
1401 uint32_t m_Parent;
1402 uint32_t m_Unknown1;
1403
1405
1406 std::array<int32_t, 4> m_Coords;
1407
1408 uint32_t m_Ptr2;
1409
1410 uint32_t m_Unknown3;
1411 uint32_t m_Unknown4;
1412 uint32_t m_Unknown5;
1413};
1414
1415
1434
1435
1445{
1446 std::vector<uint32_t> m_Refs;
1447};
1448
1449
1486
1487
1494{
1495 uint8_t m_Type;
1496 uint16_t m_T;
1497 uint32_t m_Key;
1498
1499 // Points to something in the header
1500 uint32_t m_Ptr1;
1501 uint32_t m_Ptr2;
1502
1503 uint32_t m_Null; // Null value
1504
1505 uint32_t m_Ptr3;
1506
1507 int32_t m_Coord1;
1508 int32_t m_Coord2;
1509
1511
1512 uint32_t m_Unknown1;
1513
1514 // Pointer to a string, e.g., "2" in R0603
1515 uint32_t m_PtrX30;
1516
1517 uint32_t m_Unknown2;
1518 uint32_t m_Unknown3;
1519 uint32_t m_Unknown4;
1520};
1521
1522
1549
1550
1557{
1558 uint32_t m_Key;
1559
1560 uint32_t m_FpStrRef;
1561 uint32_t m_Unknown1;
1562
1563 // Could these be signed?
1564 std::array<uint32_t, 4> m_Coords;
1565
1566 uint32_t m_Next;
1575
1578};
1579
1580
1608
1609
1618{
1620 uint8_t m_Layer; // 0 = top (F_Cu), 1 = bottom (B_Cu)
1622
1623 uint32_t m_Key;
1624
1625 uint32_t m_Next;
1626
1628
1629 // Unsure what 16x means
1631
1632 uint16_t m_Unknown2;
1633 uint16_t m_Unknown3;
1634
1636
1637 uint32_t m_Flags;
1638
1639 uint32_t m_Rotation;
1640 int32_t m_CoordX;
1641 int32_t m_CoordY;
1642
1643 // Presumably equivalent to m_InstRef16x
1645
1648 uint32_t m_TextPtr; // Points to 0x30
1649
1651 uint32_t m_AreasPtr;
1654};
1655
1656
1676
1677
1682{
1683 uint8_t m_Type;
1684 uint16_t m_T2;
1685 uint32_t m_Key;
1686
1687 std::array<uint32_t, 6> m_UnknownArray;
1688};
1689
1690
1748
1749
1783
1784
1791{
1792 uint8_t m_Type;
1794 uint32_t m_Key;
1795 uint32_t m_Next;
1796 uint32_t m_NetPtr;
1797 uint32_t m_Flags;
1798
1800
1801 uint32_t m_NextInFp;
1802 uint32_t m_ParentFp;
1803 uint32_t m_Track;
1804 uint32_t m_PadPtr;
1805 uint32_t m_Ptr6;
1806 uint32_t m_Ratline;
1809
1811
1812 uint32_t m_NameText;
1813 uint32_t m_Ptr11;
1814
1815 std::array<int32_t, 4> m_Coords;
1816};
1817
1818
1851
1852
1857{
1858 uint8_t m_T;
1860 uint32_t m_Key;
1861 uint32_t m_Next;
1862 uint32_t m_Ptr1;
1863
1865
1866 uint32_t m_Flags;
1867 uint32_t m_Ptr2;
1868 uint32_t m_Ptr3;
1869 uint32_t m_Unknown2;
1870};
1871
1872
1878{
1879 uint8_t m_T2;
1880 uint16_t m_T3;
1881
1882 std::array<uint8_t, 120> m_Content;
1883};
1884
1885
1892{
1893 uint16_t m_Code;
1894 uint32_t m_Key;
1895 uint32_t m_Next;
1896
1898
1899 uint32_t m_NumItems;
1900 uint32_t m_Count;
1901 uint32_t m_LastIdx;
1902 uint32_t m_Unknown2;
1903
1905
1914
1921
1922 struct X05
1923 {
1924 std::array<uint8_t, 28> m_Unknown;
1925 };
1926
1927 struct X06
1928 {
1929 uint16_t m_N;
1930 uint8_t m_R;
1931 uint8_t m_S;
1932 uint32_t m_Unknown1;
1933
1935 };
1936
1950
1951 struct X0B
1952 {
1953 std::array<uint8_t, 1016> m_Unknown;
1954 };
1955
1956 struct X0C
1957 {
1958 std::array<uint8_t, 232> m_Unknown;
1959 };
1960
1961 struct X0D
1962 {
1963 std::array<uint8_t, 200> m_Unknown;
1964 };
1965
1966 struct X0F
1967 {
1968 uint32_t m_Key;
1969 std::array<uint32_t, 3> m_Ptrs;
1970 uint32_t m_Ptr2;
1971 };
1972
1973 struct X10
1974 {
1975 std::array<uint8_t, 108> m_Unknown;
1976
1977 // V18 has an extra uint32 "somewhere" in this block
1979 };
1980
1981 using SubstructVariant = std::variant<X02, X03, X05, X06, FontDef_X08, X0B, X0C, X0D, X0F, X10>;
1982
1983 std::vector<SubstructVariant> m_Items;
1984};
1985
1986
1993{
1994 uint8_t m_T;
1995 uint16_t m_T2;
1996 uint32_t m_Key;
1997 uint32_t m_Ptr1;
1998 uint32_t m_Unknown1;
1999 uint32_t m_Capacity;
2000 uint32_t m_Count;
2001 uint32_t m_Unknown2;
2002
2003 std::array<uint32_t, 100> m_Ptrs;
2004
2006};
2007
2008
2027
2028
2033{
2034 uint32_t m_Key;
2035 uint32_t m_Parent;
2036 uint32_t m_Head;
2037
2038 // Array of 22 uint16_t values
2039 std::array<uint16_t, 22> m_X;
2040};
2041
2042
2055
2056
2062{
2063 uint8_t m_T;
2064 uint16_t m_SubType;
2065 uint32_t m_Len;
2066
2067 std::string m_Name;
2068 std::string m_Type;
2069
2070 uint32_t m_Unknown1;
2071 uint32_t m_Unknown2;
2072
2074
2075 std::string m_Value;
2076};
2077
2078
2084{
2085 uint8_t m_T;
2086 uint16_t m_T2;
2087 uint32_t m_Key;
2088
2090
2092 std::vector<uint32_t> m_Entries;
2093};
2094
2095
2100{
2101public:
2102 RAW_BOARD();
2103
2104 std::unique_ptr<FILE_HEADER> m_Header;
2105
2110
2115 std::unordered_map<uint32_t, std::string> m_StringTable;
2116
2117 // All the objects in the file
2118 std::vector<std::unique_ptr<BLOCK_BASE>> m_Objects;
2119
2120 // Map of keys to objects (for the objects we can get keys for)
2121 std::unordered_map<uint32_t, BLOCK_BASE*> m_ObjectKeyMap;
2122
2123 // Lists of the objects by type
2124 std::unordered_map<uint8_t, std::vector<BLOCK_BASE*>> m_ObjectLists;
2125
2126 static const size_t STRING_TABLE_OFFSET = 0x1200;
2127
2128 const BLOCK_BASE* GetObjectByKey( uint32_t aKey ) const
2129 {
2130 auto it = m_ObjectKeyMap.find( aKey );
2131 if( it != m_ObjectKeyMap.end() )
2132 return it->second;
2133 return nullptr;
2134 }
2135
2136 const std::string& GetString( uint32_t aId ) const
2137 {
2138 if( m_StringTable.count( aId ) )
2139 return m_StringTable.at( aId );
2140
2141 static const std::string empty;
2142 return empty;
2143 }
2144};
2145
2146} // namespace ALLEGRO
The base class for all blocks in the main body of an Allegro file.
uint32_t GetKey() const
virtual ~BLOCK_BASE()=default
uint8_t GetBlockType() const
BLOCK_BASE(uint8_t aBlockType, size_t aOffset)
BLOCK(uint8_t aBlockType, size_t aOffset)
const T & GetData() const
static bool empty(const wxTextEntryBase *aCtrl)
FIELD_KEYS
Hdr1 keys for field roles.
@ PHYS_CONSTRAINT_SET
Physical Constraint Set assignment.
@ NET_SCHEDULE
Net class/schedule assignment.
PAD_TYPE
The type of the padstack.
constexpr bool operator>=(FMT_VER lhs, FMT_VER rhs)
FMT_VER
The format of an Allego file.
Arc segment used in tracks, zone outlines, and shape boundaries.
std::array< int32_t, 4 > m_BoundingBoxCoords
uint8_t m_SubType
Bit 6 (0x40) = clockwise direction.
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown6
std::array< uint32_t, 20 > m_Entries
Field/property references with variable-typed substructs.
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown1
std::variant< uint32_t, std::array< uint32_t, 2 >, std::string, SUB_0x6C, SUB_0x70_0x74, SUB_0xF6 > m_Substruct
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown2
Net assignment linking a net (0x1B) to its member objects.
COND_GE< FMT_VER::V_174, uint32_t > m_Unknown
Track segment container.
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown5b
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown5a
Component/symbol definitions.
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown1
Component instance reference data.
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown2
COND_LT< FMT_VER::V_172, uint32_t > m_Unknown4
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown3
COND_GE< FMT_VER::V_172, uint32_t > m_UnknownPtr1
Pin number within a component.
COND_GE< FMT_VER::V_172, uint32_t > m_Previous
COND_LT< FMT_VER::V_172, uint32_t > m_StrPtr16x
COND_GE< FMT_VER::V_172, uint32_t > m_StrPtr
Pointer to 0x11 PIN_NAME object.
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown1
0x0A objects represent DRC (Design Rule Check) elements.
std::array< uint32_t, 4 > m_Unknown4
std::array< int32_t, 4 > m_Coords
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown2
COND_GE< FMT_VER::V_174, uint32_t > m_Unknown6
std::array< uint32_t, 5 > m_Unknown5
Pin definition with shape type, drill character, coordinates, and size.
COND_GE< FMT_VER::V_174, uint32_t > m_Unknown6
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown_16x
COND_LT< FMT_VER::V_172, uint8_t > m_DrillChar
COND_LT< FMT_VER::V_172, uint8_t > m_Shape
std::array< uint32_t, 3 > m_UnknownArray
std::array< int32_t, 2 > m_Size
COND_GE< FMT_VER::V_172, uint32_t > m_DrillChars
COND_GE< FMT_VER::V_172, uint32_t > m_Shape16x
std::array< int32_t, 2 > m_Coords
COND_LT< FMT_VER::V_172, uint16_t > m_UnknownPadding
Pad geometry and placement in board-absolute coordinates.
uint32_t m_Rotation
Board-absolute millidegrees. Subtract footprint rotation for FP-local orientation.
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown3
int32_t m_CoordsX
Board coordinates. Use SetFPRelativePosition() for KiCad FP-local space.
COND_GE< FMT_VER::V_174, uint32_t > m_Unknown1
int32_t m_CoordsY
Board coordinates. Use SetFPRelativePosition() for KiCad FP-local space.
Shape/fill segment linking a copper shape to its parent footprint.
std::array< int32_t, 4 > m_Coords
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown4
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown5
std::array< uint32_t, 4 > m_UnknownArr
Function slot in a multi-slot component (e.g.
std::array< char, 32 > m_CompDeviceType
COND_GE< FMT_VER::V_174, uint32_t > m_Unknown3
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown2
Function instance linking a component instance (0x07) to its schematic function, pin cross-references...
COND_GE< FMT_VER::V_174, uint32_t > m_Unknown2
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown1
Pin name within a component, linked from function slots (0x0F).
uint32_t m_Key
Pointer to pin name string.
uint32_t m_PinNameStrPtr
Pointer to next 0x11 PIN_NAME object or 0x0F SLOT.
COND_GE< FMT_VER::V_174, uint32_t > m_Unknown2
uint32_t m_Next
Pointer to 0x08 PIN_NUMBER object.
Cross-reference between objects.
COND_GE< FMT_VER::V_165, uint32_t > m_Unknown2
COND_GE< FMT_VER::V_174, uint32_t > m_Unknown3
Graphics container holding a chain of line segments and arcs.
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown2
0x15 , 0x16, 0x17 are segments:
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown2
0x1B objects are nets.
uint32_t m_Ratline
Pointer to first 0x03 FIELD object or null.
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown2
uint32_t m_MatchGroupPtr
Diff pair / match group pointer (0x26 or 0x2C)
Padstack definition containing drill dimensions and a table of per-layer pad/antipad/thermal componen...
std::array< uint32_t, 8 > m_DrillArr
In >= V172, elements [4] and [7] hold drill dimensions: [4] = drill diameter (or width for oblong dri...
COND_GE< FMT_VER::V_172, uint16_t > m_Unknown11
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown7
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown9
COND_LT< FMT_VER::V_172, uint32_t > m_Unknown6
COND_LT< FMT_VER::V_172, uint32_t > m_Unknown3
LAYER_COMP_SLOT
Component table layer offsets In the component table's layer section, each layer has 3 or 4 slots,...
COND_GE< FMT_VER::V_180, std::array< uint32_t, 8 > > m_V180Trailer
V180 inserts 8 extra uint32s between the fixed arrays and the component table.
COND_LT< FMT_VER::V_172, uint16_t > m_Unknown10
COND_LT< FMT_VER::V_172, uint32_t > m_Unknown5
uint32_t m_Drill
In < V172, this is the drill diameter in internal coordinates.
std::vector< uint32_t > m_UnknownArrN
Some structure of m_N * 8 or 10:
COND_LT< FMT_VER::V_172, uint32_t > m_Unknown4
COND_GE< FMT_VER::V_172, std::array< uint32_t, 28 > > m_SlotAndUnknownArr
In V172+, elements [0] and [3] hold the true slot outline dimensions (X, Y) in internal coordinate un...
size_t m_NumFixedCompEntries
How many of the entries are fixed roles (after this is n*layers)
uint8_t m_N
The number of something.
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown8
std::vector< PADSTACK_COMPONENT > m_Components
Collection of components that make up the padstack.
SLOTS
Fixed slot indices in the component table.
COND_GE_LT< FMT_VER::V_165, FMT_VER::V_172, std::array< uint32_t, 8 > > m_UnknownArr8_2
Physical constraint sets containing trace width, clearance, and routing rules.
uint32_t m_FieldPtr
Pointer to 0x03 FIELD with CS name (fallback when m_NameStrKey fails)
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown4
uint32_t m_NameStrKey
String table key for constraint set name.
std::vector< std::array< uint8_t, 256 > > m_DataA
Records contain ASCII padstack/via name strings (null-terminated at offset 4) and file path reference...
std::vector< std::array< uint8_t, 56 > > m_DataB
Per-copper-layer dimension values, 14 x int32 per record.
uint32_t m_Next
Linked list next pointer (used by LL_WALKER)
Signal integrity and simulation model data (IBIS netlists).
COND_GE< FMT_VER::V_164, uint16_t > m_Unknown3
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown4
uint32_t m_Next
Linked list next pointer (used by LL_WALKER)
COND_GE< FMT_VER::V_164, uint16_t > m_Unknown2
Per-padstack dimension records with name and value.
std::vector< uint8_t > m_Substruct
Version-dependent substruct holding padstack dimension name and value.
uint32_t m_Next
Linked list next pointer (used by LL_WALKER)
COND_GE< FMT_VER::V_174, std::array< uint32_t, 10 > > m_UnknownArray2
std::array< uint32_t, 7 > m_UnknownArray1
Headered data blob containing structured board data such as layer stackup definitions,...
std::vector< uint8_t > m_Data
An array of bytes that seems to be a variable length.
Purpose not determined.
COND_GE< FMT_VER::V_174, uint32_t > m_Unknown1
std::array< uint32_t, 8 > m_UnknownArray
0x23 objects represent ratlines.
COND_GE< FMT_VER::V_164, std::array< uint32_t, 4 > > m_Unknown2
std::array< uint32_t, 4 > m_Unknown1
COND_GE< FMT_VER::V_174, uint32_t > m_Unknown3
std::array< uint32_t, 2 > m_Flags
std::array< int32_t, 5 > m_Coords
Rectangle defined by four coordinates.
std::array< int32_t, 4 > m_Coords
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown2
Match group indirection for differential pairs and match groups.
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown1
uint32_t m_ConstPtr
Points to timing/delay constraints (field type 0x63), not physical constraints.
COND_GE< FMT_VER::V_174, uint32_t > m_Unknown2
Serialized Constraint Manager database containing secondary name table (V172+), material stackup,...
Polygon shape defined by a linked list of segments starting at m_FirstSegmentPtr (0x15/0x16/0x17 line...
COND_LT< FMT_VER::V_172, uint32_t > m_Ptr7_16x
COND_GE< FMT_VER::V_172, uint32_t > m_Ptr7
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown3
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown2
std::array< int32_t, 4 > m_Coords
0x29 objects may represent pins in .dra files.
std::string m_Name
uint32_t m_Properties
uint32_t m_Unknown
uint32_t mLayerNameId
Represents a list of layers.
COND_GE< FMT_VER::V_165, std::vector< REF_ENTRY > > m_RefEntries
COND_GE< FMT_VER::V_174, uint32_t > m_Unknown
COND_LT< FMT_VER::V_165, std::vector< NONREF_ENTRY > > m_NonRefEntries
Footprint definition (template) shared by multiple placed instances.
COND_GE< FMT_VER::V_164, uint32_t > m_Unknown2
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown3
std::array< uint32_t, 4 > m_Coords
Lookup table used for named associations.
COND_LT< FMT_VER::V_172, uint32_t > m_Unknown4
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown3
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown2
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown1
Placed footprint instance on the board.
uint32_t m_Rotation
Millidegrees (divide by 1000 for degrees)
COND_LT< FMT_VER::V_172, uint32_t > m_InstRef16x
COND_GE< FMT_VER::V_172, uint32_t > m_InstRef
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown1
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown4
Connection point at a track junction or pad-to-track transition.
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown3
Purpose not determined.
std::array< uint32_t, 6 > m_UnknownArray
Text object with position, rotation, layer, font properties, and alignment.
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown2
COND_GE< FMT_VER::V_172, TEXT_PROPERTIES > m_Font
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown1
COND_GE< FMT_VER::V_172, uint32_t > m_Ptr2
COND_GE< FMT_VER::V_172, uint32_t > m_Ptr1
COND_GE< FMT_VER::V_174, uint32_t > m_Unknown3
COND_LT< FMT_VER::V_172, uint32_t > m_Ptr3_16x
COND_LT< FMT_VER::V_172, TEXT_PROPERTIES > m_Font16x
String graphic content holding the actual text value and its display layer category.
COND_GE< FMT_VER::V_174, uint32_t > m_Un2
Placed pad instance linking a pad definition (0x0D via m_PadPtr) to its parent footprint (m_ParentFp)...
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown2
std::array< int32_t, 4 > m_Coords
COND_GE< FMT_VER::V_172, uint32_t > m_Prev
Via instance with board position, padstack reference (m_Padstack for drill/annular ring definitions),...
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown3
COND_GE< FMT_VER::V_172, uint32_t > m_UnknownPtr2
std::array< int32_t, 4 > m_BoundingBoxCoords
0x34 objects represent keepouts.
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown1
File path references to Allegro log and report files (terminator.log, eclrpt.txt).
std::array< uint8_t, 120 > m_Content
COND_GE< FMT_VER::V_172, std::array< uint32_t, 8 > > m_Ys
COND_GE< FMT_VER::V_174, uint32_t > m_Unknown2
COND_GE< FMT_VER::V_172, std::array< uint32_t, 2 > > m_Zs
COND_GE< FMT_VER::V_164, std::array< uint32_t, 3 > > m_Ys
COND_GE< FMT_VER::V_172, std::string > m_Str
COND_GE< FMT_VER::V_174, uint32_t > m_Unknown1
COND_LT< FMT_VER::V_172, std::string > m_Str16x
std::array< uint8_t, 28 > m_Unknown
COND_LT< FMT_VER::V_172, std::array< uint32_t, 50 > > m_Unknown2
std::array< uint8_t, 1016 > m_Unknown
std::array< uint8_t, 232 > m_Unknown
std::array< uint8_t, 200 > m_Unknown
std::array< uint8_t, 108 > m_Unknown
COND_GE< FMT_VER::V_180, uint32_t > m_Unknown2
Heterogeneous definition table containing font metrics (FontDef_X08), layer name definitions (X03),...
std::variant< X02, X03, X05, X06, FontDef_X08, X0B, X0C, X0D, X0F, X10 > SubstructVariant
COND_GE< FMT_VER::V_174, uint32_t > m_Unknown3
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown1
std::vector< SubstructVariant > m_Items
Fixed-capacity pointer array (100 entries).
COND_GE< FMT_VER::V_174, uint32_t > m_UnknownArr
std::array< uint32_t, 100 > m_Ptrs
0x38 objects represent films.
COND_GE< FMT_VER::V_166, uint32_t > m_Unknown2
std::array< uint32_t, 7 > m_UnknownArray1
COND_GE< FMT_VER::V_174, uint32_t > m_Unknown3
COND_GE< FMT_VER::V_166, uint32_t > m_LayerNameStr
COND_LT< FMT_VER::V_166, std::string > m_FilmName
0x39 objects represent a film layer list.
0x3A objects represent a list of films
COND_GE< FMT_VER::V_174, uint32_t > m_Unknown1
Named property with type and value strings.
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown3
Ordered list of block keys.
COND_GE< FMT_VER::V_174, uint32_t > m_Unknown
std::vector< uint32_t > m_Entries
COND_FIELD_BASE & operator=(const T &value)
COND_FIELD_BASE & operator=(T &&value)
virtual bool exists(FMT_VER ver) const =0
Define this function in the derived class to determine if the field exists in the given version of th...
const T & value_or(const T &aDefault) const
This is a conditional field that only exists in versions of a file less than a certain version.
constexpr bool exists(FMT_VER ver) const
Define this function in the derived class to determine if the field exists in the given version of th...
This is a conditional field that only exists in versions of a file of or above a certain version.
constexpr bool exists(FMT_VER ver) const
Define this function in the derived class to determine if the field exists in the given version of th...
This is a conditional field that only exists in versions of a file less than a certain version.
constexpr bool exists(FMT_VER ver) const
Define this function in the derived class to determine if the field exists in the given version of th...
uint32_t m_LayerList0x2A
uint32_t m_A
This is apparently some kind of linked list that chains though subsets objects in the file.
Allegro files start with this header.
COND_GE< FMT_VER::V_180, LINKED_LIST > m_LL_V18_4
COND_GE< FMT_VER::V_180, uint32_t > m_Unknown2g_V18
COND_LT< FMT_VER::V_180, std::array< uint32_t, 7 > > m_Unknown2_preV18
COND_LT< FMT_VER::V_180, uint32_t > m_0x35_Start_preV18
COND_GE< FMT_VER::V_180, std::array< uint32_t, 9 > > m_Unknown5_V18
std::array< char, 60 > m_AllegroVersion
COND_GE< FMT_VER::V_180, LINKED_LIST > m_LL_V18_5
COND_GE< FMT_VER::V_180, uint32_t > m_0x35_Start_V18
COND_LT< FMT_VER::V_180, LINKED_LIST > m_LL_Unknown5_preV18
COND_GE< FMT_VER::V_180, LINKED_LIST > m_LL_V18_3
COND_LT< FMT_VER::V_180, uint32_t > m_Unknown7
std::array< LAYER_MAP_ENTRY, 25 > m_LayerMap
The layer maps is a list of groups of two numbers.
COND_GE< FMT_VER::V_180, uint32_t > m_Unknown2e_V18
std::array< uint32_t, 50 > m_Unknown9
COND_LT< FMT_VER::V_180, uint32_t > m_0x27_End_preV18
COND_GE< FMT_VER::V_180, LINKED_LIST > m_LL_Unknown5_V18
COND_GE< FMT_VER::V_180, uint32_t > m_0x27_End_V18
COND_GE< FMT_VER::V_180, uint32_t > m_0x35_End_V18
COND_GE< FMT_VER::V_180, LINKED_LIST > m_LL_V18_6
uint32_t Get_0x27_End() const
const LINKED_LIST & GetUnknown5() const
COND_LT< FMT_VER::V_180, std::array< uint32_t, 17 > > m_Unknown5_preV18
COND_LT< FMT_VER::V_180, uint32_t > m_Unknown3
COND_LT< FMT_VER::V_180, uint32_t > m_0x35_End_preV18
COND_GE< FMT_VER::V_180, LINKED_LIST > m_LL_V18_1
COND_LT< FMT_VER::V_180, uint32_t > m_StringCount_preV18
COND_GE< FMT_VER::V_180, uint32_t > m_StringCount_V18
uint32_t GetStringsCount() const
COND_GE< FMT_VER::V_180, uint32_t > m_Unknown2b_V18
COND_GE< FMT_VER::V_180, uint32_t > m_Unknown2d_V18
COND_GE< FMT_VER::V_180, LINKED_LIST > m_LL_V18_2
COND_GE< FMT_VER::V_180, uint32_t > m_Unknown2a_V18
SUBCLASS
The second byte in a CLASS:SUBCLASS pair.
bool operator==(const LAYER_INFO &) const =default
Substruct in a padstack object.
uint32_t m_StrPtr
Seems to point to various things:
COND_GE< FMT_VER::V_172, int16_t > m_Z1
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown1
COND_GE< FMT_VER::V_172, int16_t > m_Z
std::optional< uint32_t > m_Z2
const BLOCK_BASE * GetObjectByKey(uint32_t aKey) const
static const size_t STRING_TABLE_OFFSET
std::unordered_map< uint32_t, std::string > m_StringTable
The string map is a map of U32 ID to strings.
const std::string & GetString(uint32_t aId) const
std::unordered_map< uint32_t, BLOCK_BASE * > m_ObjectKeyMap
FMT_VER m_FmtVer
What version is this file?
std::vector< std::unique_ptr< BLOCK_BASE > > m_Objects
std::unique_ptr< FILE_HEADER > m_Header
std::unordered_map< uint8_t, std::vector< BLOCK_BASE * > > m_ObjectLists
0x33 VIA objects.
Definition allegro_db.h:797