schema_editor/comdel/domain/schema.cpp

29 lines
756 B
C++
Raw Normal View History

2022-04-05 21:48:07 +00:00
#include "schema.h"
namespace domain {
Schema::Schema()
{
}
bool Schema::hasConnection(string& component, string& pin) {
return getConnection(component, pin) != nullptr;
}
ConnectionInstance* Schema::getConnection(string& component, string& pin) {
for(auto& conn: connections) {
if(conn->instance->name == component && conn->connection.getComponent().pin == pin) {
return conn.get();
}
auto dirConn = dynamic_cast<DirectConnectionInstance*>(conn.get());
if(dirConn != nullptr) {
if(dirConn->secondInstance->name == component && conn->connection.getSecondComponent()->pin == pin) {
return dirConn;
}
}
}
return nullptr;
}
2022-04-05 21:48:07 +00:00
} // namespace domain