summaryrefslogtreecommitdiffstats
path: root/src/server/events
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-08-12 23:42:17 +0000
committerDavid Robillard <d@drobilla.net>2012-08-12 23:42:17 +0000
commitefe8e2311ee2fed881f95cc1e72825906d21c7c1 (patch)
tree371c03610f691f0b97137b9e5b2f756b21fc5583 /src/server/events
parente63caf72f320ab683de6378ff6f2944890054cbf (diff)
downloadingen-efe8e2311ee2fed881f95cc1e72825906d21c7c1.tar.gz
ingen-efe8e2311ee2fed881f95cc1e72825906d21c7c1.tar.bz2
ingen-efe8e2311ee2fed881f95cc1e72825906d21c7c1.zip
Use ingen:root as the path for the root patch, opening up path space for engine/driver/etc.
Strict conversion between Path and URI (Path no longer is-a URI). git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4672 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/server/events')
-rw-r--r--src/server/events/Connect.cpp10
-rw-r--r--src/server/events/CreateNode.cpp12
-rw-r--r--src/server/events/CreatePatch.cpp2
-rw-r--r--src/server/events/CreatePort.cpp2
-rw-r--r--src/server/events/Delete.cpp11
-rw-r--r--src/server/events/Delta.cpp8
-rw-r--r--src/server/events/Get.cpp15
-rw-r--r--src/server/events/Get.hpp1
-rw-r--r--src/server/events/Move.cpp3
-rw-r--r--src/server/events/SetPortValue.cpp5
10 files changed, 35 insertions, 34 deletions
diff --git a/src/server/events/Connect.cpp b/src/server/events/Connect.cpp
index 39252a13..17b66192 100644
--- a/src/server/events/Connect.cpp
+++ b/src/server/events/Connect.cpp
@@ -57,27 +57,27 @@ Connect::pre_process()
PortImpl* tail = _engine.engine_store()->find_port(_tail_path);
PortImpl* head = _engine.engine_store()->find_port(_head_path);
if (!tail) {
- return Event::pre_process_done(PORT_NOT_FOUND, _tail_path.str());
+ return Event::pre_process_done(PORT_NOT_FOUND, _tail_path);
} else if (!head) {
- return Event::pre_process_done(PORT_NOT_FOUND, _head_path.str());
+ return Event::pre_process_done(PORT_NOT_FOUND, _head_path);
}
OutputPort* tail_output = dynamic_cast<OutputPort*>(tail);
_head = dynamic_cast<InputPort*>(head);
if (!tail_output || !_head) {
- return Event::pre_process_done(DIRECTION_MISMATCH, _head_path.str());
+ return Event::pre_process_done(DIRECTION_MISMATCH, _head_path);
}
NodeImpl* const tail_node = tail->parent_node();
NodeImpl* const head_node = head->parent_node();
if (!tail_node || !head_node) {
- return Event::pre_process_done(PARENT_NOT_FOUND, _head_path.str());
+ return Event::pre_process_done(PARENT_NOT_FOUND, _head_path);
}
if (tail_node->parent() != head_node->parent()
&& tail_node != head_node->parent()
&& tail_node->parent() != head_node) {
- return Event::pre_process_done(PARENT_DIFFERS, _head_path.str());
+ return Event::pre_process_done(PARENT_DIFFERS, _head_path);
}
if (!EdgeImpl::can_connect(tail_output, _head)) {
diff --git a/src/server/events/CreateNode.cpp b/src/server/events/CreateNode.cpp
index 27b5ce50..0c3e34bf 100644
--- a/src/server/events/CreateNode.cpp
+++ b/src/server/events/CreateNode.cpp
@@ -66,16 +66,16 @@ CreateNode::pre_process()
}
if (_engine.engine_store()->find_object(_path)) {
- return Event::pre_process_done(EXISTS, _path.str());
+ return Event::pre_process_done(EXISTS, _path);
}
if (!(_patch = _engine.engine_store()->find_patch(_path.parent()))) {
- return Event::pre_process_done(PARENT_NOT_FOUND, _path.parent().str());
+ return Event::pre_process_done(PARENT_NOT_FOUND, _path.parent());
}
PluginImpl* plugin = _engine.node_factory()->plugin(plugin_uri);
if (!plugin) {
- return Event::pre_process_done(PLUGIN_NOT_FOUND, plugin_uri);
+ return Event::pre_process_done(PLUGIN_NOT_FOUND, Raul::URI(plugin_uri));
}
const iterator p = _properties.find(uris.ingen_polyphonic);
@@ -89,7 +89,7 @@ CreateNode::pre_process()
polyphonic,
_patch,
_engine))) {
- return Event::pre_process_done(CREATION_FAILED, _path.str());
+ return Event::pre_process_done(CREATION_FAILED, _path);
}
_node->properties().insert(_properties.begin(), _properties.end());
@@ -106,13 +106,13 @@ CreateNode::pre_process()
_compiled_patch = _patch->compile();
}
- _update.push_back(make_pair(_node->path(), _node->properties()));
+ _update.push_back(make_pair(_node->uri(), _node->properties()));
for (uint32_t i = 0; i < _node->num_ports(); ++i) {
const PortImpl* port = _node->port_impl(i);
Resource::Properties pprops = port->properties();
pprops.erase(uris.ingen_value);
pprops.insert(std::make_pair(uris.ingen_value, port->value()));
- _update.push_back(std::make_pair(port->path(), pprops));
+ _update.push_back(std::make_pair(port->uri(), pprops));
}
return Event::pre_process_done(SUCCESS);
diff --git a/src/server/events/CreatePatch.cpp b/src/server/events/CreatePatch.cpp
index 0fe613ba..9821902d 100644
--- a/src/server/events/CreatePatch.cpp
+++ b/src/server/events/CreatePatch.cpp
@@ -114,7 +114,7 @@ void
CreatePatch::post_process()
{
if (!respond()) {
- _engine.broadcaster()->put(_path, _update);
+ _engine.broadcaster()->put(GraphObject::path_to_uri(_path), _update);
}
}
diff --git a/src/server/events/CreatePort.cpp b/src/server/events/CreatePort.cpp
index df9ebb6e..f45c200b 100644
--- a/src/server/events/CreatePort.cpp
+++ b/src/server/events/CreatePort.cpp
@@ -180,7 +180,7 @@ void
CreatePort::post_process()
{
if (!respond()) {
- _engine.broadcaster()->put(_path, _update);
+ _engine.broadcaster()->put(GraphObject::path_to_uri(_path), _update);
}
delete _old_ports_array;
diff --git a/src/server/events/Delete.cpp b/src/server/events/Delete.cpp
index 5a88de9f..3121d6ad 100644
--- a/src/server/events/Delete.cpp
+++ b/src/server/events/Delete.cpp
@@ -50,8 +50,9 @@ Delete::Delete(Engine& engine,
, _disconnect_event(NULL)
, _lock(engine.engine_store()->lock(), Glib::NOT_LOCK)
{
- if (Raul::Path::is_path(uri))
- _path = Raul::Path(uri.str());
+ if (GraphObject::uri_is_path(uri)) {
+ _path = GraphObject::uri_to_path(uri);
+ }
}
Delete::~Delete()
@@ -62,9 +63,7 @@ Delete::~Delete()
bool
Delete::pre_process()
{
- if (_path.is_root() ||
- _path == "path:/control_in" ||
- _path == "path:/control_out") {
+ if (_path == "/" || _path == "/control_in" || _path == "/control_out") {
return Event::pre_process_done(NOT_DELETABLE, _path);
}
@@ -170,7 +169,7 @@ Delete::post_process()
if (_disconnect_event) {
_disconnect_event->post_process();
}
- _engine.broadcaster()->del(_path);
+ _engine.broadcaster()->del(_uri);
_engine.broadcaster()->bundle_end();
}
diff --git a/src/server/events/Delta.cpp b/src/server/events/Delta.cpp
index 91980837..18f35ab6 100644
--- a/src/server/events/Delta.cpp
+++ b/src/server/events/Delta.cpp
@@ -105,13 +105,13 @@ Delta::pre_process()
{
typedef Properties::const_iterator iterator;
- const bool is_graph_object = Raul::Path::is_path(_subject);
+ const bool is_graph_object = GraphObject::uri_is_path(_subject);
// Take a writer lock while we modify the store
Glib::RWLock::WriterLock lock(_engine.engine_store()->lock());
_object = is_graph_object
- ? _engine.engine_store()->find_object(Raul::Path(_subject.str()))
+ ? _engine.engine_store()->find_object(GraphObject::uri_to_path(_subject))
: static_cast<Ingen::Resource*>(_engine.node_factory()->plugin(_subject));
if (!_object && (!is_graph_object || !_create)) {
@@ -121,7 +121,7 @@ Delta::pre_process()
const Ingen::URIs& uris = _engine.world()->uris();
if (is_graph_object && !_object) {
- Raul::Path path(_subject.str());
+ Raul::Path path(GraphObject::uri_to_path(_subject));
bool is_patch = false, is_node = false, is_port = false, is_output = false;
Ingen::Resource::type(uris, _properties, is_patch, is_node, is_port, is_output);
@@ -139,7 +139,7 @@ Delta::pre_process()
if (_create_event) {
_create_event->pre_process();
// Grab the object for applying properties, if the create-event succeeded
- _object = _engine.engine_store()->find_object(Raul::Path(_subject.str()));
+ _object = _engine.engine_store()->find_object(path);
} else {
return Event::pre_process_done(BAD_OBJECT_TYPE, _subject);
}
diff --git a/src/server/events/Get.cpp b/src/server/events/Get.cpp
index 8ffe9319..9ec581a1 100644
--- a/src/server/events/Get.cpp
+++ b/src/server/events/Get.cpp
@@ -16,6 +16,7 @@
#include <utility>
+#include "ingen/GraphObject.hpp"
#include "ingen/Interface.hpp"
#include "Broadcaster.hpp"
@@ -59,8 +60,8 @@ Get::pre_process()
return Event::pre_process_done(SUCCESS);
} else if (_uri == "ingen:engine") {
return Event::pre_process_done(SUCCESS);
- } else if (Raul::Path::is_valid(_uri.str())) {
- _object = _engine.engine_store()->find_object(Raul::Path(_uri.str()));
+ } else if (GraphObject::uri_is_path(_uri)) {
+ _object = _engine.engine_store()->find_object(GraphObject::uri_to_path(_uri));
return Event::pre_process_done(_object ? SUCCESS : NOT_FOUND, _uri);
} else {
_plugin = _engine.node_factory()->plugin(_uri);
@@ -76,9 +77,9 @@ send_port(Interface* client, const PortImpl* port)
props.erase(port->bufs().uris().ingen_value);
props.insert(std::make_pair(port->bufs().uris().ingen_value,
port->value()));
- client->put(port->path(), props);
+ client->put(port->uri(), props);
} else {
- client->put(port->path(), port->properties());
+ client->put(port->uri(), port->properties());
}
}
@@ -89,7 +90,7 @@ send_node(Interface* client, const NodeImpl* node)
if (plugin->type() == Plugin::Patch) {
send_patch(client, (const PatchImpl*)node);
} else {
- client->put(node->path(), node->properties());
+ client->put(node->uri(), node->properties());
for (size_t j = 0; j < node->num_ports(); ++j) {
send_port(client, node->port_impl(j));
}
@@ -99,11 +100,11 @@ send_node(Interface* client, const NodeImpl* node)
static void
send_patch(Interface* client, const PatchImpl* patch)
{
- client->put(patch->path(),
+ client->put(patch->uri(),
patch->properties(Resource::INTERNAL),
Resource::INTERNAL);
- client->put(patch->path(),
+ client->put(patch->uri(),
patch->properties(Resource::EXTERNAL),
Resource::EXTERNAL);
diff --git a/src/server/events/Get.hpp b/src/server/events/Get.hpp
index fd1059ad..fa88237d 100644
--- a/src/server/events/Get.hpp
+++ b/src/server/events/Get.hpp
@@ -26,7 +26,6 @@
namespace Ingen {
namespace Server {
-class GraphObject;
class PluginImpl;
namespace Events {
diff --git a/src/server/events/Move.cpp b/src/server/events/Move.cpp
index 483c77e7..5c16ca8b 100644
--- a/src/server/events/Move.cpp
+++ b/src/server/events/Move.cpp
@@ -80,7 +80,8 @@ Move::pre_process()
if (child_old_path == _old_path)
child_new_path = _new_path;
else
- child_new_path = Raul::Path(_new_path).base() + child_old_path.substr(_old_path.length()+1);
+ child_new_path = Raul::Path(_new_path).base()
+ + child_old_path.substr(_old_path.length() + 1);
PtrCast<GraphObjectImpl>(i->second)->set_path(child_new_path);
i->first = child_new_path;
diff --git a/src/server/events/SetPortValue.cpp b/src/server/events/SetPortValue.cpp
index f3d68f9b..0f63ed53 100644
--- a/src/server/events/SetPortValue.cpp
+++ b/src/server/events/SetPortValue.cpp
@@ -104,7 +104,8 @@ SetPortValue::apply(Context& context)
(const uint8_t*)_value.get_body())) {
_port->raise_set_by_user_flag();
} else {
- Raul::warn(Raul::fmt("Error writing to port %1%\n") % _port->path());
+ Raul::warn(Raul::fmt("Error writing to port %1%\n")
+ % _port->path().c_str());
}
} else {
Raul::warn(Raul::fmt("Unknown value type %1%\n") % _value.type());
@@ -116,7 +117,7 @@ SetPortValue::post_process()
{
if (!respond()) {
_engine.broadcaster()->set_property(
- _port->path(),
+ _port->uri(),
_engine.world()->uris().ingen_value,
_value);
}