OdbDesignLib
OdbDesign ODB++ Parsing Library
Package.h
1 #pragma once
2 
3 #include "../odbdesign_export.h"
4 #include <string>
5 #include <memory>
6 #include <vector>
7 #include <map>
8 #include "Pin.h"
9 #include "../ProtoBuf/package.pb.h"
10 #include "../IProtoBuffable.h"
11 
12 
13 namespace Odb::Lib::ProductModel
14 {
15  class ODBDESIGN_EXPORT Package : public IProtoBuffable<Odb::Lib::Protobuf::ProductModel::Package>
16  {
17  public:
18  Package(const std::string& name, unsigned int index);
19  ~Package();
20 
21  std::string GetName() const;
22  unsigned int GetIndex() const;
23 
24  void AddPin(const std::string& name);
25  std::shared_ptr<Pin> GetPin(const std::string& name) const;
26  std::shared_ptr<Pin> GetPin(unsigned int index) const;
27  const Pin::StringMap& GetPinsByName() const;
28  const Pin::Vector& GetPins() const;
29 
30  // Inherited via IProtoBuffable
31  std::unique_ptr<Odb::Lib::Protobuf::ProductModel::Package> to_protobuf() const override;
32  void from_protobuf(const Odb::Lib::Protobuf::ProductModel::Package& message) override;
33 
34  typedef std::vector<std::shared_ptr<Package>> Vector;
35  typedef std::map<std::string, std::shared_ptr<Package>> StringMap;
36 
37  private:
38  std::string m_name;
39  Pin::Vector m_pins;
40  Pin::StringMap m_pinsByName;
41  unsigned int m_index;
42 
43  };
44 } // namespace Odb::Lib::ProductModel