OdbDesignLib
OdbDesign ODB++ Parsing Library
Via.cpp
1 #include "Via.h"
2 #include <memory>
3 #include "../ProtoBuf/via.pb.h"
4 #include "../ProtoBuf/enums.pb.h"
5 #include "../enums.h"
6 #include <string>
7 
8 
9 namespace Odb::Lib::ProductModel
10 {
11  Via::Via()
12  : m_name("")
13  , m_side(BoardSide::Top)
14  {
15  }
16 
17  std::string Via::GetName() const
18  {
19  return m_name;
20  }
21 
22  BoardSide Via::GetSide() const
23  {
24  return m_side;
25  }
26 
27  std::unique_ptr<Odb::Lib::Protobuf::ProductModel::Via> Via::to_protobuf() const
28  {
29  auto pViaMsg = std::make_unique<Odb::Lib::Protobuf::ProductModel::Via>();
30  pViaMsg->set_name(m_name);
31  pViaMsg->set_boardside(static_cast<Odb::Lib::Protobuf::BoardSide>(m_side));
32  return pViaMsg;
33  }
34 
35  void Via::from_protobuf(const Odb::Lib::Protobuf::ProductModel::Via& message)
36  {
37  m_name = message.name();
38  m_side = static_cast<BoardSide>(message.boardside());
39  }
40 
41 } // namespace Odb::Lib::ProductModel