KiCad PCB EDA Suite
Loading...
Searching...
No Matches
cadstar_parts_lib_model.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 (C) 2023 Roberto Fernandez Bautista <[email protected]>
5 * Copyright (C) 2023 KiCad Developers, see AUTHORS.txt for contributors.
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 along
18 * with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef CADSTAR_PARTS_LIB_MODEL_H
22#define CADSTAR_PARTS_LIB_MODEL_H
23
24#include <map>
25#include <optional>
26#include <string>
27#include <vector>
29
34struct CADSTAR_PART_PIN;
36
42{
43 std::optional<long> m_FormatNumber;
44 std::map<long, CADSTAR_PART_NODE> m_HierarchyNodes;
45 std::vector<CADSTAR_PART_ENTRY> m_PartEntries;
46};
47
48
50{
51 std::string m_Name;
52 std::optional<std::string> m_Number;
53 std::optional<std::string> m_Version;
54 std::optional<std::string> m_Description;
55 std::string m_Pcb_component;
56 std::optional<std::string> m_Pcb_alternate;
57 std::optional<std::string> m_Value; // *VALUE Note: ? character = the start of a new line
58 std::optional<std::string> m_PartDefinitionName; // *DFN
59 std::string m_ComponentStem = "";
60 std::optional<long> m_MaxPinCount;
61
62 std::optional<std::string> m_SpicePartName;
63 std::optional<std::string> m_SpiceModel;
64
65 std::optional<std::string> m_AcceptancePartName; // The part the acceptance text refers to
66 std::optional<std::string> m_AcceptanceText; // "Part Acceptance" has canonical meaning
67
69 bool m_PinsVisible = true;
70
78 std::map<long, std::string> m_PinNamesMap;
79
85 std::map<long, std::string> m_PinLabelsMap;
86
92 std::vector<std::vector<long>> m_PinEquivalences;
93
104 std::vector<CADSTAR_SWAP_GROUP> m_InternalSwapGroup;
105
116 std::vector<CADSTAR_SWAP_GROUP> m_ExternalSwapGroup;
117
124 std::map<std::string, std::string> m_UserAttributes;
125
132 std::map<std::string, CADSTAR_ATTRIBUTE_VALUE> m_SchAttributes;
133
140 std::map<std::string, CADSTAR_ATTRIBUTE_VALUE> m_PcbAttributes;
141
148 std::map<std::string, CADSTAR_ATTRIBUTE_VALUE> m_SchAndPcbAttributes;
149
158 std::map<std::string, CADSTAR_ATTRIBUTE_VALUE> m_PartAttributes;
159
163 std::vector<CADSTAR_PART_SYMBOL_ENTRY> m_Symbols;
164
172 std::map<std::string, std::vector<CADSTAR_PART_PIN>> m_HiddenPins;
173};
174
175
177{
179 m_Identifier( 0 ),
182 m_Loading()
183 {};
184
186 std::optional<long> aLoading ) :
187 m_Identifier( aId ),
188 m_Position( aPos ),
189 m_Type( aType ),
190 m_Loading( aLoading )
191 {};
192
196 std::optional<long> m_Loading;
197};
198
199
201{
203
204 CADSTAR_PART_SYMBOL_ENTRY( std::string aName, std::optional<std::string> aAlternate,
205 std::vector<CADSTAR_PART_PIN> aPins ) :
206 m_SymbolName( aName ),
207 m_SymbolAlternateName( aAlternate ),
208 m_Pins( aPins )
209 {};
210
211 std::string m_SymbolName;
212 std::optional<std::string> m_SymbolAlternateName;
213 std::vector<CADSTAR_PART_PIN> m_Pins;
214};
215
216
218{
219 bool m_ReadOnly = false;
220 std::string m_Value;
221};
222
223
225{
226 std::optional<std::string> m_Name;
227
232 std::vector<std::vector<long>> m_Gates;
233};
234
235
237{
238 std::optional<long> m_ParentNodeIdx;
239 std::string m_Name;
240 std::vector<std::string> m_PartNames;
241};
242
243#endif //CADSTAR_PARTS_LIB_MODEL_H
CADSTAR_PIN_POSITION
Positioning of pin names can be in one of four quadrants.
CADSTAR_PIN_TYPE
file: cadstar_archive_objects.h Contains common object definitions
@ UNCOMMITTED
Uncommitted pin (default)
CADSTAR Parts Library (*.lib) model - a data structure describing the contents of the file format.
std::optional< long > m_FormatNumber
std::map< long, CADSTAR_PART_NODE > m_HierarchyNodes
std::vector< CADSTAR_PART_ENTRY > m_PartEntries
std::string m_ComponentStem
std::vector< CADSTAR_SWAP_GROUP > m_InternalSwapGroup
Groups of INTERNAL gates that are interchangeable with each other.
std::map< std::string, std::vector< CADSTAR_PART_PIN > > m_HiddenPins
Pins with an implied electrical connection to a net, not part of any symbol (Note: we probably will n...
bool m_GateSwappingAllowed
std::map< std::string, CADSTAR_ATTRIBUTE_VALUE > m_SchAttributes
Dollar sign ($) line $[!]<SCM Attribute name>(<Attribute value>) Attributes related to the schematic ...
std::vector< std::vector< long > > m_PinEquivalences
Groups of pins that are interchangeable with each other.
std::map< std::string, CADSTAR_ATTRIBUTE_VALUE > m_SchAndPcbAttributes
At symbol (@) line [@[!]<SCM/PCB Attribute name>(<Attribute value>)] Attributes related to the PCB co...
std::vector< CADSTAR_SWAP_GROUP > m_ExternalSwapGroup
Groups of EXTERNAL gates that are interchangeable with each other.
std::vector< CADSTAR_PART_SYMBOL_ENTRY > m_Symbols
Symbols that form this part.
std::map< std::string, std::string > m_UserAttributes
Star (*) line *<User-defined name> This line is ignored by CADSTAR.
std::map< long, std::string > m_PinNamesMap
Map of pin identifiers to alphanumeric pin names Pin names can be a maximum of 10 characters (Typical...
std::optional< std::string > m_AcceptancePartName
bool m_PinsVisible
std::optional< std::string > m_Pcb_alternate
std::optional< std::string > m_Version
std::string m_Name
std::optional< std::string > m_SpicePartName
std::optional< std::string > m_Description
std::optional< std::string > m_Number
std::string m_Pcb_component
std::optional< std::string > m_SpiceModel
std::optional< long > m_MaxPinCount
std::optional< std::string > m_AcceptanceText
std::optional< std::string > m_PartDefinitionName
std::map< std::string, CADSTAR_ATTRIBUTE_VALUE > m_PcbAttributes
Percentage sign (%) line %[!]<PCB Attribute name>(<Attribute value>) Attributes related to the PCB co...
std::optional< std::string > m_Value
std::map< std::string, CADSTAR_ATTRIBUTE_VALUE > m_PartAttributes
Tilde (~) line ~[!]<Parts Library Attribute Name>(<Attribute Value>) Attributes related to the Part i...
std::map< long, std::string > m_PinLabelsMap
Map of pin identifiers to alphanumeric pin labels.
std::optional< long > m_ParentNodeIdx
std::vector< std::string > m_PartNames
Part names belonging to this hierarchy.
CADSTAR_PART_PIN(long aId, CADSTAR_PIN_POSITION aPos, CADSTAR_PIN_TYPE aType, std::optional< long > aLoading)
CADSTAR_PIN_POSITION m_Position
std::optional< long > m_Loading
CADSTAR_PART_SYMBOL_ENTRY()
CADSTAR_PART_SYMBOL_ENTRY(std::string aName, std::optional< std::string > aAlternate, std::vector< CADSTAR_PART_PIN > aPins)
std::string m_SymbolName
std::vector< CADSTAR_PART_PIN > m_Pins
std::optional< std::string > m_SymbolAlternateName
std::optional< std::string > m_Name
std::vector< std::vector< long > > m_Gates
Each gate is a list of pin identifiers.