40 lines
1013 B
C++
40 lines
1013 B
C++
#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();
|
|
}
|
|
|
|
} // namespace domain
|