#include "connection.h" namespace domain { Connection::Connection(ConnectionComponent first, std::optional second, std::string bus, std::vector attributes, std::vector firstWires, std::optional> secondWires) : first(first), second(second), bus(bus), attributes(attributes), firstWires(firstWires), secondWires(secondWires) {} ConnectionComponent Connection::getComponent() { return first; } std::optional Connection::getSecondComponent() { return second; } std::string Connection::getBus() { return bus; } std::vector Connection::getAttributes() { return attributes; } std::vector Connection::getWires() { return firstWires; } std::optional> Connection::getSecondWires() { return secondWires; } Attribute Connection::getAttribute(std::string name) { for(uint i=0; ibus == bus && (first == component || (second.has_value() && *second == component)); } bool Connection::isConnecting(ConnectionComponent component, std::string bus, ConnectionComponent secondComponent) { if(!second.has_value()) { return false; } return (this->first == component && this->bus == bus && this->second == secondComponent) || (this->first == secondComponent && this->bus == bus && this->second == component); } } // namespace domain