From 4ceb2aa22679af70ddcfd9d5719a4585b818bdbd Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 19 Apr 2011 17:04:46 +0000 Subject: Replace load_plugins API with a GET of ingen:plugins. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3161 a436a847-0d15-0410-975c-d299462d15a1 --- src/engine/HTTPEngineReceiver.cpp | 2 +- src/engine/NodeFactory.cpp | 10 +++++++ src/engine/NodeFactory.hpp | 2 +- src/engine/OSCEngineReceiver.cpp | 14 ---------- src/engine/OSCEngineReceiver.hpp | 1 - src/engine/QueuedEngineInterface.cpp | 5 ---- src/engine/QueuedEngineInterface.hpp | 1 - src/engine/events.hpp | 1 - src/engine/events/LoadPlugins.cpp | 53 ------------------------------------ src/engine/events/LoadPlugins.hpp | 46 ------------------------------- src/engine/ingen_lv2.cpp | 4 +-- src/engine/wscript | 1 - 12 files changed, 14 insertions(+), 126 deletions(-) delete mode 100644 src/engine/events/LoadPlugins.cpp delete mode 100644 src/engine/events/LoadPlugins.hpp (limited to 'src/engine') diff --git a/src/engine/HTTPEngineReceiver.cpp b/src/engine/HTTPEngineReceiver.cpp index 22de974e..9ee54319 100644 --- a/src/engine/HTTPEngineReceiver.cpp +++ b/src/engine/HTTPEngineReceiver.cpp @@ -134,7 +134,7 @@ HTTPEngineReceiver::message_callback(SoupServer* server, } else if (msg->method == SOUP_METHOD_GET && path.substr(0, 8) == "/plugins") { // FIXME: kludge - me->load_plugins(); + me->get("ingen:plugins"); me->_receive_thread->whip(); serialiser->start_to_string("/", base_uri); diff --git a/src/engine/NodeFactory.cpp b/src/engine/NodeFactory.cpp index 21b8257c..20ad9fc2 100644 --- a/src/engine/NodeFactory.cpp +++ b/src/engine/NodeFactory.cpp @@ -66,6 +66,16 @@ NodeFactory::~NodeFactory() _plugins.clear(); } +const NodeFactory::Plugins& +NodeFactory::plugins() +{ + if (!_has_loaded) { + // TODO: Plugin list refreshing + load_plugins(); + } + return _plugins; +} + PluginImpl* NodeFactory::plugin(const Raul::URI& uri) { diff --git a/src/engine/NodeFactory.hpp b/src/engine/NodeFactory.hpp index 3057319c..3c906663 100644 --- a/src/engine/NodeFactory.hpp +++ b/src/engine/NodeFactory.hpp @@ -51,7 +51,7 @@ public: void load_plugins(); typedef std::map Plugins; - const Plugins& plugins() const { return _plugins; } + const Plugins& plugins(); PluginImpl* plugin(const Raul::URI& uri); diff --git a/src/engine/OSCEngineReceiver.cpp b/src/engine/OSCEngineReceiver.cpp index baa6d5e1..a957d863 100644 --- a/src/engine/OSCEngineReceiver.cpp +++ b/src/engine/OSCEngineReceiver.cpp @@ -97,7 +97,6 @@ OSCEngineReceiver::OSCEngineReceiver(Engine& engine, size_t queue_size, uint16_t lo_server_add_method(_server, "/quit", "i", quit_cb, this); lo_server_add_method(_server, "/register_client", "i", register_client_cb, this); lo_server_add_method(_server, "/unregister_client", "i", unregister_client_cb, this); - lo_server_add_method(_server, "/load_plugins", "i", load_plugins_cb, this); lo_server_add_method(_server, "/activate", "i", engine_activate_cb, this); lo_server_add_method(_server, "/deactivate", "i", engine_deactivate_cb, this); lo_server_add_method(_server, "/put", NULL, put_cb, this); @@ -339,19 +338,6 @@ OSCEngineReceiver::_unregister_client_cb(const char* path, const char* types, lo return 0; } -/** \page engine_osc_namespace - *

/load_plugins

- * \arg \b response-id (integer) - * - * Locate all available plugins, making them available for use. - */ -int -OSCEngineReceiver::_load_plugins_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg) -{ - load_plugins(); - return 0; -} - /** \page engine_osc_namespace *

/activate

* \arg \b response-id (integer) diff --git a/src/engine/OSCEngineReceiver.hpp b/src/engine/OSCEngineReceiver.hpp index e059a843..a94ca396 100644 --- a/src/engine/OSCEngineReceiver.hpp +++ b/src/engine/OSCEngineReceiver.hpp @@ -97,7 +97,6 @@ private: LO_HANDLER(ping_slow); LO_HANDLER(register_client); LO_HANDLER(unregister_client); - LO_HANDLER(load_plugins); LO_HANDLER(engine_activate); LO_HANDLER(engine_deactivate); LO_HANDLER(get); diff --git a/src/engine/QueuedEngineInterface.cpp b/src/engine/QueuedEngineInterface.cpp index 345602fa..ba48b5c5 100644 --- a/src/engine/QueuedEngineInterface.cpp +++ b/src/engine/QueuedEngineInterface.cpp @@ -92,11 +92,6 @@ QueuedEngineInterface::unregister_client(const URI& uri) } // Engine commands -void -QueuedEngineInterface::load_plugins() -{ - push_queued(new Events::LoadPlugins(_engine, _request, now())); -} void QueuedEngineInterface::activate() diff --git a/src/engine/QueuedEngineInterface.hpp b/src/engine/QueuedEngineInterface.hpp index cb4e2c26..e4338dbc 100644 --- a/src/engine/QueuedEngineInterface.hpp +++ b/src/engine/QueuedEngineInterface.hpp @@ -61,7 +61,6 @@ public: virtual void unregister_client(const Raul::URI& uri); // Engine commands - virtual void load_plugins(); virtual void activate(); virtual void deactivate(); virtual void quit(); diff --git a/src/engine/events.hpp b/src/engine/events.hpp index 6382baae..7ddcfe52 100644 --- a/src/engine/events.hpp +++ b/src/engine/events.hpp @@ -29,7 +29,6 @@ #include "events/Disconnect.hpp" #include "events/DisconnectAll.hpp" #include "events/Get.hpp" -#include "events/LoadPlugins.hpp" #include "events/Move.hpp" #include "events/Ping.hpp" #include "events/RegisterClient.hpp" diff --git a/src/engine/events/LoadPlugins.cpp b/src/engine/events/LoadPlugins.cpp deleted file mode 100644 index 975165bf..00000000 --- a/src/engine/events/LoadPlugins.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* This file is part of Ingen. - * Copyright 2007-2011 David 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 "LoadPlugins.hpp" -#include "Request.hpp" -#include "Engine.hpp" -#include "NodeFactory.hpp" -#include "ClientBroadcaster.hpp" - -namespace Ingen { -namespace Engine { -namespace Events { - -LoadPlugins::LoadPlugins(Engine& engine, SharedPtr request, SampleCount timestamp) - : QueuedEvent(engine, request, timestamp, bool(request)) -{ -} - -void -LoadPlugins::pre_process() -{ - _engine.node_factory()->load_plugins(); - - QueuedEvent::pre_process(); -} - -void -LoadPlugins::post_process() -{ - if (_request) - _request->unblock(); - - _request->respond_ok(); -} - -} // namespace Engine -} // namespace Ingen -} // namespace Events - diff --git a/src/engine/events/LoadPlugins.hpp b/src/engine/events/LoadPlugins.hpp deleted file mode 100644 index 47646e92..00000000 --- a/src/engine/events/LoadPlugins.hpp +++ /dev/null @@ -1,46 +0,0 @@ -/* This file is part of Ingen. - * Copyright 2007-2011 David 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 INGEN_EVENTS_LOADPLUGINS_HPP -#define INGEN_EVENTS_LOADPLUGINS_HPP - -#include "QueuedEvent.hpp" - -namespace Ingen { -namespace Engine { -namespace Events { - -/** Loads all plugins into the internal plugin database (in NodeFactory). - * - * \ingroup engine - */ -class LoadPlugins : public QueuedEvent -{ -public: - LoadPlugins(Engine& engine, - SharedPtr request, - SampleCount timestamp); - - void pre_process(); - void post_process(); -}; - -} // namespace Engine -} // namespace Ingen -} // namespace Events - -#endif // INGEN_EVENTS_LOADPLUGINS_HPP diff --git a/src/engine/ingen_lv2.cpp b/src/engine/ingen_lv2.cpp index 44ebc52b..0c943a7a 100644 --- a/src/engine/ingen_lv2.cpp +++ b/src/engine/ingen_lv2.cpp @@ -290,8 +290,8 @@ ingen_instantiate(const LV2_Descriptor* descriptor, engine->post_processor()->set_end_time(UINT_MAX); - // FIXME: don't load all plugins, only necessary ones - plugin->world->engine()->load_plugins(); + // TODO: Load only necessary plugins + plugin->world->engine()->get("ingen:plugins"); interface->process(*engine->post_processor(), context, false); engine->post_processor()->process(); diff --git a/src/engine/wscript b/src/engine/wscript index 987779fd..2321da69 100644 --- a/src/engine/wscript +++ b/src/engine/wscript @@ -43,7 +43,6 @@ def build(bld): events/Disconnect.cpp events/DisconnectAll.cpp events/Get.cpp - events/LoadPlugins.cpp events/Move.cpp events/RegisterClient.cpp events/RequestMetadata.cpp -- cgit v1.2.1