summaryrefslogtreecommitdiffstats
path: root/src/libs/client/ConnectionModel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/client/ConnectionModel.cpp')
-rw-r--r--src/libs/client/ConnectionModel.cpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/libs/client/ConnectionModel.cpp b/src/libs/client/ConnectionModel.cpp
index 1c7541b9..18b6fbd7 100644
--- a/src/libs/client/ConnectionModel.cpp
+++ b/src/libs/client/ConnectionModel.cpp
@@ -27,8 +27,8 @@ ConnectionModel::ConnectionModel(const Path& src_port, const Path& dst_port)
m_dst_port(NULL)
{
// Be sure connection is within one patch
- assert(m_src_port_path.parent().parent()
- == m_dst_port_path.parent().parent());
+ //assert(m_src_port_path.parent().parent()
+ // == m_dst_port_path.parent().parent());
}
@@ -51,4 +51,24 @@ ConnectionModel::dst_port_path() const
return m_dst_port->path();
}
+const Path
+ConnectionModel::patch_path() const
+{
+ const Path& src_node = m_src_port_path.parent();
+ const Path& dst_node = m_dst_port_path.parent();
+ Path patch_path = src_node.parent();
+
+ if (src_node.parent() != dst_node.parent()) {
+ // Connection to a patch port from inside the patch
+ assert(src_node.parent() == dst_node || dst_node.parent() == src_node);
+ if (src_node.parent() == dst_node)
+ patch_path = dst_node;
+ else
+ patch_path = src_node;
+ }
+
+ return patch_path;
+}
+
+
} // namespace LibOmClient