diff options
-rw-r--r-- | src/client/ClientStore.cpp | 11 | ||||
-rw-r--r-- | src/client/ClientStore.hpp | 2 | ||||
-rw-r--r-- | src/client/HTTPEngineSender.cpp | 7 | ||||
-rw-r--r-- | src/client/HTTPEngineSender.hpp | 4 | ||||
-rw-r--r-- | src/client/OSCEngineSender.cpp | 10 | ||||
-rw-r--r-- | src/client/OSCEngineSender.hpp | 2 | ||||
-rw-r--r-- | src/client/SigClientInterface.hpp | 6 | ||||
-rw-r--r-- | src/client/ThreadedSigClientInterface.cpp | 10 | ||||
-rw-r--r-- | src/client/ThreadedSigClientInterface.hpp | 2 | ||||
-rw-r--r-- | src/common/interface/CommonInterface.hpp | 2 | ||||
-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 | ||||
-rw-r--r-- | src/serialisation/Parser.cpp | 15 | ||||
-rw-r--r-- | src/shared/ClashAvoider.cpp | 6 | ||||
-rw-r--r-- | src/shared/ClashAvoider.hpp | 2 |
22 files changed, 92 insertions, 67 deletions
diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp index 4c4e452c..cf1109cf 100644 --- a/src/client/ClientStore.cpp +++ b/src/client/ClientStore.cpp @@ -44,6 +44,7 @@ ClientStore::ClientStore(SharedPtr<EngineInterface> engine, SharedPtr<SigClientI emitter->signal_object_destroyed.connect(sigc::mem_fun(this, &ClientStore::destroy)); emitter->signal_object_renamed.connect(sigc::mem_fun(this, &ClientStore::rename)); + emitter->signal_new_object.connect(sigc::mem_fun(this, &ClientStore::new_object)); emitter->signal_new_plugin.connect(sigc::mem_fun(this, &ClientStore::new_plugin)); emitter->signal_new_patch.connect(sigc::mem_fun(this, &ClientStore::new_patch)); emitter->signal_new_node.connect(sigc::mem_fun(this, &ClientStore::new_node)); @@ -428,7 +429,7 @@ ClientStore::new_plugin(const string& uri, const string& type_uri, const string& } -void +bool ClientStore::new_object(const Shared::GraphObject* object) { using namespace Shared; @@ -436,20 +437,22 @@ ClientStore::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/client/ClientStore.hpp b/src/client/ClientStore.hpp index 2387f519..1d5c4589 100644 --- a/src/client/ClientStore.hpp +++ b/src/client/ClientStore.hpp @@ -70,7 +70,7 @@ public: // CommonInterface void new_plugin(const string& uri, const string& type_uri, const string& symbol, const string& name); - void new_object(const Shared::GraphObject* object); + bool new_object(const Shared::GraphObject* object); void new_patch(const string& path, uint32_t poly); void new_node(const string& path, const string& plugin_uri); void new_port(const string& path, const string& type, uint32_t index, bool is_output); diff --git a/src/client/HTTPEngineSender.cpp b/src/client/HTTPEngineSender.cpp index 7a6366e0..4dbcb4b2 100644 --- a/src/client/HTTPEngineSender.cpp +++ b/src/client/HTTPEngineSender.cpp @@ -113,6 +113,13 @@ HTTPEngineSender::new_port(const string& path, uint32_t index, bool is_output) { + const string uri = _engine_url + "/patch" + path; + cout << "HTTP " << uri << " NEW PORT: " << path << endl; + SoupMessage* msg = soup_message_new("PUT", uri.c_str()); + string str = string("NEW PORT").append(path).append(type); + soup_message_set_request(msg, "application/x-turtle", + SOUP_MEMORY_COPY, str.c_str(), str.length()); + soup_session_send_message(_session, msg); } diff --git a/src/client/HTTPEngineSender.hpp b/src/client/HTTPEngineSender.hpp index 67cf9152..89a20273 100644 --- a/src/client/HTTPEngineSender.hpp +++ b/src/client/HTTPEngineSender.hpp @@ -61,8 +61,8 @@ public: void bundle_begin() { transfer_begin(); } void bundle_end() { transfer_end(); } - void transfer_begin(); - void transfer_end(); + void transfer_begin() {} + void transfer_end() {} // Client registration void register_client(ClientInterface* client); diff --git a/src/client/OSCEngineSender.cpp b/src/client/OSCEngineSender.cpp index 7392f9d2..592702a3 100644 --- a/src/client/OSCEngineSender.cpp +++ b/src/client/OSCEngineSender.cpp @@ -131,7 +131,7 @@ OSCEngineSender::quit() // Object commands -void +bool OSCEngineSender::new_object(const Shared::GraphObject* object) { using namespace Shared; @@ -139,20 +139,22 @@ OSCEngineSender::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/client/OSCEngineSender.hpp b/src/client/OSCEngineSender.hpp index ba851d68..22de8e70 100644 --- a/src/client/OSCEngineSender.hpp +++ b/src/client/OSCEngineSender.hpp @@ -80,7 +80,7 @@ public: // Object commands - void new_object(const Shared::GraphObject* object); + bool new_object(const Shared::GraphObject* object); void new_patch(const string& path, uint32_t poly); diff --git a/src/client/SigClientInterface.hpp b/src/client/SigClientInterface.hpp index 046dbcbb..05f027a4 100644 --- a/src/client/SigClientInterface.hpp +++ b/src/client/SigClientInterface.hpp @@ -47,7 +47,7 @@ public: std::string uri() const { return "(internal)"; } // Signal parameters match up directly with ClientInterface calls - sigc::signal<void, const Shared::GraphObject*> signal_new_object; + sigc::signal<bool, const Shared::GraphObject*> signal_new_object; sigc::signal<void, int32_t> signal_response_ok; sigc::signal<void, int32_t, string> signal_response_error; @@ -104,8 +104,8 @@ protected: void new_plugin(const string& uri, const string& type_uri, const string& symbol, const string& name) { if (_enabled) signal_new_plugin.emit(uri, type_uri, symbol, name); } - void new_object(const Shared::GraphObject* object) - { if (_enabled) signal_new_object.emit(object); } + bool new_object(const Shared::GraphObject* object) + { if (_enabled) signal_new_object.emit(object); return false; } void new_patch(const string& path, uint32_t poly) { if (_enabled) signal_new_patch.emit(path, poly); } diff --git a/src/client/ThreadedSigClientInterface.cpp b/src/client/ThreadedSigClientInterface.cpp index b430a0a0..bc7707f3 100644 --- a/src/client/ThreadedSigClientInterface.cpp +++ b/src/client/ThreadedSigClientInterface.cpp @@ -77,27 +77,29 @@ ThreadedSigClientInterface::emit_signals() } -void +bool ThreadedSigClientInterface::new_object(const Shared::GraphObject* object) { using namespace Shared; 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/client/ThreadedSigClientInterface.hpp b/src/client/ThreadedSigClientInterface.hpp index 984f9cad..dc3e342e 100644 --- a/src/client/ThreadedSigClientInterface.hpp +++ b/src/client/ThreadedSigClientInterface.hpp @@ -97,7 +97,7 @@ public: void new_plugin(const string& uri, const string& type_uri, const string& symbol, const string& name) { push_sig(sigc::bind(new_plugin_slot, uri, type_uri, symbol, name)); } - void new_object(const Shared::GraphObject* object); + bool new_object(const Shared::GraphObject* object); void new_patch(const string& path, uint32_t poly) { push_sig(sigc::bind(new_patch_slot, path, poly)); } diff --git a/src/common/interface/CommonInterface.hpp b/src/common/interface/CommonInterface.hpp index d0d81945..a68cf175 100644 --- a/src/common/interface/CommonInterface.hpp +++ b/src/common/interface/CommonInterface.hpp @@ -45,7 +45,7 @@ public: /** End (and send) an atomic bundle */ virtual void bundle_end() = 0; - virtual void new_object(const GraphObject* object) = 0; + virtual bool new_object(const GraphObject* object) = 0; virtual void new_patch(const std::string& path, uint32_t poly) = 0; 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); diff --git a/src/serialisation/Parser.cpp b/src/serialisation/Parser.cpp index 2eb4eb75..0591e0f8 100644 --- a/src/serialisation/Parser.cpp +++ b/src/serialisation/Parser.cpp @@ -96,7 +96,7 @@ Parser::parse_string( cout << "Parsing " << object_uri.get() << " (base " << base_uri << ")" << endl; //else // cout << "Parsing all objects found in string (base " << base_uri << ")" << endl; - + bool ret = parse(world, target, model, base_uri, engine_base, object_uri, symbol, data); if (ret) { const Glib::ustring subject = Glib::ustring("<") + base_uri + Glib::ustring(">"); @@ -124,7 +124,6 @@ Parser::parse( if (object_uri && object_uri.get()[0] == '/') object_uri = object_uri.get().substr(1); - /* **** First query out global information (top-level info) **** */ // Delete anything explicitly declared to not exist @@ -208,6 +207,7 @@ Parser::parse( const Redland::Node& subject = (object_uri ? subject_uri : (*i)["subject"]); const Redland::Node& rdf_class = (*i)["class"]; //cout << "SUBJECT: " << subject.to_c_string() << endl; + //cout << "CLASS: " << rdf_class.to_c_string() << endl; if (!object_uri) { path_str = uri_relative_to_base(base_uri, subject.to_c_string()); //cout << "BASE: " << base_uri.c_str() << endl; @@ -217,7 +217,8 @@ Parser::parse( if (!Path::is_valid(path_str)) { //cerr << "INVALID PATH: " << path_str << endl; } else if (Path(path_str).parent() != "/") { - continue; + cout << "Non-root parent object " << path_str << endl; + //continue; } } @@ -233,8 +234,8 @@ Parser::parse( if (is_object) { Raul::Path path(path_str == "" ? "/" : path_str); - if (path.parent() != "/") - continue; + //if (path.parent() != "/") + // continue; if (rdf_class == patch_class) { ret = parse_patch(world, target, model, base_uri, engine_base, @@ -350,7 +351,7 @@ Parser::parse_patch( for (Redland::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { const string node_name = (*i)["name"].to_string(); const Path node_path = patch_path.base() + node_name; - + if (created.find(node_path) == created.end()) { const string node_plugin = (*i)["plugin"].to_string(); bool node_polyphonic = false; @@ -543,7 +544,7 @@ Parser::parse_port( " FILTER (?type != ?datatype && ((?type = lv2:InputPort) || (?type = lv2:OutputPort)))\n" "OPTIONAL { " + subject + " ingen:value ?value . }\n" "}"); - + Redland::Query::Results results = query.run(*world->rdf_world, model, base_uri); world->rdf_world->mutex().lock(); diff --git a/src/shared/ClashAvoider.cpp b/src/shared/ClashAvoider.cpp index aa7dd774..b5d99cbd 100644 --- a/src/shared/ClashAvoider.cpp +++ b/src/shared/ClashAvoider.cpp @@ -126,12 +126,10 @@ ClashAvoider::exists(const Raul::Path& path) const } -void +bool ClashAvoider::new_object(const GraphObject* object) { - // FIXME: - ((GraphObject*)object)->set_path(map_path(object->path())); - _target.new_object(object); + return false; } diff --git a/src/shared/ClashAvoider.hpp b/src/shared/ClashAvoider.hpp index ead6d96c..efdebf98 100644 --- a/src/shared/ClashAvoider.hpp +++ b/src/shared/ClashAvoider.hpp @@ -49,7 +49,7 @@ public: // Object commands - void new_object(const GraphObject* object); + bool new_object(const GraphObject* object); void new_patch(const std::string& path, uint32_t poly); |