OdbDesignLib
OdbDesign ODB++ Parsing Library
Pin.cpp
1 #include "Pin.h"
2 #include <string>
3 #include <memory>
4 #include "../ProtoBuf/pin.pb.h"
5 
6 namespace Odb::Lib::ProductModel
7 {
8  Pin::Pin(const std::string& name, unsigned int index)
9  : m_name(name)
10  , m_index(index)
11  {
12  }
13 
14  std::string Pin::GetName() const
15  {
16  return m_name;
17  }
18 
19  unsigned int Pin::GetIndex() const
20  {
21  return m_index;
22  }
23 
24  std::unique_ptr<Odb::Lib::Protobuf::ProductModel::Pin> Odb::Lib::ProductModel::Pin::to_protobuf() const
25  {
26  auto pPinMessage = std::make_unique<Odb::Lib::Protobuf::ProductModel::Pin>();
27  pPinMessage->set_name(m_name);
28  pPinMessage->set_index(m_index);
29  return pPinMessage;
30  }
31 
32  void Pin::from_protobuf(const Odb::Lib::Protobuf::ProductModel::Pin& message)
33  {
34  m_name = message.name();
35  m_index = message.index();
36  }
37 }