diff options
author | David Robillard <d@drobilla.net> | 2008-08-15 23:34:41 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-08-15 23:34:41 +0000 |
commit | ab2aa4d4922ab1a62b7a43013d09b2d9d144b3c5 (patch) | |
tree | 9e235f0c3b7a355e3cc661720359cd3d9eb18fb9 /src/libs/client | |
parent | 4d5a589570a65d508170c59b4c738b441e216a93 (diff) | |
download | ingen-ab2aa4d4922ab1a62b7a43013d09b2d9d144b3c5.tar.gz ingen-ab2aa4d4922ab1a62b7a43013d09b2d9d144b3c5.tar.bz2 ingen-ab2aa4d4922ab1a62b7a43013d09b2d9d144b3c5.zip |
Push serialiser down into core ('world').
HTTP access to patches (serialised on demand).
git-svn-id: http://svn.drobilla.net/lad/ingen@1393 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/client')
-rw-r--r-- | src/libs/client/ConnectionModel.hpp | 4 | ||||
-rw-r--r-- | src/libs/client/NodeModel.cpp | 8 | ||||
-rw-r--r-- | src/libs/client/NodeModel.hpp | 8 | ||||
-rw-r--r-- | src/libs/client/ObjectModel.cpp | 38 | ||||
-rw-r--r-- | src/libs/client/ObjectModel.hpp | 11 | ||||
-rw-r--r-- | src/libs/client/PatchModel.cpp | 6 | ||||
-rw-r--r-- | src/libs/client/PatchModel.hpp | 12 | ||||
-rw-r--r-- | src/libs/client/PortModel.hpp | 16 | ||||
-rw-r--r-- | src/libs/client/Store.cpp | 138 | ||||
-rw-r--r-- | src/libs/client/Store.hpp | 16 |
10 files changed, 133 insertions, 124 deletions
diff --git a/src/libs/client/ConnectionModel.hpp b/src/libs/client/ConnectionModel.hpp index 5ace402f..91c448df 100644 --- a/src/libs/client/ConnectionModel.hpp +++ b/src/libs/client/ConnectionModel.hpp @@ -29,7 +29,7 @@ namespace Ingen { namespace Client { -class Store; +class ClientStore; /** Class to represent a port->port connection in the engine. @@ -52,7 +52,7 @@ public: const Path dst_port_path() const { return _dst_port->path(); } private: - friend class Store; + friend class ClientStore; ConnectionModel(SharedPtr<PortModel> src, SharedPtr<PortModel> dst) : _src_port(src) diff --git a/src/libs/client/NodeModel.cpp b/src/libs/client/NodeModel.cpp index 4e81d6dd..96d70663 100644 --- a/src/libs/client/NodeModel.cpp +++ b/src/libs/client/NodeModel.cpp @@ -27,8 +27,8 @@ namespace Ingen { namespace Client { -NodeModel::NodeModel(Store& store, SharedPtr<PluginModel> plugin, const Path& path, bool polyphonic) - : ObjectModel(store, path, polyphonic) +NodeModel::NodeModel(SharedPtr<PluginModel> plugin, const Path& path, bool polyphonic) + : ObjectModel(path, polyphonic) , _plugin_uri(plugin->uri()) , _plugin(plugin) , _min_values(0) @@ -36,8 +36,8 @@ NodeModel::NodeModel(Store& store, SharedPtr<PluginModel> plugin, const Path& pa { } -NodeModel::NodeModel(Store& store, const string& plugin_uri, const Path& path, bool polyphonic) - : ObjectModel(store, path, polyphonic) +NodeModel::NodeModel(const string& plugin_uri, const Path& path, bool polyphonic) + : ObjectModel(path, polyphonic) , _plugin_uri(plugin_uri) , _min_values(0) , _max_values(0) diff --git a/src/libs/client/NodeModel.hpp b/src/libs/client/NodeModel.hpp index 700027b6..08e106ab 100644 --- a/src/libs/client/NodeModel.hpp +++ b/src/libs/client/NodeModel.hpp @@ -38,7 +38,7 @@ namespace Ingen { namespace Client { class PluginModel; -class Store; +class ClientStore; /** Node model class, used by the client to store engine's state. @@ -66,10 +66,10 @@ public: sigc::signal<void, SharedPtr<PortModel> > signal_removed_port; protected: - friend class Store; + friend class ClientStore; - NodeModel(Store& store, const string& plugin_uri, const Path& path, bool polyphonic); - NodeModel(Store& store, SharedPtr<PluginModel> plugin, const Path& path, bool polyphonic); + NodeModel(const string& plugin_uri, const Path& path, bool polyphonic); + NodeModel(SharedPtr<PluginModel> plugin, const Path& path, bool polyphonic); NodeModel(const Path& path); void add_child(SharedPtr<ObjectModel> c); diff --git a/src/libs/client/ObjectModel.cpp b/src/libs/client/ObjectModel.cpp index b951bc6b..e83b9fe1 100644 --- a/src/libs/client/ObjectModel.cpp +++ b/src/libs/client/ObjectModel.cpp @@ -26,9 +26,8 @@ namespace Ingen { namespace Client { -ObjectModel::ObjectModel(Store& store, const Path& path, bool polyphonic) - : _store(store) - , _path(path) +ObjectModel::ObjectModel(const Path& path, bool polyphonic) + : _path(path) , _polyphonic(polyphonic) { } @@ -39,39 +38,6 @@ ObjectModel::~ObjectModel() } -ObjectModel::const_iterator -ObjectModel::children_begin() const -{ - Store::Objects::const_iterator me = _store.objects().find(_path); - assert(me != _store.objects().end()); - ++me; - return me; -} - - -ObjectModel::const_iterator -ObjectModel::children_end() const -{ - Store::Objects::const_iterator me = _store.objects().find(_path); - assert(me != _store.objects().end()); - return _store.objects().find_descendants_end(me); -} - - -SharedPtr<Shared::GraphObject> -ObjectModel::find_child(const string& name) const -{ - const_iterator me = _store.objects().find(_path); - assert(me != _store.objects().end()); - const_iterator children_end = _store.objects().find_descendants_end(me); - const_iterator child = _store.objects().find(me, children_end, _path.base() + name); - if (child != _store.objects().end()) - return PtrCast<ObjectModel>(child->second); - else - return SharedPtr<ObjectModel>(); -} - - /** Get a piece of variable for this object. * * @return Metadata value with key @a key, empty string otherwise. diff --git a/src/libs/client/ObjectModel.hpp b/src/libs/client/ObjectModel.hpp index 5655222f..f052f1d9 100644 --- a/src/libs/client/ObjectModel.hpp +++ b/src/libs/client/ObjectModel.hpp @@ -41,7 +41,7 @@ using Raul::Symbol; namespace Ingen { namespace Client { -class Store; +class ClientStore; /** Base class for all GraphObject models (NodeModel, PatchModel, PortModel). @@ -72,10 +72,6 @@ public: GraphObject* graph_parent() const { return _parent.get(); } - const_iterator children_begin() const; - const_iterator children_end() const; - SharedPtr<Shared::GraphObject> find_child(const string& name) const; - // Signals sigc::signal<void, SharedPtr<ObjectModel> > signal_new_child; sigc::signal<void, SharedPtr<ObjectModel> > signal_removed_child; @@ -85,9 +81,9 @@ public: sigc::signal<void> signal_renamed; protected: - friend class Store; + friend class ClientStore; - ObjectModel(Store& store, const Path& path, bool polyphonic); + ObjectModel(const Path& path, bool polyphonic); virtual void set_path(const Path& p) { _path = p; signal_renamed.emit(); } virtual void set_parent(SharedPtr<ObjectModel> p) { assert(p); _parent = p; } @@ -99,7 +95,6 @@ protected: virtual void set(SharedPtr<ObjectModel> model); - Store& _store; Path _path; bool _polyphonic; SharedPtr<ObjectModel> _parent; diff --git a/src/libs/client/PatchModel.cpp b/src/libs/client/PatchModel.cpp index b47bd4f4..7f928b41 100644 --- a/src/libs/client/PatchModel.cpp +++ b/src/libs/client/PatchModel.cpp @@ -189,7 +189,9 @@ PatchModel::polyphonic() const unsigned -PatchModel::child_name_offset(const string& base_name) const +PatchModel::child_name_offset(ClientStore& store, + SharedPtr<PatchModel> parent, + const string& base_name) { assert(Path::is_valid_name(base_name)); unsigned offset = 0; @@ -199,7 +201,7 @@ PatchModel::child_name_offset(const string& base_name) const ss << base_name; if (offset > 0) ss << "_" << offset; - if (!find_child(ss.str())) + if (store.find(parent->path().base() + ss.str()) == store.objects().end()) break; else if (offset == 0) offset = 2; diff --git a/src/libs/client/PatchModel.hpp b/src/libs/client/PatchModel.hpp index c73c60a3..62b9db44 100644 --- a/src/libs/client/PatchModel.hpp +++ b/src/libs/client/PatchModel.hpp @@ -33,7 +33,7 @@ using std::list; using std::string; namespace Ingen { namespace Client { -class Store; +class ClientStore; /** Client's model of a patch. @@ -62,7 +62,9 @@ public: signal_editable.emit(e); } } - unsigned child_name_offset(const string& base_name) const; + static unsigned child_name_offset(ClientStore& store, + SharedPtr<PatchModel> parent, + const string& base_name); // Signals sigc::signal<void, SharedPtr<NodeModel> > signal_new_node; @@ -75,10 +77,10 @@ public: sigc::signal<void, bool> signal_editable; private: - friend class Store; + friend class ClientStore; - PatchModel(Store& store, const Path& patch_path, size_t internal_poly) - : NodeModel(store, "ingen:Patch", patch_path, false) // FIXME + PatchModel(const Path& patch_path, size_t internal_poly) + : NodeModel("ingen:Patch", patch_path, false) // FIXME , _enabled(false) , _poly(internal_poly) , _editable(true) diff --git a/src/libs/client/PortModel.hpp b/src/libs/client/PortModel.hpp index a452c338..3739be58 100644 --- a/src/libs/client/PortModel.hpp +++ b/src/libs/client/PortModel.hpp @@ -71,15 +71,15 @@ public: sigc::signal<void, SharedPtr<PortModel> > signal_disconnection; private: - friend class Store; + friend class ClientStore; - PortModel(Store& store, const Path& path, uint32_t index, DataType type, Direction dir) - : ObjectModel(store, path, true), - _index(index), - _type(type), - _direction(dir), - _current_val(0.0f), - _connections(0) + PortModel(const Path& path, uint32_t index, DataType type, Direction dir) + : ObjectModel(path, true) + , _index(index) + , _type(type) + , _direction(dir) + , _current_val(0.0f) + , _connections(0) { if (_type == DataType::UNKNOWN) std::cerr << "[PortModel] Warning: Unknown port type" << std::endl; diff --git a/src/libs/client/Store.cpp b/src/libs/client/Store.cpp index 6bb3b767..47ed3719 100644 --- a/src/libs/client/Store.cpp +++ b/src/libs/client/Store.cpp @@ -32,31 +32,31 @@ namespace Ingen { namespace Client { -Store::Store(SharedPtr<EngineInterface> engine, SharedPtr<SigClientInterface> emitter) +ClientStore::ClientStore(SharedPtr<EngineInterface> engine, SharedPtr<SigClientInterface> emitter) : _engine(engine) , _emitter(emitter) { - emitter->signal_object_destroyed.connect(sigc::mem_fun(this, &Store::destruction_event)); - emitter->signal_object_renamed.connect(sigc::mem_fun(this, &Store::rename_event)); - emitter->signal_new_plugin.connect(sigc::mem_fun(this, &Store::new_plugin_event)); - emitter->signal_new_patch.connect(sigc::mem_fun(this, &Store::new_patch_event)); - emitter->signal_new_node.connect(sigc::mem_fun(this, &Store::new_node_event)); - emitter->signal_new_port.connect(sigc::mem_fun(this, &Store::new_port_event)); - emitter->signal_polyphonic.connect(sigc::mem_fun(this, &Store::polyphonic_event)); - emitter->signal_patch_enabled.connect(sigc::mem_fun(this, &Store::patch_enabled_event)); - emitter->signal_patch_disabled.connect(sigc::mem_fun(this, &Store::patch_disabled_event)); - emitter->signal_patch_polyphony.connect(sigc::mem_fun(this, &Store::patch_polyphony_event)); - emitter->signal_patch_cleared.connect(sigc::mem_fun(this, &Store::patch_cleared_event)); - emitter->signal_connection.connect(sigc::mem_fun(this, &Store::connection_event)); - emitter->signal_disconnection.connect(sigc::mem_fun(this, &Store::disconnection_event)); - emitter->signal_variable_change.connect(sigc::mem_fun(this, &Store::variable_change_event)); - emitter->signal_control_change.connect(sigc::mem_fun(this, &Store::control_change_event)); - emitter->signal_port_activity.connect(sigc::mem_fun(this, &Store::port_activity_event)); + emitter->signal_object_destroyed.connect(sigc::mem_fun(this, &ClientStore::destruction_event)); + emitter->signal_object_renamed.connect(sigc::mem_fun(this, &ClientStore::rename_event)); + emitter->signal_new_plugin.connect(sigc::mem_fun(this, &ClientStore::new_plugin_event)); + emitter->signal_new_patch.connect(sigc::mem_fun(this, &ClientStore::new_patch_event)); + emitter->signal_new_node.connect(sigc::mem_fun(this, &ClientStore::new_node_event)); + emitter->signal_new_port.connect(sigc::mem_fun(this, &ClientStore::new_port_event)); + emitter->signal_polyphonic.connect(sigc::mem_fun(this, &ClientStore::polyphonic_event)); + emitter->signal_patch_enabled.connect(sigc::mem_fun(this, &ClientStore::patch_enabled_event)); + emitter->signal_patch_disabled.connect(sigc::mem_fun(this, &ClientStore::patch_disabled_event)); + emitter->signal_patch_polyphony.connect(sigc::mem_fun(this, &ClientStore::patch_polyphony_event)); + emitter->signal_patch_cleared.connect(sigc::mem_fun(this, &ClientStore::patch_cleared_event)); + emitter->signal_connection.connect(sigc::mem_fun(this, &ClientStore::connection_event)); + emitter->signal_disconnection.connect(sigc::mem_fun(this, &ClientStore::disconnection_event)); + emitter->signal_variable_change.connect(sigc::mem_fun(this, &ClientStore::variable_change_event)); + emitter->signal_control_change.connect(sigc::mem_fun(this, &ClientStore::control_change_event)); + emitter->signal_port_activity.connect(sigc::mem_fun(this, &ClientStore::port_activity_event)); } void -Store::clear() +ClientStore::clear() { _objects.clear(); _plugins.clear(); @@ -64,7 +64,7 @@ Store::clear() void -Store::add_plugin_orphan(SharedPtr<NodeModel> node) +ClientStore::add_plugin_orphan(SharedPtr<NodeModel> node) { cerr << "WARNING: Node " << node->path() << " received, but plugin " << node->plugin_uri() << " unknown." << endl; @@ -85,7 +85,7 @@ Store::add_plugin_orphan(SharedPtr<NodeModel> node) void -Store::resolve_plugin_orphans(SharedPtr<PluginModel> plugin) +ClientStore::resolve_plugin_orphans(SharedPtr<PluginModel> plugin) { Raul::Table<string, list<SharedPtr<NodeModel> > >::iterator n = _plugin_orphans.find(plugin->uri()); @@ -107,7 +107,7 @@ Store::resolve_plugin_orphans(SharedPtr<PluginModel> plugin) void -Store::add_connection_orphan(std::pair<Path, Path> orphan) +ClientStore::add_connection_orphan(std::pair<Path, Path> orphan) { cerr << "WARNING: Orphan connection " << orphan.first << " -> " << orphan.second << " received." << endl; @@ -117,7 +117,7 @@ Store::add_connection_orphan(std::pair<Path, Path> orphan) void -Store::resolve_connection_orphans(SharedPtr<PortModel> port) +ClientStore::resolve_connection_orphans(SharedPtr<PortModel> port) { assert(port->parent()); @@ -140,7 +140,7 @@ Store::resolve_connection_orphans(SharedPtr<PortModel> port) void -Store::add_orphan(SharedPtr<ObjectModel> child) +ClientStore::add_orphan(SharedPtr<ObjectModel> child) { cerr << "WARNING: Orphan object " << child->path() << " received." << endl; @@ -160,7 +160,7 @@ Store::add_orphan(SharedPtr<ObjectModel> child) void -Store::add_variable_orphan(const Path& subject_path, const string& predicate, const Atom& value) +ClientStore::add_variable_orphan(const Path& subject_path, const string& predicate, const Atom& value) { Raul::PathTable<list<std::pair<string, Atom> > >::iterator orphans = _variable_orphans.find(subject_path); @@ -178,7 +178,7 @@ Store::add_variable_orphan(const Path& subject_path, const string& predicate, co void -Store::resolve_variable_orphans(SharedPtr<ObjectModel> subject) +ClientStore::resolve_variable_orphans(SharedPtr<ObjectModel> subject) { Raul::PathTable<list<std::pair<string, Atom> > >::iterator v = _variable_orphans.find(subject->path()); @@ -199,7 +199,7 @@ Store::resolve_variable_orphans(SharedPtr<ObjectModel> subject) void -Store::resolve_orphans(SharedPtr<ObjectModel> parent) +ClientStore::resolve_orphans(SharedPtr<ObjectModel> parent) { Raul::PathTable<list<SharedPtr<ObjectModel> > >::iterator c = _orphans.find(parent->path()); @@ -219,7 +219,7 @@ Store::resolve_orphans(SharedPtr<ObjectModel> parent) void -Store::add_object(SharedPtr<ObjectModel> object) +ClientStore::add_object(SharedPtr<ObjectModel> object) { // If we already have "this" object, merge the existing one into the new // one (with precedence to the new values). @@ -265,7 +265,7 @@ Store::add_object(SharedPtr<ObjectModel> object) SharedPtr<ObjectModel> -Store::remove_object(const Path& path) +ClientStore::remove_object(const Path& path) { Objects::iterator i = _objects.find(path); @@ -308,7 +308,7 @@ Store::remove_object(const Path& path) SharedPtr<PluginModel> -Store::plugin(const string& uri) +ClientStore::plugin(const string& uri) { assert(uri.length() > 0); Plugins::iterator i = _plugins.find(uri); @@ -320,7 +320,7 @@ Store::plugin(const string& uri) SharedPtr<ObjectModel> -Store::object(const Path& path) +ClientStore::object(const Path& path) { assert(path.length() > 0); Objects::iterator i = _objects.find(path); @@ -335,7 +335,7 @@ Store::object(const Path& path) } void -Store::add_plugin(SharedPtr<PluginModel> pm) +ClientStore::add_plugin(SharedPtr<PluginModel> pm) { // FIXME: dupes? merge, like with objects? @@ -343,14 +343,46 @@ Store::add_plugin(SharedPtr<PluginModel> pm) signal_new_plugin(pm); //cerr << "Plugin: " << pm->uri() << ", # plugins: " << _plugins.size() << endl; } + + +ClientStore::Objects::const_iterator +ClientStore::children_begin(SharedPtr<Shared::GraphObject> o) const +{ + Objects::const_iterator parent = _objects.find(o->path()); + assert(parent != _objects.end()); + ++parent; + return parent; +} +ClientStore::Objects::const_iterator +ClientStore::children_end(SharedPtr<Shared::GraphObject> o) const +{ + Objects::const_iterator parent = _objects.find(o->path()); + assert(parent != _objects.end()); + return _objects.find_descendants_end(parent); +} + + +SharedPtr<Shared::GraphObject> +ClientStore::find_child(SharedPtr<Shared::GraphObject> parent, const string& child_name) const +{ + Objects::const_iterator pi = _objects.find(parent->path()); + assert(pi != _objects.end()); + Objects::const_iterator children_end = _objects.find_descendants_end(pi); + Objects::const_iterator child = _objects.find(pi, children_end, parent->path().base() + child_name); + if (child != _objects.end()) + return PtrCast<ObjectModel>(child->second); + else + return SharedPtr<ObjectModel>(); +} + /* ****** Signal Handlers ******** */ void -Store::destruction_event(const Path& path) +ClientStore::destruction_event(const Path& path) { SharedPtr<ObjectModel> removed = remove_object(path); @@ -361,7 +393,7 @@ Store::destruction_event(const Path& path) } void -Store::rename_event(const Path& old_path, const Path& new_path) +ClientStore::rename_event(const Path& old_path, const Path& new_path) { Objects::iterator parent = _objects.find(old_path); if (parent == _objects.end()) { @@ -403,7 +435,7 @@ Store::rename_event(const Path& old_path, const Path& new_path) } void -Store::new_plugin_event(const string& uri, const string& type_uri, const string& symbol, const string& name) +ClientStore::new_plugin_event(const string& uri, const string& type_uri, const string& symbol, const string& name) { SharedPtr<PluginModel> p(new PluginModel(uri, type_uri, symbol, name)); add_plugin(p); @@ -412,35 +444,35 @@ Store::new_plugin_event(const string& uri, const string& type_uri, const string& void -Store::new_patch_event(const Path& path, uint32_t poly) +ClientStore::new_patch_event(const Path& path, uint32_t poly) { - SharedPtr<PatchModel> p(new PatchModel(*this, path, poly)); + SharedPtr<PatchModel> p(new PatchModel(path, poly)); add_object(p); } void -Store::new_node_event(const string& plugin_uri, const Path& node_path, bool is_polyphonic, uint32_t num_ports) +ClientStore::new_node_event(const string& plugin_uri, const Path& node_path, bool is_polyphonic, uint32_t num_ports) { // FIXME: num_ports unused SharedPtr<PluginModel> plug = plugin(plugin_uri); if (!plug) { - SharedPtr<NodeModel> n(new NodeModel(*this, plugin_uri, node_path, is_polyphonic)); + SharedPtr<NodeModel> n(new NodeModel(plugin_uri, node_path, is_polyphonic)); add_plugin_orphan(n); } else { - SharedPtr<NodeModel> n(new NodeModel(*this, plug, node_path, is_polyphonic)); + SharedPtr<NodeModel> n(new NodeModel(plug, node_path, is_polyphonic)); add_object(n); } } void -Store::new_port_event(const Path& path, uint32_t index, const string& type, bool is_output) +ClientStore::new_port_event(const Path& path, uint32_t index, const string& type, bool is_output) { PortModel::Direction pdir = is_output ? PortModel::OUTPUT : PortModel::INPUT; - SharedPtr<PortModel> p(new PortModel(*this, path, index, type, pdir)); + SharedPtr<PortModel> p(new PortModel(path, index, type, pdir)); add_object(p); if (p->parent()) resolve_connection_orphans(p); @@ -448,7 +480,7 @@ Store::new_port_event(const Path& path, uint32_t index, const string& type, bool void -Store::polyphonic_event(const Path& path, bool polyphonic) +ClientStore::polyphonic_event(const Path& path, bool polyphonic) { SharedPtr<ObjectModel> object = this->object(path); if (object) @@ -457,7 +489,7 @@ Store::polyphonic_event(const Path& path, bool polyphonic) void -Store::patch_enabled_event(const Path& path) +ClientStore::patch_enabled_event(const Path& path) { SharedPtr<PatchModel> patch = PtrCast<PatchModel>(object(path)); if (patch) @@ -466,7 +498,7 @@ Store::patch_enabled_event(const Path& path) void -Store::patch_disabled_event(const Path& path) +ClientStore::patch_disabled_event(const Path& path) { SharedPtr<PatchModel> patch = PtrCast<PatchModel>(object(path)); if (patch) @@ -475,7 +507,7 @@ Store::patch_disabled_event(const Path& path) void -Store::patch_polyphony_event(const Path& path, uint32_t poly) +ClientStore::patch_polyphony_event(const Path& path, uint32_t poly) { SharedPtr<PatchModel> patch = PtrCast<PatchModel>(object(path)); if (patch) @@ -484,7 +516,7 @@ Store::patch_polyphony_event(const Path& path, uint32_t poly) void -Store::patch_cleared_event(const Path& path) +ClientStore::patch_cleared_event(const Path& path) { Objects::iterator i = _objects.find(path); if (i != _objects.end()) { @@ -512,7 +544,7 @@ Store::patch_cleared_event(const Path& path) void -Store::variable_change_event(const Path& subject_path, const string& predicate, const Atom& value) +ClientStore::variable_change_event(const Path& subject_path, const string& predicate, const Atom& value) { SharedPtr<ObjectModel> subject = object(subject_path); @@ -528,7 +560,7 @@ Store::variable_change_event(const Path& subject_path, const string& predicate, void -Store::control_change_event(const Path& port_path, float value) +ClientStore::control_change_event(const Path& port_path, float value) { SharedPtr<PortModel> port = PtrCast<PortModel>(object(port_path)); if (port) @@ -539,7 +571,7 @@ Store::control_change_event(const Path& port_path, float value) void -Store::port_activity_event(const Path& port_path) +ClientStore::port_activity_event(const Path& port_path) { SharedPtr<PortModel> port = PtrCast<PortModel>(object(port_path)); if (port) @@ -550,7 +582,7 @@ Store::port_activity_event(const Path& port_path) SharedPtr<PatchModel> -Store::connection_patch(const Path& src_port_path, const Path& dst_port_path) +ClientStore::connection_patch(const Path& src_port_path, const Path& dst_port_path) { SharedPtr<PatchModel> patch; @@ -575,7 +607,7 @@ Store::connection_patch(const Path& src_port_path, const Path& dst_port_path) bool -Store::attempt_connection(const Path& src_port_path, const Path& dst_port_path, bool add_orphan) +ClientStore::attempt_connection(const Path& src_port_path, const Path& dst_port_path, bool add_orphan) { SharedPtr<PortModel> src_port = PtrCast<PortModel>(object(src_port_path)); SharedPtr<PortModel> dst_port = PtrCast<PortModel>(object(dst_port_path)); @@ -608,14 +640,14 @@ Store::attempt_connection(const Path& src_port_path, const Path& dst_port_path, void -Store::connection_event(const Path& src_port_path, const Path& dst_port_path) +ClientStore::connection_event(const Path& src_port_path, const Path& dst_port_path) { attempt_connection(src_port_path, dst_port_path, true); } void -Store::disconnection_event(const Path& src_port_path, const Path& dst_port_path) +ClientStore::disconnection_event(const Path& src_port_path, const Path& dst_port_path) { // Find the ports and create a ConnectionModel just to get at the parent path // finding logic in ConnectionModel. So I'm lazy. diff --git a/src/libs/client/Store.hpp b/src/libs/client/Store.hpp index 70f11142..f86c511a 100644 --- a/src/libs/client/Store.hpp +++ b/src/libs/client/Store.hpp @@ -28,6 +28,7 @@ #include <raul/PathTable.hpp> #include <raul/TableImpl.hpp> #include "interface/EngineInterface.hpp" +#include "interface/Store.hpp" using std::string; using std::list; using Ingen::Shared::EngineInterface; using Raul::Path; @@ -52,9 +53,9 @@ class ConnectionModel; * * \ingroup IngenClient */ -class Store : public sigc::trackable { // FIXME: is trackable necessary? +class ClientStore : public Shared::Store, public sigc::trackable { // FIXME: is trackable necessary? public: - Store(SharedPtr<EngineInterface> engine, SharedPtr<SigClientInterface> emitter); + ClientStore(SharedPtr<EngineInterface> engine, SharedPtr<SigClientInterface> emitter); SharedPtr<PluginModel> plugin(const string& uri); SharedPtr<ObjectModel> object(const Path& path); @@ -63,17 +64,28 @@ public: size_t num_object() { return _objects.size(); } + Objects::iterator find(const Path& path) { return _objects.find(path); } + typedef Raul::Table<string, SharedPtr<PluginModel> > Plugins; const Plugins& plugins() const { return _plugins; } typedef Raul::PathTable< SharedPtr<Shared::GraphObject> > Objects; const Objects& objects() const { return _objects; } + Objects& objects() { return _objects; } + + Objects::const_iterator children_begin(SharedPtr<Shared::GraphObject> o) const; + Objects::const_iterator children_end(SharedPtr<Shared::GraphObject> o) const; + + SharedPtr<Shared::GraphObject> find_child(SharedPtr<Shared::GraphObject> parent, + const string& child_name) const; sigc::signal<void, SharedPtr<ObjectModel> > signal_new_object; sigc::signal<void, SharedPtr<PluginModel> > signal_new_plugin; private: + void add(Shared::GraphObject* o) { throw; } + void add_object(SharedPtr<ObjectModel> object); SharedPtr<ObjectModel> remove_object(const Path& path); |