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