From eae593911c18a2f7a59c00920dfb5d09846e940d Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 24 Sep 2011 03:39:42 +0000 Subject: Remove unnecessary request_property() and RequestMetadataEvent. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3486 a436a847-0d15-0410-975c-d299462d15a1 --- src/server/OSCEngineReceiver.cpp | 18 ----- src/server/OSCEngineReceiver.hpp | 1 - src/server/QueuedEngineInterface.cpp | 6 -- src/server/QueuedEngineInterface.hpp | 2 - src/server/events.hpp | 1 - src/server/events/RequestMetadata.cpp | 139 ---------------------------------- src/server/events/RequestMetadata.hpp | 79 ------------------- src/server/wscript | 1 - 8 files changed, 247 deletions(-) delete mode 100644 src/server/events/RequestMetadata.cpp delete mode 100644 src/server/events/RequestMetadata.hpp (limited to 'src/server') diff --git a/src/server/OSCEngineReceiver.cpp b/src/server/OSCEngineReceiver.cpp index d7f2e46b..e95f1941 100644 --- a/src/server/OSCEngineReceiver.cpp +++ b/src/server/OSCEngineReceiver.cpp @@ -114,7 +114,6 @@ OSCEngineReceiver::OSCEngineReceiver(Engine& engine, uint16_t port) lo_server_add_method(_server, "/set_property", NULL, set_property_cb, this); // Queries - lo_server_add_method(_server, "/request_property", "iss", request_property_cb, this); lo_server_add_method(_server, "/get", "is", get_cb, this); lo_server_add_method(_server, NULL, NULL, unknown_cb, NULL); @@ -571,23 +570,6 @@ OSCEngineReceiver::_set_property_cb(const char* path, const char* types, lo_arg* return 0; } -/** @page engine_osc_namespace - *

/request_property

