summaryrefslogtreecommitdiffstats
path: root/src/server
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
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')
-rw-r--r--src/server/Broadcaster.cpp4
-rw-r--r--src/server/Context.cpp2
-rw-r--r--src/server/Event.hpp5
-rw-r--r--src/server/GraphObjectImpl.hpp2
-rw-r--r--src/server/JackDriver.cpp4
-rw-r--r--src/server/LV2Node.cpp11
-rw-r--r--src/server/NodeFactory.cpp2
-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
-rw-r--r--src/server/util.hpp2
18 files changed, 54 insertions, 47 deletions
diff --git a/src/server/Broadcaster.cpp b/src/server/Broadcaster.cpp
index aa7b7aae..fe8ceae4 100644
--- a/src/server/Broadcaster.cpp
+++ b/src/server/Broadcaster.cpp
@@ -36,7 +36,7 @@ Broadcaster::register_client(const Raul::URI& uri,
SharedPtr<Interface> client)
{
Glib::Mutex::Lock lock(_clients_mutex);
- LOG(Raul::info)(Raul::fmt("Registered client <%1%>\n") % uri);
+ LOG(Raul::info)(Raul::fmt("Registered client <%1%>\n") % uri.c_str());
_clients[uri] = client;
}
@@ -51,7 +51,7 @@ Broadcaster::unregister_client(const Raul::URI& uri)
const size_t erased = _clients.erase(uri);
if (erased > 0) {
- LOG(Raul::info)(Raul::fmt("Unregistered client <%1%>\n") % uri);
+ LOG(Raul::info)(Raul::fmt("Unregistered client <%1%>\n") % uri.c_str());
}
return (erased > 0);
diff --git a/src/server/Context.cpp b/src/server/Context.cpp
index 13c2c43f..846368d2 100644
--- a/src/server/Context.cpp
+++ b/src/server/Context.cpp
@@ -91,7 +91,7 @@ Context::emit_notifications(FrameTime end)
const char* key = _engine.world()->uri_map().unmap_uri(note.key);
if (key) {
_engine.broadcaster()->set_property(
- note.port->path(), key, value);
+ note.port->uri(), key, value);
} else {
Raul::error("Error unmapping notification key URI\n");
}
diff --git a/src/server/Event.hpp b/src/server/Event.hpp
index 5f2e99bb..e35e1895 100644
--- a/src/server/Event.hpp
+++ b/src/server/Event.hpp
@@ -23,6 +23,7 @@
#include "raul/Path.hpp"
#include "raul/SharedPtr.hpp"
+#include "ingen/GraphObject.hpp"
#include "ingen/Interface.hpp"
#include "ingen/Status.hpp"
@@ -106,6 +107,10 @@ protected:
return !st;
}
+ inline bool pre_process_done(Status st, const Raul::Path& subject) {
+ return pre_process_done(st, GraphObject::path_to_uri(subject));
+ }
+
/** Respond to the originating client. */
inline Status respond() {
if (_request_client) {
diff --git a/src/server/GraphObjectImpl.hpp b/src/server/GraphObjectImpl.hpp
index fa9cb6b9..4e626692 100644
--- a/src/server/GraphObjectImpl.hpp
+++ b/src/server/GraphObjectImpl.hpp
@@ -54,7 +54,6 @@ class GraphObjectImpl : public GraphObject
public:
virtual ~GraphObjectImpl() {}
- const Raul::URI& uri() const { return _path; }
const Raul::Symbol& symbol() const { return _symbol; }
GraphObject* graph_parent() const { return _parent; }
@@ -67,6 +66,7 @@ public:
if (new_sym[0] != '\0') {
_symbol = Raul::Symbol(new_sym);
}
+ set_uri(GraphObject::path_to_uri(new_path));
}
const Raul::Atom& get_property(const Raul::URI& key) const;
diff --git a/src/server/JackDriver.cpp b/src/server/JackDriver.cpp
index 8d4c13cc..e24bc13a 100644
--- a/src/server/JackDriver.cpp
+++ b/src/server/JackDriver.cpp
@@ -84,7 +84,7 @@ JackPort::create()
if (_jack_port == NULL) {
LOG(Raul::error)(Raul::fmt("Failed to register port %1%\n")
- % _patch_port->path());
+ % _patch_port->path().c_str());
throw JackDriver::PortRegistrationFailedException();
}
}
@@ -340,7 +340,7 @@ JackDriver::remove_port(ProcessContext& context,
}
}
- LOG(Raul::warn)(Raul::fmt("Unable to find port %1%\n") % path);
+ LOG(Raul::warn)(Raul::fmt("Unable to find port %1%\n") % path.c_str());
return NULL;
}
diff --git a/src/server/LV2Node.cpp b/src/server/LV2Node.cpp
index 646a8bbf..21fd3c34 100644
--- a/src/server/LV2Node.cpp
+++ b/src/server/LV2Node.cpp
@@ -79,7 +79,7 @@ LV2Node::make_instance(URIs& uris,
if (!inst) {
Raul::error(Raul::fmt("Failed to instantiate <%1%>\n")
- % _lv2_plugin->uri());
+ % _lv2_plugin->uri().c_str());
return SharedPtr<LilvInstance>();
}
@@ -124,7 +124,7 @@ LV2Node::make_instance(URIs& uris,
% port->path());*/
} else {
Raul::error(Raul::fmt("%1% auto-morphed to unknown type %2%\n")
- % port->path() % type);
+ % port->path().c_str() % type);
return SharedPtr<LilvInstance>();
}
}
@@ -295,7 +295,7 @@ LV2Node::instantiate(BufferFactory& bufs)
lilv_nodes_free(sizes);
Raul::info(Raul::fmt("Atom port %1% buffer size %2%\n")
- % path() % port_buffer_size);
+ % path().c_str() % port_buffer_size);
}
enum { UNKNOWN, INPUT, OUTPUT } direction = UNKNOWN;
@@ -307,7 +307,7 @@ LV2Node::instantiate(BufferFactory& bufs)
if (port_type == PortType::UNKNOWN || direction == UNKNOWN) {
Raul::error(Raul::fmt("<%1%> port %2% has unknown type or direction\n")
- % _lv2_plugin->uri() % port_sym.c_str());
+ % _lv2_plugin->uri().c_str() % port_sym.c_str());
ret = false;
break;
}
@@ -423,7 +423,8 @@ LV2Node::work(uint32_t size, const void* data)
if (_worker_iface) {
LV2_Handle inst = lilv_instance_get_handle(instance(0));
if (_worker_iface->work(inst, work_respond, this, size, data)) {
- Raul::error(Raul::fmt("Error calling %1% work method\n") % _path);
+ Raul::error(Raul::fmt("Error calling %1% work method\n")
+ % _path.c_str());
}
}
}
diff --git a/src/server/NodeFactory.cpp b/src/server/NodeFactory.cpp
index 4bf19036..502e5370 100644
--- a/src/server/NodeFactory.cpp
+++ b/src/server/NodeFactory.cpp
@@ -122,7 +122,7 @@ NodeFactory::load_lv2_plugins()
const string uri(lilv_node_as_uri(lilv_plugin_get_uri(lv2_plug)));
if (_plugins.find(uri) != _plugins.end()) {
- Raul::warn(Raul::fmt("Already discovered <%s>\n") % uri);
+ Raul::warn(Raul::fmt("Already discovered <%s>\n") % uri.c_str());
continue;
}
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);
}
diff --git a/src/server/util.hpp b/src/server/util.hpp
index 10c08d7f..54649c7e 100644
--- a/src/server/util.hpp
+++ b/src/server/util.hpp
@@ -84,7 +84,7 @@ set_denormal_flags()
static inline std::string
ingen_jack_port_name(const Raul::Path& path)
{
- return path.chop_start("/");
+ return path.substr(1);
}
} // namespace Server