OdbDesign
OdbDesign ODB++ Parser - C++ library, gRPC/REST server, CLI, tests
 
Loading...
Searching...
No Matches
Component.h
Go to the documentation of this file.
1#pragma once
2
3#include "../odbdesign_export.h"
4#include <string>
5#include <vector>
6#include <map>
7#include <memory>
8#include <optional>
9#include "Package.h"
10#include "../enums.h"
11#include "Part.h"
12#include "component.pb.h"
13#include "../IProtoBuffable.h"
14
15
17{
18 class ODBDESIGN_EXPORT Component : public IProtoBuffable<Odb::Lib::Protobuf::ProductModel::Component>
19 {
20 public:
21 Component();
22 Component(const std::string& refDes, const std::string& partName, std::shared_ptr<Package> pPackage, unsigned int index, BoardSide side, std::shared_ptr<Part> pPart, std::optional<unsigned int> id = std::nullopt);
23 ~Component();
24
25 std::string GetRefDes() const;
26 std::string GetPartName() const;
27 std::shared_ptr<Package> GetPackage() const;
28 unsigned int GetIndex() const;
29 BoardSide GetSide() const;
30 std::shared_ptr<Part> GetPart() const;
31
32 // ODB++ product-model-wide UID from ;ID= (spec p.30/p.152). Optional:
33 // absent stays absent (decision D2) — never synthesized, never a join key.
34 std::optional<unsigned int> GetId() const;
35
36 // Inherited via IProtoBuffable
37 std::unique_ptr<Odb::Lib::Protobuf::ProductModel::Component> to_protobuf() const override;
38 void from_protobuf(const Odb::Lib::Protobuf::ProductModel::Component& message) override;
39
40 //static Component* MakeEmpty();
41
42 typedef std::vector<std::shared_ptr<Component>> Vector;
43 typedef std::map<std::string, std::shared_ptr<Component>> StringMap;
44
45 private:
46 std::string m_refDes;
47 std::string m_partName;
48 std::shared_ptr<Package> m_pPackage;
49 unsigned int m_index;
50 BoardSide m_side;
51 std::shared_ptr<Part> m_pPart;
52 std::optional<unsigned int> m_id;
53 };
54}
std::map< std::string, std::shared_ptr< Component > > StringMap
Definition Component.h:43
std::vector< std::shared_ptr< Component > > Vector
Definition Component.h:42
BoardSide
Definition enums.h:6
#define ODBDESIGN_EXPORT