summaryrefslogtreecommitdiffstats
path: root/src/libs/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/client')
-rw-r--r--src/libs/client/Store.cpp44
-rw-r--r--src/libs/client/Store.h4
2 files changed, 24 insertions, 24 deletions
diff --git a/src/libs/client/Store.cpp b/src/libs/client/Store.cpp
index ef70dc28..34b86e2e 100644
--- a/src/libs/client/Store.cpp
+++ b/src/libs/client/Store.cpp
@@ -101,7 +101,6 @@ Store::patch(const string& path)
if (i == m_objects.end())
return NULL;
else
- //return dynamic_cast<PatchModel*>((*i).second.get());
return (CountedPtr<PatchModel>)(*i).second; // FIXME
}
@@ -207,18 +206,16 @@ Store::new_patch_event(const string& path, uint32_t poly)
// FIXME: What to do with a conflict?
if (m_objects.find(path) == m_objects.end()) {
- PatchModel* const p = new PatchModel(path, poly);
+ CountedPtr<PatchModel> p(new PatchModel(path, poly));
add_object(p);
- std::map<string, CountedPtr<ObjectModel> >::iterator pi = m_objects.find(p->path().parent());
- if (pi != m_objects.end()) {
- CountedPtr<PatchModel> parent = (*pi).second;
- if (parent) {
- p->set_parent(parent);
- parent->add_node(p);
- } else {
- cerr << "ERROR: new patch with no parent" << endl;
- }
+ CountedPtr<PatchModel> parent = object(p->path().parent());
+ if (parent) {
+ p->set_parent(parent);
+ parent->add_node(p);
+ assert(p->parent() == parent);
+ } else {
+ cerr << "ERROR: new patch with no parent" << endl;
}
}
}
@@ -239,15 +236,16 @@ Store::new_node_event(const string& plugin_type, const string& plugin_uri, const
// FIXME: num_ports unused
add_object(n);
- std::map<string, CountedPtr<ObjectModel> >::iterator pi = m_objects.find(n->path().parent());
- if (pi != m_objects.end()) {
- CountedPtr<PatchModel> parent = (*pi).second;
- if (parent) {
- n->set_parent(parent);
- parent->add_node(n);
- } else {
- cerr << "ERROR: new node with no parent" << endl;
- }
+ //std::map<string, CountedPtr<ObjectModel> >::iterator pi = m_objects.find(n->path().parent());
+ //if (pi != m_objects.end()) {
+ CountedPtr<PatchModel> parent = object(n->path().parent());
+ if (parent) {
+ n->set_parent(parent);
+ assert(n->parent() == parent);
+ parent->add_node(n);
+ assert(n->parent() == parent);
+ } else {
+ cerr << "ERROR: new node with no parent" << endl;
}
}
}
@@ -289,10 +287,12 @@ Store::new_port_event(const string& path, const string& type, bool is_output)
if (pi != m_objects.end()) {
CountedPtr<NodeModel> parent = (*pi).second;
p->set_parent(parent);
- if (parent)
+ if (parent) {
parent->add_port(p);
- else
+ assert(p->parent() == parent);
+ } else {
cerr << "ERROR: new port with no parent" << endl;
+ }
}
}
}
diff --git a/src/libs/client/Store.h b/src/libs/client/Store.h
index 27850bcf..0b84d418 100644
--- a/src/libs/client/Store.h
+++ b/src/libs/client/Store.h
@@ -21,6 +21,7 @@
#include <string>
#include <map>
#include "util/CountedPtr.h"
+#include <sigc++/sigc++.h>
using std::string; using std::map;
namespace LibOmClient {
@@ -36,7 +37,7 @@ class PortModel;
*
* \ingroup OmGtk
*/
-class Store {
+class Store : public sigc::trackable { // FIXME: is trackable necessary?
public:
CountedPtr<PluginModel> plugin(const string& uri);
CountedPtr<ObjectModel> object(const string& path);
@@ -46,7 +47,6 @@ public:
size_t num_objects() { return m_objects.size(); }
-
const map<string, CountedPtr<PluginModel> >& plugins() const { return m_plugins; }
static void instantiate(SigClientInterface& emitter)