schema_editor/comdel/domain/connection.cpp

49 lines
1.2 KiB
C++
Raw Normal View History

2022-03-31 21:20:41 +00:00
#include "connection.h"
namespace domain {
Connection::Connection(std::string component, std::string pin, std::string bus, std::vector<Attribute> attributes, std::vector<Value> wires)
: component(component), pin(pin), bus(bus), attributes(attributes), wires(wires)
{}
bool Connection::isConnecting(std::string component, std::string pin, std::string bus) {
return this->component == component && this->pin == pin && this->bus == bus;
}
std::string Connection::getComponent() {
return component;
}
std::string Connection::getPin() {
return pin;
}
std::string Connection::getBus() {
return bus;
}
std::vector<Attribute> Connection::getAttributes() {
return attributes;
}
std::vector<Value> Connection::getWires() {
return wires;
}
Attribute Connection::getAttribute(std::string name) {
for(uint i=0; i<attributes.size(); i++) {
if(attributes[i].getName() == name) {
return attributes[i];
}
}
throw std::exception();
}
2022-04-05 21:48:07 +00:00
bool Connection::hasAttribute(std::string name) {
for(uint i=0; i<attributes.size(); i++) {
if(attributes[i].getName() == name) {
return true;
}
}
return false;
}
2022-03-31 21:20:41 +00:00
} // namespace domain