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/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 +- 41 files changed, 351 insertions(+), 351 deletions(-) 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 (limited to 'src/libs/engine') 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" -- cgit v1.2.1