4 namespace Odb::Lib::ProductModel
6 Net::Net(std::string name,
unsigned int index)
14 m_pinConnections.clear();
17 std::string Net::GetName()
const
22 PinConnection::Vector& Net::GetPinConnections()
24 return m_pinConnections;
27 unsigned int Net::GetIndex()
const
32 bool Net::AddPinConnection(std::shared_ptr<Component> pComponent, std::shared_ptr<Pin> pPin)
34 m_pinConnections.push_back(std::make_shared<PinConnection>(pComponent, pPin));
38 std::unique_ptr<Odb::Lib::Protobuf::ProductModel::Net> Odb::Lib::ProductModel::Net::to_protobuf()
const
40 auto pNetMsg = std::make_unique<Odb::Lib::Protobuf::ProductModel::Net>();
41 pNetMsg->set_name(m_name);
42 pNetMsg->set_index(m_index);
43 for (
auto& pPinConnection : m_pinConnections)
45 pNetMsg->add_pinconnections()->CopyFrom(*pPinConnection->to_protobuf());
50 void Odb::Lib::ProductModel::Net::from_protobuf(
const Odb::Lib::Protobuf::ProductModel::Net& message)
52 m_name = message.name();
53 m_index = message.index();
54 for (
auto& pinConnectionMsg : message.pinconnections())
56 auto pPinConnection = std::make_shared<PinConnection>(
nullptr,
nullptr,
"");
57 pPinConnection->from_protobuf(pinConnectionMsg);
58 m_pinConnections.push_back(pPinConnection);