summaryrefslogtreecommitdiffstats
path: root/src/engine/events
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-02-19 05:10:29 +0000
committerDavid Robillard <d@drobilla.net>2011-02-19 05:10:29 +0000
commit6b18de71d1c603255b263a64434005306f152f13 (patch)
tree09c6e87acca1fe76bc74b3b549fee7ad09751993 /src/engine/events
parent8e07e115429a0869593d4f29dc3e6cf5c8b25049 (diff)
downloadingen-6b18de71d1c603255b263a64434005306f152f13.tar.gz
ingen-6b18de71d1c603255b263a64434005306f152f13.tar.bz2
ingen-6b18de71d1c603255b263a64434005306f152f13.zip
Save/load patches as nested bundles (fix ticket #520).
Sane (context-based, ala RDF quads) approach to the problem of externally visible / internally visible properties. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2993 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/engine/events')
-rw-r--r--src/engine/events/CreatePatch.cpp7
-rw-r--r--src/engine/events/CreatePort.cpp3
-rw-r--r--src/engine/events/RequestMetadata.cpp6
-rw-r--r--src/engine/events/RequestMetadata.hpp22
-rw-r--r--src/engine/events/SetMetadata.cpp14
-rw-r--r--src/engine/events/SetMetadata.hpp4
6 files changed, 28 insertions, 28 deletions
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;
};