From fca0d027053f78684823c9c0b885045708125ef6 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 16 Aug 2008 02:36:17 +0000 Subject: Reorganize two 'store' implementations, move header to shared module (prepare for factoring out). git-svn-id: http://svn.drobilla.net/lad/ingen@1395 a436a847-0d15-0410-975c-d299462d15a1 --- src/common/interface/Store.hpp | 47 ----- src/libs/client/ClientStore.cpp | 155 +++++++++++++++ src/libs/client/ClientStore.hpp | 155 +++++++++++++++ src/libs/client/Makefile.am | 4 +- src/libs/client/ObjectModel.hpp | 1 - src/libs/client/PatchModel.cpp | 1 + src/libs/client/Store.hpp | 155 --------------- src/libs/engine/ClientBroadcaster.cpp | 2 +- src/libs/engine/Engine.cpp | 14 +- src/libs/engine/Engine.hpp | 4 +- src/libs/engine/EngineStore.cpp | 216 +++++++++++++++++++++ src/libs/engine/EngineStore.hpp | 82 ++++++++ src/libs/engine/GraphObjectImpl.cpp | 2 +- src/libs/engine/HTTPEngineReceiver.cpp | 6 +- src/libs/engine/Makefile.am | 4 +- src/libs/engine/NodeBase.cpp | 2 +- src/libs/engine/NodeBase.hpp | 2 +- src/libs/engine/OSCClientSender.cpp | 2 +- src/libs/engine/ObjectSender.cpp | 2 +- src/libs/engine/ObjectStore.cpp | 216 --------------------- src/libs/engine/ObjectStore.hpp | 82 -------- src/libs/engine/events/AllNotesOffEvent.cpp | 4 +- src/libs/engine/events/ClearPatchEvent.cpp | 6 +- src/libs/engine/events/ClearPatchEvent.hpp | 2 +- src/libs/engine/events/ConnectionEvent.cpp | 2 +- src/libs/engine/events/CreateNodeEvent.cpp | 2 +- src/libs/engine/events/CreatePatchEvent.cpp | 4 +- src/libs/engine/events/CreatePortEvent.cpp | 2 +- src/libs/engine/events/DestroyEvent.cpp | 2 +- src/libs/engine/events/DestroyEvent.hpp | 4 +- .../engine/events/DisablePortMonitoringEvent.cpp | 2 +- src/libs/engine/events/DisconnectAllEvent.cpp | 2 +- src/libs/engine/events/DisconnectionEvent.cpp | 2 +- src/libs/engine/events/EnablePatchEvent.cpp | 2 +- .../engine/events/EnablePortBroadcastingEvent.cpp | 2 +- src/libs/engine/events/MidiLearnEvent.cpp | 2 +- src/libs/engine/events/NoteEvent.cpp | 2 +- src/libs/engine/events/RenameEvent.cpp | 2 +- src/libs/engine/events/RenameEvent.hpp | 4 +- src/libs/engine/events/RequestAllObjectsEvent.cpp | 2 +- src/libs/engine/events/RequestMetadataEvent.cpp | 2 +- src/libs/engine/events/RequestObjectEvent.cpp | 2 +- src/libs/engine/events/RequestPluginEvent.cpp | 2 +- src/libs/engine/events/RequestPortValueEvent.cpp | 2 +- src/libs/engine/events/SetMetadataEvent.cpp | 2 +- src/libs/engine/events/SetPolyphonicEvent.cpp | 2 +- src/libs/engine/events/SetPolyphonyEvent.cpp | 2 +- src/libs/engine/events/SetPortValueEvent.cpp | 2 +- src/libs/gui/App.cpp | 2 +- src/libs/gui/App.hpp | 2 +- src/libs/gui/ConnectWindow.cpp | 2 +- src/libs/gui/LoadPluginWindow.cpp | 2 +- src/libs/gui/NewSubpatchWindow.cpp | 1 + src/libs/gui/PatchCanvas.cpp | 2 +- src/libs/gui/PatchTreeWindow.cpp | 2 +- src/libs/gui/PatchWindow.cpp | 2 +- src/libs/gui/RenameWindow.cpp | 2 +- src/libs/serialisation/Serialiser.hpp | 2 +- src/libs/shared/Store.hpp | 47 +++++ 59 files changed, 721 insertions(+), 565 deletions(-) delete mode 100644 src/common/interface/Store.hpp create mode 100644 src/libs/client/ClientStore.cpp create mode 100644 src/libs/client/ClientStore.hpp delete mode 100644 src/libs/client/Store.hpp create mode 100644 src/libs/engine/EngineStore.cpp create mode 100644 src/libs/engine/EngineStore.hpp delete mode 100644 src/libs/engine/ObjectStore.cpp delete mode 100644 src/libs/engine/ObjectStore.hpp create mode 100644 src/libs/shared/Store.hpp diff --git a/src/common/interface/Store.hpp b/src/common/interface/Store.hpp deleted file mode 100644 index 428945b9..00000000 --- a/src/common/interface/Store.hpp +++ /dev/null @@ -1,47 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2008 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef COMMON_STORE_H -#define COMMON_STORE_H - -#include -#include "interface/GraphObject.hpp" - -using Raul::PathTable; -using Raul::Path; - -namespace Ingen { -namespace Shared { - - -class Store { -public: - typedef Raul::PathTable< SharedPtr > Objects; - virtual const Objects& objects() const = 0; - - virtual Objects::iterator find(const Path& path) = 0; - virtual void add(GraphObject* o) = 0; - - virtual Objects::const_iterator children_begin(SharedPtr o) const = 0; - virtual Objects::const_iterator children_end(SharedPtr o) const = 0; -}; - - -} // namespace Shared -} // namespace Ingen - -#endif // COMMON_STORE_H diff --git a/src/libs/client/ClientStore.cpp b/src/libs/client/ClientStore.cpp new file mode 100644 index 00000000..24c23f14 --- /dev/null +++ b/src/libs/client/ClientStore.cpp @@ -0,0 +1,155 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef STORE_H +#define STORE_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "interface/EngineInterface.hpp" +#include "shared/Store.hpp" +using std::string; using std::list; +using Ingen::Shared::EngineInterface; +using Raul::Path; +using Raul::Atom; + +namespace Ingen { + +namespace Shared { class GraphObject; } + +namespace Client { + +class SigClientInterface; +class ObjectModel; +class PluginModel; +class PatchModel; +class NodeModel; +class PortModel; +class ConnectionModel; + + +/** Automatically manages models of objects in the engine. + * + * \ingroup IngenClient + */ +class ClientStore : public Shared::Store, public sigc::trackable { // FIXME: is trackable necessary? +public: + ClientStore(SharedPtr engine, SharedPtr emitter); + + SharedPtr plugin(const string& uri); + SharedPtr object(const Path& path); + + void clear(); + + size_t num_object() { return _objects.size(); } + + Objects::iterator find(const Path& path) { return _objects.find(path); } + + typedef Raul::Table > Plugins; + const Plugins& plugins() const { return _plugins; } + + typedef Raul::PathTable< SharedPtr > Objects; + const Objects& objects() const { return _objects; } + Objects& objects() { return _objects; } + + Objects::const_iterator children_begin(SharedPtr o) const; + Objects::const_iterator children_end(SharedPtr o) const; + + SharedPtr find_child(SharedPtr parent, + const string& child_name) const; + + sigc::signal > signal_new_object; + sigc::signal > signal_new_plugin; + +private: + + void add(Shared::GraphObject* o) { throw; } + + void add_object(SharedPtr object); + SharedPtr remove_object(const Path& path); + + void add_plugin(SharedPtr plugin); + + SharedPtr connection_patch(const Path& src_port_path, const Path& dst_port_path); + + // It would be nice to integrate these somehow.. + + void add_orphan(SharedPtr orphan); + void resolve_orphans(SharedPtr parent); + + void add_connection_orphan(std::pair orphan); + void resolve_connection_orphans(SharedPtr port); + + void add_plugin_orphan(SharedPtr orphan); + void resolve_plugin_orphans(SharedPtr plugin); + + void add_variable_orphan(const Path& subject, const string& predicate, const Atom& value); + void resolve_variable_orphans(SharedPtr subject); + + // Slots for SigClientInterface signals + void destruction_event(const Path& path); + void rename_event(const Path& old_path, const Path& new_path); + void new_plugin_event(const string& uri, const string& type_uri, const string& symbol, const string& name); + void new_patch_event(const Path& path, uint32_t poly); + void new_node_event(const string& plugin_uri, const Path& node_path, bool is_polyphonic, uint32_t num_ports); + void new_port_event(const Path& path, uint32_t index, const string& data_type, bool is_output); + void polyphonic_event(const Path& path, bool polyphonic); + void patch_enabled_event(const Path& path); + void patch_disabled_event(const Path& path); + void patch_polyphony_event(const Path& path, uint32_t poly); + void patch_cleared_event(const Path& path); + void variable_change_event(const Path& subject_path, const string& predicate, const Atom& value); + void control_change_event(const Path& port_path, float value); + void port_activity_event(const Path& port_path); + void connection_event(const Path& src_port_path, const Path& dst_port_path); + void disconnection_event(const Path& src_port_path, const Path& dst_port_path); + + bool attempt_connection(const Path& src_port_path, const Path& dst_port_path, bool add_orphan=false); + + SharedPtr _engine; + SharedPtr _emitter; + + Objects _objects; ///< Map, keyed by Ingen path + Plugins _plugins; ///< Map, keyed by plugin URI + + /** Objects we've received, but depend on the existance of another unknown object. + * Keyed by the path of the depended-on object (for tolerance of orderless comms) */ + Raul::PathTable > > _orphans; + + /** Same idea, except with plugins instead of parents. + * It's unfortunate everything doesn't just have a URI and this was the same.. ahem.. */ + Raul::Table > > _plugin_orphans; + + /** Not orphans OF variable like the above, but orphans which are variable */ + Raul::PathTable > > _variable_orphans; + + /** Ditto */ + list > _connection_orphans; +}; + + +} // namespace Client +} // namespace Ingen + +#endif // STORE_H diff --git a/src/libs/client/ClientStore.hpp b/src/libs/client/ClientStore.hpp new file mode 100644 index 00000000..24c23f14 --- /dev/null +++ b/src/libs/client/ClientStore.hpp @@ -0,0 +1,155 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef STORE_H +#define STORE_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "interface/EngineInterface.hpp" +#include "shared/Store.hpp" +using std::string; using std::list; +using Ingen::Shared::EngineInterface; +using Raul::Path; +using Raul::Atom; + +namespace Ingen { + +namespace Shared { class GraphObject; } + +namespace Client { + +class SigClientInterface; +class ObjectModel; +class PluginModel; +class PatchModel; +class NodeModel; +class PortModel; +class ConnectionModel; + + +/** Automatically manages models of objects in the engine. + * + * \ingroup IngenClient + */ +class ClientStore : public Shared::Store, public sigc::trackable { // FIXME: is trackable necessary? +public: + ClientStore(SharedPtr engine, SharedPtr emitter); + + SharedPtr plugin(const string& uri); + SharedPtr object(const Path& path); + + void clear(); + + size_t num_object() { return _objects.size(); } + + Objects::iterator find(const Path& path) { return _objects.find(path); } + + typedef Raul::Table > Plugins; + const Plugins& plugins() const { return _plugins; } + + typedef Raul::PathTable< SharedPtr > Objects; + const Objects& objects() const { return _objects; } + Objects& objects() { return _objects; } + + Objects::const_iterator children_begin(SharedPtr o) const; + Objects::const_iterator children_end(SharedPtr o) const; + + SharedPtr find_child(SharedPtr parent, + const string& child_name) const; + + sigc::signal > signal_new_object; + sigc::signal > signal_new_plugin; + +private: + + void add(Shared::GraphObject* o) { throw; } + + void add_object(SharedPtr object); + SharedPtr remove_object(const Path& path); + + void add_plugin(SharedPtr plugin); + + SharedPtr connection_patch(const Path& src_port_path, const Path& dst_port_path); + + // It would be nice to integrate these somehow.. + + void add_orphan(SharedPtr orphan); + void resolve_orphans(SharedPtr parent); + + void add_connection_orphan(std::pair orphan); + void resolve_connection_orphans(SharedPtr port); + + void add_plugin_orphan(SharedPtr orphan); + void resolve_plugin_orphans(SharedPtr plugin); + + void add_variable_orphan(const Path& subject, const string& predicate, const Atom& value); + void resolve_variable_orphans(SharedPtr subject); + + // Slots for SigClientInterface signals + void destruction_event(const Path& path); + void rename_event(const Path& old_path, const Path& new_path); + void new_plugin_event(const string& uri, const string& type_uri, const string& symbol, const string& name); + void new_patch_event(const Path& path, uint32_t poly); + void new_node_event(const string& plugin_uri, const Path& node_path, bool is_polyphonic, uint32_t num_ports); + void new_port_event(const Path& path, uint32_t index, const string& data_type, bool is_output); + void polyphonic_event(const Path& path, bool polyphonic); + void patch_enabled_event(const Path& path); + void patch_disabled_event(const Path& path); + void patch_polyphony_event(const Path& path, uint32_t poly); + void patch_cleared_event(const Path& path); + void variable_change_event(const Path& subject_path, const string& predicate, const Atom& value); + void control_change_event(const Path& port_path, float value); + void port_activity_event(const Path& port_path); + void connection_event(const Path& src_port_path, const Path& dst_port_path); + void disconnection_event(const Path& src_port_path, const Path& dst_port_path); + + bool attempt_connection(const Path& src_port_path, const Path& dst_port_path, bool add_orphan=false); + + SharedPtr _engine; + SharedPtr _emitter; + + Objects _objects; ///< Map, keyed by Ingen path + Plugins _plugins; ///< Map, keyed by plugin URI + + /** Objects we've received, but depend on the existance of another unknown object. + * Keyed by the path of the depended-on object (for tolerance of orderless comms) */ + Raul::PathTable > > _orphans; + + /** Same idea, except with plugins instead of parents. + * It's unfortunate everything doesn't just have a URI and this was the same.. ahem.. */ + Raul::Table > > _plugin_orphans; + + /** Not orphans OF variable like the above, but orphans which are variable */ + Raul::PathTable > > _variable_orphans; + + /** Ditto */ + list > _connection_orphans; +}; + + +} // namespace Client +} // namespace Ingen + +#endif // STORE_H diff --git a/src/libs/client/Makefile.am b/src/libs/client/Makefile.am index f111a54d..7047ce62 100644 --- a/src/libs/client/Makefile.am +++ b/src/libs/client/Makefile.am @@ -49,8 +49,8 @@ libingen_client_la_SOURCES = \ PortModel.cpp \ PortModel.hpp \ SigClientInterface.hpp \ - Store.cpp \ - Store.hpp \ + ClientStore.cpp \ + ClientStore.hpp \ ThreadedSigClientInterface.cpp \ ThreadedSigClientInterface.hpp \ client.cpp \ diff --git a/src/libs/client/ObjectModel.hpp b/src/libs/client/ObjectModel.hpp index f052f1d9..dbd188a3 100644 --- a/src/libs/client/ObjectModel.hpp +++ b/src/libs/client/ObjectModel.hpp @@ -30,7 +30,6 @@ #include #include #include "interface/GraphObject.hpp" -#include "Store.hpp" using Raul::PathTable; using std::string; diff --git a/src/libs/client/PatchModel.cpp b/src/libs/client/PatchModel.cpp index 7f928b41..360707d3 100644 --- a/src/libs/client/PatchModel.cpp +++ b/src/libs/client/PatchModel.cpp @@ -18,6 +18,7 @@ #include "PatchModel.hpp" #include "NodeModel.hpp" #include "ConnectionModel.hpp" +#include "ClientStore.hpp" #include #include diff --git a/src/libs/client/Store.hpp b/src/libs/client/Store.hpp deleted file mode 100644 index f86c511a..00000000 --- a/src/libs/client/Store.hpp +++ /dev/null @@ -1,155 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef STORE_H -#define STORE_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "interface/EngineInterface.hpp" -#include "interface/Store.hpp" -using std::string; using std::list; -using Ingen::Shared::EngineInterface; -using Raul::Path; -using Raul::Atom; - -namespace Ingen { - -namespace Shared { class GraphObject; } - -namespace Client { - -class SigClientInterface; -class ObjectModel; -class PluginModel; -class PatchModel; -class NodeModel; -class PortModel; -class ConnectionModel; - - -/** Automatically manages models of objects in the engine. - * - * \ingroup IngenClient - */ -class ClientStore : public Shared::Store, public sigc::trackable { // FIXME: is trackable necessary? -public: - ClientStore(SharedPtr engine, SharedPtr emitter); - - SharedPtr plugin(const string& uri); - SharedPtr object(const Path& path); - - void clear(); - - size_t num_object() { return _objects.size(); } - - Objects::iterator find(const Path& path) { return _objects.find(path); } - - typedef Raul::Table > Plugins; - const Plugins& plugins() const { return _plugins; } - - typedef Raul::PathTable< SharedPtr > Objects; - const Objects& objects() const { return _objects; } - Objects& objects() { return _objects; } - - Objects::const_iterator children_begin(SharedPtr o) const; - Objects::const_iterator children_end(SharedPtr o) const; - - SharedPtr find_child(SharedPtr parent, - const string& child_name) const; - - sigc::signal > signal_new_object; - sigc::signal > signal_new_plugin; - -private: - - void add(Shared::GraphObject* o) { throw; } - - void add_object(SharedPtr object); - SharedPtr remove_object(const Path& path); - - void add_plugin(SharedPtr plugin); - - SharedPtr connection_patch(const Path& src_port_path, const Path& dst_port_path); - - // It would be nice to integrate these somehow.. - - void add_orphan(SharedPtr orphan); - void resolve_orphans(SharedPtr parent); - - void add_connection_orphan(std::pair orphan); - void resolve_connection_orphans(SharedPtr port); - - void add_plugin_orphan(SharedPtr orphan); - void resolve_plugin_orphans(SharedPtr plugin); - - void add_variable_orphan(const Path& subject, const string& predicate, const Atom& value); - void resolve_variable_orphans(SharedPtr subject); - - // Slots for SigClientInterface signals - void destruction_event(const Path& path); - void rename_event(const Path& old_path, const Path& new_path); - void new_plugin_event(const string& uri, const string& type_uri, const string& symbol, const string& name); - void new_patch_event(const Path& path, uint32_t poly); - void new_node_event(const string& plugin_uri, const Path& node_path, bool is_polyphonic, uint32_t num_ports); - void new_port_event(const Path& path, uint32_t index, const string& data_type, bool is_output); - void polyphonic_event(const Path& path, bool polyphonic); - void patch_enabled_event(const Path& path); - void patch_disabled_event(const Path& path); - void patch_polyphony_event(const Path& path, uint32_t poly); - void patch_cleared_event(const Path& path); - void variable_change_event(const Path& subject_path, const string& predicate, const Atom& value); - void control_change_event(const Path& port_path, float value); - void port_activity_event(const Path& port_path); - void connection_event(const Path& src_port_path, const Path& dst_port_path); - void disconnection_event(const Path& src_port_path, const Path& dst_port_path); - - bool attempt_connection(const Path& src_port_path, const Path& dst_port_path, bool add_orphan=false); - - SharedPtr _engine; - SharedPtr _emitter; - - Objects _objects; ///< Map, keyed by Ingen path - Plugins _plugins; ///< Map, keyed by plugin URI - - /** Objects we've received, but depend on the existance of another unknown object. - * Keyed by the path of the depended-on object (for tolerance of orderless comms) */ - Raul::PathTable > > _orphans; - - /** Same idea, except with plugins instead of parents. - * It's unfortunate everything doesn't just have a URI and this was the same.. ahem.. */ - Raul::Table > > _plugin_orphans; - - /** Not orphans OF variable like the above, but orphans which are variable */ - Raul::PathTable > > _variable_orphans; - - /** Ditto */ - list > _connection_orphans; -}; - - -} // namespace Client -} // namespace Ingen - -#endif // STORE_H diff --git a/src/libs/engine/ClientBroadcaster.cpp b/src/libs/engine/ClientBroadcaster.cpp index bc77cc27..34f34933 100644 --- a/src/libs/engine/ClientBroadcaster.cpp +++ b/src/libs/engine/ClientBroadcaster.cpp @@ -20,7 +20,7 @@ #include #include "interface/ClientInterface.hpp" #include "ClientBroadcaster.hpp" -#include "ObjectStore.hpp" +#include "EngineStore.hpp" #include "NodeFactory.hpp" #include "util.hpp" #include "PatchImpl.hpp" diff --git a/src/libs/engine/Engine.cpp b/src/libs/engine/Engine.cpp index e7c2545c..382f44b9 100644 --- a/src/libs/engine/Engine.cpp +++ b/src/libs/engine/Engine.cpp @@ -27,12 +27,12 @@ #include "tuning.hpp" #include "Event.hpp" #include "common/interface/EventType.hpp" -#include "common/interface/Store.hpp" +#include "shared/Store.hpp" #include "JackAudioDriver.hpp" #include "NodeFactory.hpp" #include "ClientBroadcaster.hpp" #include "PatchImpl.hpp" -#include "ObjectStore.hpp" +#include "EngineStore.hpp" #include "MidiDriver.hpp" #include "OSCDriver.hpp" #include "QueuedEventSource.hpp" @@ -64,9 +64,9 @@ Engine::Engine(Ingen::Shared::World* world) , _activated(false) { if (world->store) { - assert(PtrCast(world->store)); + assert(PtrCast(world->store)); } else { - world->store = SharedPtr(new ObjectStore()); + world->store = SharedPtr(new EngineStore()); } } @@ -75,7 +75,7 @@ Engine::~Engine() { deactivate(); - for (ObjectStore::Objects::iterator i = object_store()->objects().begin(); + for (EngineStore::Objects::iterator i = object_store()->objects().begin(); i != object_store()->objects().end(); ++i) { if ( ! PtrCast(i->second)->parent() ) i->second.reset(); @@ -93,10 +93,10 @@ Engine::~Engine() } -ObjectStore* +EngineStore* Engine::object_store() const { - return dynamic_cast(_world->store.get()); + return dynamic_cast(_world->store.get()); } diff --git a/src/libs/engine/Engine.hpp b/src/libs/engine/Engine.hpp index 1d3b4253..dd8f3b15 100644 --- a/src/libs/engine/Engine.hpp +++ b/src/libs/engine/Engine.hpp @@ -38,7 +38,7 @@ class MidiDriver; class OSCDriver; class NodeFactory; class ClientBroadcaster; -class ObjectStore; +class EngineStore; class EventSource; class PostProcessor; class Event; @@ -92,7 +92,7 @@ public: ClientBroadcaster* broadcaster() const { return _broadcaster; } NodeFactory* node_factory() const { return _node_factory; } - ObjectStore* object_store() const; + EngineStore* object_store() const; /** Return the active driver for the given type */ Driver* driver(DataType type, EventType event_type); diff --git a/src/libs/engine/EngineStore.cpp b/src/libs/engine/EngineStore.cpp new file mode 100644 index 00000000..90268e9b --- /dev/null +++ b/src/libs/engine/EngineStore.cpp @@ -0,0 +1,216 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include +#include +#include +#include "EngineStore.hpp" +#include "PatchImpl.hpp" +#include "NodeImpl.hpp" +#include "PortImpl.hpp" +#include "ThreadManager.hpp" + +using namespace std; +using namespace Raul; + +namespace Ingen { + + +/** Find the Patch at the given path. + */ +PatchImpl* +EngineStore::find_patch(const Path& path) +{ + GraphObjectImpl* const object = find_object(path); + return dynamic_cast(object); +} + + +/** Find the Node at the given path. + */ +NodeImpl* +EngineStore::find_node(const Path& path) +{ + GraphObjectImpl* const object = find_object(path); + return dynamic_cast(object); +} + + +/** Find the Port at the given path. + */ +PortImpl* +EngineStore::find_port(const Path& path) +{ + GraphObjectImpl* const object = find_object(path); + return dynamic_cast(object); +} + + +/** Find the Object at the given path. + */ +GraphObjectImpl* +EngineStore::find_object(const Path& path) +{ + Objects::iterator i = _objects.find(path); + return ((i == _objects.end()) ? NULL : dynamic_cast(i->second.get())); +} + + +EngineStore::Objects::const_iterator +EngineStore::children_begin(SharedPtr o) const +{ + Objects::const_iterator parent = _objects.find(o->path()); + assert(parent != _objects.end()); + ++parent; + return parent; +} + + +EngineStore::Objects::const_iterator +EngineStore::children_end(SharedPtr o) const +{ + Objects::const_iterator parent = _objects.find(o->path()); + assert(parent != _objects.end()); + return _objects.find_descendants_end(parent); +} + + +/** Add an object to the store. Not realtime safe. + */ +void +EngineStore::add(GraphObject* obj) +{ + GraphObjectImpl* o = dynamic_cast(obj); + assert(o); + + assert(ThreadManager::current_thread_id() == THREAD_PRE_PROCESS); + + if (_objects.find(o->path()) != _objects.end()) { + cerr << "[EngineStore] ERROR: Attempt to add duplicate object " << o->path() << endl; + return; + } + + _objects.insert(make_pair(o->path(), o)); + + NodeImpl* node = dynamic_cast(o); + if (node) { + for (uint32_t i=0; i < node->num_ports(); ++i) { + add(node->port_impl(i)); + } + } +} + + +/** Add a family of objects to the store. Not realtime safe. + */ +void +EngineStore::add(const Table >& table) +{ + assert(ThreadManager::current_thread_id() == THREAD_PRE_PROCESS); + + //cerr << "[EngineStore] Adding " << o[0].second->path() << endl; + _objects.cram(table); + + /*cerr << "[EngineStore] Adding Table:" << endl; + for (Objects::const_iterator i = table.begin(); i != table.end(); ++i) { + cerr << i->first << " = " << i->second->path() << endl; + }*/ +} + + +/** Remove an object from the store. + * + * Returned is a vector containing all descendants of the object removed + * including the object itself, in lexicographically sorted order by Path. + */ +SharedPtr< Table > > +EngineStore::remove(const Path& path) +{ + return remove(_objects.find(path)); +} + + +/** Remove an object from the store. + * + * Returned is a vector containing all descendants of the object removed + * including the object itself, in lexicographically sorted order by Path. + */ +SharedPtr< Table > > +EngineStore::remove(Objects::iterator object) +{ + assert(ThreadManager::current_thread_id() == THREAD_PRE_PROCESS); + + if (object != _objects.end()) { + Objects::iterator descendants_end = _objects.find_descendants_end(object); + //cout << "[EngineStore] Removing " << object->first << " {" << endl; + SharedPtr< Table > > removed + = _objects.yank(object, descendants_end); + /*for (Objects::iterator i = removed->begin(); i != removed->end(); ++i) { + cout << "\t" << i->first << endl; + } + cout << "}" << endl;*/ + + return removed; + + } else { + cerr << "[EngineStore] WARNING: Removing " << object->first << " failed." << endl; + return SharedPtr(); + } +} + + +/** Remove all children of an object from the store. + * + * Returned is a vector containing all descendants of the object removed + * in lexicographically sorted order by Path. + */ +SharedPtr< Table > > +EngineStore::remove_children(const Path& path) +{ + return remove_children(_objects.find(path)); +} + + +/** Remove all children of an object from the store. + * + * Returned is a vector containing all descendants of the object removed + * in lexicographically sorted order by Path. + */ +SharedPtr< Table > > +EngineStore::remove_children(Objects::iterator object) +{ + if (object != _objects.end()) { + Objects::iterator descendants_end = _objects.find_descendants_end(object); + + if (descendants_end != object) { + Objects::iterator first_child = object; + ++first_child; + return _objects.yank(first_child, descendants_end); + } + + } else { + cerr << "[EngineStore] WARNING: Removing children of " << object->first << " failed." << endl; + return SharedPtr(); + } + + return SharedPtr(); +} + + +} // namespace Ingen diff --git a/src/libs/engine/EngineStore.hpp b/src/libs/engine/EngineStore.hpp new file mode 100644 index 00000000..e128dde8 --- /dev/null +++ b/src/libs/engine/EngineStore.hpp @@ -0,0 +1,82 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef OBJECTSTORE_H +#define OBJECTSTORE_H + +#include +#include +#include +#include "shared/Store.hpp" + +using std::string; +using namespace Raul; + +namespace Ingen { + +namespace Shared { class GraphObject; } + +class PatchImpl; +class NodeImpl; +class PortImpl; +class GraphObjectImpl; + + +/** Storage for all GraphObjects (tree of GraphObject's sorted by path). + * + * All looking up in pre_process() methods (and anything else that isn't in-band + * with the audio thread) should use this (to read and modify the GraphObject + * tree). + * + * Searching with find*() is fast (O(log(n)) binary search on contiguous + * memory) and realtime safe, but modification (add or remove) are neither. + */ +class EngineStore : public Shared::Store +{ +public: + typedef Raul::PathTable< SharedPtr > Objects; + + PatchImpl* find_patch(const Path& path); + NodeImpl* find_node(const Path& path); + PortImpl* find_port(const Path& path); + GraphObjectImpl* find_object(const Path& path); + + Objects::iterator find(const Path& path) { return _objects.find(path); } + + Objects::const_iterator children_begin(SharedPtr o) const; + Objects::const_iterator children_end(SharedPtr o) const; + + void add(Shared::GraphObject* o); + void add(const Table >& family); + //void add(TreeNode* o); + + SharedPtr< Table > > remove(const Path& path); + SharedPtr< Table > > remove(Objects::iterator i); + SharedPtr< Table > > remove_children(const Path& path); + SharedPtr< Table > > remove_children(Objects::iterator i); + + const Objects& objects() const { return _objects; } + Objects& objects() { return _objects; } + +private: + Objects _objects; +}; + + +} // namespace Ingen + +#endif // OBJECTSTORE diff --git a/src/libs/engine/GraphObjectImpl.cpp b/src/libs/engine/GraphObjectImpl.cpp index 5275261f..0e1abc57 100644 --- a/src/libs/engine/GraphObjectImpl.cpp +++ b/src/libs/engine/GraphObjectImpl.cpp @@ -17,7 +17,7 @@ #include "GraphObjectImpl.hpp" #include "PatchImpl.hpp" -#include "ObjectStore.hpp" +#include "EngineStore.hpp" namespace Ingen { diff --git a/src/libs/engine/HTTPEngineReceiver.cpp b/src/libs/engine/HTTPEngineReceiver.cpp index 47da1eb1..ee16cf44 100644 --- a/src/libs/engine/HTTPEngineReceiver.cpp +++ b/src/libs/engine/HTTPEngineReceiver.cpp @@ -29,7 +29,7 @@ #include "HTTPEngineReceiver.hpp" #include "QueuedEventSource.hpp" #include "ClientBroadcaster.hpp" -#include "ObjectStore.hpp" +#include "EngineStore.hpp" using namespace std; @@ -122,10 +122,10 @@ HTTPEngineReceiver::message_callback(SoupServer* server, SoupMessage* msg, const } #if 0 - ObjectStore::Objects::iterator end = store->objects().find_descendants_end(start); + EngineStore::Objects::iterator end = store->objects().find_descendants_end(start); string response; - for (ObjectStore::Objects::iterator i = start; i != end; ++i) + for (EngineStore::Objects::iterator i = start; i != end; ++i) response.append(i->first).append("\n"); #endif diff --git a/src/libs/engine/Makefile.am b/src/libs/engine/Makefile.am index 938d6817..5d7cb10f 100644 --- a/src/libs/engine/Makefile.am +++ b/src/libs/engine/Makefile.am @@ -91,8 +91,8 @@ libingen_engine_la_SOURCES = \ OSCEngineReceiver.hpp \ ObjectSender.cpp \ ObjectSender.hpp \ - ObjectStore.cpp \ - ObjectStore.hpp \ + EngineStore.cpp \ + EngineStore.hpp \ OutputPort.cpp \ OutputPort.hpp \ PatchImpl.cpp \ diff --git a/src/libs/engine/NodeBase.cpp b/src/libs/engine/NodeBase.cpp index 6eb0f8d8..bb4f0e5c 100644 --- a/src/libs/engine/NodeBase.cpp +++ b/src/libs/engine/NodeBase.cpp @@ -26,7 +26,7 @@ #include "ClientBroadcaster.hpp" #include "PortImpl.hpp" #include "PatchImpl.hpp" -#include "ObjectStore.hpp" +#include "EngineStore.hpp" #include "ThreadManager.hpp" using namespace std; diff --git a/src/libs/engine/NodeBase.hpp b/src/libs/engine/NodeBase.hpp index 2671a5a0..e4e2bfe5 100644 --- a/src/libs/engine/NodeBase.hpp +++ b/src/libs/engine/NodeBase.hpp @@ -32,7 +32,7 @@ namespace Ingen { class PluginImpl; class PatchImpl; -class ObjectStore; +class EngineStore; namespace Shared { class ClientInterface; diff --git a/src/libs/engine/OSCClientSender.cpp b/src/libs/engine/OSCClientSender.cpp index 98164de7..3b853571 100644 --- a/src/libs/engine/OSCClientSender.cpp +++ b/src/libs/engine/OSCClientSender.cpp @@ -20,7 +20,7 @@ #include #include #include -#include "ObjectStore.hpp" +#include "EngineStore.hpp" #include "NodeFactory.hpp" #include "util.hpp" #include "PatchImpl.hpp" diff --git a/src/libs/engine/ObjectSender.cpp b/src/libs/engine/ObjectSender.cpp index fff2a797..67bd41d2 100644 --- a/src/libs/engine/ObjectSender.cpp +++ b/src/libs/engine/ObjectSender.cpp @@ -17,7 +17,7 @@ #include "ObjectSender.hpp" #include "interface/ClientInterface.hpp" -#include "ObjectStore.hpp" +#include "EngineStore.hpp" #include "PatchImpl.hpp" #include "NodeImpl.hpp" #include "PortImpl.hpp" diff --git a/src/libs/engine/ObjectStore.cpp b/src/libs/engine/ObjectStore.cpp deleted file mode 100644 index 3cecb338..00000000 --- a/src/libs/engine/ObjectStore.cpp +++ /dev/null @@ -1,216 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include -#include -#include -#include "ObjectStore.hpp" -#include "PatchImpl.hpp" -#include "NodeImpl.hpp" -#include "PortImpl.hpp" -#include "ThreadManager.hpp" - -using namespace std; -using namespace Raul; - -namespace Ingen { - - -/** Find the Patch at the given path. - */ -PatchImpl* -ObjectStore::find_patch(const Path& path) -{ - GraphObjectImpl* const object = find_object(path); - return dynamic_cast(object); -} - - -/** Find the Node at the given path. - */ -NodeImpl* -ObjectStore::find_node(const Path& path) -{ - GraphObjectImpl* const object = find_object(path); - return dynamic_cast(object); -} - - -/** Find the Port at the given path. - */ -PortImpl* -ObjectStore::find_port(const Path& path) -{ - GraphObjectImpl* const object = find_object(path); - return dynamic_cast(object); -} - - -/** Find the Object at the given path. - */ -GraphObjectImpl* -ObjectStore::find_object(const Path& path) -{ - Objects::iterator i = _objects.find(path); - return ((i == _objects.end()) ? NULL : dynamic_cast(i->second.get())); -} - - -ObjectStore::Objects::const_iterator -ObjectStore::children_begin(SharedPtr o) const -{ - Objects::const_iterator parent = _objects.find(o->path()); - assert(parent != _objects.end()); - ++parent; - return parent; -} - - -ObjectStore::Objects::const_iterator -ObjectStore::children_end(SharedPtr o) const -{ - Objects::const_iterator parent = _objects.find(o->path()); - assert(parent != _objects.end()); - return _objects.find_descendants_end(parent); -} - - -/** Add an object to the store. Not realtime safe. - */ -void -ObjectStore::add(GraphObject* obj) -{ - GraphObjectImpl* o = dynamic_cast(obj); - assert(o); - - assert(ThreadManager::current_thread_id() == THREAD_PRE_PROCESS); - - if (_objects.find(o->path()) != _objects.end()) { - cerr << "[ObjectStore] ERROR: Attempt to add duplicate object " << o->path() << endl; - return; - } - - _objects.insert(make_pair(o->path(), o)); - - NodeImpl* node = dynamic_cast(o); - if (node) { - for (uint32_t i=0; i < node->num_ports(); ++i) { - add(node->port_impl(i)); - } - } -} - - -/** Add a family of objects to the store. Not realtime safe. - */ -void -ObjectStore::add(const Table >& table) -{ - assert(ThreadManager::current_thread_id() == THREAD_PRE_PROCESS); - - //cerr << "[ObjectStore] Adding " << o[0].second->path() << endl; - _objects.cram(table); - - /*cerr << "[ObjectStore] Adding Table:" << endl; - for (Objects::const_iterator i = table.begin(); i != table.end(); ++i) { - cerr << i->first << " = " << i->second->path() << endl; - }*/ -} - - -/** Remove an object from the store. - * - * Returned is a vector containing all descendants of the object removed - * including the object itself, in lexicographically sorted order by Path. - */ -SharedPtr< Table > > -ObjectStore::remove(const Path& path) -{ - return remove(_objects.find(path)); -} - - -/** Remove an object from the store. - * - * Returned is a vector containing all descendants of the object removed - * including the object itself, in lexicographically sorted order by Path. - */ -SharedPtr< Table > > -ObjectStore::remove(Objects::iterator object) -{ - assert(ThreadManager::current_thread_id() == THREAD_PRE_PROCESS); - - if (object != _objects.end()) { - Objects::iterator descendants_end = _objects.find_descendants_end(object); - //cout << "[ObjectStore] Removing " << object->first << " {" << endl; - SharedPtr< Table > > removed - = _objects.yank(object, descendants_end); - /*for (Objects::iterator i = removed->begin(); i != removed->end(); ++i) { - cout << "\t" << i->first << endl; - } - cout << "}" << endl;*/ - - return removed; - - } else { - cerr << "[ObjectStore] WARNING: Removing " << object->first << " failed." << endl; - return SharedPtr(); - } -} - - -/** Remove all children of an object from the store. - * - * Returned is a vector containing all descendants of the object removed - * in lexicographically sorted order by Path. - */ -SharedPtr< Table > > -ObjectStore::remove_children(const Path& path) -{ - return remove_children(_objects.find(path)); -} - - -/** Remove all children of an object from the store. - * - * Returned is a vector containing all descendants of the object removed - * in lexicographically sorted order by Path. - */ -SharedPtr< Table > > -ObjectStore::remove_children(Objects::iterator object) -{ - if (object != _objects.end()) { - Objects::iterator descendants_end = _objects.find_descendants_end(object); - - if (descendants_end != object) { - Objects::iterator first_child = object; - ++first_child; - return _objects.yank(first_child, descendants_end); - } - - } else { - cerr << "[ObjectStore] WARNING: Removing children of " << object->first << " failed." << endl; - return SharedPtr(); - } - - return SharedPtr(); -} - - -} // namespace Ingen diff --git a/src/libs/engine/ObjectStore.hpp b/src/libs/engine/ObjectStore.hpp deleted file mode 100644 index edba52f0..00000000 --- a/src/libs/engine/ObjectStore.hpp +++ /dev/null @@ -1,82 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef OBJECTSTORE_H -#define OBJECTSTORE_H - -#include -#include -#include -#include "interface/Store.hpp" - -using std::string; -using namespace Raul; - -namespace Ingen { - -namespace Shared { class GraphObject; } - -class PatchImpl; -class NodeImpl; -class PortImpl; -class GraphObjectImpl; - - -/** Storage for all GraphObjects (tree of GraphObject's sorted by path). - * - * All looking up in pre_process() methods (and anything else that isn't in-band - * with the audio thread) should use this (to read and modify the GraphObject - * tree). - * - * Searching with find*() is fast (O(log(n)) binary search on contiguous - * memory) and realtime safe, but modification (add or remove) are neither. - */ -class ObjectStore : public Shared::Store -{ -public: - typedef Raul::PathTable< SharedPtr > Objects; - - PatchImpl* find_patch(const Path& path); - NodeImpl* find_node(const Path& path); - PortImpl* find_port(const Path& path); - GraphObjectImpl* find_object(const Path& path); - - Objects::iterator find(const Path& path) { return _objects.find(path); } - - Objects::const_iterator children_begin(SharedPtr o) const; - Objects::const_iterator children_end(SharedPtr o) const; - - void add(Shared::GraphObject* o); - void add(const Table >& family); - //void add(TreeNode* o); - - SharedPtr< Table > > remove(const Path& path); - SharedPtr< Table > > remove(Objects::iterator i); - SharedPtr< Table > > remove_children(const Path& path); - SharedPtr< Table > > remove_children(Objects::iterator i); - - const Objects& objects() const { return _objects; } - Objects& objects() { return _objects; } - -private: - Objects _objects; -}; - - -} // namespace Ingen - -#endif // OBJECTSTORE diff --git a/src/libs/engine/events/AllNotesOffEvent.cpp b/src/libs/engine/events/AllNotesOffEvent.cpp index a0b3360f..6012ea92 100644 --- a/src/libs/engine/events/AllNotesOffEvent.cpp +++ b/src/libs/engine/events/AllNotesOffEvent.cpp @@ -18,9 +18,9 @@ #include "AllNotesOffEvent.hpp" #include "Responder.hpp" #include "Engine.hpp" -#include "ObjectStore.hpp" +#include "EngineStore.hpp" #include "module/World.hpp" -#include "interface/Store.hpp" +#include "shared/Store.hpp" namespace Ingen { diff --git a/src/libs/engine/events/ClearPatchEvent.cpp b/src/libs/engine/events/ClearPatchEvent.cpp index 0e725e65..60b882f9 100644 --- a/src/libs/engine/events/ClearPatchEvent.cpp +++ b/src/libs/engine/events/ClearPatchEvent.cpp @@ -22,7 +22,7 @@ #include "PatchImpl.hpp" #include "ClientBroadcaster.hpp" #include "util.hpp" -#include "ObjectStore.hpp" +#include "EngineStore.hpp" #include "PortImpl.hpp" #include "NodeImpl.hpp" #include "ConnectionImpl.hpp" @@ -47,7 +47,7 @@ ClearPatchEvent::ClearPatchEvent(Engine& engine, SharedPtr responder, void ClearPatchEvent::pre_process() { - ObjectStore::Objects::iterator patch_iterator = _engine.object_store()->find(_patch_path); + EngineStore::Objects::iterator patch_iterator = _engine.object_store()->find(_patch_path); if (patch_iterator != _engine.object_store()->objects().end()) { _patch = PtrCast(patch_iterator->second); @@ -88,7 +88,7 @@ ClearPatchEvent::execute(ProcessContext& context) // Remove driver ports, if necessary if (_patch->parent() == NULL) { - for (ObjectStore::Objects::iterator i = _removed_table->begin(); i != _removed_table->end(); ++i) { + for (EngineStore::Objects::iterator i = _removed_table->begin(); i != _removed_table->end(); ++i) { SharedPtr port = PtrCast(i->second); if (port && port->type() == DataType::AUDIO) _driver_port = _engine.audio_driver()->remove_port(port->path()); diff --git a/src/libs/engine/events/ClearPatchEvent.hpp b/src/libs/engine/events/ClearPatchEvent.hpp index 0353dc01..803721fb 100644 --- a/src/libs/engine/events/ClearPatchEvent.hpp +++ b/src/libs/engine/events/ClearPatchEvent.hpp @@ -23,7 +23,7 @@ #include #include #include "QueuedEvent.hpp" -#include "ObjectStore.hpp" +#include "EngineStore.hpp" #include "PatchImpl.hpp" using std::string; diff --git a/src/libs/engine/events/ConnectionEvent.cpp b/src/libs/engine/events/ConnectionEvent.cpp index ac04d1cc..55286ffd 100644 --- a/src/libs/engine/events/ConnectionEvent.cpp +++ b/src/libs/engine/events/ConnectionEvent.cpp @@ -25,7 +25,7 @@ #include "ConnectionImpl.hpp" #include "Engine.hpp" #include "InputPort.hpp" -#include "ObjectStore.hpp" +#include "EngineStore.hpp" #include "OutputPort.hpp" #include "PatchImpl.hpp" #include "PortImpl.hpp" diff --git a/src/libs/engine/events/CreateNodeEvent.cpp b/src/libs/engine/events/CreateNodeEvent.cpp index 7589b150..d1d21a36 100644 --- a/src/libs/engine/events/CreateNodeEvent.cpp +++ b/src/libs/engine/events/CreateNodeEvent.cpp @@ -29,7 +29,7 @@ #include "PatchImpl.hpp" #include "NodeFactory.hpp" #include "ClientBroadcaster.hpp" -#include "ObjectStore.hpp" +#include "EngineStore.hpp" #include "PortImpl.hpp" #include "AudioDriver.hpp" diff --git a/src/libs/engine/events/CreatePatchEvent.cpp b/src/libs/engine/events/CreatePatchEvent.cpp index 8642dc1d..2b396cbb 100644 --- a/src/libs/engine/events/CreatePatchEvent.cpp +++ b/src/libs/engine/events/CreatePatchEvent.cpp @@ -25,7 +25,7 @@ #include "Engine.hpp" #include "ClientBroadcaster.hpp" #include "AudioDriver.hpp" -#include "ObjectStore.hpp" +#include "EngineStore.hpp" namespace Ingen { @@ -79,7 +79,7 @@ CreatePatchEvent::pre_process() _patch->activate(); - // Insert into ObjectStore + // Insert into EngineStore //_patch->add_to_store(_engine.object_store()); _engine.object_store()->add(_patch); diff --git a/src/libs/engine/events/CreatePortEvent.cpp b/src/libs/engine/events/CreatePortEvent.cpp index aca33c67..b8ef244f 100644 --- a/src/libs/engine/events/CreatePortEvent.cpp +++ b/src/libs/engine/events/CreatePortEvent.cpp @@ -26,7 +26,7 @@ #include "Engine.hpp" #include "PatchImpl.hpp" #include "QueuedEventSource.hpp" -#include "ObjectStore.hpp" +#include "EngineStore.hpp" #include "ClientBroadcaster.hpp" #include "PortImpl.hpp" #include "AudioDriver.hpp" diff --git a/src/libs/engine/events/DestroyEvent.cpp b/src/libs/engine/events/DestroyEvent.cpp index bc28501e..bdcb1ad2 100644 --- a/src/libs/engine/events/DestroyEvent.cpp +++ b/src/libs/engine/events/DestroyEvent.cpp @@ -27,7 +27,7 @@ #include "MidiDriver.hpp" #include "DisconnectAllEvent.hpp" #include "ClientBroadcaster.hpp" -#include "ObjectStore.hpp" +#include "EngineStore.hpp" #include "QueuedEventSource.hpp" #include "PortImpl.hpp" diff --git a/src/libs/engine/events/DestroyEvent.hpp b/src/libs/engine/events/DestroyEvent.hpp index 5d87f27c..c2cf9ed5 100644 --- a/src/libs/engine/events/DestroyEvent.hpp +++ b/src/libs/engine/events/DestroyEvent.hpp @@ -21,7 +21,7 @@ #include #include #include "QueuedEvent.hpp" -#include "ObjectStore.hpp" +#include "EngineStore.hpp" #include "PatchImpl.hpp" using std::string; @@ -58,7 +58,7 @@ public: private: Path _path; - ObjectStore::Objects::iterator _store_iterator; + EngineStore::Objects::iterator _store_iterator; SharedPtr _node; ///< Non-NULL iff a node SharedPtr _port; ///< Non-NULL iff a port DriverPort* _driver_port; diff --git a/src/libs/engine/events/DisablePortMonitoringEvent.cpp b/src/libs/engine/events/DisablePortMonitoringEvent.cpp index d5b99618..02d64c0b 100644 --- a/src/libs/engine/events/DisablePortMonitoringEvent.cpp +++ b/src/libs/engine/events/DisablePortMonitoringEvent.cpp @@ -21,7 +21,7 @@ #include "Responder.hpp" #include "Engine.hpp" #include "PortImpl.hpp" -#include "ObjectStore.hpp" +#include "EngineStore.hpp" #include "ClientBroadcaster.hpp" #include "AudioBuffer.hpp" diff --git a/src/libs/engine/events/DisconnectAllEvent.cpp b/src/libs/engine/events/DisconnectAllEvent.cpp index a536fffc..78c2b23b 100644 --- a/src/libs/engine/events/DisconnectAllEvent.cpp +++ b/src/libs/engine/events/DisconnectAllEvent.cpp @@ -27,7 +27,7 @@ #include "Engine.hpp" #include "InputPort.hpp" #include "NodeImpl.hpp" -#include "ObjectStore.hpp" +#include "EngineStore.hpp" #include "OutputPort.hpp" #include "PatchImpl.hpp" #include "PortImpl.hpp" diff --git a/src/libs/engine/events/DisconnectionEvent.cpp b/src/libs/engine/events/DisconnectionEvent.cpp index 03110f9e..d796877f 100644 --- a/src/libs/engine/events/DisconnectionEvent.cpp +++ b/src/libs/engine/events/DisconnectionEvent.cpp @@ -27,7 +27,7 @@ #include "PatchImpl.hpp" #include "ClientBroadcaster.hpp" #include "PortImpl.hpp" -#include "ObjectStore.hpp" +#include "EngineStore.hpp" using std::string; namespace Ingen { diff --git a/src/libs/engine/events/EnablePatchEvent.cpp b/src/libs/engine/events/EnablePatchEvent.cpp index b1cda98a..aff5885b 100644 --- a/src/libs/engine/events/EnablePatchEvent.cpp +++ b/src/libs/engine/events/EnablePatchEvent.cpp @@ -21,7 +21,7 @@ #include "PatchImpl.hpp" #include "util.hpp" #include "ClientBroadcaster.hpp" -#include "ObjectStore.hpp" +#include "EngineStore.hpp" namespace Ingen { diff --git a/src/libs/engine/events/EnablePortBroadcastingEvent.cpp b/src/libs/engine/events/EnablePortBroadcastingEvent.cpp index dcc09ac4..cb7dc5ec 100644 --- a/src/libs/engine/events/EnablePortBroadcastingEvent.cpp +++ b/src/libs/engine/events/EnablePortBroadcastingEvent.cpp @@ -21,7 +21,7 @@ #include "Responder.hpp" #include "Engine.hpp" #include "PortImpl.hpp" -#include "ObjectStore.hpp" +#include "EngineStore.hpp" #include "ClientBroadcaster.hpp" #include "AudioBuffer.hpp" diff --git a/src/libs/engine/events/MidiLearnEvent.cpp b/src/libs/engine/events/MidiLearnEvent.cpp index 8d5b0658..3e8947b7 100644 --- a/src/libs/engine/events/MidiLearnEvent.cpp +++ b/src/libs/engine/events/MidiLearnEvent.cpp @@ -18,7 +18,7 @@ #include "MidiLearnEvent.hpp" #include "Responder.hpp" #include "Engine.hpp" -#include "ObjectStore.hpp" +#include "EngineStore.hpp" #include "NodeImpl.hpp" #include "MidiControlNode.hpp" #include "ClientBroadcaster.hpp" diff --git a/src/libs/engine/events/NoteEvent.cpp b/src/libs/engine/events/NoteEvent.cpp index 8f262d14..d5f2cf76 100644 --- a/src/libs/engine/events/NoteEvent.cpp +++ b/src/libs/engine/events/NoteEvent.cpp @@ -18,7 +18,7 @@ #include "NoteEvent.hpp" #include "Responder.hpp" #include "Engine.hpp" -#include "ObjectStore.hpp" +#include "EngineStore.hpp" #include "NodeImpl.hpp" #include "MidiNoteNode.hpp" #include "MidiTriggerNode.hpp" diff --git a/src/libs/engine/events/RenameEvent.cpp b/src/libs/engine/events/RenameEvent.cpp index 7d487cc1..cd2189e8 100644 --- a/src/libs/engine/events/RenameEvent.cpp +++ b/src/libs/engine/events/RenameEvent.cpp @@ -19,7 +19,7 @@ #include "ClientBroadcaster.hpp" #include "Engine.hpp" #include "NodeImpl.hpp" -#include "ObjectStore.hpp" +#include "EngineStore.hpp" #include "PatchImpl.hpp" #include "RenameEvent.hpp" #include "Responder.hpp" diff --git a/src/libs/engine/events/RenameEvent.hpp b/src/libs/engine/events/RenameEvent.hpp index dbfc6d53..114b59fa 100644 --- a/src/libs/engine/events/RenameEvent.hpp +++ b/src/libs/engine/events/RenameEvent.hpp @@ -21,7 +21,7 @@ #include #include #include "QueuedEvent.hpp" -#include "ObjectStore.hpp" +#include "EngineStore.hpp" using std::string; @@ -54,7 +54,7 @@ private: string _name; Path _new_path; PatchImpl* _parent_patch; - ObjectStore::Objects::iterator _store_iterator; + EngineStore::Objects::iterator _store_iterator; ErrorType _error; }; diff --git a/src/libs/engine/events/RequestAllObjectsEvent.cpp b/src/libs/engine/events/RequestAllObjectsEvent.cpp index 7865cd9b..94e34f3b 100644 --- a/src/libs/engine/events/RequestAllObjectsEvent.cpp +++ b/src/libs/engine/events/RequestAllObjectsEvent.cpp @@ -20,7 +20,7 @@ #include "Engine.hpp" #include "ObjectSender.hpp" #include "ClientBroadcaster.hpp" -#include "ObjectStore.hpp" +#include "EngineStore.hpp" namespace Ingen { diff --git a/src/libs/engine/events/RequestMetadataEvent.cpp b/src/libs/engine/events/RequestMetadataEvent.cpp index 99f0e04e..cf428c05 100644 --- a/src/libs/engine/events/RequestMetadataEvent.cpp +++ b/src/libs/engine/events/RequestMetadataEvent.cpp @@ -20,7 +20,7 @@ #include "Responder.hpp" #include "Engine.hpp" #include "GraphObjectImpl.hpp" -#include "ObjectStore.hpp" +#include "EngineStore.hpp" #include "interface/ClientInterface.hpp" #include "ClientBroadcaster.hpp" using std::string; diff --git a/src/libs/engine/events/RequestObjectEvent.cpp b/src/libs/engine/events/RequestObjectEvent.cpp index 34c04889..c1c93129 100644 --- a/src/libs/engine/events/RequestObjectEvent.cpp +++ b/src/libs/engine/events/RequestObjectEvent.cpp @@ -20,7 +20,7 @@ #include "interface/ClientInterface.hpp" #include "Responder.hpp" #include "Engine.hpp" -#include "ObjectStore.hpp" +#include "EngineStore.hpp" #include "ClientBroadcaster.hpp" #include "PatchImpl.hpp" #include "NodeImpl.hpp" diff --git a/src/libs/engine/events/RequestPluginEvent.cpp b/src/libs/engine/events/RequestPluginEvent.cpp index 1c1df99e..36358df7 100644 --- a/src/libs/engine/events/RequestPluginEvent.cpp +++ b/src/libs/engine/events/RequestPluginEvent.cpp @@ -21,7 +21,7 @@ #include "Responder.hpp" #include "Engine.hpp" #include "PortImpl.hpp" -#include "ObjectStore.hpp" +#include "EngineStore.hpp" #include "ClientBroadcaster.hpp" #include "NodeFactory.hpp" #include "PluginImpl.hpp" diff --git a/src/libs/engine/events/RequestPortValueEvent.cpp b/src/libs/engine/events/RequestPortValueEvent.cpp index e26b1036..1e09662b 100644 --- a/src/libs/engine/events/RequestPortValueEvent.cpp +++ b/src/libs/engine/events/RequestPortValueEvent.cpp @@ -21,7 +21,7 @@ #include "Responder.hpp" #include "Engine.hpp" #include "PortImpl.hpp" -#include "ObjectStore.hpp" +#include "EngineStore.hpp" #include "ClientBroadcaster.hpp" #include "AudioBuffer.hpp" #include "ProcessContext.hpp" diff --git a/src/libs/engine/events/SetMetadataEvent.cpp b/src/libs/engine/events/SetMetadataEvent.cpp index 2829eb1e..14293037 100644 --- a/src/libs/engine/events/SetMetadataEvent.cpp +++ b/src/libs/engine/events/SetMetadataEvent.cpp @@ -21,7 +21,7 @@ #include "Engine.hpp" #include "ClientBroadcaster.hpp" #include "GraphObjectImpl.hpp" -#include "ObjectStore.hpp" +#include "EngineStore.hpp" using std::string; diff --git a/src/libs/engine/events/SetPolyphonicEvent.cpp b/src/libs/engine/events/SetPolyphonicEvent.cpp index 73e27c93..d2ff97aa 100644 --- a/src/libs/engine/events/SetPolyphonicEvent.cpp +++ b/src/libs/engine/events/SetPolyphonicEvent.cpp @@ -22,7 +22,7 @@ #include "PatchImpl.hpp" #include "ClientBroadcaster.hpp" #include "util.hpp" -#include "ObjectStore.hpp" +#include "EngineStore.hpp" #include "PortImpl.hpp" #include "NodeImpl.hpp" #include "ConnectionImpl.hpp" diff --git a/src/libs/engine/events/SetPolyphonyEvent.cpp b/src/libs/engine/events/SetPolyphonyEvent.cpp index 7efa7386..2a22da2f 100644 --- a/src/libs/engine/events/SetPolyphonyEvent.cpp +++ b/src/libs/engine/events/SetPolyphonyEvent.cpp @@ -22,7 +22,7 @@ #include "PatchImpl.hpp" #include "ClientBroadcaster.hpp" #include "util.hpp" -#include "ObjectStore.hpp" +#include "EngineStore.hpp" #include "PortImpl.hpp" #include "NodeImpl.hpp" #include "ConnectionImpl.hpp" diff --git a/src/libs/engine/events/SetPortValueEvent.cpp b/src/libs/engine/events/SetPortValueEvent.cpp index 9ab6349d..ee9be86e 100644 --- a/src/libs/engine/events/SetPortValueEvent.cpp +++ b/src/libs/engine/events/SetPortValueEvent.cpp @@ -23,7 +23,7 @@ #include "PortImpl.hpp" #include "ClientBroadcaster.hpp" #include "NodeImpl.hpp" -#include "ObjectStore.hpp" +#include "EngineStore.hpp" #include "AudioBuffer.hpp" #include "EventBuffer.hpp" #include "ProcessContext.hpp" diff --git a/src/libs/gui/App.cpp b/src/libs/gui/App.cpp index b558f706..3823b407 100644 --- a/src/libs/gui/App.cpp +++ b/src/libs/gui/App.cpp @@ -32,7 +32,7 @@ #include "serialisation/serialisation.hpp" #include "client/ObjectModel.hpp" #include "client/PatchModel.hpp" -#include "client/Store.hpp" +#include "client/ClientStore.hpp" #include "engine/Engine.hpp" #include "NodeModule.hpp" #include "ControlPanel.hpp" diff --git a/src/libs/gui/App.hpp b/src/libs/gui/App.hpp index f7a3ead1..c6a6c66c 100644 --- a/src/libs/gui/App.hpp +++ b/src/libs/gui/App.hpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include using namespace std; diff --git a/src/libs/gui/ConnectWindow.cpp b/src/libs/gui/ConnectWindow.cpp index c9cd948d..9707e5aa 100644 --- a/src/libs/gui/ConnectWindow.cpp +++ b/src/libs/gui/ConnectWindow.cpp @@ -31,7 +31,7 @@ #include "client/OSCClientReceiver.hpp" #include "client/OSCEngineSender.hpp" #include "client/ThreadedSigClientInterface.hpp" -#include "client/Store.hpp" +#include "client/ClientStore.hpp" #include "client/PatchModel.hpp" #include "module/Module.hpp" #include "App.hpp" diff --git a/src/libs/gui/LoadPluginWindow.cpp b/src/libs/gui/LoadPluginWindow.cpp index c518f25f..b2f09ee8 100644 --- a/src/libs/gui/LoadPluginWindow.cpp +++ b/src/libs/gui/LoadPluginWindow.cpp @@ -22,7 +22,7 @@ #include "interface/EngineInterface.hpp" #include "client/NodeModel.hpp" #include "client/PatchModel.hpp" -#include "client/Store.hpp" +#include "client/ClientStore.hpp" #include "App.hpp" #include "LoadPluginWindow.hpp" #include "PatchWindow.hpp" diff --git a/src/libs/gui/NewSubpatchWindow.cpp b/src/libs/gui/NewSubpatchWindow.cpp index def57975..02d3e9e0 100644 --- a/src/libs/gui/NewSubpatchWindow.cpp +++ b/src/libs/gui/NewSubpatchWindow.cpp @@ -19,6 +19,7 @@ #include "interface/EngineInterface.hpp" #include "client/NodeModel.hpp" #include "client/PatchModel.hpp" +#include "client/ClientStore.hpp" #include "NewSubpatchWindow.hpp" #include "PatchView.hpp" diff --git a/src/libs/gui/PatchCanvas.cpp b/src/libs/gui/PatchCanvas.cpp index d7ffd78b..c92eeb43 100644 --- a/src/libs/gui/PatchCanvas.cpp +++ b/src/libs/gui/PatchCanvas.cpp @@ -27,7 +27,7 @@ #include "client/PluginModel.hpp" #include "client/PatchModel.hpp" #include "client/NodeModel.hpp" -#include "client/Store.hpp" +#include "client/ClientStore.hpp" #include "App.hpp" #include "PatchCanvas.hpp" #include "PatchWindow.hpp" diff --git a/src/libs/gui/PatchTreeWindow.cpp b/src/libs/gui/PatchTreeWindow.cpp index 85f4f19c..336d3aaf 100644 --- a/src/libs/gui/PatchTreeWindow.cpp +++ b/src/libs/gui/PatchTreeWindow.cpp @@ -18,7 +18,7 @@ #include #include "interface/EngineInterface.hpp" #include "client/OSCEngineSender.hpp" -#include "client/Store.hpp" +#include "client/ClientStore.hpp" #include "client/PatchModel.hpp" #include "App.hpp" #include "PatchTreeWindow.hpp" diff --git a/src/libs/gui/PatchWindow.cpp b/src/libs/gui/PatchWindow.cpp index fc455a87..ad558903 100644 --- a/src/libs/gui/PatchWindow.cpp +++ b/src/libs/gui/PatchWindow.cpp @@ -21,7 +21,7 @@ #include #include "interface/EngineInterface.hpp" #include "client/PatchModel.hpp" -#include "client/Store.hpp" +#include "client/ClientStore.hpp" #include "App.hpp" #include "PatchCanvas.hpp" #include "LoadPluginWindow.hpp" diff --git a/src/libs/gui/RenameWindow.cpp b/src/libs/gui/RenameWindow.cpp index d5ef1b24..465b6b1b 100644 --- a/src/libs/gui/RenameWindow.cpp +++ b/src/libs/gui/RenameWindow.cpp @@ -19,7 +19,7 @@ #include #include "interface/EngineInterface.hpp" #include "client/ObjectModel.hpp" -#include "client/Store.hpp" +#include "client/ClientStore.hpp" #include "App.hpp" #include "RenameWindow.hpp" diff --git a/src/libs/serialisation/Serialiser.hpp b/src/libs/serialisation/Serialiser.hpp index 51d89cab..eb3a8810 100644 --- a/src/libs/serialisation/Serialiser.hpp +++ b/src/libs/serialisation/Serialiser.hpp @@ -29,7 +29,7 @@ #include #include #include "interface/GraphObject.hpp" -#include "interface/Store.hpp" +#include "shared/Store.hpp" using namespace Raul; using namespace Ingen::Shared; diff --git a/src/libs/shared/Store.hpp b/src/libs/shared/Store.hpp new file mode 100644 index 00000000..428945b9 --- /dev/null +++ b/src/libs/shared/Store.hpp @@ -0,0 +1,47 @@ +/* This file is part of Ingen. + * Copyright (C) 2008 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef COMMON_STORE_H +#define COMMON_STORE_H + +#include +#include "interface/GraphObject.hpp" + +using Raul::PathTable; +using Raul::Path; + +namespace Ingen { +namespace Shared { + + +class Store { +public: + typedef Raul::PathTable< SharedPtr > Objects; + virtual const Objects& objects() const = 0; + + virtual Objects::iterator find(const Path& path) = 0; + virtual void add(GraphObject* o) = 0; + + virtual Objects::const_iterator children_begin(SharedPtr o) const = 0; + virtual Objects::const_iterator children_end(SharedPtr o) const = 0; +}; + + +} // namespace Shared +} // namespace Ingen + +#endif // COMMON_STORE_H -- cgit v1.2.1