summaryrefslogtreecommitdiffstats
path: root/src/server/events
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/events')
-rw-r--r--src/server/events/RequestMetadata.cpp139
-rw-r--r--src/server/events/RequestMetadata.hpp79
2 files changed, 0 insertions, 218 deletions
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 <http://drobilla.net>
- *
- * 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 <boost/intrusive_ptr.hpp>
-#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> 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<GraphObjectImpl*>(_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<PortImpl*>(_resource);
- if (port) {
- boost::intrusive_ptr<AudioBuffer> abuf =
- boost::dynamic_pointer_cast<AudioBuffer>(port->buffer(0));
- if (abuf) {
- _value = abuf->value_at(0);
- } else {
- boost::intrusive_ptr<ObjectBuffer> obuf =
- boost::dynamic_pointer_cast<ObjectBuffer>(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 <http://drobilla.net>
- *
- * 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
- * <h2>GET</h2>
- * 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> 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