#include "port.h" ConnectionMode Client::ConnectedTo(Port *port) { ConnectionMode cm = CM_UNKNOWN; PortList::iterator it; for (it = m_ports.begin(); it != m_ports.end(); ++it) { Port *p = *it; ConnectionMode cm2 = p->ConnectedTo(port); if (cm == CM_UNKNOWN) { cm = cm2; } else if (cm != cm2) { // If connected types aren't the same, we're partially connected. return CM_PARTIAL; } } return cm; } ConnectionMode Client::ConnectedTo(PortGroup *group) { ConnectionMode cm = CM_UNKNOWN; PortList::iterator it; for (it = group->m_ports.begin(); it != group->m_ports.end(); ++it) { Port *port = *it; ConnectionMode cm2 = this->ConnectedTo(port); if (cm == CM_UNKNOWN) { cm = cm2; } else if (cm != cm2) { // If connected types aren't the same, we're partially connected. return CM_PARTIAL; } } return cm; } ConnectionMode Client::ConnectedTo(Client *client) { ConnectionMode cm = CM_UNKNOWN; PortList::iterator it; for (it = client->m_ports.begin(); it != client->m_ports.end(); ++it) { Port *port = *it; ConnectionMode cm2 = this->ConnectedTo(port); if (cm == CM_UNKNOWN) { cm = cm2; } else if (cm != cm2) { // If connected types aren't the same, we're partially connected. return CM_PARTIAL; } } return cm; } ConnectionMode PortGroup::ConnectedTo(Port *port) { ConnectionMode cm = CM_UNKNOWN; PortList::iterator it; for (it = m_ports.begin(); it != m_ports.end(); ++it) { Port *p = *it; ConnectionMode cm2 = p->ConnectedTo(port); if (cm == CM_UNKNOWN) { cm = cm2; } else if (cm != cm2) { // If connected types aren't the same, we're partially connected. return CM_PARTIAL; } } return cm; } ConnectionMode PortGroup::ConnectedTo(PortGroup *group) { ConnectionMode cm = CM_UNKNOWN; PortList::iterator plita; PortList::iterator plitb; for (plita = m_ports.begin(), plitb = group->m_ports.begin(); plita != m_ports.end() && plitb != group->m_ports.end(); ++plita, ++plitb) { Port *pa = *plita; Port *pb = *plitb; ConnectionMode cm2 = pa->ConnectedTo(pb); if (cm == CM_UNKNOWN) { cm = cm2; } else if (cm != cm2) { // If connected types aren't the same, we're partially connected. return CM_PARTIAL; } } return cm; } ConnectionMode PortGroup::ConnectedTo(Client *client) { ConnectionMode cm = CM_UNKNOWN; PortList::iterator it; for (it = client->m_ports.begin(); it != client->m_ports.end(); ++it) { Port *port = *it; ConnectionMode cm2 = this->ConnectedTo(port); if (cm == CM_UNKNOWN) { cm = cm2; } else if (cm != cm2) { // If connected types aren't the same, we're partially connected. return CM_PARTIAL; } } return cm; } ConnectionMode Port::ConnectedTo(Port *port) { PortList::iterator it; for (it = m_connections.begin(); it != m_connections.end(); ++it) { Port *p = *it; if (p == port) return CM_FULL; } return CM_NONE; } ConnectionMode Port::ConnectedTo(PortGroup *group) { ConnectionMode cm = CM_UNKNOWN; PortList::iterator it; for (it = group->m_ports.begin(); it != group->m_ports.end(); ++it) { Port *port = *it; ConnectionMode cm2 = this->ConnectedTo(port); if (cm == CM_UNKNOWN) { cm = cm2; } else if (cm != cm2) { // If connected types aren't the same, we're partially connected. return CM_PARTIAL; } } return cm; } ConnectionMode Port::ConnectedTo(Client *client) { ConnectionMode cm = CM_UNKNOWN; PortList::iterator it; for (it = client->m_ports.begin(); it != client->m_ports.end(); ++it) { Port *port = *it; ConnectionMode cm2 = this->ConnectedTo(port); if (cm == CM_UNKNOWN) { cm = cm2; } else if (cm != cm2) { // If connected types aren't the same, we're partially connected. return CM_PARTIAL; } } return cm; }