#include "schema.h" namespace domain { 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(conn.get()); if (dirConn != nullptr) { if (dirConn->secondInstance->name == component && conn->connection.getSecondComponent()->pin == pin) { return dirConn; } } } return nullptr; } BusInstance *Schema::getBusInstance(string &name) { for (auto &instance: busInstances) { if (instance->name == name) { return instance.get(); } } return nullptr; } ComponentInstance *Schema::getComponentInstance(string &name) { for (auto &instance: componentInstances) { if (instance->name == name) { return instance.get(); } } return nullptr; } } // namespace domain