Added pin connection editing
This commit is contained in:
1 parent
f66fc1db26
commit
4d4cf136fb
6 files changed
+119
-23
No files matched your search
@@ -7,18 +7,28 @@ namespace domain {
|
||||
}
|
||||
|
||||
ConnectionInstance *Schema::getConnection(string &component, string &pin) {
|
||||
auto pinConnections = getConnections(component, pin);
|
||||
if(pinConnections.empty()) {
|
||||
return nullptr;
|
||||
} else {
|
||||
return pinConnections[0];
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<ConnectionInstance*> Schema::getConnections(string &component, string &pin) {
|
||||
std::vector<ConnectionInstance*> pinConnections;
|
||||
for (auto &conn: connections) {
|
||||
if (conn->instance->name == component && conn->connection.getComponent().pin == pin) {
|
||||
return conn.get();
|
||||
pinConnections.push_back(conn.get());
|
||||
}
|
||||
auto dirConn = dynamic_cast<DirectConnectionInstance *>(conn.get());
|
||||
if (dirConn != nullptr) {
|
||||
if (dirConn->secondInstance->name == component && conn->connection.getSecondComponent()->pin == pin) {
|
||||
return dirConn;
|
||||
pinConnections.push_back(conn.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
return pinConnections;
|
||||
}
|
||||
|
||||
BusInstance *Schema::getBusInstance(string &name) {
|
||||
|
||||
@@ -42,6 +42,8 @@ namespace domain {
|
||||
ConnectionInstance *getConnection(string &component, string &pin);
|
||||
|
||||
std::vector<ConnectionEntry> availableConnections(std::string instance, std::string pin, bool onlyConnectable);
|
||||
|
||||
vector<ConnectionInstance *> getConnections(string &component, string &pin);
|
||||
};
|
||||
|
||||
} // namespace domain
|
||||
|
||||
Reference in new issue
Block a user