From cc384f6f622cc10fd83616256080b80dc2123aaf Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 14 Sep 2006 02:27:02 +0000 Subject: Cleaned up client-side model code significantly (made everything private so only Store can change the state of models). Extremely broken, just committing to move code between machines :). git-svn-id: http://svn.drobilla.net/lad/ingen@133 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/client/NodeModel.cpp | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) (limited to 'src/libs/client/NodeModel.cpp') diff --git a/src/libs/client/NodeModel.cpp b/src/libs/client/NodeModel.cpp index 55f70130..cb46bafc 100644 --- a/src/libs/client/NodeModel.cpp +++ b/src/libs/client/NodeModel.cpp @@ -53,7 +53,7 @@ NodeModel::remove_port(CountedPtr port) void -NodeModel::remove_port(const string& port_path) +NodeModel::remove_port(const Path& port_path) { for (PortModelList::iterator i = m_ports.begin(); i != m_ports.end(); ++i) { if ((*i)->path() == port_path) { @@ -118,22 +118,10 @@ NodeModel::add_port(CountedPtr pm) assert(pm->path().is_child_of(_path)); assert(pm->parent().get() == this); - PortModelList::iterator existing = m_ports.end(); - for (PortModelList::iterator i = m_ports.begin(); i != m_ports.end(); ++i) { - if ((*i)->path() == pm->path()) { - existing = i; - break; - } - } - - if (existing != m_ports.end()) { - cerr << "Warning: port clash, assimilating old port " << _path << endl; - pm->assimilate(*existing); - *existing = pm; - } else { - m_ports.push_back(pm); - new_port_sig.emit(pm); - } + PortModelList::iterator existing = find(m_ports.begin(), m_ports.end(), pm); + + // Store should have handled this by merging the two + assert(existing == m_ports.end()); } -- cgit v1.2.1