diff options
Diffstat (limited to 'src/engine')
-rw-r--r-- | src/engine/ClientBroadcaster.hpp | 3 | ||||
-rw-r--r-- | src/engine/DuplexPort.hpp | 4 | ||||
-rw-r--r-- | src/engine/Engine.cpp | 20 | ||||
-rw-r--r-- | src/engine/GraphObjectImpl.cpp | 8 | ||||
-rw-r--r-- | src/engine/GraphObjectImpl.hpp | 8 | ||||
-rw-r--r-- | src/engine/HTTPClientSender.cpp | 3 | ||||
-rw-r--r-- | src/engine/HTTPClientSender.hpp | 3 | ||||
-rw-r--r-- | src/engine/LV2Node.cpp | 2 | ||||
-rw-r--r-- | src/engine/NodeImpl.cpp | 12 | ||||
-rw-r--r-- | src/engine/OSCClientSender.cpp | 3 | ||||
-rw-r--r-- | src/engine/OSCClientSender.hpp | 3 | ||||
-rw-r--r-- | src/engine/ObjectSender.cpp | 14 | ||||
-rw-r--r-- | src/engine/PortImpl.hpp | 2 | ||||
-rw-r--r-- | src/engine/QueuedEngineInterface.cpp | 28 | ||||
-rw-r--r-- | src/engine/QueuedEngineInterface.hpp | 3 | ||||
-rw-r--r-- | src/engine/events/CreatePatch.cpp | 7 | ||||
-rw-r--r-- | src/engine/events/CreatePort.cpp | 3 | ||||
-rw-r--r-- | src/engine/events/RequestMetadata.cpp | 6 | ||||
-rw-r--r-- | src/engine/events/RequestMetadata.hpp | 22 | ||||
-rw-r--r-- | src/engine/events/SetMetadata.cpp | 14 | ||||
-rw-r--r-- | src/engine/events/SetMetadata.hpp | 4 |
21 files changed, 83 insertions, 89 deletions
diff --git a/src/engine/ClientBroadcaster.hpp b/src/engine/ClientBroadcaster.hpp index 4102f50e..11668218 100644 --- a/src/engine/ClientBroadcaster.hpp +++ b/src/engine/ClientBroadcaster.hpp @@ -69,7 +69,8 @@ public: void bundle_end() { BROADCAST(bundle_end); } void put(const Raul::URI& uri, - const Shared::Resource::Properties& properties) { + const Shared::Resource::Properties& properties, + Shared::Resource::Graph ctx=Shared::Resource::DEFAULT) { BROADCAST(put, uri, properties); } diff --git a/src/engine/DuplexPort.hpp b/src/engine/DuplexPort.hpp index 9d1db378..3c7ad421 100644 --- a/src/engine/DuplexPort.hpp +++ b/src/engine/DuplexPort.hpp @@ -54,8 +54,8 @@ public: bool get_buffers(BufferFactory& bufs, Raul::Array<BufferFactory::Ref>* buffers, uint32_t poly); - void pre_process(Context& context); - void post_process(Context& context); + void pre_process(Ingen::Context& context); + void post_process(Ingen::Context& context); bool is_input() const { return !_is_output; } bool is_output() const { return _is_output; } diff --git a/src/engine/Engine.cpp b/src/engine/Engine.cpp index 8e0d7e0e..12c479f5 100644 --- a/src/engine/Engine.cpp +++ b/src/engine/Engine.cpp @@ -179,9 +179,11 @@ Engine::activate() PatchImpl* root_patch = _driver->root_patch(); if (!root_patch) { root_patch = new PatchImpl(*this, "root", 1, NULL, _driver->sample_rate(), 1); - root_patch->meta().set_property(uris.rdf_type, uris.ingen_Patch); - root_patch->meta().set_property(uris.ingen_polyphony, Raul::Atom(int32_t(1))); - root_patch->set_property(uris.rdf_type, uris.ingen_Node); + root_patch->set_property(uris.rdf_type, + Resource::Property(uris.ingen_Patch, Resource::INTERNAL)); + root_patch->set_property(uris.ingen_polyphony, + Resource::Property(Raul::Atom(int32_t(1)), + Resource::INTERNAL)); root_patch->activate(*_buffer_factory); _world->store()->add(root_patch); root_patch->compiled_patch(root_patch->compile()); @@ -197,8 +199,10 @@ Engine::activate() Shared::Resource::Properties in_properties(control_properties); in_properties.insert(make_pair(uris.rdf_type, uris.lv2_InputPort)); in_properties.insert(make_pair(uris.lv2_index, 0)); - in_properties.insert(make_pair(uris.ingenui_canvas_x, 32.0f)); - in_properties.insert(make_pair(uris.ingenui_canvas_y, 32.0f)); + in_properties.insert(make_pair(uris.ingenui_canvas_x, + Resource::Property(32.0f, Resource::EXTERNAL))); + in_properties.insert(make_pair(uris.ingenui_canvas_y, + Resource::Property(32.0f, Resource::EXTERNAL))); execute_and_delete_event(context, new Events::CreatePort( *this, SharedPtr<Request>(), 0, @@ -208,8 +212,10 @@ Engine::activate() Shared::Resource::Properties out_properties(control_properties); out_properties.insert(make_pair(uris.rdf_type, uris.lv2_OutputPort)); out_properties.insert(make_pair(uris.lv2_index, 1)); - out_properties.insert(make_pair(uris.ingenui_canvas_x, 128.0f)); - out_properties.insert(make_pair(uris.ingenui_canvas_y, 32.0f)); + out_properties.insert(make_pair(uris.ingenui_canvas_x, + Resource::Property(128.0f, Resource::EXTERNAL))); + out_properties.insert(make_pair(uris.ingenui_canvas_y, + Resource::Property(32.0f, Resource::EXTERNAL))); execute_and_delete_event(context, new Events::CreatePort( *this, SharedPtr<Request>(), 0, diff --git a/src/engine/GraphObjectImpl.cpp b/src/engine/GraphObjectImpl.cpp index 87a9a844..c257b319 100644 --- a/src/engine/GraphObjectImpl.cpp +++ b/src/engine/GraphObjectImpl.cpp @@ -35,7 +35,6 @@ GraphObjectImpl::GraphObjectImpl(Shared::LV2URIMap& uris, , _parent(parent) , _path(parent ? parent->path().child(symbol) : "/") , _symbol(symbol) - , _meta(uris, ResourceImpl::meta_uri(uri())) { } @@ -43,22 +42,23 @@ GraphObjectImpl::GraphObjectImpl(Shared::LV2URIMap& uris, void GraphObjectImpl::add_meta_property(const Raul::URI& key, const Atom& value) { - _meta.add_property(key, value); + add_property(key, Resource::Property(value, Resource::INTERNAL)); } void GraphObjectImpl::set_meta_property(const Raul::URI& key, const Atom& value) { - _meta.set_property(key, value); + set_property(key, Resource::Property(value, Resource::INTERNAL)); } const Atom& GraphObjectImpl::get_property(const Raul::URI& key) const { + static const Atom null_atom; Resource::Properties::const_iterator i = properties().find(key); - return (i != properties().end()) ? i->second : _meta.get_property(key); + return (i != properties().end()) ? i->second : null_atom; } diff --git a/src/engine/GraphObjectImpl.hpp b/src/engine/GraphObjectImpl.hpp index 3f8defe7..59f28b3e 100644 --- a/src/engine/GraphObjectImpl.hpp +++ b/src/engine/GraphObjectImpl.hpp @@ -54,14 +54,11 @@ class GraphObjectImpl : virtual public Ingen::Shared::GraphObject public: virtual ~GraphObjectImpl() {} - const Raul::URI& meta_uri() const { return _meta.uri(); } - const Raul::URI& uri() const { return _path; } - const Raul::Symbol& symbol() const { return _symbol; } + const Raul::URI& uri() const { return _path; } + const Raul::Symbol& symbol() const { return _symbol; } GraphObject* graph_parent() const { return _parent; } GraphObjectImpl* parent() const { return _parent; } - Resource& meta() { return _meta; } - const Resource& meta() const { return _meta; } //virtual void process(ProcessContext& context) = 0; @@ -106,7 +103,6 @@ protected: GraphObjectImpl* _parent; Raul::Path _path; Raul::Symbol _symbol; - ResourceImpl _meta; }; diff --git a/src/engine/HTTPClientSender.cpp b/src/engine/HTTPClientSender.cpp index 6f1f293a..e5633c4c 100644 --- a/src/engine/HTTPClientSender.cpp +++ b/src/engine/HTTPClientSender.cpp @@ -54,7 +54,8 @@ HTTPClientSender::error(const std::string& msg) void HTTPClientSender::put(const URI& uri, - const Resource::Properties& properties) + const Resource::Properties& properties, + Shared::Resource::Graph ctx) { const string path = (uri.substr(0, 6) == "path:/") ? uri.substr(6) : uri.str(); const string full_uri = _url + "/" + path; diff --git a/src/engine/HTTPClientSender.hpp b/src/engine/HTTPClientSender.hpp index 37b9b112..630bdd5a 100644 --- a/src/engine/HTTPClientSender.hpp +++ b/src/engine/HTTPClientSender.hpp @@ -68,7 +68,8 @@ public: void error(const std::string& msg); virtual void put(const Raul::URI& path, - const Shared::Resource::Properties& properties); + const Shared::Resource::Properties& properties, + Shared::Resource::Graph ctx); virtual void delta(const Raul::URI& path, const Shared::Resource::Properties& remove, diff --git a/src/engine/LV2Node.cpp b/src/engine/LV2Node.cpp index ee6bf4ed..35da06ba 100644 --- a/src/engine/LV2Node.cpp +++ b/src/engine/LV2Node.cpp @@ -294,11 +294,9 @@ LV2Node::instantiate(BufferFactory& bufs) if (direction == INPUT && data_type == PortType::CONTROL) { port->set_value(val); if (!isnan(min_values[j])) { - port->meta().set_property(uris.lv2_minimum, min_values[j]); port->set_property(uris.lv2_minimum, min_values[j]); } if (!isnan(max_values[j])) { - port->meta().set_property(uris.lv2_maximum, max_values[j]); port->set_property(uris.lv2_maximum, max_values[j]); } } diff --git a/src/engine/NodeImpl.cpp b/src/engine/NodeImpl.cpp index e2bb1139..7c1e185a 100644 --- a/src/engine/NodeImpl.cpp +++ b/src/engine/NodeImpl.cpp @@ -91,7 +91,7 @@ NodeImpl::activate(BufferFactory& bufs) assert(!_activated); _activated = true; - for (unsigned long p = 0; p < num_ports(); ++p) { + for (uint32_t p = 0; p < num_ports(); ++p) { PortImpl* const port = _ports->at(p); port->setup_buffers(bufs, port->poly()); port->connect_buffers(); @@ -130,8 +130,9 @@ NodeImpl::prepare_poly(BufferFactory& bufs, uint32_t poly) if (!_polyphonic) poly = 1; - for (size_t i = 0; i < _ports->size(); ++i) - _ports->at(i)->prepare_poly(bufs, poly); + if (_ports) + for (size_t i = 0; i < _ports->size(); ++i) + _ports->at(i)->prepare_poly(bufs, poly); return true; } @@ -147,8 +148,9 @@ NodeImpl::apply_poly(Raul::Maid& maid, uint32_t poly) _polyphony = poly; - for (size_t i = 0; i < num_ports(); ++i) - _ports->at(i)->apply_poly(maid, poly); + if (_ports) + for (size_t i = 0; i < num_ports(); ++i) + _ports->at(i)->apply_poly(maid, poly); return true; } diff --git a/src/engine/OSCClientSender.cpp b/src/engine/OSCClientSender.cpp index 22f9d41f..75f330b3 100644 --- a/src/engine/OSCClientSender.cpp +++ b/src/engine/OSCClientSender.cpp @@ -110,7 +110,8 @@ OSCClientSender::error(const std::string& msg) */ void OSCClientSender::put(const Raul::URI& path, - const Shared::Resource::Properties& properties) + const Shared::Resource::Properties& properties, + Shared::Resource::Graph ctx) { typedef Shared::Resource::Properties::const_iterator iterator; lo_message m = lo_message_new(); diff --git a/src/engine/OSCClientSender.hpp b/src/engine/OSCClientSender.hpp index 09d2e452..7df10d15 100644 --- a/src/engine/OSCClientSender.hpp +++ b/src/engine/OSCClientSender.hpp @@ -67,7 +67,8 @@ public: void error(const std::string& msg); virtual void put(const Raul::URI& path, - const Shared::Resource::Properties& properties); + const Shared::Resource::Properties& properties, + Shared::Resource::Graph ctx=Shared::Resource::DEFAULT); virtual void delta(const Raul::URI& path, const Shared::Resource::Properties& remove, diff --git a/src/engine/ObjectSender.cpp b/src/engine/ObjectSender.cpp index 8253eb9c..b962da2e 100644 --- a/src/engine/ObjectSender.cpp +++ b/src/engine/ObjectSender.cpp @@ -63,8 +63,13 @@ ObjectSender::send_patch(ClientInterface* client, const PatchImpl* patch, bool r if (bundle) client->transfer_begin(); - client->put(patch->meta_uri(), patch->meta().properties()); - client->put(patch->path(), patch->properties()); + client->put(patch->path(), + patch->properties(Resource::INTERNAL), + Resource::INTERNAL); + + client->put(patch->path(), + patch->properties(Resource::EXTERNAL), + Resource::EXTERNAL); if (recursive) { // Send nodes @@ -131,11 +136,6 @@ ObjectSender::send_port(ClientInterface* client, const PortImpl* port, bool bund if (bundle) client->bundle_begin(); - PatchImpl* graph_parent = dynamic_cast<PatchImpl*>(port->parent_node()); - - if (graph_parent) - client->put(port->meta_uri(), port->meta().properties()); - client->put(port->path(), port->properties()); // Send control value diff --git a/src/engine/PortImpl.hpp b/src/engine/PortImpl.hpp index 2ae853bd..c9b74ca4 100644 --- a/src/engine/PortImpl.hpp +++ b/src/engine/PortImpl.hpp @@ -133,7 +133,7 @@ public: void raise_set_by_user_flag() { _set_by_user = true; } - Context::ID context() const { return _context; } + Context::ID context() const { return _context; } void set_context(Context::ID c); BufferFactory& bufs() const { return _bufs; } diff --git a/src/engine/QueuedEngineInterface.cpp b/src/engine/QueuedEngineInterface.cpp index 3984ca39..c1051c0a 100644 --- a/src/engine/QueuedEngineInterface.cpp +++ b/src/engine/QueuedEngineInterface.cpp @@ -157,13 +157,11 @@ QueuedEngineInterface::bundle_end() void -QueuedEngineInterface::put(const URI& uri, - const Resource::Properties& properties) +QueuedEngineInterface::put(const URI& uri, + const Resource::Properties& properties, + const Shared::Resource::Graph ctx) { - bool meta = ResourceImpl::is_meta_uri(uri); - URI subject(meta ? (string("path:/") + uri.substr(6)) : uri.str()); - - push_queued(new Events::SetMetadata(_engine, _request, now(), true, meta, subject, properties)); + push_queued(new Events::SetMetadata(_engine, _request, now(), true, ctx, uri, properties)); } @@ -172,10 +170,7 @@ QueuedEngineInterface::delta(const URI& uri, const Shared::Resource::Properties& remove, const Shared::Resource::Properties& add) { - bool meta = ResourceImpl::is_meta_uri(uri); - URI subject(meta ? (string("path:/") + uri.substr(6)) : uri.str()); - - push_queued(new Events::SetMetadata(_engine, _request, now(), false, meta, subject, add, remove)); + push_queued(new Events::SetMetadata(_engine, _request, now(), false, Resource::DEFAULT, uri, add, remove)); } @@ -224,14 +219,11 @@ QueuedEngineInterface::set_property(const URI& uri, const URI& predicate, const Atom& value) { - size_t hash = uri.find("#"); - bool meta = (hash != string::npos); - Path path = meta ? (string("/") + path.chop_start("/")) : uri.str(); Resource::Properties remove; remove.insert(make_pair(predicate, _engine.world()->uris()->wildcard)); Resource::Properties add; add.insert(make_pair(predicate, value)); - push_queued(new Events::SetMetadata(_engine, _request, now(), false, meta, path, add, remove)); + push_queued(new Events::SetMetadata(_engine, _request, now(), false, Resource::DEFAULT, uri, add, remove)); } // Requests // @@ -257,13 +249,7 @@ QueuedEngineInterface::get(const URI& uri) void QueuedEngineInterface::request_property(const URI& uri, const URI& key) { - size_t hash = uri.find("#"); - bool meta = (hash != string::npos); - const string path_str = string("/") + uri.chop_start("/"); - if (meta && Path::is_valid(path_str)) - push_queued(new Events::RequestMetadata(_engine, _request, now(), meta, path_str, key)); - else - push_queued(new Events::RequestMetadata(_engine, _request, now(), meta, uri, key)); + push_queued(new Events::RequestMetadata(_engine, _request, now(), Resource::DEFAULT, uri, key)); } diff --git a/src/engine/QueuedEngineInterface.hpp b/src/engine/QueuedEngineInterface.hpp index b6d06134..2c1e94b9 100644 --- a/src/engine/QueuedEngineInterface.hpp +++ b/src/engine/QueuedEngineInterface.hpp @@ -72,7 +72,8 @@ public: // CommonInterface object commands virtual void put(const Raul::URI& path, - const Shared::Resource::Properties& properties); + const Shared::Resource::Properties& properties, + const Shared::Resource::Graph g=Shared::Resource::DEFAULT); virtual void delta(const Raul::URI& path, const Shared::Resource::Properties& remove, diff --git a/src/engine/events/CreatePatch.cpp b/src/engine/events/CreatePatch.cpp index 38f97fe4..f5e07797 100644 --- a/src/engine/events/CreatePatch.cpp +++ b/src/engine/events/CreatePatch.cpp @@ -87,9 +87,10 @@ CreatePatch::pre_process() _patch = new PatchImpl(_engine, path.symbol(), poly, _parent, _engine.driver()->sample_rate(), _poly); - _patch->meta().properties().insert(_properties.begin(), _properties.end()); - _patch->meta().set_property(uris.rdf_type, uris.ingen_Patch); - _patch->set_property(uris.rdf_type, uris.ingen_Node); + _patch->properties().insert(_properties.begin(), _properties.end()); + _patch->add_property(uris.rdf_type, uris.ingen_Patch); + _patch->add_property(uris.rdf_type, + Resource::Property(uris.ingen_Node, Resource::EXTERNAL)); if (_parent != NULL) { _parent->add_node(new PatchImpl::Nodes::Node(_patch)); diff --git a/src/engine/events/CreatePort.cpp b/src/engine/events/CreatePort.cpp index 332cb1ce..cb05a020 100644 --- a/src/engine/events/CreatePort.cpp +++ b/src/engine/events/CreatePort.cpp @@ -110,11 +110,8 @@ CreatePort::pre_process() && poly_i->second.get_bool()); _patch_port = _patch->create_port(*_engine.buffer_factory(), _path.symbol(), _data_type, buffer_size, _is_output, polyphonic); - if (_patch->parent()) - _patch_port->set_property(uris.rdf_instanceOf, _patch_port->meta_uri()); _patch_port->properties().insert(_properties.begin(), _properties.end()); - _patch_port->meta().properties().insert(_properties.begin(), _properties.end()); assert(index_i->second == Atom((int)_patch_port->index())); diff --git a/src/engine/events/RequestMetadata.cpp b/src/engine/events/RequestMetadata.cpp index fd8d98fe..e16bf57a 100644 --- a/src/engine/events/RequestMetadata.cpp +++ b/src/engine/events/RequestMetadata.cpp @@ -43,7 +43,7 @@ using namespace Shared; RequestMetadata::RequestMetadata(Engine& engine, SharedPtr<Request> request, SampleCount timestamp, - bool is_meta, + Resource::Graph ctx, const URI& subject, const URI& key) : QueuedEvent(engine, request, timestamp) @@ -51,7 +51,7 @@ RequestMetadata::RequestMetadata(Engine& engine, , _uri(subject) , _key(key) , _resource(0) - , _is_meta(is_meta) + , _context(ctx) { } @@ -76,8 +76,6 @@ RequestMetadata::pre_process() if (obj) { if (_key == _engine.world()->uris()->ingen_value) _special_type = PORT_VALUE; - else if (_is_meta) - _value = obj->meta().get_property(_key); else _value = obj->get_property(_key); } else { diff --git a/src/engine/events/RequestMetadata.hpp b/src/engine/events/RequestMetadata.hpp index 99c77651..96afe6b2 100644 --- a/src/engine/events/RequestMetadata.hpp +++ b/src/engine/events/RequestMetadata.hpp @@ -44,12 +44,12 @@ namespace Events { class RequestMetadata : public QueuedEvent { public: - RequestMetadata(Engine& engine, - SharedPtr<Request> request, - SampleCount timestamp, - bool meta, - const Raul::URI& subject, - const Raul::URI& key); + RequestMetadata(Engine& engine, + SharedPtr<Request> request, + SampleCount timestamp, + Shared::Resource::Graph context, + const Raul::URI& subject, + const Raul::URI& key); void pre_process(); void execute(ProcessContext& context); @@ -62,11 +62,11 @@ private: PORT_VALUE } _special_type; - Raul::URI _uri; - Raul::URI _key; - Raul::Atom _value; - Shared::ResourceImpl* _resource; - bool _is_meta; + Raul::URI _uri; + Raul::URI _key; + Raul::Atom _value; + Shared::ResourceImpl* _resource; + Shared::Resource::Graph _context; }; diff --git a/src/engine/events/SetMetadata.cpp b/src/engine/events/SetMetadata.cpp index d1a1c53e..a6b446d4 100644 --- a/src/engine/events/SetMetadata.cpp +++ b/src/engine/events/SetMetadata.cpp @@ -54,7 +54,7 @@ SetMetadata::SetMetadata( SharedPtr<Request> request, SampleCount timestamp, bool create, - bool meta, + Resource::Graph context, const URI& subject, const Properties& properties, const Properties& remove) @@ -67,10 +67,14 @@ SetMetadata::SetMetadata( , _patch(NULL) , _compiled_patch(NULL) , _create(create) - , _is_meta(meta) + , _context(context) { + if (context != Resource::DEFAULT) { + Resource::set_context(_properties, context); + } + /* - LOG(info) << "Set " << subject << " {" << endl; + LOG(info) << "Set " << subject << " : " << context << " {" << endl; typedef Resource::Properties::const_iterator iterator; for (iterator i = properties.begin(); i != properties.end(); ++i) LOG(info) << " " << i->first << " = " << i->second << " :: " << i->second.type() << endl; @@ -177,7 +181,7 @@ SetMetadata::pre_process() const Raul::Atom& value = p->second; SpecialType op = NONE; if (obj) { - Resource& resource = _is_meta ? obj->meta() : *obj; + Resource& resource = *obj; resource.add_property(key, value); PortImpl* port = dynamic_cast<PortImpl*>(_object); @@ -353,7 +357,7 @@ SetMetadata::post_process() else _request->respond_ok(); if (_create) - _engine.broadcaster()->put(_subject, _properties); + _engine.broadcaster()->put(_subject, _properties, _context); else _engine.broadcaster()->delta(_subject, _remove, _properties); break; diff --git a/src/engine/events/SetMetadata.hpp b/src/engine/events/SetMetadata.hpp index b2e73679..021cb3f4 100644 --- a/src/engine/events/SetMetadata.hpp +++ b/src/engine/events/SetMetadata.hpp @@ -69,7 +69,7 @@ public: SharedPtr<Request> request, SampleCount timestamp, bool create, - bool meta, + Shared::Resource::Graph context, const Raul::URI& subject, const Shared::Resource::Properties& properties, const Shared::Resource::Properties& remove=Shared::Resource::Properties()); @@ -112,7 +112,7 @@ private: CompiledPatch* _compiled_patch; std::string _error_predicate; bool _create; - bool _is_meta; + Shared::Resource::Graph _context; SharedPtr<ControlBindings::Bindings> _old_bindings; }; |