- * @arg @p response-id :: Integer - * @arg @p uri :: URI String - * @arg @p key :: URI String - * - * Request the value of a property on an object. - */ -int -OSCEngineReceiver::_request_property_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg) -{ - const char* object_path = &argv[1]->s; - const char* key = &argv[2]->s; - - request_property(object_path, key); - return 0; -} // Static Callbacks // diff --git a/src/server/OSCEngineReceiver.hpp b/src/server/OSCEngineReceiver.hpp index 3c84e1d5..c3d9829a 100644 --- a/src/server/OSCEngineReceiver.hpp +++ b/src/server/OSCEngineReceiver.hpp @@ -115,7 +115,6 @@ private: LO_HANDLER(learn); LO_HANDLER(set_property); LO_HANDLER(property_set); - LO_HANDLER(request_property); lo_server _server; }; diff --git a/src/server/QueuedEngineInterface.cpp b/src/server/QueuedEngineInterface.cpp index 958a5110..f941ef58 100644 --- a/src/server/QueuedEngineInterface.cpp +++ b/src/server/QueuedEngineInterface.cpp @@ -213,11 +213,5 @@ QueuedEngineInterface::get(const URI& uri) push_queued(new Events::Get(_engine, _request, now(), uri)); } -void -QueuedEngineInterface::request_property(const URI& uri, const URI& key) -{ - push_queued(new Events::RequestMetadata(_engine, _request, now(), Resource::DEFAULT, uri, key)); -} - } // namespace Server } // namespace Ingen diff --git a/src/server/QueuedEngineInterface.hpp b/src/server/QueuedEngineInterface.hpp index 65ad80f7..f8aa3c24 100644 --- a/src/server/QueuedEngineInterface.hpp +++ b/src/server/QueuedEngineInterface.hpp @@ -96,8 +96,6 @@ public: // Requests virtual void ping(); virtual void get(const Raul::URI& uri); - virtual void request_property(const Raul::URI& object_path, - const Raul::URI& key); protected: virtual void disable_responses(); diff --git a/src/server/events.hpp b/src/server/events.hpp index acb07b81..776b6c52 100644 --- a/src/server/events.hpp +++ b/src/server/events.hpp @@ -30,7 +30,6 @@ #include "events/Move.hpp" #include "events/Ping.hpp" #include "events/RegisterClient.hpp" -#include "events/RequestMetadata.hpp" #include "events/SetMetadata.hpp" #include "events/SetPortValue.hpp" #include "events/UnregisterClient.hpp" diff --git a/src/server/events/RequestMetadata.cpp b/src/server/events/RequestMetadata.cpp deleted file mode 100644 index 597a831b..00000000 --- a/src/server/events/RequestMetadata.cpp +++ /dev/null @@ -1,139 +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 -#include "ingen/ClientInterface.hpp" -#include "events/RequestMetadata.hpp" -#include "shared/LV2Atom.hpp" -#include "shared/LV2URIMap.hpp" -#include "AudioBuffer.hpp" -#include "ClientBroadcaster.hpp" -#include "Engine.hpp" -#include "EngineStore.hpp" -#include "GraphObjectImpl.hpp" -#include "ObjectBuffer.hpp" -#include "PluginImpl.hpp" -#include "PortImpl.hpp" -#include "ProcessContext.hpp" -#include "Request.hpp" - -using namespace std; -using namespace Raul; - -namespace Ingen { -namespace Server { -namespace Events { - -RequestMetadata::RequestMetadata(Engine& engine, - SharedPtr request, - SampleCount timestamp, - Resource::Graph ctx, - const URI& subject, - const URI& key) - : QueuedEvent(engine, request, timestamp) - , _special_type(NONE) - , _uri(subject) - , _key(key) - , _resource(0) - , _context(ctx) -{ -} - -void -RequestMetadata::pre_process() -{ - const bool is_object = Path::is_path(_uri); - if (_request->client()) { - if (is_object) - _resource = _engine.engine_store()->find_object(Path(_uri.str())); - else - _resource = _engine.node_factory()->plugin(_uri); - - if (!_resource) { - QueuedEvent::pre_process(); - return; - } - } - - GraphObjectImpl* obj = dynamic_cast(_resource); - if (obj) { - if (_key == _engine.world()->uris()->ingen_value) - _special_type = PORT_VALUE; - else - _value = obj->get_property(_key); - } else { - _value = _resource->get_property(_key); - } - - QueuedEvent::pre_process(); -} - -void -RequestMetadata::execute(ProcessContext& context) -{ - QueuedEvent::execute(context); - if (_special_type == PORT_VALUE) { - PortImpl* port = dynamic_cast(_resource); - if (port) { - boost::intrusive_ptr abuf = - boost::dynamic_pointer_cast(port->buffer(0)); - if (abuf) { - _value = abuf->value_at(0); - } else { - boost::intrusive_ptr obuf = - boost::dynamic_pointer_cast(port->buffer(0)); - if (obuf) { - Ingen::Shared::LV2Atom::to_atom(*_engine.world()->uris().get(), - obuf->atom(), - _value); - } - } - } else { - _resource = 0; - } - } -} - -void -RequestMetadata::post_process() -{ - if (_request->client()) { - if (_special_type == PORT_VALUE) { - if (_resource) { - _request->respond_ok(); - _request->client()->set_property(_uri.str(), - _engine.world()->uris()->ingen_value, _value); - } else { - const string msg = "Get value for non-port " + _uri.str(); - _request->respond_error(msg); - } - } else if (!_resource) { - const string msg = "Unable to find subject " + _uri.str(); - _request->respond_error(msg); - } else { - _request->respond_ok(); - _request->client()->set_property(_uri, _key, _value); - } - } else { - _request->respond_error("Unknown client"); - } -} - -} // namespace Server -} // namespace Ingen -} // namespace Events - diff --git a/src/server/events/RequestMetadata.hpp b/src/server/events/RequestMetadata.hpp deleted file mode 100644 index 3f8311ef..00000000 --- a/src/server/events/RequestMetadata.hpp +++ /dev/null @@ -1,79 +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_REQUESTMETADATA_HPP -#define INGEN_EVENTS_REQUESTMETADATA_HPP - -#include "raul/Atom.hpp" -#include "raul/URI.hpp" - -#include "QueuedEvent.hpp" - -namespace Ingen { - -namespace Shared { class ResourceImpl; } - -namespace Server { - -class GraphObjectImpl; - -namespace Events { - -/** \page methods - *

GET

- * As per HTTP (RFC2616 S9.3). - * - * Get the description of a graph object. - */ - -/** GET an object (see \ref methods). - * - * \ingroup engine - */ -class RequestMetadata : public QueuedEvent -{ -public: - RequestMetadata(Engine& engine, - SharedPtr request, - SampleCount timestamp, - Resource::Graph context, - const Raul::URI& subject, - const Raul::URI& key); - - void pre_process(); - void execute(ProcessContext& context); - void post_process(); - -private: - enum ErrorType { NO_ERROR, NOT_FOUND }; - enum { - NONE, - PORT_VALUE - } _special_type; - - Raul::URI _uri; - Raul::URI _key; - Raul::Atom _value; - Ingen::Shared::ResourceImpl* _resource; - Resource::Graph _context; -}; - -} // namespace Server -} // namespace Ingen -} // namespace Events - -#endif // INGEN_EVENTS_REQUESTMETADATA_HPP diff --git a/src/server/wscript b/src/server/wscript index 287debaf..3cef01b8 100644 --- a/src/server/wscript +++ b/src/server/wscript @@ -46,7 +46,6 @@ def build(bld): events/Get.cpp events/Move.cpp events/RegisterClient.cpp - events/RequestMetadata.cpp events/SetMetadata.cpp events/SetPortValue.cpp events/UnregisterClient.cpp -- cgit v1.2.1