8 #include "../../odbdesign_export.h"
9 #include "../../enums.h"
10 #include "../../IProtoBuffable.h"
11 #include "PropertyRecord.h"
12 #include "../../ProtoBuf/componentsfile.pb.h"
13 #include "AttributeLookupTable.h"
14 #include "../IStreamSaveable.h"
17 namespace Odb::Lib::FileModel::Design
25 bool Parse(std::filesystem::path directory);
27 bool Save(std::ostream& os)
override;
29 std::string GetUnits()
const;
30 BoardSide GetSide()
const;
31 std::filesystem::path GetPath();
32 std::filesystem::path GetDirectory();
33 std::string GetLayerName()
const;
53 constexpr
inline static const char* RECORD_TOKEN =
"CMP";
56 typedef std::map<std::string, std::shared_ptr<ComponentRecord>> StringMap;
57 typedef std::vector<std::shared_ptr<ComponentRecord>> Vector;
62 unsigned int pinNumber;
67 unsigned int netNumber;
68 unsigned int subnetNumber;
72 constexpr
inline static const char* RECORD_TOKEN =
"TOP";
75 typedef std::map<std::string, std::shared_ptr<ToeprintRecord>> StringMap;
76 typedef std::vector<std::shared_ptr<ToeprintRecord>> Vector;
79 std::unique_ptr<Odb::Lib::Protobuf::ComponentsFile::ComponentRecord::ToeprintRecord> to_protobuf()
const override;
80 void from_protobuf(
const Odb::Lib::Protobuf::ComponentsFile::ComponentRecord::ToeprintRecord& message)
override;
83 PropertyRecord::Vector m_propertyRecords;
84 ToeprintRecord::Vector m_toeprintRecords;
87 std::unique_ptr<Odb::Lib::Protobuf::ComponentsFile::ComponentRecord> to_protobuf()
const override;
88 void from_protobuf(
const Odb::Lib::Protobuf::ComponentsFile::ComponentRecord& message)
override;
97 std::vector<std::string> descriptions;
104 std::unique_ptr<Odb::Lib::Protobuf::ComponentsFile::BomDescriptionRecord> to_protobuf()
const override;
105 void from_protobuf(
const Odb::Lib::Protobuf::ComponentsFile::BomDescriptionRecord& message)
override;
107 typedef std::vector<std::shared_ptr<BomDescriptionRecord>> Vector;
108 typedef std::map<std::string, std::shared_ptr<BomDescriptionRecord>> StringMap;
110 inline static const char* CPN_RECORD_TOKEN =
"CPN";
111 inline static const char* PKG_RECORD_TOKEN =
"PKG";
112 inline static const char* IPN_RECORD_TOKEN =
"IPN";
113 inline static const char* DSC_RECORD_TOKEN =
"DSC";
114 inline static const char* VPL_VND_RECORD_TOKEN =
"VPL_VND";
115 inline static const char* VPL_MPN_RECORD_TOKEN =
"VPL_MPN";
116 inline static const char* VND_RECORD_TOKEN =
"VND";
117 inline static const char* MPN_RECORD_TOKEN =
"MPN";
121 const ComponentRecord::Vector& GetComponentRecords()
const;
122 const ComponentRecord::StringMap& GetComponentRecordsByName()
const;
123 const std::vector<std::string>& GetAttributeNames()
const;
124 const std::vector<std::string>& GetAttributeTextValues()
const;
125 const BomDescriptionRecord::StringMap& GetBomDescriptionRecordsByCpn()
const;
127 constexpr
inline static const char* TOP_COMPONENTS_LAYER_NAME =
"comp_+_top";
128 constexpr
inline static const char* BOTTOM_COMPONENTS_LAYER_NAME =
"comp_+_bot";
131 std::unique_ptr<Odb::Lib::Protobuf::ComponentsFile> to_protobuf()
const override;
132 void from_protobuf(
const Odb::Lib::Protobuf::ComponentsFile& message)
override;
138 std::string m_layerName;
139 std::filesystem::path m_path;
140 std::filesystem::path m_directory;
142 std::vector<std::string> m_attributeNames;
143 std::vector<std::string> m_attributeTextValues;
145 ComponentRecord::Vector m_componentRecords;
147 ComponentRecord::StringMap m_componentRecordsByName;
149 BomDescriptionRecord::StringMap m_bomDescriptionRecordsByCpn;
151 const bool m_allowToepintNetNumbersOfNegative1 =
true;
153 constexpr
inline static const char* COMPONENTS_FILENAMES[] =
160 constexpr
inline static const char* UNITS_TOKEN =
"UNITS";
161 constexpr
inline static const char* ID_TOKEN =
"ID";
162 constexpr
inline static const char* ATTRIBUTE_NAME_TOKEN =
"@";
163 constexpr
inline static const char* ATTRIBUTE_VALUE_TOKEN =
"&";
164 constexpr
inline static const char* COMMENT_TOKEN =
"#";
167 constexpr
inline static const char* BOM_DESCR_RECORD_TOKEN_CPN =
"CPN";
168 constexpr
inline static const char* BOM_DESCR_RECORD_TOKEN_PKG =
"PKG";
169 constexpr
inline static const char* BOM_DESCR_RECORD_TOKEN_IPN =
"IPN";
170 constexpr
inline static const char* BOM_DESCR_RECORD_TOKEN_DSC =
"DSC";
171 constexpr
inline static const char* BOM_DESCR_RECORD_TOKEN_VPL_VND =
"VPL_VND";
172 constexpr
inline static const char* BOM_DESCR_RECORD_TOKEN_VPL_MPN =
"VPL_MPN";
173 constexpr
inline static const char* BOM_DESCR_RECORD_TOKEN_VND =
"VND";
174 constexpr
inline static const char* BOM_DESCR_RECORD_TOKEN_MPN =
"MPN";