diff options
author | David Robillard <d@drobilla.net> | 2008-11-16 16:50:59 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-11-16 16:50:59 +0000 |
commit | 422694ebc886882fc8c2f0555a725d052dfc935c (patch) | |
tree | 39474e6c6dea95328eeed3963d5dcf0f958397d1 /src/engine | |
parent | f1b0b3495340399bebb93b20ed9a264a3db4e5da (diff) | |
download | ingen-422694ebc886882fc8c2f0555a725d052dfc935c.tar.gz ingen-422694ebc886882fc8c2f0555a725d052dfc935c.tar.bz2 ingen-422694ebc886882fc8c2f0555a725d052dfc935c.zip |
More HTTP.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@1726 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/engine')
-rw-r--r-- | src/engine/HTTPClientSender.cpp | 9 | ||||
-rw-r--r-- | src/engine/HTTPClientSender.hpp | 2 | ||||
-rw-r--r-- | src/engine/HTTPEngineReceiver.cpp | 4 | ||||
-rw-r--r-- | src/engine/OSCClientSender.cpp | 10 | ||||
-rw-r--r-- | src/engine/OSCClientSender.hpp | 2 | ||||
-rw-r--r-- | src/engine/ObjectSender.cpp | 41 | ||||
-rw-r--r-- | src/engine/ObjectSender.hpp | 6 | ||||
-rw-r--r-- | src/engine/QueuedEngineInterface.cpp | 4 | ||||
-rw-r--r-- | src/engine/QueuedEngineInterface.hpp | 2 |
9 files changed, 46 insertions, 34 deletions
diff --git a/src/engine/HTTPClientSender.cpp b/src/engine/HTTPClientSender.cpp index 0cbd1100..e7c94eda 100644 --- a/src/engine/HTTPClientSender.cpp +++ b/src/engine/HTTPClientSender.cpp @@ -138,8 +138,7 @@ HTTPClientSender::set_port_value(const std::string& port_path, const Raul::Atom& { Redland::Node node = AtomRDF::atom_to_node(*_engine.world()->rdf_world, value); string msg = string( - "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n" - "@prefix ingen: <http://drobilla.net/ns/ingen#> .\n\n<").append( + "@prefix ingen: <http://drobilla.net/ns/ingen#> .\n\n<").append( port_path).append("> ingen:value ").append(node.to_string()).append(" .\n"); send_chunk(msg); } @@ -159,15 +158,14 @@ void HTTPClientSender::activity(const std::string& path) { string msg = string( - "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n" - "@prefix ingen: <http://drobilla.net/ns/ingen#> .\n\n<").append( + "@prefix ingen: <http://drobilla.net/ns/ingen#> .\n\n<").append( path).append("> ingen:activity true .\n"); send_chunk(msg); } static void null_deleter(const Shared::GraphObject*) {} -void +bool HTTPClientSender::new_object(const Shared::GraphObject* object) { SharedPtr<Serialisation::Serialiser> serialiser = _engine.world()->serialiser; @@ -177,6 +175,7 @@ HTTPClientSender::new_object(const Shared::GraphObject* object) serialiser->serialise(obj); string str = serialiser->finish(); send_chunk(str); + return true; } diff --git a/src/engine/HTTPClientSender.hpp b/src/engine/HTTPClientSender.hpp index 5dc658d7..e168d8cd 100644 --- a/src/engine/HTTPClientSender.hpp +++ b/src/engine/HTTPClientSender.hpp @@ -73,7 +73,7 @@ public: void error(const std::string& msg); - virtual void new_object(const Shared::GraphObject* object); + virtual bool new_object(const Shared::GraphObject* object); virtual void new_plugin(const std::string& uri, const std::string& type_uri, diff --git a/src/engine/HTTPEngineReceiver.cpp b/src/engine/HTTPEngineReceiver.cpp index bda30264..d31e2ab4 100644 --- a/src/engine/HTTPEngineReceiver.cpp +++ b/src/engine/HTTPEngineReceiver.cpp @@ -124,6 +124,10 @@ HTTPEngineReceiver::message_callback(SoupServer* server, SoupMessage* msg, const const string base_uri = ""; const char* mime_type = "text/plain"; + if (!strcmp(msg->method, SOUP_METHOD_PUT)) { + cout << "PUT " << path << ":\n" << msg->request_body->data << endl; + } + if (path == "/" || path == "") { const string r = string("@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\n") .append("\n<> rdfs:seeAlso <plugins> ;") diff --git a/src/engine/OSCClientSender.cpp b/src/engine/OSCClientSender.cpp index fb87ba23..b5900f11 100644 --- a/src/engine/OSCClientSender.cpp +++ b/src/engine/OSCClientSender.cpp @@ -313,7 +313,7 @@ OSCClientSender::new_plugin(const std::string& uri, } -void +bool OSCClientSender::new_object(const Shared::GraphObject* object) { using namespace Shared; @@ -321,20 +321,22 @@ OSCClientSender::new_object(const Shared::GraphObject* object) const Patch* patch = dynamic_cast<const Patch*>(object); if (patch) { new_patch(patch->path(), patch->internal_polyphony()); - return; + return true; } const Node* node = dynamic_cast<const Node*>(object); if (node) { new_node(node->path(), node->plugin()->uri()); - return; + return true; } const Port* port = dynamic_cast<const Port*>(object); if (port) { new_port(port->path(), port->type().uri(), port->index(), !port->is_input()); - return; + return true; } + + return false; } diff --git a/src/engine/OSCClientSender.hpp b/src/engine/OSCClientSender.hpp index 04f240fe..eda067a8 100644 --- a/src/engine/OSCClientSender.hpp +++ b/src/engine/OSCClientSender.hpp @@ -77,7 +77,7 @@ public: const std::string& symbol, const std::string& name); - virtual void new_object(const Shared::GraphObject* object); + virtual bool new_object(const Shared::GraphObject* object); virtual void new_patch(const std::string& path, uint32_t poly); diff --git a/src/engine/ObjectSender.cpp b/src/engine/ObjectSender.cpp index 8f38b738..161769d8 100644 --- a/src/engine/ObjectSender.cpp +++ b/src/engine/ObjectSender.cpp @@ -33,7 +33,10 @@ namespace Ingen { void ObjectSender::send_object(ClientInterface* client, const GraphObjectImpl* object, bool recursive) { - client->new_object(object); + cout << "SEND OBJECT " << object->path() << " RECURSIVE: " << recursive << endl; + + if (client->new_object(object)) + return; const PatchImpl* patch = dynamic_cast<const PatchImpl*>(object); if (patch) { @@ -56,9 +59,10 @@ ObjectSender::send_object(ClientInterface* client, const GraphObjectImpl* object void -ObjectSender::send_patch(ClientInterface* client, const PatchImpl* patch, bool recursive) +ObjectSender::send_patch(ClientInterface* client, const PatchImpl* patch, bool recursive, bool bundle) { - client->bundle_begin(); + if (bundle) + client->transfer_begin(); client->new_patch(patch->path(), patch->internal_polyphony()); client->set_property(patch->path(), "ingen:polyphonic", patch->polyphonic()); @@ -70,36 +74,35 @@ ObjectSender::send_patch(ClientInterface* client, const PatchImpl* patch, bool r client->set_property(patch->path(), "ingen:enabled", (bool)patch->enabled()); - client->bundle_end(); - if (recursive) { // Send nodes for (List<NodeImpl*>::const_iterator j = patch->nodes().begin(); j != patch->nodes().end(); ++j) { const NodeImpl* const node = (*j); - send_node(client, node, true); + send_node(client, node, true, false); } // Send ports for (uint32_t i=0; i < patch->num_ports(); ++i) { PortImpl* const port = patch->port_impl(i); - send_port(client, port); + send_port(client, port, false); } // Send connections - client->transfer_begin(); for (PatchImpl::Connections::const_iterator j = patch->connections().begin(); j != patch->connections().end(); ++j) client->connect((*j)->src_port_path(), (*j)->dst_port_path()); - client->transfer_end(); } + + if (bundle) + client->transfer_end(); } /** Sends a node or a patch */ void -ObjectSender::send_node(ClientInterface* client, const NodeImpl* node, bool recursive) +ObjectSender::send_node(ClientInterface* client, const NodeImpl* node, bool recursive, bool bundle) { PluginImpl* const plugin = node->plugin_impl(); @@ -115,7 +118,8 @@ ObjectSender::send_node(ClientInterface* client, const NodeImpl* node, bool recu return; } - client->bundle_begin(); + if (bundle) + client->transfer_begin(); client->new_node(node->path(), node->plugin()->uri()); client->set_property(node->path(), "ingen:polyphonic", node->polyphonic()); @@ -130,22 +134,24 @@ ObjectSender::send_node(ClientInterface* client, const NodeImpl* node, bool recu for (GraphObjectImpl::Properties::const_iterator j = prop.begin(); j != prop.end(); ++j) client->set_property(node->path(), (*j).first, (*j).second); - client->bundle_end(); - if (recursive) { // Send ports for (size_t j=0; j < node->num_ports(); ++j) - send_port(client, node->port_impl(j)); + send_port(client, node->port_impl(j), false); } + + if (bundle) + client->transfer_end(); } void -ObjectSender::send_port(ClientInterface* client, const PortImpl* port) +ObjectSender::send_port(ClientInterface* client, const PortImpl* port, bool bundle) { assert(port); - client->bundle_begin(); + if (bundle) + client->bundle_begin(); client->new_port(port->path(), port->type().uri(), port->index(), port->is_output()); client->set_property(port->path(), "ingen:polyphonic", port->polyphonic()); @@ -167,7 +173,8 @@ ObjectSender::send_port(ClientInterface* client, const PortImpl* port) client->set_port_value(port->path(), value); } - client->bundle_end(); + if (bundle) + client->bundle_end(); } diff --git a/src/engine/ObjectSender.hpp b/src/engine/ObjectSender.hpp index e546fe2f..f4a5959d 100644 --- a/src/engine/ObjectSender.hpp +++ b/src/engine/ObjectSender.hpp @@ -45,9 +45,9 @@ class PluginImpl; class ObjectSender { public: static void send_object(ClientInterface* client, const GraphObjectImpl* object, bool recursive); - static void send_patch(ClientInterface* client, const PatchImpl* patch, bool recursive); - static void send_node(ClientInterface* client, const NodeImpl* node, bool recursive); - static void send_port(ClientInterface* client, const PortImpl* port); + static void send_patch(ClientInterface* client, const PatchImpl* patch, bool recursive, bool bundle=true); + static void send_node(ClientInterface* client, const NodeImpl* node, bool recursive, bool bundle=true); + static void send_port(ClientInterface* client, const PortImpl* port, bool bundle=true); }; } // namespace Ingen diff --git a/src/engine/QueuedEngineInterface.cpp b/src/engine/QueuedEngineInterface.cpp index 62828102..a399e955 100644 --- a/src/engine/QueuedEngineInterface.cpp +++ b/src/engine/QueuedEngineInterface.cpp @@ -138,10 +138,10 @@ QueuedEngineInterface::bundle_end() // Object commands -void +bool QueuedEngineInterface::new_object(const GraphObject* object) { - cout << "NEW OBJECT" << endl; + return false; } diff --git a/src/engine/QueuedEngineInterface.hpp b/src/engine/QueuedEngineInterface.hpp index e7268e9e..6af848e7 100644 --- a/src/engine/QueuedEngineInterface.hpp +++ b/src/engine/QueuedEngineInterface.hpp @@ -73,7 +73,7 @@ public: // Object commands - virtual void new_object(const Shared::GraphObject* object); + virtual bool new_object(const Shared::GraphObject* object); virtual void new_patch(const string& path, uint32_t poly); |