#ifndef DOMAIN_CONNECTION_H #define DOMAIN_CONNECTION_H #include "attribute.h" #include #include namespace domain { struct ConnectionComponent { std::string component; std::string pin; bool operator==(const ConnectionComponent& rhs) const { return (component == rhs.component) && (pin == rhs.pin); } bool operator!=(const ConnectionComponent& rhs) const { return !operator==(rhs); } bool operator<(const ConnectionComponent& rhs) const { if(component < rhs.component) { return true; } else if(component == rhs.component) { if(pin < rhs.pin) { return true; } } return false; } }; class Connection { ConnectionComponent first; std::optional second; std::string bus; std::vector attributes; std::vector firstWires; std::optional> secondWires; public: Connection(ConnectionComponent first, std::optional second, std::string bus, std::vector attributes, std::vector firstWires, std::optional> secondWires); bool isConnecting(ConnectionComponent first); bool isConnecting(ConnectionComponent first, std::string bus); bool isConnecting(ConnectionComponent first, std::string bus, ConnectionComponent second); bool isConnecting(ConnectionComponent first, ConnectionComponent second); ConnectionComponent getComponent(); std::optional getSecondComponent(); std::string getBus(); std::vector getAttributes(); std::vector getWires(); std::optional> getSecondWires(); Attribute getAttribute(std::string name); bool hasAttribute(std::string name); }; } // namespace domain #endif // DOMAIN_CONNECTION_H