summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libs/client/ClientStore.cpp2
-rw-r--r--src/libs/engine/Engine.cpp14
-rw-r--r--src/libs/engine/Engine.hpp2
-rw-r--r--src/libs/engine/HTTPEngineReceiver.cpp30
-rw-r--r--src/libs/engine/events/AllNotesOffEvent.cpp2
-rw-r--r--src/libs/engine/events/ClearPatchEvent.cpp6
-rw-r--r--src/libs/engine/events/ConnectionEvent.cpp4
-rw-r--r--src/libs/engine/events/CreateNodeEvent.cpp8
-rw-r--r--src/libs/engine/events/CreatePatchEvent.cpp8
-rw-r--r--src/libs/engine/events/CreatePortEvent.cpp8
-rw-r--r--src/libs/engine/events/DestroyEvent.cpp10
-rw-r--r--src/libs/engine/events/DisablePortMonitoringEvent.cpp2
-rw-r--r--src/libs/engine/events/DisconnectAllEvent.cpp4
-rw-r--r--src/libs/engine/events/DisconnectionEvent.cpp4
-rw-r--r--src/libs/engine/events/EnablePatchEvent.cpp2
-rw-r--r--src/libs/engine/events/EnablePortBroadcastingEvent.cpp2
-rw-r--r--src/libs/engine/events/MidiLearnEvent.cpp2
-rw-r--r--src/libs/engine/events/NoteEvent.cpp2
-rw-r--r--src/libs/engine/events/RenameEvent.cpp12
-rw-r--r--src/libs/engine/events/RequestAllObjectsEvent.cpp2
-rw-r--r--src/libs/engine/events/RequestMetadataEvent.cpp2
-rw-r--r--src/libs/engine/events/RequestObjectEvent.cpp2
-rw-r--r--src/libs/engine/events/RequestPortValueEvent.cpp2
-rw-r--r--src/libs/engine/events/SetMetadataEvent.cpp2
-rw-r--r--src/libs/engine/events/SetPolyphonicEvent.cpp2
-rw-r--r--src/libs/engine/events/SetPolyphonyEvent.cpp2
-rw-r--r--src/libs/engine/events/SetPortValueEvent.cpp4
-rw-r--r--src/libs/gui/App.cpp42
-rw-r--r--src/libs/gui/App.hpp4
-rw-r--r--src/libs/gui/PatchCanvas.cpp2
-rw-r--r--src/libs/gui/UploadPatchWindow.cpp3
-rw-r--r--src/libs/serialisation/Serialiser.cpp75
-rw-r--r--src/libs/serialisation/Serialiser.hpp14
-rw-r--r--src/libs/serialisation/serialisation.cpp4
-rw-r--r--src/libs/serialisation/serialisation.hpp5
-rw-r--r--src/libs/shared/Store.cpp63
-rw-r--r--src/progs/ingen/main.cpp1
37 files changed, 227 insertions, 128 deletions
diff --git a/src/libs/client/ClientStore.cpp b/src/libs/client/ClientStore.cpp
index 96f0dfa8..3c7f17aa 100644
--- a/src/libs/client/ClientStore.cpp
+++ b/src/libs/client/ClientStore.cpp
@@ -58,7 +58,7 @@ ClientStore::ClientStore(SharedPtr<EngineInterface> engine, SharedPtr<SigClientI
void
ClientStore::clear()
{
- clear();
+ Store::clear();
_plugins.clear();
}
diff --git a/src/libs/engine/Engine.cpp b/src/libs/engine/Engine.cpp
index 13fcafa0..ba5dcd15 100644
--- a/src/libs/engine/Engine.cpp
+++ b/src/libs/engine/Engine.cpp
@@ -75,8 +75,8 @@ Engine::~Engine()
{
deactivate();
- for (EngineStore::iterator i = object_store()->begin();
- i != object_store()->end(); ++i) {
+ for (EngineStore::iterator i = engine_store()->begin();
+ i != engine_store()->end(); ++i) {
if ( ! PtrCast<GraphObjectImpl>(i->second)->parent() )
i->second.reset();
}
@@ -93,10 +93,10 @@ Engine::~Engine()
}
-EngineStore*
-Engine::object_store() const
+SharedPtr<EngineStore>
+Engine::engine_store() const
{
- return dynamic_cast<EngineStore*>(_world->store.get());
+ return PtrCast<EngineStore>(_world->store);
}
@@ -270,8 +270,8 @@ Engine::deactivate()
_event_source->deactivate();
- /*for (Tree<GraphObject*>::iterator i = _object_store->objects().begin();
- i != _object_store->objects().end(); ++i)
+ /*for (Tree<GraphObject*>::iterator i = _engine_store->objects().begin();
+ i != _engine_store->objects().end(); ++i)
if ((*i)->as_node() != NULL && (*i)->as_node()->parent() == NULL)
(*i)->as_node()->deactivate();*/
diff --git a/src/libs/engine/Engine.hpp b/src/libs/engine/Engine.hpp
index dd8f3b15..26884f73 100644
--- a/src/libs/engine/Engine.hpp
+++ b/src/libs/engine/Engine.hpp
@@ -92,7 +92,7 @@ public:
ClientBroadcaster* broadcaster() const { return _broadcaster; }
NodeFactory* node_factory() const { return _node_factory; }
- EngineStore* object_store() const;
+ SharedPtr<EngineStore> engine_store() const;
/** Return the active driver for the given type */
Driver* driver(DataType type, EventType event_type);
diff --git a/src/libs/engine/HTTPEngineReceiver.cpp b/src/libs/engine/HTTPEngineReceiver.cpp
index b9cd1d7b..7427f18d 100644
--- a/src/libs/engine/HTTPEngineReceiver.cpp
+++ b/src/libs/engine/HTTPEngineReceiver.cpp
@@ -17,6 +17,7 @@
#include <iostream>
#include <cstdlib>
+#include <cstdio>
#include <string>
#include "types.hpp"
#include <raul/SharedPtr.hpp>
@@ -55,7 +56,7 @@ HTTPEngineReceiver::HTTPEngineReceiver(Engine& engine, uint16_t port)
if (engine.world()->serialisation_module) {
if (!engine.world()->serialiser)
engine.world()->serialiser = SharedPtr<Serialiser>(
- Ingen::Serialisation::new_serialiser(engine.world()));
+ Ingen::Serialisation::new_serialiser(engine.world(), engine.engine_store()));
if (!engine.world()->loader)
engine.world()->loader = SharedPtr<Loader>(
@@ -129,9 +130,27 @@ HTTPEngineReceiver::message_callback(SoupServer* server, SoupMessage* msg, const
return;
}
+#if 0
+ SoupMessageHeaders* in_head = msg->request_headers;
+ const char* str = soup_message_headers_get(in_head, "Accept");
+ cout << "Accept: " << str << endl;
+#endif
+
// Serialise object
- string base_uri = string("ingen:").append(start->second->path());
- const string response = serialiser->to_string(start->second, base_uri, GraphObject::Variables());
+ const string response = serialiser->to_string(start->second, "http://example.org",
+ GraphObject::Variables());
+
+#if 0
+ FILE* xhtml_file = fopen("/home/dave/ingen_ui.xhtml", "r");
+ string response;
+ while (!feof(xhtml_file)) {
+ int c = fgetc(xhtml_file);
+ if (c != EOF)
+ response += (char)c;
+ }
+ fclose(xhtml_file);
+#endif
+
soup_message_set_status (msg, SOUP_STATUS_OK);
soup_message_set_response (msg, "text/plain", SOUP_MEMORY_COPY,
response.c_str(), response.length());
@@ -152,9 +171,14 @@ HTTPEngineReceiver::message_callback(SoupServer* server, SoupMessage* msg, const
soup_message_set_status (msg, SOUP_STATUS_INTERNAL_SERVER_ERROR);
return;
}
+
+ //cout << "POST: " << msg->request_body->data << endl;
// Load object
soup_message_set_status (msg, SOUP_STATUS_NOT_IMPLEMENTED);
+ } else if (msg->method == SOUP_METHOD_POST) {
+ //cout << "PUT: " << msg->request_body->data << endl;
+ soup_message_set_status (msg, SOUP_STATUS_NOT_IMPLEMENTED);
} else {
soup_message_set_status (msg, SOUP_STATUS_NOT_IMPLEMENTED);
}
diff --git a/src/libs/engine/events/AllNotesOffEvent.cpp b/src/libs/engine/events/AllNotesOffEvent.cpp
index 6012ea92..fcb68b31 100644
--- a/src/libs/engine/events/AllNotesOffEvent.cpp
+++ b/src/libs/engine/events/AllNotesOffEvent.cpp
@@ -50,7 +50,7 @@ AllNotesOffEvent::execute(ProcessContext& context)
Event::execute(context);
if (_patch == NULL && _patch_path != "")
- _patch = _engine.object_store()->find_patch(_patch_path);
+ _patch = _engine.engine_store()->find_patch(_patch_path);
//if (_patch != NULL)
// for (Raul::List<MidiInNode*>::iterator j = _patch->midi_in_nodes().begin(); j != _patch->midi_in_nodes().end(); ++j)
diff --git a/src/libs/engine/events/ClearPatchEvent.cpp b/src/libs/engine/events/ClearPatchEvent.cpp
index 30b69915..c1fb0749 100644
--- a/src/libs/engine/events/ClearPatchEvent.cpp
+++ b/src/libs/engine/events/ClearPatchEvent.cpp
@@ -47,13 +47,13 @@ ClearPatchEvent::ClearPatchEvent(Engine& engine, SharedPtr<Responder> responder,
void
ClearPatchEvent::pre_process()
{
- EngineStore::Objects::iterator patch_iterator = _engine.object_store()->find(_patch_path);
+ EngineStore::Objects::iterator patch_iterator = _engine.engine_store()->find(_patch_path);
- if (patch_iterator != _engine.object_store()->end()) {
+ if (patch_iterator != _engine.engine_store()->end()) {
_patch = PtrCast<PatchImpl>(patch_iterator->second);
if (_patch) {
_process = _patch->enabled();
- _removed_table = _engine.object_store()->remove_children(patch_iterator);
+ _removed_table = _engine.engine_store()->remove_children(patch_iterator);
_patch->nodes().clear();
_patch->connections().clear();
_ports_array = _patch->build_ports_array();
diff --git a/src/libs/engine/events/ConnectionEvent.cpp b/src/libs/engine/events/ConnectionEvent.cpp
index 55286ffd..24b80dee 100644
--- a/src/libs/engine/events/ConnectionEvent.cpp
+++ b/src/libs/engine/events/ConnectionEvent.cpp
@@ -62,8 +62,8 @@ ConnectionEvent::pre_process()
return;
}
- _src_port = _engine.object_store()->find_port(_src_port_path);
- _dst_port = _engine.object_store()->find_port(_dst_port_path);
+ _src_port = _engine.engine_store()->find_port(_src_port_path);
+ _dst_port = _engine.engine_store()->find_port(_dst_port_path);
if (_src_port == NULL || _dst_port == NULL) {
_error = PORT_NOT_FOUND;
diff --git a/src/libs/engine/events/CreateNodeEvent.cpp b/src/libs/engine/events/CreateNodeEvent.cpp
index d1d21a36..49cbb58e 100644
--- a/src/libs/engine/events/CreateNodeEvent.cpp
+++ b/src/libs/engine/events/CreateNodeEvent.cpp
@@ -73,13 +73,13 @@ CreateNodeEvent::CreateNodeEvent(Engine& engine, SharedPtr<Responder> responder,
void
CreateNodeEvent::pre_process()
{
- if (_engine.object_store()->find_object(_path) != NULL) {
+ if (_engine.engine_store()->find_object(_path) != NULL) {
_node_already_exists = true;
QueuedEvent::pre_process();
return;
}
- _patch = _engine.object_store()->find_patch(_path.parent());
+ _patch = _engine.engine_store()->find_patch(_path.parent());
PluginImpl* const plugin = (_plugin_uri != "")
? _engine.node_factory()->plugin(_plugin_uri)
@@ -98,8 +98,8 @@ CreateNodeEvent::pre_process()
// This can be done here because the audio thread doesn't touch the
// node tree - just the process order array
_patch->add_node(new PatchImpl::Nodes::Node(_node));
- //_node->add_to_store(_engine.object_store());
- _engine.object_store()->add(_node);
+ //_node->add_to_store(_engine.engine_store());
+ _engine.engine_store()->add(_node);
// FIXME: not really necessary to build process order since it's not connected,
// just append to the list
diff --git a/src/libs/engine/events/CreatePatchEvent.cpp b/src/libs/engine/events/CreatePatchEvent.cpp
index 2b396cbb..e054412f 100644
--- a/src/libs/engine/events/CreatePatchEvent.cpp
+++ b/src/libs/engine/events/CreatePatchEvent.cpp
@@ -45,7 +45,7 @@ CreatePatchEvent::CreatePatchEvent(Engine& engine, SharedPtr<Responder> responde
void
CreatePatchEvent::pre_process()
{
- if (_path == "/" || _engine.object_store()->find_object(_path) != NULL) {
+ if (_path == "/" || _engine.engine_store()->find_object(_path) != NULL) {
_error = OBJECT_EXISTS;
QueuedEvent::pre_process();
return;
@@ -57,7 +57,7 @@ CreatePatchEvent::pre_process()
return;
}
- _parent = _engine.object_store()->find_patch(_path.parent());
+ _parent = _engine.engine_store()->find_patch(_path.parent());
if (_parent == NULL) {
_error = PARENT_NOT_FOUND;
QueuedEvent::pre_process();
@@ -80,8 +80,8 @@ CreatePatchEvent::pre_process()
_patch->activate();
// Insert into EngineStore
- //_patch->add_to_store(_engine.object_store());
- _engine.object_store()->add(_patch);
+ //_patch->add_to_store(_engine.engine_store());
+ _engine.engine_store()->add(_patch);
QueuedEvent::pre_process();
}
diff --git a/src/libs/engine/events/CreatePortEvent.cpp b/src/libs/engine/events/CreatePortEvent.cpp
index b8ef244f..e767f522 100644
--- a/src/libs/engine/events/CreatePortEvent.cpp
+++ b/src/libs/engine/events/CreatePortEvent.cpp
@@ -72,14 +72,14 @@ CreatePortEvent::CreatePortEvent(Engine& engine,
void
CreatePortEvent::pre_process()
{
- if (_error == UNKNOWN_TYPE || _engine.object_store()->find_object(_path)) {
+ if (_error == UNKNOWN_TYPE || _engine.engine_store()->find_object(_path)) {
QueuedEvent::pre_process();
return;
}
// FIXME: this is just a mess :/
- _patch = _engine.object_store()->find_patch(_path.parent());
+ _patch = _engine.engine_store()->find_patch(_path.parent());
if (_patch != NULL) {
assert(_patch->path() == _path.parent());
@@ -106,8 +106,8 @@ CreatePortEvent::pre_process()
_ports_array->at(_patch->num_ports()-1) = _patch_port;
- //_patch_port->add_to_store(_engine.object_store());
- _engine.object_store()->add(_patch_port);
+ //_patch_port->add_to_store(_engine.engine_store());
+ _engine.engine_store()->add(_patch_port);
if (!_patch->parent()) {
if (_type == "ingen:AudioPort")
diff --git a/src/libs/engine/events/DestroyEvent.cpp b/src/libs/engine/events/DestroyEvent.cpp
index 6d1fc3fb..9c9db2db 100644
--- a/src/libs/engine/events/DestroyEvent.cpp
+++ b/src/libs/engine/events/DestroyEvent.cpp
@@ -37,7 +37,7 @@ namespace Ingen {
DestroyEvent::DestroyEvent(Engine& engine, SharedPtr<Responder> responder, FrameTime time, QueuedEventSource* source, const string& path, bool block)
: QueuedEvent(engine, responder, time, source, source)
, _path(path)
- , _store_iterator(engine.object_store()->end())
+ , _store_iterator(engine.engine_store()->end())
, _driver_port(NULL)
, _patch_node_listnode(NULL)
, _patch_port_listnode(NULL)
@@ -58,17 +58,17 @@ DestroyEvent::~DestroyEvent()
void
DestroyEvent::pre_process()
{
- _store_iterator = _engine.object_store()->find(_path);
+ _store_iterator = _engine.engine_store()->find(_path);
- if (_store_iterator != _engine.object_store()->end()) {
+ if (_store_iterator != _engine.engine_store()->end()) {
_node = PtrCast<NodeImpl>(_store_iterator->second);
if (!_node)
_port = PtrCast<PortImpl>(_store_iterator->second);
}
- if (_store_iterator != _engine.object_store()->end()) {
- _removed_table = _engine.object_store()->remove(_store_iterator);
+ if (_store_iterator != _engine.engine_store()->end()) {
+ _removed_table = _engine.engine_store()->remove(_store_iterator);
}
if (_node != NULL && _path != "/") {
diff --git a/src/libs/engine/events/DisablePortMonitoringEvent.cpp b/src/libs/engine/events/DisablePortMonitoringEvent.cpp
index 02d64c0b..cecc8dfd 100644
--- a/src/libs/engine/events/DisablePortMonitoringEvent.cpp
+++ b/src/libs/engine/events/DisablePortMonitoringEvent.cpp
@@ -44,7 +44,7 @@ DisablePortMonitoringEvent::DisablePortMonitoringEvent(Engine& engi
void
DisablePortMonitoringEvent::pre_process()
{
- _port = _engine.object_store()->find_port(_port_path);
+ _port = _engine.engine_store()->find_port(_port_path);
QueuedEvent::pre_process();
}
diff --git a/src/libs/engine/events/DisconnectAllEvent.cpp b/src/libs/engine/events/DisconnectAllEvent.cpp
index 78c2b23b..77b1b1b3 100644
--- a/src/libs/engine/events/DisconnectAllEvent.cpp
+++ b/src/libs/engine/events/DisconnectAllEvent.cpp
@@ -76,7 +76,7 @@ void
DisconnectAllEvent::pre_process()
{
if (_lookup) {
- _parent = _engine.object_store()->find_patch(_parent_path);
+ _parent = _engine.engine_store()->find_patch(_parent_path);
if (_parent == NULL) {
_error = PARENT_NOT_FOUND;
@@ -84,7 +84,7 @@ DisconnectAllEvent::pre_process()
return;
}
- GraphObjectImpl* object = _engine.object_store()->find_object(_path);
+ GraphObjectImpl* object = _engine.engine_store()->find_object(_path);
if (object == NULL) {
_error = OBJECT_NOT_FOUND;
diff --git a/src/libs/engine/events/DisconnectionEvent.cpp b/src/libs/engine/events/DisconnectionEvent.cpp
index d796877f..86ad8b4e 100644
--- a/src/libs/engine/events/DisconnectionEvent.cpp
+++ b/src/libs/engine/events/DisconnectionEvent.cpp
@@ -83,8 +83,8 @@ DisconnectionEvent::pre_process()
return;
}
- _src_port = _engine.object_store()->find_port(_src_port_path);
- _dst_port = _engine.object_store()->find_port(_dst_port_path);
+ _src_port = _engine.engine_store()->find_port(_src_port_path);
+ _dst_port = _engine.engine_store()->find_port(_dst_port_path);
}
if (_src_port == NULL || _dst_port == NULL) {
diff --git a/src/libs/engine/events/EnablePatchEvent.cpp b/src/libs/engine/events/EnablePatchEvent.cpp
index aff5885b..48657146 100644
--- a/src/libs/engine/events/EnablePatchEvent.cpp
+++ b/src/libs/engine/events/EnablePatchEvent.cpp
@@ -39,7 +39,7 @@ EnablePatchEvent::EnablePatchEvent(Engine& engine, SharedPtr<Responder> responde
void
EnablePatchEvent::pre_process()
{
- _patch = _engine.object_store()->find_patch(_patch_path);
+ _patch = _engine.engine_store()->find_patch(_patch_path);
if (_enable && _patch) {
/* Any event that requires a new process order will set the patch's
diff --git a/src/libs/engine/events/EnablePortBroadcastingEvent.cpp b/src/libs/engine/events/EnablePortBroadcastingEvent.cpp
index cb7dc5ec..1d3d2c9e 100644
--- a/src/libs/engine/events/EnablePortBroadcastingEvent.cpp
+++ b/src/libs/engine/events/EnablePortBroadcastingEvent.cpp
@@ -46,7 +46,7 @@ EnablePortBroadcastingEvent::EnablePortBroadcastingEvent(Engine& en
void
EnablePortBroadcastingEvent::pre_process()
{
- _port = _engine.object_store()->find_port(_port_path);
+ _port = _engine.engine_store()->find_port(_port_path);
QueuedEvent::pre_process();
}
diff --git a/src/libs/engine/events/MidiLearnEvent.cpp b/src/libs/engine/events/MidiLearnEvent.cpp
index 3e8947b7..45216e70 100644
--- a/src/libs/engine/events/MidiLearnEvent.cpp
+++ b/src/libs/engine/events/MidiLearnEvent.cpp
@@ -51,7 +51,7 @@ MidiLearnEvent::MidiLearnEvent(Engine& engine, SharedPtr<Responder> responder, S
void
MidiLearnEvent::pre_process()
{
- _node = _engine.object_store()->find_node(_node_path);
+ _node = _engine.engine_store()->find_node(_node_path);
_response_event = new MidiLearnResponseEvent(_engine, _node_path + "/Controller_Number", _time);
QueuedEvent::pre_process();
diff --git a/src/libs/engine/events/NoteEvent.cpp b/src/libs/engine/events/NoteEvent.cpp
index d5f2cf76..d74d5cd0 100644
--- a/src/libs/engine/events/NoteEvent.cpp
+++ b/src/libs/engine/events/NoteEvent.cpp
@@ -65,7 +65,7 @@ NoteEvent::execute(ProcessContext& context)
// Lookup if neccessary
if (!_node)
- _node = _engine.object_store()->find_node(_node_path);
+ _node = _engine.engine_store()->find_node(_node_path);
// FIXME: barf
diff --git a/src/libs/engine/events/RenameEvent.cpp b/src/libs/engine/events/RenameEvent.cpp
index 73426a59..164676aa 100644
--- a/src/libs/engine/events/RenameEvent.cpp
+++ b/src/libs/engine/events/RenameEvent.cpp
@@ -37,7 +37,7 @@ RenameEvent::RenameEvent(Engine& engine, SharedPtr<Responder> responder, SampleC
_name(name),
_new_path("/"),
_parent_patch(NULL),
- _store_iterator(engine.object_store()->end()),
+ _store_iterator(engine.engine_store()->end()),
_error(NO_ERROR)
{
/*
@@ -64,21 +64,21 @@ RenameEvent::pre_process()
_new_path = _old_path.parent().base() + _name;
- _store_iterator = _engine.object_store()->find(_old_path);
- if (_store_iterator == _engine.object_store()->end()) {
+ _store_iterator = _engine.engine_store()->find(_old_path);
+ if (_store_iterator == _engine.engine_store()->end()) {
_error = OBJECT_NOT_FOUND;
QueuedEvent::pre_process();
return;
}
- if (_engine.object_store()->find_object(_new_path)) {
+ if (_engine.engine_store()->find_object(_new_path)) {
_error = OBJECT_EXISTS;
QueuedEvent::pre_process();
return;
}
SharedPtr< Table<Path, SharedPtr<Shared::GraphObject> > > removed
- = _engine.object_store()->remove(_store_iterator);
+ = _engine.engine_store()->remove(_store_iterator);
assert(removed->size() > 0);
@@ -96,7 +96,7 @@ RenameEvent::pre_process()
i->first = child_new_path;
}
- _engine.object_store()->add(*removed.get());
+ _engine.engine_store()->add(*removed.get());
QueuedEvent::pre_process();
}
diff --git a/src/libs/engine/events/RequestAllObjectsEvent.cpp b/src/libs/engine/events/RequestAllObjectsEvent.cpp
index 94e34f3b..d57080aa 100644
--- a/src/libs/engine/events/RequestAllObjectsEvent.cpp
+++ b/src/libs/engine/events/RequestAllObjectsEvent.cpp
@@ -45,7 +45,7 @@ RequestAllObjectsEvent::post_process()
_responder->respond_ok();
// Everything is a child of the root patch, so this sends it all
- PatchImpl* root = _engine.object_store()->find_patch("/");
+ PatchImpl* root = _engine.engine_store()->find_patch("/");
if (root && _responder->client())
ObjectSender::send_patch(_responder->client(), root, true);
diff --git a/src/libs/engine/events/RequestMetadataEvent.cpp b/src/libs/engine/events/RequestMetadataEvent.cpp
index cf428c05..4a7571bb 100644
--- a/src/libs/engine/events/RequestMetadataEvent.cpp
+++ b/src/libs/engine/events/RequestMetadataEvent.cpp
@@ -41,7 +41,7 @@ void
RequestMetadataEvent::pre_process()
{
if (_responder->client()) {
- _object = _engine.object_store()->find_object(_path);
+ _object = _engine.engine_store()->find_object(_path);
if (_object == NULL) {
QueuedEvent::pre_process();
return;
diff --git a/src/libs/engine/events/RequestObjectEvent.cpp b/src/libs/engine/events/RequestObjectEvent.cpp
index c1c93129..88479482 100644
--- a/src/libs/engine/events/RequestObjectEvent.cpp
+++ b/src/libs/engine/events/RequestObjectEvent.cpp
@@ -44,7 +44,7 @@ RequestObjectEvent::RequestObjectEvent(Engine& engine, SharedPtr<Responder> resp
void
RequestObjectEvent::pre_process()
{
- _object = _engine.object_store()->find_object(_path);
+ _object = _engine.engine_store()->find_object(_path);
QueuedEvent::pre_process();
}
diff --git a/src/libs/engine/events/RequestPortValueEvent.cpp b/src/libs/engine/events/RequestPortValueEvent.cpp
index 1e09662b..20203f88 100644
--- a/src/libs/engine/events/RequestPortValueEvent.cpp
+++ b/src/libs/engine/events/RequestPortValueEvent.cpp
@@ -43,7 +43,7 @@ RequestPortValueEvent::RequestPortValueEvent(Engine& engine, SharedPtr<Responder
void
RequestPortValueEvent::pre_process()
{
- _port = _engine.object_store()->find_port(_port_path);
+ _port = _engine.engine_store()->find_port(_port_path);
QueuedEvent::pre_process();
}
diff --git a/src/libs/engine/events/SetMetadataEvent.cpp b/src/libs/engine/events/SetMetadataEvent.cpp
index 14293037..3e41a510 100644
--- a/src/libs/engine/events/SetMetadataEvent.cpp
+++ b/src/libs/engine/events/SetMetadataEvent.cpp
@@ -41,7 +41,7 @@ SetMetadataEvent::SetMetadataEvent(Engine& engine, SharedPtr<Responder> responde
void
SetMetadataEvent::pre_process()
{
- _object = _engine.object_store()->find_object(_path);
+ _object = _engine.engine_store()->find_object(_path);
if (_object == NULL) {
QueuedEvent::pre_process();
return;
diff --git a/src/libs/engine/events/SetPolyphonicEvent.cpp b/src/libs/engine/events/SetPolyphonicEvent.cpp
index d2ff97aa..bce65ba9 100644
--- a/src/libs/engine/events/SetPolyphonicEvent.cpp
+++ b/src/libs/engine/events/SetPolyphonicEvent.cpp
@@ -44,7 +44,7 @@ SetPolyphonicEvent::SetPolyphonicEvent(Engine& engine, SharedPtr<Responder> resp
void
SetPolyphonicEvent::pre_process()
{
- _object = _engine.object_store()->find_object(_path);
+ _object = _engine.engine_store()->find_object(_path);
QueuedEvent::pre_process();
}
diff --git a/src/libs/engine/events/SetPolyphonyEvent.cpp b/src/libs/engine/events/SetPolyphonyEvent.cpp
index 2a22da2f..17222330 100644
--- a/src/libs/engine/events/SetPolyphonyEvent.cpp
+++ b/src/libs/engine/events/SetPolyphonyEvent.cpp
@@ -43,7 +43,7 @@ SetPolyphonyEvent::SetPolyphonyEvent(Engine& engine, SharedPtr<Responder> respon
void
SetPolyphonyEvent::pre_process()
{
- _patch = _engine.object_store()->find_patch(_patch_path);
+ _patch = _engine.engine_store()->find_patch(_patch_path);
if (_patch && _poly > _patch->internal_polyphony())
_patch->prepare_internal_poly(_poly);
diff --git a/src/libs/engine/events/SetPortValueEvent.cpp b/src/libs/engine/events/SetPortValueEvent.cpp
index ee9be86e..01263d2c 100644
--- a/src/libs/engine/events/SetPortValueEvent.cpp
+++ b/src/libs/engine/events/SetPortValueEvent.cpp
@@ -94,7 +94,7 @@ SetPortValueEvent::pre_process()
if (_queued) {
if (_port == NULL) {
if (Path::is_valid(_port_path))
- _port = _engine.object_store()->find_port(_port_path);
+ _port = _engine.engine_store()->find_port(_port_path);
else
_error = ILLEGAL_PATH;
}
@@ -115,7 +115,7 @@ SetPortValueEvent::execute(ProcessContext& context)
if (_error == NO_ERROR && _port == NULL) {
if (Path::is_valid(_port_path))
- _port = _engine.object_store()->find_port(_port_path);
+ _port = _engine.engine_store()->find_port(_port_path);
else
_error = ILLEGAL_PATH;
}
diff --git a/src/libs/gui/App.cpp b/src/libs/gui/App.cpp
index a0a877d5..34f04f35 100644
--- a/src/libs/gui/App.cpp
+++ b/src/libs/gui/App.cpp
@@ -73,18 +73,6 @@ App::App(Ingen::Shared::World* world)
, _world(world)
, _enable_signal(true)
{
- // FIXME: defer loading of serialisation module until needed
- if (!world->serialisation_module)
- world->serialisation_module = Ingen::Shared::load_module("ingen_serialisation");
-
- if (world->serialisation_module)
- if (!world->serialiser)
- world->serialiser = SharedPtr<Serialiser>(
- Ingen::Serialisation::new_serialiser(world));
-
- if (!world->serialiser)
- cerr << "WARNING: Failed to load ingen_serialisation module, save disabled." << endl;
-
Glib::RefPtr<Gnome::Glade::Xml> glade_xml = GladeFactory::new_glade_reference();
glade_xml->get_widget_derived("connect_win", _connect_window);
@@ -93,18 +81,7 @@ App::App(Ingen::Shared::World* world)
glade_xml->get_widget("about_win", _about_dialog);
_about_dialog->property_program_name() = "Ingen";
- Redland::World& rdf_world = *world->rdf_world;
-
- rdf_world.add_prefix("xsd", "http://www.w3.org/2001/XMLSchema#");
- rdf_world.add_prefix("ingen", "http://drobilla.net/ns/ingen#");
- rdf_world.add_prefix("ingenuity", "http://drobilla.net/ns/ingenuity#");
- rdf_world.add_prefix("lv2", "http://lv2plug.in/ns/lv2core#");
- rdf_world.add_prefix("lv2_midi", "http://lv2plug.in/ns/ext/midi");
- rdf_world.add_prefix("rdfs", "http://www.w3.org/2000/01/rdf-schema#");
- rdf_world.add_prefix("doap", "http://usefulinc.com/ns/doap#");
- rdf_world.add_prefix("dc", "http://purl.org/dc/elements/1.1/");
-
- PluginModel::set_rdf_world(rdf_world);
+ PluginModel::set_rdf_world(*world->rdf_world);
#ifdef HAVE_SLV2
PluginModel::set_slv2_world(world->slv2_world);
@@ -197,6 +174,23 @@ App::detach()
_world->engine.reset();
}
}
+
+
+const SharedPtr<Serialiser>&
+App::serialiser()
+{
+ if (!_serialiser) {
+ if (!_world->serialisation_module)
+ _world->serialisation_module = Ingen::Shared::load_module("ingen_serialisation");
+
+ if (_world->serialisation_module)
+ _serialiser = SharedPtr<Serialiser>(Ingen::Serialisation::new_serialiser(_world, _store));
+
+ if (!_serialiser)
+ cerr << "WARNING: Failed to load ingen_serialisation module, save disabled." << endl;
+ }
+ return _serialiser;
+}
void
diff --git a/src/libs/gui/App.hpp b/src/libs/gui/App.hpp
index c6a6c66c..a13259ad 100644
--- a/src/libs/gui/App.hpp
+++ b/src/libs/gui/App.hpp
@@ -106,7 +106,8 @@ public:
const SharedPtr<SigClientInterface>& client() const { return _client; }
const SharedPtr<ClientStore>& store() const { return _store; }
const SharedPtr<ThreadedLoader>& loader() const { return _loader; }
- const SharedPtr<Serialiser>& serialiser() const { return _world->serialiser; }
+
+ const SharedPtr<Serialiser>& serialiser();
static inline App& instance() { assert(_instance); return *_instance; }
@@ -139,6 +140,7 @@ protected:
SharedPtr<SigClientInterface> _client;
SharedPtr<ClientStore> _store;
+ SharedPtr<Serialiser> _serialiser;
SharedPtr<ThreadedLoader> _loader;
Configuration* _configuration;
diff --git a/src/libs/gui/PatchCanvas.cpp b/src/libs/gui/PatchCanvas.cpp
index c92eeb43..59011721 100644
--- a/src/libs/gui/PatchCanvas.cpp
+++ b/src/libs/gui/PatchCanvas.cpp
@@ -539,7 +539,7 @@ PatchCanvas::destroy_selection()
void
PatchCanvas::copy_selection()
{
- Serialiser serialiser(*App::instance().world());
+ Serialiser serialiser(*App::instance().world(), App::instance().store());
serialiser.start_to_string("");
for (list<boost::shared_ptr<Item> >::iterator m = _selected_items.begin(); m != _selected_items.end(); ++m) {
diff --git a/src/libs/gui/UploadPatchWindow.cpp b/src/libs/gui/UploadPatchWindow.cpp
index b14f7e2c..2ca54f3c 100644
--- a/src/libs/gui/UploadPatchWindow.cpp
+++ b/src/libs/gui/UploadPatchWindow.cpp
@@ -24,6 +24,7 @@
#include <redlandmm/Query.hpp>
#include "module/global.hpp"
#include "module/World.hpp"
+#include "client/ClientStore.hpp"
#include "interface/EngineInterface.hpp"
#include "serialisation/Serialiser.hpp"
#include "client/PatchModel.hpp"
@@ -247,7 +248,7 @@ UploadPatchWindow::upload_clicked()
_upload_progress->set_fraction(0.0);
_upload_progress->set_text("");
- Serialiser s(*App::instance().world());
+ Serialiser s(*App::instance().world(), App::instance().store());
const string uri = string("http://rdf.drobilla.net/ingen_patches/")
.append(symbol).append(".ingen.ttl");
diff --git a/src/libs/serialisation/Serialiser.cpp b/src/libs/serialisation/Serialiser.cpp
index 8d5bb1a7..d2f2031f 100644
--- a/src/libs/serialisation/Serialiser.cpp
+++ b/src/libs/serialisation/Serialiser.cpp
@@ -53,8 +53,8 @@ namespace Ingen {
namespace Serialisation {
-Serialiser::Serialiser(Shared::World& world)
- : _store(world.store)
+Serialiser::Serialiser(Shared::World& world, SharedPtr<Shared::Store> store)
+ : _store(store)
, _world(*world.rdf_world)
{
}
@@ -148,22 +148,37 @@ Serialiser::finish()
ret = _model->serialise_to_string();
_base_uri = "";
+#ifdef USE_BLANK_NODES
_node_map.clear();
-
+#endif
return ret;
}
+
+Redland::Node
+Serialiser::patch_path_to_rdf_node(const Path& path)
+{
+#ifdef USE_BLANK_NODES
+ if (path == _root_object->path()) {
+ return Redland::Node(_model->world(), Redland::Node::RESOURCE, _base_uri);
+ } else {
+ assert(path.length() > _root_object->path().length());
+ return Redland::Node(_model->world(), Redland::Node::RESOURCE,
+ _base_uri + string("#") + path.substr(_root_object->path().length()));
+ }
+#else
+ return path_to_rdf_node(path);
+#endif
+}
+
+
/** Convert a path to an RDF blank node ID for serializing.
*/
Redland::Node
-Serialiser::path_to_node_id(const Path& path)
+Serialiser::path_to_rdf_node(const Path& path)
{
- assert(_model);
-
- if (path == _root_object->path())
- return Redland::Node(_model->world(), Redland::Node::RESOURCE, _base_uri);
-
+#if USE_BLANK_NODES
NodeMap::iterator i = _node_map.find(path);
if (i != _node_map.end()) {
assert(i->second);
@@ -175,6 +190,16 @@ Serialiser::path_to_node_id(const Path& path)
_node_map[path] = id;
return id;
}
+#else
+ assert(_model);
+ assert(path.substr(0, _root_object->path().length()) == _root_object->path());
+
+ if (path == _root_object->path())
+ return Redland::Node(_model->world(), Redland::Node::RESOURCE, _base_uri);
+ else
+ return Redland::Node(_model->world(), Redland::Node::RESOURCE,
+ path.substr(_root_object->path().base().length()-1));
+#endif
}
@@ -243,13 +268,13 @@ Serialiser::serialise(SharedPtr<GraphObject> object) throw (std::logic_error)
SharedPtr<Shared::Node> node = PtrCast<Shared::Node>(object);
if (node) {
- serialise_node(node, path_to_node_id(node->path()));
+ serialise_node(node, path_to_rdf_node(node->path()));
return;
}
SharedPtr<Shared::Port> port = PtrCast<Shared::Port>(object);
if (port) {
- serialise_port(port.get(), path_to_node_id(port->path()));
+ serialise_port(port.get(), path_to_rdf_node(port->path()));
return;
}
@@ -258,25 +283,12 @@ Serialiser::serialise(SharedPtr<GraphObject> object) throw (std::logic_error)
}
-Redland::Node
-Serialiser::patch_path_to_rdf_id(const Path& path)
-{
- if (path == _root_object->path()) {
- return Redland::Node(_model->world(), Redland::Node::RESOURCE, _base_uri);
- } else {
- assert(path.length() > _root_object->path().length());
- return Redland::Node(_model->world(), Redland::Node::RESOURCE,
- _base_uri + string("#") + path.substr(_root_object->path().length()));
- }
-}
-
-
void
Serialiser::serialise_patch(SharedPtr<Shared::Patch> patch)
{
assert(_model);
- const Redland::Node patch_id = patch_path_to_rdf_id(patch->path());
+ const Redland::Node patch_id = patch_path_to_rdf_node(patch->path());
_model->add_statement(
patch_id,
@@ -301,7 +313,6 @@ Serialiser::serialise_patch(SharedPtr<Shared::Patch> patch)
serialise_variables(patch_id, patch->variables());
- //for (GraphObject::const_iterator n = patch->children_begin(); n != patch->children_end(); ++n) {
for (GraphObject::const_iterator n = _store->children_begin(patch);
n != _store->children_end(patch); ++n) {
@@ -311,10 +322,10 @@ Serialiser::serialise_patch(SharedPtr<Shared::Patch> patch)
SharedPtr<Shared::Patch> patch = PtrCast<Shared::Patch>(n->second);
SharedPtr<Shared::Node> node = PtrCast<Shared::Node>(n->second);
if (patch) {
- _model->add_statement(patch_id, "ingen:node", patch_path_to_rdf_id(patch->path()));
+ _model->add_statement(patch_id, "ingen:node", patch_path_to_rdf_node(patch->path()));
serialise_patch(patch);
} else if (node) {
- const Redland::Node node_id = path_to_node_id(n->second->path());
+ const Redland::Node node_id = path_to_rdf_node(n->second->path());
_model->add_statement(patch_id, "ingen:node", node_id);
serialise_node(node, node_id);
}
@@ -322,7 +333,7 @@ Serialiser::serialise_patch(SharedPtr<Shared::Patch> patch)
for (uint32_t i=0; i < patch->num_ports(); ++i) {
Port* p = patch->port(i);
- const Redland::Node port_id = path_to_node_id(p->path());
+ const Redland::Node port_id = path_to_rdf_node(p->path());
_model->add_statement(patch_id, "ingen:port", port_id);
serialise_port(p, port_id);
}
@@ -379,7 +390,7 @@ Serialiser::serialise_node(SharedPtr<Shared::Node> node, const Redland::Node& no
for (uint32_t i=0; i < node->num_ports(); ++i) {
Port* p = node->port(i);
assert(p);
- const Redland::Node port_id = path_to_node_id(p->path());
+ const Redland::Node port_id = path_to_rdf_node(p->path());
serialise_port(p, port_id);
_model->add_statement(node_id, "ingen:port", port_id);
}
@@ -422,8 +433,8 @@ Serialiser::serialise_connection(SharedPtr<Connection> connection) throw (std::l
if (!_model)
throw std::logic_error("serialise_connection called without serialization in progress");
- const Redland::Node src_node = path_to_node_id(connection->src_port_path());
- const Redland::Node dst_node = path_to_node_id(connection->dst_port_path());
+ const Redland::Node src_node = path_to_rdf_node(connection->src_port_path());
+ const Redland::Node dst_node = path_to_rdf_node(connection->dst_port_path());
/* This would allow associating data with the connection... */
/*const Redland::Node connection_node = _world.blank_id();
diff --git a/src/libs/serialisation/Serialiser.hpp b/src/libs/serialisation/Serialiser.hpp
index eb3a8810..5810f259 100644
--- a/src/libs/serialisation/Serialiser.hpp
+++ b/src/libs/serialisation/Serialiser.hpp
@@ -56,7 +56,7 @@ namespace Serialisation {
class Serialiser
{
public:
- Serialiser(Shared::World& world);
+ Serialiser(Shared::World& world, SharedPtr<Shared::Store> store);
void to_file(SharedPtr<GraphObject> object, const std::string& filename);
@@ -85,18 +85,20 @@ private:
void serialise_variables(Redland::Node subject, const GraphObject::Variables& variables);
- Redland::Node path_to_node_id(const Path& path);
- Redland::Node patch_path_to_rdf_id(const Path& path);
-
- typedef std::map<Raul::Path, Redland::Node> NodeMap;
+ Redland::Node path_to_rdf_node(const Path& path);
+ Redland::Node patch_path_to_rdf_node(const Path& path);
SharedPtr<GraphObject> _root_object;
SharedPtr<Shared::Store> _store;
Mode _mode;
- NodeMap _node_map;
std::string _base_uri;
Redland::World& _world;
Redland::Model* _model;
+
+#ifdef USE_BLANK_NODES
+ typedef std::map<Raul::Path, Redland::Node> NodeMap;
+ NodeMap _node_map;
+#endif
};
diff --git a/src/libs/serialisation/serialisation.cpp b/src/libs/serialisation/serialisation.cpp
index 49b8d465..3ece3772 100644
--- a/src/libs/serialisation/serialisation.cpp
+++ b/src/libs/serialisation/serialisation.cpp
@@ -33,10 +33,10 @@ new_loader()
Ingen::Serialisation::Serialiser*
-new_serialiser(Ingen::Shared::World* world)
+new_serialiser(Ingen::Shared::World* world, SharedPtr<Store> store)
{
assert(world->rdf_world);
- return new Serialiser(*world);
+ return new Serialiser(*world, store);
}
diff --git a/src/libs/serialisation/serialisation.hpp b/src/libs/serialisation/serialisation.hpp
index 8f6e8291..abae159c 100644
--- a/src/libs/serialisation/serialisation.hpp
+++ b/src/libs/serialisation/serialisation.hpp
@@ -20,7 +20,7 @@
namespace Ingen {
-namespace Shared { class World; }
+namespace Shared { class World; class Store; }
namespace Serialisation {
@@ -31,7 +31,8 @@ class Serialiser;
extern "C" {
extern Loader* new_loader();
- extern Serialiser* new_serialiser(Ingen::Shared::World* world);
+ extern Serialiser* new_serialiser(Ingen::Shared::World* world,
+ SharedPtr<Shared::Store> store);
}
diff --git a/src/libs/shared/Store.cpp b/src/libs/shared/Store.cpp
new file mode 100644
index 00000000..88fb9cb8
--- /dev/null
+++ b/src/libs/shared/Store.cpp
@@ -0,0 +1,63 @@
+/* This file is part of Ingen.
+ * Copyright (C) 2008 Dave 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 <raul/PathTable.hpp>
+#include <raul/TableImpl.hpp>
+#include "Store.hpp"
+
+using namespace std;
+using namespace Raul;
+
+namespace Ingen {
+namespace Shared {
+
+
+Store::const_iterator
+Store::children_begin(SharedPtr<Shared::GraphObject> o) const
+{
+ const_iterator parent = find(o->path());
+ assert(parent != end());
+ ++parent;
+ return parent;
+}
+
+
+Store::const_iterator
+Store::children_end(SharedPtr<Shared::GraphObject> o) const
+{
+ const_iterator parent = find(o->path());
+ assert(parent != end());
+ return find_descendants_end(parent);
+}
+
+
+SharedPtr<Shared::GraphObject>
+Store::find_child(SharedPtr<Shared::GraphObject> parent, const string& child_name) const
+{
+ const_iterator pi = find(parent->path());
+ assert(pi != end());
+ const_iterator children_end = find_descendants_end(pi);
+ const_iterator child = find(pi, children_end, parent->path().base() + child_name);
+ if (child != end())
+ return child->second;
+ else
+ return SharedPtr<Shared::GraphObject>();
+}
+
+
+} // namespace Shared
+} // namespace Ingen
diff --git a/src/progs/ingen/main.cpp b/src/progs/ingen/main.cpp
index b4e930a4..2fe368f7 100644
--- a/src/progs/ingen/main.cpp
+++ b/src/progs/ingen/main.cpp
@@ -96,6 +96,7 @@ main(int argc, char** argv)
world->rdf_world->add_prefix("ingen", "http://drobilla.net/ns/ingen#");
world->rdf_world->add_prefix("ingenuity", "http://drobilla.net/ns/ingenuity#");
world->rdf_world->add_prefix("lv2", "http://lv2plug.in/ns/lv2core#");
+ world->rdf_world->add_prefix("lv2_midi", "http://lv2plug.in/ns/ext/midi");
world->rdf_world->add_prefix("rdfs", "http://www.w3.org/2000/01/rdf-schema#");
world->rdf_world->add_prefix("doap", "http://usefulinc.com/ns/doap#");
world->rdf_world->add_prefix("dc", "http://purl.org/dc/elements/1.1/");