summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-05-13 04:05:32 +0000
committerDavid Robillard <d@drobilla.net>2009-05-13 04:05:32 +0000
commit19928bb583e72802746b89e322f71ecc0fcb7427 (patch)
tree95912dc84d8c9dcf57939398514feaf148c1cd63
parent96f839e64de70a23210847e322d24690299287fe (diff)
downloadingen-19928bb583e72802746b89e322f71ecc0fcb7427.tar.gz
ingen-19928bb583e72802746b89e322f71ecc0fcb7427.tar.bz2
ingen-19928bb583e72802746b89e322f71ecc0fcb7427.zip
The great ID refactoring of 2009.
Path is now actually URI (scheme path: for now). Therefore ingen nodes and such live in the same namespace as ... well, everything. Including plugins. Thar be profit, laddies. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@1992 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--src/client/ClientStore.cpp255
-rw-r--r--src/client/ClientStore.hpp84
-rw-r--r--src/client/ConnectionModel.hpp4
-rw-r--r--src/client/DeprecatedLoader.cpp22
-rw-r--r--src/client/DeprecatedLoader.hpp44
-rw-r--r--src/client/HTTPClientReceiver.cpp2
-rw-r--r--src/client/HTTPEngineSender.cpp86
-rw-r--r--src/client/HTTPEngineSender.hpp123
-rw-r--r--src/client/NodeModel.cpp5
-rw-r--r--src/client/NodeModel.hpp12
-rw-r--r--src/client/OSCEngineSender.cpp90
-rw-r--r--src/client/OSCEngineSender.hpp118
-rw-r--r--src/client/ObjectModel.cpp7
-rw-r--r--src/client/ObjectModel.hpp43
-rw-r--r--src/client/PatchModel.cpp9
-rw-r--r--src/client/PatchModel.hpp15
-rw-r--r--src/client/PluginModel.cpp6
-rw-r--r--src/client/PluginModel.hpp25
-rw-r--r--src/client/PluginUI.cpp2
-rw-r--r--src/client/PortModel.cpp2
-rw-r--r--src/client/PortModel.hpp38
-rw-r--r--src/client/SigClientInterface.hpp83
-rw-r--r--src/client/ThreadedSigClientInterface.hpp82
-rw-r--r--src/common/interface/ClientInterface.hpp20
-rw-r--r--src/common/interface/CommonInterface.hpp54
-rw-r--r--src/common/interface/DataType.hpp10
-rw-r--r--src/common/interface/EngineInterface.hpp31
-rw-r--r--src/common/interface/Resource.hpp12
-rw-r--r--src/engine/ClientBroadcaster.cpp29
-rw-r--r--src/engine/ClientBroadcaster.hpp33
-rw-r--r--src/engine/Event.hpp9
-rw-r--r--src/engine/GraphObjectImpl.cpp4
-rw-r--r--src/engine/GraphObjectImpl.hpp15
-rw-r--r--src/engine/HTTPClientSender.cpp70
-rw-r--r--src/engine/HTTPClientSender.hpp71
-rw-r--r--src/engine/HTTPEngineReceiver.cpp2
-rw-r--r--src/engine/InternalPlugin.cpp9
-rw-r--r--src/engine/LADSPANode.cpp2
-rw-r--r--src/engine/LV2Node.cpp4
-rw-r--r--src/engine/LV2Plugin.cpp2
-rw-r--r--src/engine/NodeFactory.cpp2
-rw-r--r--src/engine/NodeFactory.hpp16
-rw-r--r--src/engine/OSCClientSender.cpp46
-rw-r--r--src/engine/OSCClientSender.hpp77
-rw-r--r--src/engine/ObjectSender.cpp2
-rw-r--r--src/engine/QueuedEngineInterface.cpp72
-rw-r--r--src/engine/QueuedEngineInterface.hpp98
-rw-r--r--src/engine/events/AllNotesOffEvent.cpp4
-rw-r--r--src/engine/events/AllNotesOffEvent.hpp8
-rw-r--r--src/engine/events/ClearPatchEvent.cpp4
-rw-r--r--src/engine/events/ClearPatchEvent.hpp11
-rw-r--r--src/engine/events/ConnectionEvent.cpp2
-rw-r--r--src/engine/events/ConnectionEvent.hpp4
-rw-r--r--src/engine/events/CreateNodeEvent.cpp31
-rw-r--r--src/engine/events/CreateNodeEvent.hpp20
-rw-r--r--src/engine/events/CreatePatchEvent.cpp51
-rw-r--r--src/engine/events/CreatePatchEvent.hpp20
-rw-r--r--src/engine/events/CreatePortEvent.cpp18
-rw-r--r--src/engine/events/CreatePortEvent.hpp6
-rw-r--r--src/engine/events/DestroyEvent.cpp8
-rw-r--r--src/engine/events/DestroyEvent.hpp27
-rw-r--r--src/engine/events/DisablePortMonitoringEvent.cpp13
-rw-r--r--src/engine/events/DisablePortMonitoringEvent.hpp19
-rw-r--r--src/engine/events/DisconnectAllEvent.cpp6
-rw-r--r--src/engine/events/DisconnectAllEvent.hpp5
-rw-r--r--src/engine/events/DisconnectionEvent.cpp7
-rw-r--r--src/engine/events/DisconnectionEvent.hpp4
-rw-r--r--src/engine/events/LoadPluginsEvent.hpp7
-rw-r--r--src/engine/events/MidiLearnEvent.cpp6
-rw-r--r--src/engine/events/MidiLearnEvent.hpp9
-rw-r--r--src/engine/events/NoteEvent.cpp10
-rw-r--r--src/engine/events/NoteEvent.hpp14
-rw-r--r--src/engine/events/RegisterClientEvent.cpp8
-rw-r--r--src/engine/events/RegisterClientEvent.hpp21
-rw-r--r--src/engine/events/RenameEvent.cpp19
-rw-r--r--src/engine/events/RenameEvent.hpp20
-rw-r--r--src/engine/events/RequestAllObjectsEvent.hpp6
-rw-r--r--src/engine/events/RequestMetadataEvent.cpp10
-rw-r--r--src/engine/events/RequestMetadataEvent.hpp14
-rw-r--r--src/engine/events/RequestObjectEvent.cpp11
-rw-r--r--src/engine/events/RequestObjectEvent.hpp9
-rw-r--r--src/engine/events/RequestPluginEvent.cpp11
-rw-r--r--src/engine/events/RequestPluginEvent.hpp8
-rw-r--r--src/engine/events/RequestPortValueEvent.cpp13
-rw-r--r--src/engine/events/RequestPortValueEvent.hpp13
-rw-r--r--src/engine/events/SendPortActivityEvent.hpp2
-rw-r--r--src/engine/events/SendPortValueEvent.hpp2
-rw-r--r--src/engine/events/SetMetadataEvent.cpp23
-rw-r--r--src/engine/events/SetMetadataEvent.hpp16
-rw-r--r--src/engine/events/SetPortValueEvent.cpp62
-rw-r--r--src/engine/events/SetPortValueEvent.hpp17
-rw-r--r--src/engine/events/UnregisterClientEvent.cpp6
-rw-r--r--src/engine/events/UnregisterClientEvent.hpp16
-rw-r--r--src/gui/BreadCrumb.hpp2
-rw-r--r--src/gui/BreadCrumbBox.cpp5
-rw-r--r--src/gui/ConnectWindow.cpp11
-rw-r--r--src/gui/ControlPanel.cpp9
-rw-r--r--src/gui/ControlPanel.hpp12
-rw-r--r--src/gui/Controls.cpp9
-rw-r--r--src/gui/Controls.hpp29
-rw-r--r--src/gui/LoadPatchWindow.cpp2
-rw-r--r--src/gui/LoadPluginWindow.cpp14
-rw-r--r--src/gui/LoadPluginWindow.hpp2
-rw-r--r--src/gui/LoadRemotePatchWindow.cpp2
-rw-r--r--src/gui/NewSubpatchWindow.cpp3
-rw-r--r--src/gui/NodeControlWindow.cpp4
-rw-r--r--src/gui/NodeMenu.cpp4
-rw-r--r--src/gui/NodeModule.cpp34
-rw-r--r--src/gui/NodeModule.hpp2
-rw-r--r--src/gui/NodePropertiesWindow.cpp10
-rw-r--r--src/gui/ObjectMenu.cpp6
-rw-r--r--src/gui/ObjectMenu.hpp2
-rw-r--r--src/gui/PatchCanvas.cpp14
-rw-r--r--src/gui/PatchPortModule.cpp47
-rw-r--r--src/gui/PatchPortModule.hpp5
-rw-r--r--src/gui/PatchPropertiesWindow.cpp3
-rw-r--r--src/gui/PatchTreeWindow.cpp13
-rw-r--r--src/gui/PatchTreeWindow.hpp15
-rw-r--r--src/gui/PatchView.cpp9
-rw-r--r--src/gui/PatchView.hpp4
-rw-r--r--src/gui/PatchWindow.cpp6
-rw-r--r--src/gui/Port.cpp18
-rw-r--r--src/gui/Port.hpp2
-rw-r--r--src/gui/PortPropertiesWindow.cpp16
-rw-r--r--src/gui/PortPropertiesWindow.hpp17
-rw-r--r--src/gui/RenameWindow.cpp3
-rw-r--r--src/gui/ThreadedLoader.cpp2
-rw-r--r--src/gui/UploadPatchWindow.hpp4
-rw-r--r--src/ingen/main.cpp2
-rw-r--r--src/serialisation/Parser.cpp12
-rw-r--r--src/serialisation/Serialiser.cpp20
-rw-r--r--src/shared/Builder.cpp9
-rw-r--r--src/shared/ClashAvoider.cpp60
-rw-r--r--src/shared/ClashAvoider.hpp60
-rw-r--r--src/shared/ResourceImpl.cpp4
-rw-r--r--src/shared/ResourceImpl.hpp15
136 files changed, 1324 insertions, 1666 deletions
diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp
index c73150d0..f120e7ed 100644
--- a/src/client/ClientStore.cpp
+++ b/src/client/ClientStore.cpp
@@ -29,6 +29,7 @@ using namespace std;
using namespace Raul;
namespace Ingen {
+using namespace Shared;
namespace Client {
@@ -69,178 +70,6 @@ ClientStore::clear()
void
-ClientStore::add_plugin_orphan(SharedPtr<NodeModel> node)
-{
- if (!_handle_orphans)
- return;
-
- Raul::Table<string, list<SharedPtr<NodeModel> > >::iterator spawn
- = _plugin_orphans.find(node->plugin_uri());
-
- if (spawn != _plugin_orphans.end()) {
- spawn->second.push_back(node);
- } else {
- cerr << "WARNING: Orphans of plugin " << node->plugin_uri() << " received" << endl;
- _engine->request_plugin(node->plugin_uri());
- list<SharedPtr<NodeModel> > l;
- l.push_back(node);
- _plugin_orphans[node->plugin_uri()] = l;
- }
-}
-
-
-void
-ClientStore::resolve_plugin_orphans(SharedPtr<PluginModel> plugin)
-{
- if (!_handle_orphans)
- return;
- Raul::Table<string, list<SharedPtr<NodeModel> > >::iterator n
- = _plugin_orphans.find(plugin->uri());
-
- if (n != _plugin_orphans.end()) {
-
- list<SharedPtr<NodeModel> > spawn = n->second; // take a copy
- cerr << "Missing dependant " << plugin->uri() << " received" << endl;
-
- _plugin_orphans.erase(plugin->uri()); // prevent infinite recursion
-
- for (list<SharedPtr<NodeModel> >::iterator i = spawn.begin();
- i != spawn.end(); ++i) {
- (*i)->_plugin = plugin;
- //add_object(*i);
- }
- }
-}
-
-
-void
-ClientStore::add_connection_orphan(std::pair<Path, Path> orphan)
-{
- // Do this anyway, it's needed to get the connections for copy&paste
- //if (!_handle_orphans)
- //return;
-
- if (_handle_orphans)
- cerr << "WARNING: Orphan connection " << orphan.first
- << " -> " << orphan.second << " received." << endl;
-
- _connection_orphans.push_back(orphan);
-}
-
-
-void
-ClientStore::resolve_connection_orphans(SharedPtr<PortModel> port)
-{
- if (!_handle_orphans)
- return;
- assert(port->parent());
-
- for (list< pair<Path, Path> >::iterator c = _connection_orphans.begin();
- c != _connection_orphans.end(); ) {
-
- list< pair<Path, Path> >::iterator next = c;
- ++next;
-
- if (c->first == port->path() || c->second == port->path()) {
- cerr << "Missing dependant (" << c->first << " -> " << c->second << ") received" << endl;
- bool success = attempt_connection(c->first, c->second);
- if (success)
- _connection_orphans.erase(c);
- }
-
- c = next;
- }
-}
-
-
-void
-ClientStore::add_orphan(SharedPtr<ObjectModel> child)
-{
- if (!_handle_orphans)
- return;
- cerr << "WARNING: Orphan object " << child->path() << " received." << endl;
-
- Raul::PathTable<list<SharedPtr<ObjectModel> > >::iterator children
- = _orphans.find(child->path().parent());
-
- _engine->request_object(child->path().parent());
-
- if (children != _orphans.end()) {
- children->second.push_back(child);
- } else {
- list<SharedPtr<ObjectModel> > l;
- l.push_back(child);
- _orphans.insert(make_pair(child->path().parent(), l));
- }
-}
-
-
-void
-ClientStore::add_variable_orphan(const Path& subject_path, const string& predicate, const Atom& value)
-{
- if (!_handle_orphans)
- return;
- Raul::PathTable<list<std::pair<string, Atom> > >::iterator orphans
- = _variable_orphans.find(subject_path);
-
- //_engine->request_object(subject_path);
-
- if (orphans != _variable_orphans.end()) {
- orphans->second.push_back(std::pair<string, Atom>(predicate, value));
- } else {
- list<std::pair<string, Atom> > l;
- l.push_back(std::pair<string, Atom>(predicate, value));
- _variable_orphans[subject_path] = l;
- }
-}
-
-
-void
-ClientStore::resolve_variable_orphans(SharedPtr<ObjectModel> subject)
-{
- if (!_handle_orphans)
- return;
- Raul::PathTable<list<std::pair<string, Atom> > >::iterator v
- = _variable_orphans.find(subject->path());
-
- if (v != _variable_orphans.end()) {
-
- list<std::pair<string, Atom> > values = v->second; // take a copy
-
- _variable_orphans.erase(subject->path());
- cerr << "Missing dependant " << subject->path() << " received" << endl;
-
- for (list<std::pair<string, Atom> >::iterator i = values.begin();
- i != values.end(); ++i) {
- subject->set_variable(i->first, i->second);
- }
- }
-}
-
-
-void
-ClientStore::resolve_orphans(SharedPtr<ObjectModel> parent)
-{
- if (!_handle_orphans)
- return;
- Raul::PathTable<list<SharedPtr<ObjectModel> > >::iterator c
- = _orphans.find(parent->path());
-
- if (c != _orphans.end()) {
-
- list<SharedPtr<ObjectModel> > children = c->second; // take a copy
-
- _orphans.erase(parent->path()); // prevent infinite recursion
-
- for (list<SharedPtr<ObjectModel> >::iterator i = children.begin();
- i != children.end(); ++i) {
- add_object(*i);
- }
- }
-}
-
-
-void
ClientStore::add_object(SharedPtr<ObjectModel> object)
{
// If we already have "this" object, merge the existing one into the new
@@ -250,7 +79,7 @@ ClientStore::add_object(SharedPtr<ObjectModel> object)
PtrCast<ObjectModel>(existing->second)->set(object);
} else {
- if (object->path() != "/") {
+ if (!object->path().is_root()) {
SharedPtr<ObjectModel> parent = this->object(object->path().parent());
if (parent) {
assert(object->path().is_child_of(parent->path()));
@@ -261,15 +90,17 @@ ClientStore::add_object(SharedPtr<ObjectModel> object)
(*this)[object->path()] = object;
signal_new_object.emit(object);
+#if 0
resolve_variable_orphans(parent);
resolve_orphans(parent);
SharedPtr<PortModel> port = PtrCast<PortModel>(object);
if (port)
resolve_connection_orphans(port);
+#endif
} else {
- add_orphan(object);
+ //add_orphan(object);
}
} else {
(*this)[object->path()] = object;
@@ -308,7 +139,7 @@ ClientStore::remove_object(const Path& path)
if (result)
result->signal_destroyed.emit();
- if (result->path() != "/") {
+ if (!result->path().is_root()) {
assert(result->parent());
SharedPtr<ObjectModel> parent = this->object(result->path().parent());
@@ -328,7 +159,7 @@ ClientStore::remove_object(const Path& path)
SharedPtr<PluginModel>
-ClientStore::plugin(const string& uri)
+ClientStore::plugin(const URI& uri)
{
assert(uri.length() > 0);
Plugins::iterator i = _plugins->find(uri);
@@ -349,7 +180,7 @@ ClientStore::object(const Path& path)
} else {
SharedPtr<ObjectModel> model = PtrCast<ObjectModel>(i->second);
assert(model);
- assert(model->path() == "/" || model->parent());
+ assert(model->path().is_root() || model->parent());
return model;
}
}
@@ -369,7 +200,7 @@ ClientStore::add_plugin(SharedPtr<PluginModel> pm)
void
-ClientStore::destroy(const std::string& path)
+ClientStore::destroy(const Path& path)
{
SharedPtr<ObjectModel> removed = remove_object(path);
removed.reset();
@@ -377,13 +208,8 @@ ClientStore::destroy(const std::string& path)
}
void
-ClientStore::rename(const std::string& old_path_str, const std::string& new_path_str)
+ClientStore::rename(const Path& old_path_str, const Path& new_path_str)
{
- if (!Path::is_valid(old_path_str) || !Path::is_valid(new_path_str)) {
- cerr << "[Store] Bad path renaming " << old_path_str << " to " << new_path_str << endl;
- return;
- }
-
Path old_path(old_path_str);
Path new_path(new_path_str);
@@ -427,12 +253,12 @@ ClientStore::rename(const std::string& old_path_str, const std::string& new_path
}
void
-ClientStore::new_plugin(const string& uri, const string& type_uri, const string& symbol)
+ClientStore::new_plugin(const URI& uri, const URI& type_uri, const Symbol& symbol)
{
SharedPtr<PluginModel> p(new PluginModel(uri, type_uri));
p->set_property("lv2:symbol", Atom(Atom::STRING, symbol));
add_plugin(p);
- resolve_plugin_orphans(p);
+ //resolve_plugin_orphans(p);
}
@@ -464,7 +290,7 @@ ClientStore::new_object(const Shared::GraphObject* object)
void
-ClientStore::new_patch(const string& path, uint32_t poly)
+ClientStore::new_patch(const Path& path, uint32_t poly)
{
SharedPtr<PatchModel> p(new PatchModel(path, poly));
add_object(p);
@@ -472,12 +298,12 @@ ClientStore::new_patch(const string& path, uint32_t poly)
void
-ClientStore::new_node(const string& path, const string& plugin_uri)
+ClientStore::new_node(const Path& path, const URI& plugin_uri)
{
SharedPtr<PluginModel> plug = plugin(plugin_uri);
if (!plug) {
SharedPtr<NodeModel> n(new NodeModel(plugin_uri, path));
- add_plugin_orphan(n);
+ //add_plugin_orphan(n);
add_object(n);
} else {
SharedPtr<NodeModel> n(new NodeModel(plug, path));
@@ -487,27 +313,20 @@ ClientStore::new_node(const string& path, const string& plugin_uri)
void
-ClientStore::new_port(const string& path, const string& type, uint32_t index, bool is_output)
+ClientStore::new_port(const Path& path, const URI& type, uint32_t index, bool is_output)
{
PortModel::Direction pdir = is_output ? PortModel::OUTPUT : PortModel::INPUT;
SharedPtr<PortModel> p(new PortModel(path, index, type, pdir));
add_object(p);
- if (p->parent())
- resolve_connection_orphans(p);
+ /*if (p->parent())
+ resolve_connection_orphans(p);*/
}
void
-ClientStore::clear_patch(const std::string& path_str)
+ClientStore::clear_patch(const Path& path)
{
- if (!Path::is_valid(path_str)) {
- cerr << "[Store] Illegal path in clear: " << path_str << endl;
- return;
- }
-
- Path path(path_str);
-
iterator i = find(path);
if (i != end()) {
assert((*i).second->path() == path);
@@ -534,7 +353,7 @@ ClientStore::clear_patch(const std::string& path_str)
void
-ClientStore::set_variable(const string& subject_path, const string& predicate, const Atom& value)
+ClientStore::set_variable(const Path& subject_path, const URI& predicate, const Atom& value)
{
SharedPtr<ObjectModel> subject = object(subject_path);
@@ -543,40 +362,28 @@ ClientStore::set_variable(const string& subject_path, const string& predicate, c
} else if (subject) {
subject->set_variable(predicate, value);
} else {
- add_variable_orphan(subject_path, predicate, value);
+ //add_variable_orphan(subject_path, predicate, value);
cerr << "WARNING: variable '" << predicate << "' for unknown object " << subject_path << endl;
}
}
void
-ClientStore::set_property(const string& subject_path, const string& predicate, const Atom& value)
+ClientStore::set_property(const Path& subject_path, const URI& predicate, const Atom& value)
{
if (!value.is_valid())
cerr << "WARNING: property '" << predicate << "' is NULL" << endl;
- if (Path::is_valid(subject_path)) {
- SharedPtr<ObjectModel> obj = object(subject_path);
- if (obj)
- obj->set_property(predicate, value);
- else
+ SharedPtr<ObjectModel> obj = object(subject_path);
+ if (obj)
+ obj->set_property(predicate, value);
+ else
cerr << "WARNING: property '" << predicate << "' for unknown object " << subject_path << endl;
- } else {
- if (subject_path.find(":") != string::npos
- && predicate == "rdf:type" && value.type() == Atom::URI) {
- const std::string& type = value.get_uri();
- if ( (type == "http://drobilla.net/ns/ingen#LADSPAPlugin")
- || (type == "http://drobilla.net/ns/ingen#Internal")
- || (type == "http://lv2plug.in/ns/lv2core#Plugin")) {
- add_plugin(SharedPtr<PluginModel>(new PluginModel(subject_path, type)));
- }
- }
- }
}
void
-ClientStore::set_port_value(const string& port_path, const Raul::Atom& value)
+ClientStore::set_port_value(const Path& port_path, const Atom& value)
{
SharedPtr<PortModel> port = PtrCast<PortModel>(object(port_path));
if (port)
@@ -587,7 +394,7 @@ ClientStore::set_port_value(const string& port_path, const Raul::Atom& value)
void
-ClientStore::set_voice_value(const string& port_path, uint32_t voice, const Raul::Atom& value)
+ClientStore::set_voice_value(const Path& port_path, uint32_t voice, const Atom& value)
{
SharedPtr<PortModel> port = PtrCast<PortModel>(object(port_path));
if (port)
@@ -654,7 +461,7 @@ ClientStore::attempt_connection(const Path& src_port_path, const Path& dst_port_
patch->add_connection(cm);
return true;
} else if (add_orphan) {
- add_connection_orphan(make_pair(src_port_path, dst_port_path));
+ //add_connection_orphan(make_pair(src_port_path, dst_port_path));
}
return false;
@@ -662,14 +469,14 @@ ClientStore::attempt_connection(const Path& src_port_path, const Path& dst_port_
void
-ClientStore::connect(const string& src_port_path, const string& dst_port_path)
+ClientStore::connect(const Path& src_port_path, const Path& dst_port_path)
{
attempt_connection(src_port_path, dst_port_path, true);
}
void
-ClientStore::disconnect(const string& src_port_path, const string& dst_port_path)
+ClientStore::disconnect(const Path& src_port_path, const Path& dst_port_path)
{
// Find the ports and create a ConnectionModel just to get at the parent path
// finding logic in ConnectionModel. So I'm lazy.
diff --git a/src/client/ClientStore.hpp b/src/client/ClientStore.hpp
index d3ab2978..9fb95b0b 100644
--- a/src/client/ClientStore.hpp
+++ b/src/client/ClientStore.hpp
@@ -31,11 +31,6 @@
namespace Raul { class Atom; }
-using namespace std;
-using Ingen::Shared::EngineInterface;
-using Raul::Path;
-using Raul::Atom;
-
namespace Ingen {
namespace Shared { class GraphObject; }
@@ -57,37 +52,34 @@ class ConnectionModel;
*/
class ClientStore : public Shared::Store, public Shared::CommonInterface, public sigc::trackable {
public:
- ClientStore(SharedPtr<EngineInterface> engine=SharedPtr<EngineInterface>(),
+ ClientStore(SharedPtr<Shared::EngineInterface> engine=SharedPtr<Shared::EngineInterface>(),
SharedPtr<SigClientInterface> emitter=SharedPtr<SigClientInterface>());
- SharedPtr<PluginModel> plugin(const string& uri);
- SharedPtr<ObjectModel> object(const Path& path);
+ SharedPtr<PluginModel> plugin(const Raul::URI& uri);
+ SharedPtr<ObjectModel> object(const Raul::Path& path);
void clear();
- typedef Raul::Table<string, SharedPtr<PluginModel> > Plugins;
+ typedef Raul::Table<Raul::URI, SharedPtr<PluginModel> > Plugins;
SharedPtr<const Plugins> plugins() const { return _plugins; }
SharedPtr<Plugins> plugins() { return _plugins; }
void set_plugins(SharedPtr<Plugins> p) { _plugins = p; }
// CommonInterface
- void new_plugin(const string& uri, const string& type_uri, const string& symbol);
+ void new_plugin(const Raul::URI& uri, const Raul::URI& type_uri, const Raul::Symbol& symbol);
bool new_object(const Shared::GraphObject* object);
- void new_patch(const string& path, uint32_t poly);
- void new_node(const string& path, const string& plugin_uri);
- void new_port(const string& path, const string& type, uint32_t index, bool is_output);
- void rename(const string& old_path, const string& new_path);
- void set_variable(const string& subject_path, const string& predicate, const Atom& value);
- void set_property(const string& subject_path, const string& predicate, const Atom& value);
- void set_port_value(const string& port_path, const Raul::Atom& value);
- void set_voice_value(const string& port_path, uint32_t voice, const Raul::Atom& value);
- void connect(const string& src_port_path, const string& dst_port_path);
- void disconnect(const string& src_port_path, const string& dst_port_path);
- void destroy(const string& path);
+ void new_patch(const Raul::Path& path, uint32_t poly);
+ void new_node(const Raul::Path& path, const Raul::URI& plugin_uri);
+ void new_port(const Raul::Path& path, const Raul::URI& type, uint32_t index, bool is_output);
+ void rename(const Raul::Path& old_path, const Raul::Path& new_path);
+ void set_variable(const Raul::Path& subject_path, const Raul::URI& predicate, const Raul::Atom& value);
+ void set_property(const Raul::Path& subject_path, const Raul::URI& predicate, const Raul::Atom& value);
+ void set_port_value(const Raul::Path& port_path, const Raul::Atom& value);
+ void set_voice_value(const Raul::Path& port_path, uint32_t voice, const Raul::Atom& value);
+ void connect(const Raul::Path& src_port_path, const Raul::Path& dst_port_path);
+ void disconnect(const Raul::Path& src_port_path, const Raul::Path& dst_port_path);
+ void destroy(const Raul::Path& path);
- typedef list< std::pair<Path, Path> > ConnectionRecords;
- const ConnectionRecords& connection_records() { return _connection_orphans; }
-
sigc::signal<void, SharedPtr<ObjectModel> > signal_new_object;
sigc::signal<void, SharedPtr<PluginModel> > signal_new_plugin;
@@ -96,56 +88,28 @@ private:
void add(Shared::GraphObject* o) { throw; }
void add_object(SharedPtr<ObjectModel> object);
- SharedPtr<ObjectModel> remove_object(const Path& path);
+ SharedPtr<ObjectModel> remove_object(const Raul::Path& path);
void add_plugin(SharedPtr<PluginModel> plugin);
- SharedPtr<PatchModel> connection_patch(const Path& src_port_path, const Path& dst_port_path);
+ SharedPtr<PatchModel> connection_patch(const Raul::Path& src_port_path, const Raul::Path& dst_port_path);
- // It would be nice to integrate these somehow..
-
- void add_orphan(SharedPtr<ObjectModel> orphan);
- void resolve_orphans(SharedPtr<ObjectModel> parent);
-
- void add_connection_orphan(std::pair<Path, Path> orphan);
- void resolve_connection_orphans(SharedPtr<PortModel> port);
-
- void add_plugin_orphan(SharedPtr<NodeModel> orphan);
- void resolve_plugin_orphans(SharedPtr<PluginModel> plugin);
-
- void add_variable_orphan(const Path& subject, const string& predicate, const Atom& value);
- void resolve_variable_orphans(SharedPtr<ObjectModel> subject);
-
void bundle_begin() {}
void bundle_end() {}
// Slots for SigClientInterface signals
- void object_renamed(const Path& old_path, const Path& new_path);
- void clear_patch(const std::string& path);
- void activity(const Path& path);
+ void object_renamed(const Raul::Path& old_path, const Raul::Path& new_path);
+ void clear_patch(const Raul::Path& path);
+ void activity(const Raul::Path& path);
- bool attempt_connection(const Path& src_port_path, const Path& dst_port_path, bool add_orphan=false);
+ bool attempt_connection(const Raul::Path& src_port_path, const Raul::Path& dst_port_path, bool add_orphan=false);
bool _handle_orphans;
- SharedPtr<EngineInterface> _engine;
- SharedPtr<SigClientInterface> _emitter;
+ SharedPtr<Shared::EngineInterface> _engine;
+ SharedPtr<SigClientInterface> _emitter;
SharedPtr<Plugins> _plugins; ///< Map, keyed by plugin URI
-
- /** Objects we've received, but depend on the existance of another unknown object.
- * Keyed by the path of the depended-on object (for tolerance of orderless comms) */
- Raul::PathTable<list<SharedPtr<ObjectModel> > > _orphans;
-
- /** Same idea, except with plugins instead of parents.
- * It's unfortunate everything doesn't just have a URI and this was the same.. ahem.. */
- Raul::Table<string, list<SharedPtr<NodeModel> > > _plugin_orphans;
-
- /** Not orphans OF variable like the above, but orphans which are variable */
- Raul::PathTable<list<std::pair<string, Atom> > > _variable_orphans;
-
- /** Ditto */
- ConnectionRecords _connection_orphans;
};
diff --git a/src/client/ConnectionModel.hpp b/src/client/ConnectionModel.hpp
index 46b9050a..d0f98ec7 100644
--- a/src/client/ConnectionModel.hpp
+++ b/src/client/ConnectionModel.hpp
@@ -48,8 +48,8 @@ public:
SharedPtr<PortModel> src_port() const { return _src_port; }
SharedPtr<PortModel> dst_port() const { return _dst_port; }
- const Path src_port_path() const { return _src_port->path(); }
- const Path dst_port_path() const { return _dst_port->path(); }
+ const Raul::Path src_port_path() const { return _src_port->path(); }
+ const Raul::Path dst_port_path() const { return _dst_port->path(); }
private:
friend class ClientStore;
diff --git a/src/client/DeprecatedLoader.cpp b/src/client/DeprecatedLoader.cpp
index 5a315813..c0591609 100644
--- a/src/client/DeprecatedLoader.cpp
+++ b/src/client/DeprecatedLoader.cpp
@@ -36,8 +36,10 @@
#define NS_INTERNALS "http://drobilla.net/ns/ingen-internals#"
using namespace std;
+using namespace Raul;
namespace Ingen {
+using namespace Shared;
namespace Client {
@@ -48,21 +50,21 @@ namespace Client {
class ControlModel
{
public:
- ControlModel(const Path& port_path, float value)
+ ControlModel(const Raul::Path& port_path, float value)
: _port_path(port_path)
, _value(value)
{
assert(_port_path.find("//") == string::npos);
}
- const Path& port_path() const { return _port_path; }
- void port_path(const string& p) { _port_path = p; }
- float value() const { return _value; }
- void value(float v) { _value = v; }
+ const Raul::Path& port_path() const { return _port_path; }
+ void port_path(const string& p) { _port_path = p; }
+ float value() const { return _value; }
+ void value(float v) { _value = v; }
private:
- Path _port_path;
- float _value;
+ Raul::Path _port_path;
+ float _value;
};
@@ -289,7 +291,7 @@ DeprecatedLoader::load_patch(const Glib::ustring& filename,
poly = 1;
// Create it, if we're not merging
- if (!existing && path != "/") {
+ if (!existing && !path.is_root()) {
_engine->new_patch(path, poly);
for (GraphObject::Properties::const_iterator i = initial_data.begin(); i != initial_data.end(); ++i)
_engine->set_variable(path, i->first, i->second);
@@ -333,7 +335,7 @@ DeprecatedLoader::load_patch(const Glib::ustring& filename,
list<ControlModel>::const_iterator i = pm->controls().begin();
for ( ; i != pm->controls().end(); ++i) {
const float value = i->value();
- _engine->set_port_value(translate_load_path(i->port_path()), Atom(value));
+ _engine->set_port_value(translate_load_path(i->port_path().str()), Atom(value));
}
} else {
cerr << "WARNING: Unknown preset: \"" << pm->name() << endl;
@@ -354,7 +356,7 @@ DeprecatedLoader::load_patch(const Glib::ustring& filename,
_load_path_translations.clear();
- return path;
+ return path.str();
}
diff --git a/src/client/DeprecatedLoader.hpp b/src/client/DeprecatedLoader.hpp
index dd391ca1..c229017c 100644
--- a/src/client/DeprecatedLoader.hpp
+++ b/src/client/DeprecatedLoader.hpp
@@ -30,10 +30,6 @@
#include "interface/GraphObject.hpp"
#include "ObjectModel.hpp"
-using std::string;
-using Ingen::Shared::EngineInterface;
-using Ingen::Shared::GraphObject;
-
namespace Raul { class Path; }
namespace Ingen {
@@ -52,41 +48,35 @@ class PresetModel; // defined in DeprecatedLoader.cpp
class DeprecatedLoader
{
public:
- DeprecatedLoader(SharedPtr<EngineInterface> engine)
- : /*_patch_search_path(".")*/ _engine(engine)
+ DeprecatedLoader(SharedPtr<Shared::EngineInterface> engine)
+ : _engine(engine)
{
assert(_engine);
}
- /*void path(const string& path) { _patch_search_path = path; }
- const string& path() { return _patch_search_path; }*/
-
- string find_file(const string& filename, const string& additional_path = "");
-
- string load_patch(const Glib::ustring& filename,
- bool merge,
- boost::optional<Path> parent_path,
- boost::optional<Symbol> name,
- GraphObject::Properties initial_data,
- bool existing = false);
+ std::string load_patch(const Glib::ustring& filename,
+ bool merge,
+ boost::optional<Raul::Path> parent_path,
+ boost::optional<Raul::Symbol> name,
+ Shared::GraphObject::Properties initial_data,
+ bool existing = false);
private:
- void add_variable(GraphObject::Properties& data, string key, string value);
+ void add_variable(Shared::GraphObject::Properties& data, std::string key, std::string value);
- string nameify_if_invalid(const string& name);
- string translate_load_path(const string& path);
+ std::string nameify_if_invalid(const std::string& name);
+ std::string translate_load_path(const std::string& path);
- //string _patch_search_path;
- SharedPtr<EngineInterface> _engine;
+ SharedPtr<Shared::EngineInterface> _engine;
/// Translations of paths from the loading file to actual paths (for deprecated patches)
- std::map<string, string> _load_path_translations;
+ std::map<std::string, std::string> _load_path_translations;
- bool load_node(const Path& parent, xmlDocPtr doc, const xmlNodePtr cur);
- bool load_connection(const Path& parent, xmlDocPtr doc, const xmlNodePtr cur);
- bool load_subpatch(const string& base_filename, const Path& parent, xmlDocPtr doc, const xmlNodePtr cur);
+ bool load_node(const Raul::Path& parent, xmlDocPtr doc, const xmlNodePtr cur);
+ bool load_connection(const Raul::Path& parent, xmlDocPtr doc, const xmlNodePtr cur);
+ bool load_subpatch(const std::string& base_filename, const Raul::Path& parent, xmlDocPtr doc, const xmlNodePtr cur);
- SharedPtr<PresetModel> load_preset(const Path& parent, xmlDocPtr doc, const xmlNodePtr cur);
+ SharedPtr<PresetModel> load_preset(const Raul::Path& parent, xmlDocPtr doc, const xmlNodePtr cur);
};
diff --git a/src/client/HTTPClientReceiver.cpp b/src/client/HTTPClientReceiver.cpp
index 969d617e..78e0ef7c 100644
--- a/src/client/HTTPClientReceiver.cpp
+++ b/src/client/HTTPClientReceiver.cpp
@@ -135,7 +135,7 @@ HTTPClientReceiver::message_callback(SoupSession* session, SoupMessage* msg, voi
{
HTTPClientReceiver* me = (HTTPClientReceiver*)ptr;
const string path = soup_message_get_uri(msg)->path;
- if (path == "/") {
+ if (path == Path::root_uri) {
me->_target->response_ok(0);
me->_target->enable();
diff --git a/src/client/HTTPEngineSender.cpp b/src/client/HTTPEngineSender.cpp
index 55119160..828af743 100644
--- a/src/client/HTTPEngineSender.cpp
+++ b/src/client/HTTPEngineSender.cpp
@@ -20,12 +20,14 @@
#include "HTTPEngineSender.hpp"
using namespace std;
+using namespace Raul;
namespace Ingen {
+using namespace Shared;
namespace Client {
-HTTPEngineSender::HTTPEngineSender(const string& engine_url)
+HTTPEngineSender::HTTPEngineSender(const URI& engine_url)
: _engine_url(engine_url)
, _id(0)
, _enabled(true)
@@ -67,7 +69,7 @@ HTTPEngineSender::register_client(ClientInterface* client)
void
-HTTPEngineSender::unregister_client(const string& uri)
+HTTPEngineSender::unregister_client(const URI& uri)
{
}
@@ -108,22 +110,22 @@ HTTPEngineSender::new_object(const Shared::GraphObject* object)
void
-HTTPEngineSender::new_patch(const string& path,
- uint32_t poly)
+HTTPEngineSender::new_patch(const Path& path,
+ uint32_t poly)
{
}
void
-HTTPEngineSender::new_port(const string& path,
- const string& type,
- uint32_t index,
- bool is_output)
+HTTPEngineSender::new_port(const Path& path,
+ const URI& type,
+ uint32_t index,
+ bool is_output)
{
- const string uri = _engine_url + "/patch" + path;
+ const string uri = _engine_url.str() + "/patch" + path.str();
cout << "HTTP " << uri << " NEW PORT: " << path << endl;
SoupMessage* msg = soup_message_new("PUT", uri.c_str());
- string str = string("NEW PORT").append(path).append(type);
+ string str = string("NEW PORT").append(path.str()).append(type.str());
soup_message_set_request(msg, "application/x-turtle",
SOUP_MEMORY_COPY, str.c_str(), str.length());
soup_session_send_message(_session, msg);
@@ -131,93 +133,93 @@ HTTPEngineSender::new_port(const string& path,
void
-HTTPEngineSender::new_node(const string& path,
- const string& plugin_uri)
+HTTPEngineSender::new_node(const Path& path,
+ const URI& plugin_uri)
{
}
void
-HTTPEngineSender::rename(const string& old_path,
- const string& new_name)
+HTTPEngineSender::rename(const Path& old_path,
+ const Path& new_path)
{
}
void
-HTTPEngineSender::destroy(const string& path)
+HTTPEngineSender::destroy(const Path& path)
{
}
void
-HTTPEngineSender::clear_patch(const string& patch_path)
+HTTPEngineSender::clear_patch(const Path& patch_path)
{
}
void
-HTTPEngineSender::connect(const string& src_port_path,
- const string& dst_port_path)
+HTTPEngineSender::connect(const Path& src_port_path,
+ const Path& dst_port_path)
{
}
void
-HTTPEngineSender::disconnect(const string& src_port_path,
- const string& dst_port_path)
+HTTPEngineSender::disconnect(const Path& src_port_path,
+ const Path& dst_port_path)
{
}
void
-HTTPEngineSender::disconnect_all(const string& parent_patch_path,
- const string& path)
+HTTPEngineSender::disconnect_all(const Path& parent_patch_path,
+ const Path& path)
{
}
void
-HTTPEngineSender::set_port_value(const string& port_path,
- const Raul::Atom& value)
+HTTPEngineSender::set_port_value(const Path& port_path,
+ const Atom& value)
{
}
void
-HTTPEngineSender::set_voice_value(const string& port_path,
- uint32_t voice,
- const Raul::Atom& value)
+HTTPEngineSender::set_voice_value(const Path& port_path,
+ uint32_t voice,
+ const Atom& value)
{
}
void
-HTTPEngineSender::set_program(const string& node_path,
- uint32_t bank,
- uint32_t program)
+HTTPEngineSender::set_program(const Path& node_path,
+ uint32_t bank,
+ uint32_t program)
{
}
void
-HTTPEngineSender::midi_learn(const string& node_path)
+HTTPEngineSender::midi_learn(const Path& node_path)
{
}
void
-HTTPEngineSender::set_variable(const string& obj_path,
- const string& predicate,
- const Raul::Atom& value)
+HTTPEngineSender::set_variable(const Path& path,
+ const URI& predicate,
+ const Atom& value)
{
}
void
-HTTPEngineSender::set_property(const string& obj_path,
- const string& predicate,
- const Raul::Atom& value)
+HTTPEngineSender::set_property(const Path& path,
+ const URI& predicate,
+ const Atom& value)
{
}
@@ -232,31 +234,31 @@ HTTPEngineSender::ping()
void
-HTTPEngineSender::request_plugin(const string& uri)
+HTTPEngineSender::request_plugin(const URI& uri)
{
}
void
-HTTPEngineSender::request_object(const string& path)
+HTTPEngineSender::request_object(const Path& path)
{
}
void
-HTTPEngineSender::request_port_value(const string& port_path)
+HTTPEngineSender::request_port_value(const Path& port_path)
{
}
void
-HTTPEngineSender::request_variable(const string& object_path, const string& key)
+HTTPEngineSender::request_variable(const Path& object_path, const URI& key)
{
}
void
-HTTPEngineSender::request_property(const string& object_path, const string& key)
+HTTPEngineSender::request_property(const Path& object_path, const URI& key)
{
}
diff --git a/src/client/HTTPEngineSender.hpp b/src/client/HTTPEngineSender.hpp
index 1579e120..7de785fc 100644
--- a/src/client/HTTPEngineSender.hpp
+++ b/src/client/HTTPEngineSender.hpp
@@ -21,10 +21,8 @@
#include <inttypes.h>
#include <string>
#include <libsoup/soup.h>
+#include "raul/Path.hpp"
#include "interface/EngineInterface.hpp"
-using std::string;
-using Ingen::Shared::EngineInterface;
-using Ingen::Shared::ClientInterface;
namespace Ingen {
namespace Client {
@@ -37,12 +35,12 @@ namespace Client {
*
* \ingroup IngenClient
*/
-class HTTPEngineSender : public EngineInterface {
+class HTTPEngineSender : public Shared::EngineInterface {
public:
- HTTPEngineSender(const string& engine_url);
+ HTTPEngineSender(const Raul::URI& engine_url);
~HTTPEngineSender();
- string uri() const { return _engine_url; }
+ Raul::URI uri() const { return _engine_url; }
inline int32_t next_id()
{ int32_t ret = (_id == -1) ? -1 : _id++; return ret; }
@@ -65,8 +63,8 @@ public:
void transfer_end() {}
// Client registration
- void register_client(ClientInterface* client);
- void unregister_client(const string& uri);
+ void register_client(Shared::ClientInterface* client);
+ void unregister_client(const Raul::URI& uri);
// Engine commands
void load_plugins();
@@ -76,72 +74,73 @@ public:
// Object commands
- bool new_object(const Shared::GraphObject* object);
+ virtual bool new_object(const Shared::GraphObject* object);
- void new_patch(const string& path,
- uint32_t poly);
-
- void new_port(const string& path,
- const string& type,
- uint32_t index,
- bool is_output);
-
- void new_node(const string& path,
- const string& plugin_uri);
+ virtual void new_patch(const Raul::Path& path,
+ uint32_t poly);
- void rename(const string& old_path,
- const string& new_name);
-
- void destroy(const string& path);
-
- void clear_patch(const string& patch_path);
+ virtual void new_node(const Raul::Path& path,
+ const Raul::URI& plugin_uri);
- void connect(const string& src_port_path,
- const string& dst_port_path);
-
- void disconnect(const string& src_port_path,
- const string& dst_port_path);
-
- void disconnect_all(const string& parent_patch_path,
- const string& path);
-
- void set_port_value(const string& port_path,
- const Raul::Atom& value);
-
- void set_voice_value(const string& port_path,
- uint32_t voice,
- const Raul::Atom& value);
+ virtual void new_port(const Raul::Path& path,
+ const Raul::URI& type,
+ uint32_t index,
+ bool is_output);
- void set_program(const string& node_path,
- uint32_t bank,
- uint32_t program);
-
- void midi_learn(const string& node_path);
-
- void set_variable(const string& obj_path,
- const string& predicate,
- const Raul::Atom& value);
+ virtual void clear_patch(const Raul::Path& path);
+
+ virtual void destroy(const Raul::Path& path);
- void set_property(const string& obj_path,
- const string& predicate,
- const Raul::Atom& value);
+ virtual void rename(const Raul::Path& old_path,
+ const Raul::Path& new_path);
+ virtual void connect(const Raul::Path& src_port_path,
+ const Raul::Path& dst_port_path);
+
+ virtual void disconnect(const Raul::Path& src_port_path,
+ const Raul::Path& dst_port_path);
+
+ virtual void disconnect_all(const Raul::Path& parent_patch_path,
+ const Raul::Path& path);
+
+ virtual void set_variable(const Raul::Path& subject_path,
+ const Raul::URI& predicate,
+ const Raul::Atom& value);
+
+ virtual void set_property(const Raul::Path& subject_path,
+ const Raul::URI& predicate,
+ const Raul::Atom& value);
+
+ virtual void set_port_value(const Raul::Path& port_path,
+ const Raul::Atom& value);
+
+ virtual void set_voice_value(const Raul::Path& port_path,
+ uint32_t voice,
+ const Raul::Atom& value);
+
+ virtual void set_program(const Raul::Path& node_path,
+ uint32_t bank,
+ uint32_t program);
+
+ virtual void midi_learn(const Raul::Path& node_path);
+
+
// Requests //
void ping();
- void request_plugin(const string& uri);
- void request_object(const string& path);
- void request_port_value(const string& port_path);
- void request_variable(const string& path, const string& key);
- void request_property(const string& path, const string& key);
+ void request_plugin(const Raul::URI& uri);
+ void request_object(const Raul::Path& path);
+ void request_port_value(const Raul::Path& port_path);
+ void request_variable(const Raul::Path& path, const Raul::URI& key);
+ void request_property(const Raul::Path& path, const Raul::URI& key);
void request_plugins();
void request_all_objects();
protected:
- SoupSession* _session;
- const string _engine_url;
- int _client_port;
- int32_t _id;
- bool _enabled;
+ SoupSession* _session;
+ const Raul::URI _engine_url;
+ int _client_port;
+ int32_t _id;
+ bool _enabled;
};
diff --git a/src/client/NodeModel.cpp b/src/client/NodeModel.cpp
index 5c8f0d28..97743098 100644
--- a/src/client/NodeModel.cpp
+++ b/src/client/NodeModel.cpp
@@ -21,6 +21,9 @@
#include "interface/Port.hpp"
#include "NodeModel.hpp"
+using namespace std;
+using namespace Raul;
+
namespace Ingen {
namespace Client {
@@ -35,7 +38,7 @@ NodeModel::NodeModel(SharedPtr<PluginModel> plugin, const Path& path)
{
}
-NodeModel::NodeModel(const string& plugin_uri, const Path& path)
+NodeModel::NodeModel(const URI& plugin_uri, const Path& path)
: ObjectModel(path)
, _plugin_uri(plugin_uri)
, _num_values(0)
diff --git a/src/client/NodeModel.hpp b/src/client/NodeModel.hpp
index 1cf7233a..cc9811fd 100644
--- a/src/client/NodeModel.hpp
+++ b/src/client/NodeModel.hpp
@@ -54,7 +54,7 @@ public:
Shared::Port* port(uint32_t index) const;
- const std::string& plugin_uri() const { return _plugin_uri; }
+ const Raul::URI& plugin_uri() const { return _plugin_uri; }
const Shared::Plugin* plugin() const { return _plugin.get(); }
uint32_t num_ports() const { return _ports.size(); }
const Ports& ports() const { return _ports; }
@@ -68,15 +68,15 @@ public:
protected:
friend class ClientStore;
- NodeModel(const std::string& plugin_uri, const Path& path);
- NodeModel(SharedPtr<PluginModel> plugin, const Path& path);
+ NodeModel(const Raul::URI& plugin_uri, const Raul::Path& path);
+ NodeModel(SharedPtr<PluginModel> plugin, const Raul::Path& path);
- NodeModel(const Path& path);
+ NodeModel(const Raul::Path& path);
void add_child(SharedPtr<ObjectModel> c);
bool remove_child(SharedPtr<ObjectModel> c);
void add_port(SharedPtr<PortModel> pm);
void remove_port(SharedPtr<PortModel> pm);
- void remove_port(const Path& port_path);
+ void remove_port(const Raul::Path& port_path);
void add_program(int bank, int program, const std::string& name);
void remove_program(int bank, int program);
void set(SharedPtr<ObjectModel> model);
@@ -84,7 +84,7 @@ protected:
virtual void clear();
Ports _ports; ///< Vector of ports (not a Table to preserve order)
- std::string _plugin_uri; ///< Plugin URI (if PluginModel is unknown)
+ Raul::URI _plugin_uri; ///< Plugin URI (if PluginModel is unknown)
SharedPtr<PluginModel> _plugin; ///< The plugin this node is an instance of
private:
diff --git a/src/client/OSCEngineSender.cpp b/src/client/OSCEngineSender.cpp
index 8ff0b226..5bbbf5a0 100644
--- a/src/client/OSCEngineSender.cpp
+++ b/src/client/OSCEngineSender.cpp
@@ -17,13 +17,14 @@
#include <iostream>
#include "raul/AtomLiblo.hpp"
+#include "raul/Path.hpp"
#include "OSCEngineSender.hpp"
#include "common/interface/Patch.hpp"
#include "common/interface/Port.hpp"
#include "common/interface/Plugin.hpp"
using namespace std;
-using Raul::Atom;
+using namespace Raul;
namespace Ingen {
namespace Client {
@@ -33,7 +34,7 @@ namespace Client {
* from the most recently created server, so create the OSC listener before
* this to have it all happen on the same port. Yeah, this is a big magic :/
*/
-OSCEngineSender::OSCEngineSender(const string& engine_url)
+OSCEngineSender::OSCEngineSender(const URI& engine_url)
: _engine_url(engine_url)
, _id(0)
{
@@ -84,7 +85,7 @@ OSCEngineSender::attach(int32_t ping_id, bool block)
* traversal. It is a parameter to remain compatible with EngineInterface.
*/
void
-OSCEngineSender::register_client(ClientInterface* client)
+OSCEngineSender::register_client(Shared::ClientInterface* client)
{
// FIXME: use parameters.. er, somehow.
send("/ingen/register_client", "i", next_id(), LO_ARGS_END, LO_ARGS_END);
@@ -92,7 +93,7 @@ OSCEngineSender::register_client(ClientInterface* client)
void
-OSCEngineSender::unregister_client(const string& uri)
+OSCEngineSender::unregister_client(const URI& uri)
{
send("/ingen/unregister_client", "i", next_id(), LO_ARGS_END);
}
@@ -159,8 +160,8 @@ OSCEngineSender::new_object(const Shared::GraphObject* object)
void
-OSCEngineSender::new_patch(const string& path,
- uint32_t poly)
+OSCEngineSender::new_patch(const Path& path,
+ uint32_t poly)
{
send("/ingen/new_patch", "isi",
next_id(),
@@ -171,10 +172,10 @@ OSCEngineSender::new_patch(const string& path,
void
-OSCEngineSender::new_port(const string& path,
- const string& type,
- uint32_t index,
- bool is_output)
+OSCEngineSender::new_port(const Path& path,
+ const URI& type,
+ uint32_t index,
+ bool is_output)
{
// FIXME: use index
send("/ingen/new_port", "issi",
@@ -187,8 +188,8 @@ OSCEngineSender::new_port(const string& path,
void
-OSCEngineSender::new_node(const string& path,
- const string& plugin_uri)
+OSCEngineSender::new_node(const Path& path,
+ const URI& plugin_uri)
{
send("/ingen/new_node", "iss",
@@ -200,19 +201,19 @@ OSCEngineSender::new_node(const string& path,
void
-OSCEngineSender::rename(const string& old_path,
- const string& new_name)
+OSCEngineSender::rename(const Path& old_path,
+ const Path& new_path)
{
send("/ingen/rename", "iss",
next_id(),
old_path.c_str(),
- new_name.c_str(),
+ new_path.c_str(),
LO_ARGS_END);
}
void
-OSCEngineSender::destroy(const string& path)
+OSCEngineSender::destroy(const Path& path)
{
send("/ingen/destroy", "is",
next_id(),
@@ -222,7 +223,7 @@ OSCEngineSender::destroy(const string& path)
void
-OSCEngineSender::clear_patch(const string& patch_path)
+OSCEngineSender::clear_patch(const Path& patch_path)
{
send("/ingen/clear_patch", "is",
next_id(),
@@ -232,8 +233,8 @@ OSCEngineSender::clear_patch(const string& patch_path)
void
-OSCEngineSender::connect(const string& src_port_path,
- const string& dst_port_path)
+OSCEngineSender::connect(const Path& src_port_path,
+ const Path& dst_port_path)
{
send("/ingen/connect", "iss",
next_id(),
@@ -244,8 +245,8 @@ OSCEngineSender::connect(const string& src_port_path,
void
-OSCEngineSender::disconnect(const string& src_port_path,
- const string& dst_port_path)
+OSCEngineSender::disconnect(const Path& src_port_path,
+ const Path& dst_port_path)
{
send("/ingen/disconnect", "iss",
next_id(),
@@ -256,8 +257,8 @@ OSCEngineSender::disconnect(const string& src_port_path,
void
-OSCEngineSender::disconnect_all(const string& parent_patch_path,
- const string& path)
+OSCEngineSender::disconnect_all(const Path& parent_patch_path,
+ const Path& path)
{
send("/ingen/disconnect_all", "iss",
next_id(),
@@ -268,8 +269,8 @@ OSCEngineSender::disconnect_all(const string& parent_patch_path,
void
-OSCEngineSender::set_port_value(const string& port_path,
- const Raul::Atom& value)
+OSCEngineSender::set_port_value(const Path& port_path,
+ const Atom& value)
{
lo_message m = lo_message_new();
lo_message_add_int32(m, next_id());
@@ -282,9 +283,9 @@ OSCEngineSender::set_port_value(const string& port_path,
void
-OSCEngineSender::set_voice_value(const string& port_path,
- uint32_t voice,
- const Raul::Atom& value)
+OSCEngineSender::set_voice_value(const Path& port_path,
+ uint32_t voice,
+ const Atom& value)
{
lo_message m = lo_message_new();
lo_message_add_int32(m, next_id());
@@ -298,11 +299,11 @@ OSCEngineSender::set_voice_value(const string& port_path,
void
-OSCEngineSender::set_program(const string& node_path,
- uint32_t bank,
- uint32_t program)
+OSCEngineSender::set_program(const Path& node_path,
+ uint32_t bank,
+ uint32_t program)
{
- send((string("/dssi") + node_path + "/program").c_str(),
+ send((string("/dssi") + node_path.str() + "/program").c_str(),
"ii",
bank,
program,
@@ -311,7 +312,7 @@ OSCEngineSender::set_program(const string& node_path,
void
-OSCEngineSender::midi_learn(const string& node_path)
+OSCEngineSender::midi_learn(const Path& node_path)
{
send("/ingen/midi_learn", "is",
next_id(),
@@ -321,9 +322,9 @@ OSCEngineSender::midi_learn(const string& node_path)
void
-OSCEngineSender::set_variable(const string& obj_path,
- const string& predicate,
- const Raul::Atom& value)
+OSCEngineSender::set_variable(const Path& obj_path,
+ const URI& predicate,
+ const Atom& value)
{
lo_message m = lo_message_new();
lo_message_add_int32(m, next_id());
@@ -335,9 +336,9 @@ OSCEngineSender::set_variable(const string& obj_path,
void
-OSCEngineSender::set_property(const string& obj_path,
- const string& predicate,
- const Raul::Atom& value)
+OSCEngineSender::set_property(const Path& obj_path,
+ const URI& predicate,
+ const Atom& value)
{
lo_message m = lo_message_new();
lo_message_add_int32(m, next_id());
@@ -359,7 +360,7 @@ OSCEngineSender::ping()
void
-OSCEngineSender::request_plugin(const string& uri)
+OSCEngineSender::request_plugin(const URI& uri)
{
send("/ingen/request_plugin", "is",
next_id(),
@@ -369,7 +370,7 @@ OSCEngineSender::request_plugin(const string& uri)
void
-OSCEngineSender::request_object(const string& path)
+OSCEngineSender::request_object(const Path& path)
{
send("/ingen/request_object", "is",
next_id(),
@@ -379,7 +380,7 @@ OSCEngineSender::request_object(const string& path)
void
-OSCEngineSender::request_port_value(const string& port_path)
+OSCEngineSender::request_port_value(const Path& port_path)
{
send("/ingen/request_port_value", "is",
next_id(),
@@ -389,7 +390,7 @@ OSCEngineSender::request_port_value(const string& port_path)
void
-OSCEngineSender::request_variable(const string& object_path, const string& key)
+OSCEngineSender::request_variable(const Path& object_path, const URI& key)
{
send("/ingen/request_variable", "iss",
next_id(),
@@ -400,7 +401,7 @@ OSCEngineSender::request_variable(const string& object_path, const string& key)
void
-OSCEngineSender::request_property(const string& object_path, const string& key)
+OSCEngineSender::request_property(const Path& object_path, const URI& key)
{
send("/ingen/request_property", "iss",
next_id(),
@@ -424,7 +425,6 @@ OSCEngineSender::request_all_objects()
}
-
} // namespace Client
} // namespace Ingen
diff --git a/src/client/OSCEngineSender.hpp b/src/client/OSCEngineSender.hpp
index cae8586a..6771de71 100644
--- a/src/client/OSCEngineSender.hpp
+++ b/src/client/OSCEngineSender.hpp
@@ -23,9 +23,6 @@
#include <lo/lo.h>
#include "interface/EngineInterface.hpp"
#include "shared/OSCSender.hpp"
-using std::string;
-using Ingen::Shared::EngineInterface;
-using Ingen::Shared::ClientInterface;
namespace Ingen {
namespace Client {
@@ -38,16 +35,16 @@ namespace Client {
*
* \ingroup IngenClient
*/
-class OSCEngineSender : public EngineInterface, public Shared::OSCSender {
+class OSCEngineSender : public Shared::EngineInterface, public Shared::OSCSender {
public:
- OSCEngineSender(const string& engine_url);
+ OSCEngineSender(const Raul::URI& engine_url);
~OSCEngineSender();
- static OSCEngineSender* create(const std::string& engine_url) {
+ static OSCEngineSender* create(const Raul::URI& engine_url) {
return new OSCEngineSender(engine_url);
}
- std::string uri() const { return _engine_url; }
+ Raul::URI uri() const { return _engine_url; }
inline int32_t next_id()
{ int32_t ret = (_id == -1) ? -1 : _id++; return ret; }
@@ -69,8 +66,8 @@ public:
void transfer_end() { OSCSender::transfer_end(); }
// Client registration
- void register_client(ClientInterface* client);
- void unregister_client(const string& uri);
+ void register_client(Shared::ClientInterface* client);
+ void unregister_client(const Raul::URI& uri);
// Engine commands
void load_plugins();
@@ -80,70 +77,71 @@ public:
// Object commands
- bool new_object(const Shared::GraphObject* object);
-
- void new_patch(const string& path,
- uint32_t poly);
-
- void new_port(const string& path,
- const string& type,
- uint32_t index,
- bool is_output);
+ virtual bool new_object(const Shared::GraphObject* object);
- void new_node(const string& path,
- const string& plugin_uri);
+ virtual void new_patch(const Raul::Path& path,
+ uint32_t poly);
- void rename(const string& old_path,
- const string& new_name);
-
- void destroy(const string& path);
-
- void clear_patch(const string& patch_path);
+ virtual void new_node(const Raul::Path& path,
+ const Raul::URI& plugin_uri);
- void connect(const string& src_port_path,
- const string& dst_port_path);
-
- void disconnect(const string& src_port_path,
- const string& dst_port_path);
-
- void disconnect_all(const string& parent_patch_path,
- const string& path);
-
- void set_port_value(const string& port_path,
- const Raul::Atom& value);
-
- void set_voice_value(const string& port_path,
- uint32_t voice,
- const Raul::Atom& value);
+ virtual void new_port(const Raul::Path& path,
+ const Raul::URI& type,
+ uint32_t index,
+ bool is_output);
+
+ virtual void clear_patch(const Raul::Path& path);
+
+ virtual void destroy(const Raul::Path& path);
- void set_program(const string& node_path,
- uint32_t bank,
- uint32_t program);
+ virtual void rename(const Raul::Path& old_path,
+ const Raul::Path& new_path);
+
+ virtual void connect(const Raul::Path& src_port_path,
+ const Raul::Path& dst_port_path);
+
+ virtual void disconnect(const Raul::Path& src_port_path,
+ const Raul::Path& dst_port_path);
+
+ virtual void disconnect_all(const Raul::Path& parent_patch_path,
+ const Raul::Path& path);
+
+ virtual void set_variable(const Raul::Path& subject_path,
+ const Raul::URI& predicate,
+ const Raul::Atom& value);
+
+ virtual void set_property(const Raul::Path& subject_path,
+ const Raul::URI& predicate,
+ const Raul::Atom& value);
+
+ virtual void set_port_value(const Raul::Path& port_path,
+ const Raul::Atom& value);
+
+ virtual void set_voice_value(const Raul::Path& port_path,
+ uint32_t voice,
+ const Raul::Atom& value);
+
+ virtual void set_program(const Raul::Path& node_path,
+ uint32_t bank,
+ uint32_t program);
- void midi_learn(const string& node_path);
+ virtual void midi_learn(const Raul::Path& node_path);
- void set_variable(const string& obj_path,
- const string& predicate,
- const Raul::Atom& value);
-
- void set_property(const string& obj_path,
- const string& predicate,
- const Raul::Atom& value);
// Requests //
void ping();
- void request_plugin(const string& uri);
- void request_object(const string& path);
- void request_port_value(const string& port_path);
- void request_variable(const string& path, const string& key);
- void request_property(const string& path, const string& key);
+ void request_plugin(const Raul::URI& uri);
+ void request_object(const Raul::Path& path);
+ void request_port_value(const Raul::Path& port_path);
+ void request_variable(const Raul::Path& path, const Raul::URI& key);
+ void request_property(const Raul::Path& path, const Raul::URI& key);
void request_plugins();
void request_all_objects();
protected:
- const string _engine_url;
- int _client_port;
- int32_t _id;
+ const Raul::URI _engine_url;
+ int _client_port;
+ int32_t _id;
};
diff --git a/src/client/ObjectModel.cpp b/src/client/ObjectModel.cpp
index f5972af5..68326a3d 100644
--- a/src/client/ObjectModel.cpp
+++ b/src/client/ObjectModel.cpp
@@ -21,13 +21,14 @@
#include "ObjectModel.hpp"
using namespace std;
+using namespace Raul;
namespace Ingen {
namespace Client {
ObjectModel::ObjectModel(const Path& path)
- : ResourceImpl(string("patch/") + path)
+ : ResourceImpl(path)
, _path(path)
{
}
@@ -43,7 +44,7 @@ ObjectModel::~ObjectModel()
* @return Metadata value with key @a key, empty string otherwise.
*/
const Atom&
-ObjectModel::get_variable(const string& key) const
+ObjectModel::get_variable(const URI& key) const
{
static const Atom null_atom;
@@ -60,7 +61,7 @@ ObjectModel::get_variable(const string& key) const
* @return Metadata value with key @a key, empty string otherwise.
*/
Atom&
-ObjectModel::get_variable( string& key)
+ObjectModel::get_variable(URI& key)
{
static Atom null_atom;
diff --git a/src/client/ObjectModel.hpp b/src/client/ObjectModel.hpp
index 4d02e546..230a030e 100644
--- a/src/client/ObjectModel.hpp
+++ b/src/client/ObjectModel.hpp
@@ -20,22 +20,17 @@
#include <cstdlib>
#include <iostream>
-#include <string>
#include <algorithm>
#include <cassert>
#include <boost/utility.hpp>
#include <sigc++/sigc++.h>
#include "raul/Atom.hpp"
#include "raul/Path.hpp"
+#include "raul/URI.hpp"
#include "raul/SharedPtr.hpp"
#include "interface/GraphObject.hpp"
#include "shared/ResourceImpl.hpp"
-using std::string;
-using Raul::Atom;
-using Raul::Path;
-using Raul::Symbol;
-
namespace Ingen {
namespace Client {
@@ -59,50 +54,50 @@ class ObjectModel : virtual public Ingen::Shared::GraphObject
public:
virtual ~ObjectModel();
- const Atom& get_variable(const string& key) const;
- Atom& get_variable(string& key);
+ const Raul::Atom& get_variable(const Raul::URI& key) const;
+ Raul::Atom& get_variable(Raul::URI& key);
- virtual void set_property(const string& key, const Atom& value) {
+ virtual void set_property(const Raul::URI& key, const Raul::Atom& value) {
ResourceImpl::set_property(key, value);
signal_property.emit(key, value);
}
- virtual void set_variable(const string& key, const Atom& value)
+ virtual void set_variable(const Raul::URI& key, const Raul::Atom& value)
{ _variables[key] = value; signal_variable.emit(key, value); }
- const Properties& variables() const { return _variables; }
- Properties& variables() { return _variables; }
- const Path path() const { return _path; }
- const Symbol symbol() const { return _path.name(); }
+ const Properties& variables() const { return _variables; }
+ Properties& variables() { return _variables; }
+ const Raul::Path path() const { return _path; }
+ const Raul::Symbol symbol() const { return _path.name(); }
SharedPtr<ObjectModel> parent() const { return _parent; }
bool polyphonic() const;
GraphObject* graph_parent() const { return _parent.get(); }
// Signals
- sigc::signal<void, SharedPtr<ObjectModel> > signal_new_child;
- sigc::signal<void, SharedPtr<ObjectModel> > signal_removed_child;
- sigc::signal<void, const string&, const Atom&> signal_variable;
- sigc::signal<void, const string&, const Atom&> signal_property;
- sigc::signal<void> signal_destroyed;
- sigc::signal<void> signal_renamed;
+ sigc::signal<void, SharedPtr<ObjectModel> > signal_new_child;
+ sigc::signal<void, SharedPtr<ObjectModel> > signal_removed_child;
+ sigc::signal<void, const Raul::URI&, const Raul::Atom&> signal_variable;
+ sigc::signal<void, const Raul::URI&, const Raul::Atom&> signal_property;
+ sigc::signal<void> signal_destroyed;
+ sigc::signal<void> signal_renamed;
protected:
friend class ClientStore;
- ObjectModel(const Path& path);
+ ObjectModel(const Raul::Path& path);
- virtual void set_path(const Path& p) { _path = p; signal_renamed.emit(); }
+ virtual void set_path(const Raul::Path& p) { _path = p; signal_renamed.emit(); }
virtual void set_parent(SharedPtr<ObjectModel> p) { assert(p); _parent = p; }
virtual void add_child(SharedPtr<ObjectModel> c) {}
virtual bool remove_child(SharedPtr<ObjectModel> c) { return true; }
virtual void set(SharedPtr<ObjectModel> model);
- Path _path;
+ Raul::Path _path;
SharedPtr<ObjectModel> _parent;
- Properties _variables;
+ Properties _variables;
};
diff --git a/src/client/PatchModel.cpp b/src/client/PatchModel.cpp
index 980a902c..1f322259 100644
--- a/src/client/PatchModel.cpp
+++ b/src/client/PatchModel.cpp
@@ -23,6 +23,7 @@
#include "ClientStore.hpp"
using namespace std;
+using namespace Raul;
namespace Ingen {
namespace Client {
@@ -97,7 +98,7 @@ PatchModel::clear()
SharedPtr<ConnectionModel>
-PatchModel::get_connection(const string& src_port_path, const string& dst_port_path) const
+PatchModel::get_connection(const Path& src_port_path, const Path& dst_port_path) const
{
for (Connections::const_iterator i = _connections->begin(); i != _connections->end(); ++i)
if ((*i)->src_port_path() == src_port_path && (*i)->dst_port_path() == dst_port_path)
@@ -142,7 +143,7 @@ PatchModel::add_connection(SharedPtr<ConnectionModel> cm)
void
-PatchModel::remove_connection(const string& src_port_path, const string& dst_port_path)
+PatchModel::remove_connection(const Path& src_port_path, const Path& dst_port_path)
{
for (Connections::iterator i = _connections->begin(); i != _connections->end(); ++i) {
SharedPtr<ConnectionModel> cm = PtrCast<ConnectionModel>(*i);
@@ -169,10 +170,10 @@ PatchModel::enabled() const
void
-PatchModel::set_variable(const std::string& key, const Atom& value)
+PatchModel::set_variable(const Raul::URI& key, const Atom& value)
{
NodeModel::set_variable(key, value);
- if (key == "ingen:polyphony")
+ if (key.str() == "ingen:polyphony")
_poly = value.get_int32();
}
diff --git a/src/client/PatchModel.hpp b/src/client/PatchModel.hpp
index 4a8b3ee7..b07924cc 100644
--- a/src/client/PatchModel.hpp
+++ b/src/client/PatchModel.hpp
@@ -19,7 +19,6 @@
#define PATCHMODEL_H
#include <cassert>
-#include <string>
#include <sigc++/sigc++.h>
#include "raul/SharedPtr.hpp"
#include "interface/Patch.hpp"
@@ -27,8 +26,6 @@
#include "ConnectionModel.hpp"
-using std::string;
-
namespace Ingen {
namespace Client {
@@ -46,8 +43,8 @@ public:
const Connections& connections() const { return *_connections.get(); }
- SharedPtr<ConnectionModel> get_connection(const string& src_port_path,
- const string& dst_port_path) const;
+ SharedPtr<ConnectionModel> get_connection(const Raul::Path& src_port_path,
+ const Raul::Path& dst_port_path) const;
uint32_t poly() const { return _poly; }
uint32_t internal_polyphony() const { return _poly; }
@@ -63,7 +60,7 @@ public:
signal_editable.emit(e);
} }
- virtual void set_variable(const string& key, const Atom& value);
+ virtual void set_variable(const Raul::URI& key, const Raul::Atom& value);
// Signals
sigc::signal<void, SharedPtr<NodeModel> > signal_new_node;
@@ -75,7 +72,7 @@ public:
private:
friend class ClientStore;
- PatchModel(const Path& patch_path, size_t internal_poly)
+ PatchModel(const Raul::Path& patch_path, size_t internal_poly)
: NodeModel("ingen:Patch", patch_path)
, _connections(new Connections())
, _poly(internal_poly)
@@ -88,15 +85,13 @@ private:
bool remove_child(SharedPtr<ObjectModel> c);
void add_connection(SharedPtr<ConnectionModel> cm);
- void remove_connection(const string& src_port_path, const string& dst_port_path);
+ void remove_connection(const Raul::Path& src_port_path, const Raul::Path& dst_port_path);
SharedPtr<Connections> _connections;
uint32_t _poly;
bool _editable;
};
-typedef Raul::Table<string, SharedPtr<PatchModel> > PatchModelMap;
-
} // namespace Client
} // namespace Ingen
diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp
index 02d68330..6f6aa715 100644
--- a/src/client/PluginModel.cpp
+++ b/src/client/PluginModel.cpp
@@ -24,7 +24,7 @@
#include "PluginUI.hpp"
using namespace std;
-using Ingen::Shared::EngineInterface;
+using namespace Raul;
namespace Ingen {
namespace Client {
@@ -37,9 +37,9 @@ SLV2Plugins PluginModel::_slv2_plugins = NULL;
Redland::World* PluginModel::_rdf_world = NULL;
-PluginModel::PluginModel(const string& uri, const string& type_uri)
+PluginModel::PluginModel(const URI& uri, const URI& type_uri)
: ResourceImpl(uri)
- , _type(type_from_uri(_rdf_world->prefixes().qualify(type_uri)))
+ , _type(type_from_uri(_rdf_world->prefixes().qualify(type_uri.str())))
{
Glib::Mutex::Lock lock(_rdf_world->mutex());
assert(_rdf_world);
diff --git a/src/client/PluginModel.hpp b/src/client/PluginModel.hpp
index c50aef6f..b2f4cd0e 100644
--- a/src/client/PluginModel.hpp
+++ b/src/client/PluginModel.hpp
@@ -19,7 +19,6 @@
#define PLUGINMODEL_H
#include "ingen-config.h"
-#include <string>
#include <iostream>
#include "raul/SharedPtr.hpp"
#include "redlandmm/World.hpp"
@@ -31,8 +30,6 @@
#include "module/World.hpp"
#include "shared/ResourceImpl.hpp"
-using std::string;
-
namespace Ingen {
namespace Client {
@@ -49,16 +46,16 @@ class PluginModel : public Ingen::Shared::Plugin
, public Ingen::Shared::ResourceImpl
{
public:
- PluginModel(const string& uri, const string& type_uri);
+ PluginModel(const Raul::URI& uri, const Raul::URI& type_uri);
Type type() const { return _type; }
- const string symbol() const { return string_property("lv2:symbol"); }
- const string name() const { return string_property("doap:name"); }
+ const std::string symbol() const { return string_property("lv2:symbol"); }
+ const std::string name() const { return string_property("doap:name"); }
- string default_node_symbol() const;
- string human_name();
- string port_human_name(uint32_t index) const;
+ std::string default_node_symbol() const;
+ std::string human_name();
+ std::string port_human_name(uint32_t index) const;
#ifdef HAVE_SLV2
static SLV2World slv2_world() { return _slv2_world; }
@@ -80,8 +77,8 @@ public:
SharedPtr<PluginUI> ui(Ingen::Shared::World* world,
SharedPtr<NodeModel> node) const;
- const string& icon_path() const;
- static string get_lv2_icon_path(SLV2Plugin plugin);
+ const std::string& icon_path() const;
+ static std::string get_lv2_icon_path(SLV2Plugin plugin);
#endif
static void set_rdf_world(Redland::World& world) {
@@ -93,14 +90,14 @@ public:
private:
const Type _type;
- const string string_property(const std::string& name) const;
+ const std::string string_property(const std::string& name) const;
#ifdef HAVE_SLV2
static SLV2World _slv2_world;
static SLV2Plugins _slv2_plugins;
- SLV2Plugin _slv2_plugin;
- mutable string _icon_path;
+ SLV2Plugin _slv2_plugin;
+ mutable std::string _icon_path;
#endif
static Redland::World* _rdf_world;
diff --git a/src/client/PluginUI.cpp b/src/client/PluginUI.cpp
index 6898dd71..63bef6b2 100644
--- a/src/client/PluginUI.cpp
+++ b/src/client/PluginUI.cpp
@@ -23,7 +23,7 @@
#include "PortModel.hpp"
using namespace std;
-using Ingen::Shared::EngineInterface;
+using namespace Raul;
using Ingen::Shared::LV2URIMap;
using Ingen::Shared::LV2Features;
diff --git a/src/client/PortModel.cpp b/src/client/PortModel.cpp
index af257ebf..d62aa236 100644
--- a/src/client/PortModel.cpp
+++ b/src/client/PortModel.cpp
@@ -24,7 +24,7 @@ namespace Client {
bool
PortModel::has_hint(const std::string& qname) const
{
- const Atom& hint = get_variable(qname);
+ const Raul::Atom& hint = get_variable(qname);
return (hint.is_valid() && hint.get_bool() > 0);
}
diff --git a/src/client/PortModel.hpp b/src/client/PortModel.hpp
index 3c4d779c..23fce480 100644
--- a/src/client/PortModel.hpp
+++ b/src/client/PortModel.hpp
@@ -41,12 +41,12 @@ class PortModel : public ObjectModel, public Ingen::Shared::Port
public:
enum Direction { INPUT, OUTPUT };
- inline uint32_t index() const { return _index; }
- inline DataType type() const { return _type; }
- inline const Atom& value() const { return _current_val; }
- inline bool connected() const { return (_connections > 0); }
- inline bool is_input() const { return (_direction == INPUT); }
- inline bool is_output() const { return (_direction == OUTPUT); }
+ inline uint32_t index() const { return _index; }
+ inline DataType type() const { return _type; }
+ inline const Raul::Atom& value() const { return _current_val; }
+ inline bool connected() const { return (_connections > 0); }
+ inline bool is_input() const { return (_direction == INPUT); }
+ inline bool is_output() const { return (_direction == OUTPUT); }
bool has_hint(const std::string& qname) const;
@@ -56,29 +56,29 @@ public:
inline bool operator==(const PortModel& pm) const { return (_path == pm._path); }
- inline void value(const Atom& val) {
+ inline void value(const Raul::Atom& val) {
if (val != _current_val) {
_current_val = val;
signal_value_changed.emit(val);
}
}
- inline void value(uint32_t voice, const Atom& val) {
+ inline void value(uint32_t voice, const Raul::Atom& val) {
// FIXME: implement properly
signal_voice_changed.emit(voice, val);
}
// Signals
- sigc::signal<void, const Atom&> signal_value_changed; ///< Value ports
- sigc::signal<void, uint32_t, const Atom&> signal_voice_changed; ///< Polyphonic value ports
- sigc::signal<void> signal_activity; ///< Message ports
- sigc::signal<void, SharedPtr<PortModel> > signal_connection;
- sigc::signal<void, SharedPtr<PortModel> > signal_disconnection;
+ sigc::signal<void, const Raul::Atom&> signal_value_changed; ///< Value ports
+ sigc::signal<void, uint32_t, const Raul::Atom&> signal_voice_changed; ///< Polyphonic value ports
+ sigc::signal<void> signal_activity; ///< Message ports
+ sigc::signal<void, SharedPtr<PortModel> > signal_connection;
+ sigc::signal<void, SharedPtr<PortModel> > signal_disconnection;
private:
friend class ClientStore;
- PortModel(const Path& path, uint32_t index, DataType type, Direction dir)
+ PortModel(const Raul::Path& path, uint32_t index, DataType type, Direction dir)
: ObjectModel(path)
, _index(index)
, _type(type)
@@ -98,11 +98,11 @@ private:
void set(SharedPtr<ObjectModel> model);
- uint32_t _index;
- DataType _type;
- Direction _direction;
- Atom _current_val;
- size_t _connections;
+ uint32_t _index;
+ DataType _type;
+ Direction _direction;
+ Raul::Atom _current_val;
+ size_t _connections;
};
diff --git a/src/client/SigClientInterface.hpp b/src/client/SigClientInterface.hpp
index ff54bab5..40b30e47 100644
--- a/src/client/SigClientInterface.hpp
+++ b/src/client/SigClientInterface.hpp
@@ -19,10 +19,9 @@
#define SIGCLIENTINTERFACE_H
#include <inttypes.h>
-#include <string>
#include <sigc++/sigc++.h>
+#include "raul/Path.hpp"
#include "interface/ClientInterface.hpp"
-using std::string;
namespace Ingen {
namespace Client {
@@ -44,32 +43,32 @@ public:
bool enabled() const { return _enabled; }
- std::string uri() const { return "(internal)"; }
+ Raul::URI uri() const { return "ingen:internal"; }
// Signal parameters match up directly with ClientInterface calls
sigc::signal<bool, const Shared::GraphObject*> signal_new_object;
- sigc::signal<void, int32_t> signal_response_ok;
- sigc::signal<void, int32_t, string> signal_response_error;
- sigc::signal<void> signal_bundle_begin;
- sigc::signal<void> signal_bundle_end;
- sigc::signal<void, string> signal_error;
- sigc::signal<void, string, string, string> signal_new_plugin;
- sigc::signal<void, string, uint32_t> signal_new_patch;
- sigc::signal<void, string, string> signal_new_node;
- sigc::signal<void, string, string, uint32_t, bool> signal_new_port;
- sigc::signal<void, string> signal_clear_patch;
- sigc::signal<void, string, string> signal_object_renamed;
- sigc::signal<void, string> signal_object_destroyed;
- sigc::signal<void, string, string> signal_connection;
- sigc::signal<void, string, string> signal_disconnection;
- sigc::signal<void, string, string, Raul::Atom> signal_variable_change;
- sigc::signal<void, string, string, Raul::Atom> signal_property_change;
- sigc::signal<void, string, Raul::Atom> signal_port_value;
- sigc::signal<void, string, uint32_t, Raul::Atom> signal_voice_value;
- sigc::signal<void, string> signal_activity;
- sigc::signal<void, string, uint32_t, uint32_t, string> signal_program_add;
- sigc::signal<void, string, uint32_t, uint32_t> signal_program_remove;
+ sigc::signal<void, int32_t> signal_response_ok;
+ sigc::signal<void, int32_t, std::string> signal_response_error;
+ sigc::signal<void> signal_bundle_begin;
+ sigc::signal<void> signal_bundle_end;
+ sigc::signal<void, std::string> signal_error;
+ sigc::signal<void, Raul::URI, Raul::URI, Raul::Symbol> signal_new_plugin;
+ sigc::signal<void, Raul::Path, uint32_t> signal_new_patch;
+ sigc::signal<void, Raul::Path, Raul::URI> signal_new_node;
+ sigc::signal<void, Raul::Path, Raul::URI, uint32_t, bool> signal_new_port;
+ sigc::signal<void, Raul::Path> signal_clear_patch;
+ sigc::signal<void, Raul::Path, Raul::Path> signal_object_renamed;
+ sigc::signal<void, Raul::Path> signal_object_destroyed;
+ sigc::signal<void, Raul::Path, Raul::Path> signal_connection;
+ sigc::signal<void, Raul::Path, Raul::Path> signal_disconnection;
+ sigc::signal<void, Raul::Path, Raul::URI, Raul::Atom> signal_variable_change;
+ sigc::signal<void, Raul::Path, Raul::URI, Raul::Atom> signal_property_change;
+ sigc::signal<void, Raul::Path, Raul::Atom> signal_port_value;
+ sigc::signal<void, Raul::Path, uint32_t, Raul::Atom> signal_voice_value;
+ sigc::signal<void, Raul::Path> signal_activity;
+ sigc::signal<void, Raul::Path, uint32_t, uint32_t, std::string> signal_program_add;
+ sigc::signal<void, Raul::Path, uint32_t, uint32_t> signal_program_remove;
/** Fire pending signals. Only does anything on derived classes (that may queue) */
virtual bool emit_signals() { return false; }
@@ -95,61 +94,61 @@ protected:
void response_ok(int32_t id)
{ if (_enabled) signal_response_ok.emit(id); }
- void response_error(int32_t id, const string& msg)
+ void response_error(int32_t id, const std::string& msg)
{ if (_enabled) signal_response_error.emit(id, msg); }
- void error(const string& msg)
+ void error(const std::string& msg)
{ if (_enabled) signal_error.emit(msg); }
- void new_plugin(const string& uri, const string& type_uri, const string& symbol)
+ void new_plugin(const Raul::URI& uri, const Raul::URI& type_uri, const Raul::Symbol& symbol)
{ if (_enabled) signal_new_plugin.emit(uri, type_uri, symbol); }
bool new_object(const Shared::GraphObject* object)
{ if (_enabled) signal_new_object.emit(object); return false; }
- void new_patch(const string& path, uint32_t poly)
+ void new_patch(const Raul::Path& path, uint32_t poly)
{ if (_enabled) signal_new_patch.emit(path, poly); }
- void new_node(const string& path, const string& plugin_uri)
+ void new_node(const Raul::Path& path, const Raul::URI& plugin_uri)
{ if (_enabled) signal_new_node.emit(path, plugin_uri); }
- void new_port(const string& path, const string& type, uint32_t index, bool is_output)
+ void new_port(const Raul::Path& path, const Raul::URI& type, uint32_t index, bool is_output)
{ if (_enabled) signal_new_port.emit(path, type, index, is_output); }
- void connect(const string& src_port_path, const string& dst_port_path)
+ void connect(const Raul::Path& src_port_path, const Raul::Path& dst_port_path)
{ if (_enabled) signal_connection.emit(src_port_path, dst_port_path); }
- void destroy(const string& path)
+ void destroy(const Raul::Path& path)
{ if (_enabled) signal_object_destroyed.emit(path); }
- void clear_patch(const string& path)
+ void clear_patch(const Raul::Path& path)
{ if (_enabled) signal_clear_patch.emit(path); }
- void rename(const string& old_path, const string& new_path)
+ void rename(const Raul::Path& old_path, const Raul::Path& new_path)
{ if (_enabled) signal_object_renamed.emit(old_path, new_path); }
- void disconnect(const string& src_port_path, const string& dst_port_path)
+ void disconnect(const Raul::Path& src_port_path, const Raul::Path& dst_port_path)
{ if (_enabled) signal_disconnection.emit(src_port_path, dst_port_path); }
- void set_variable(const string& path, const string& key, const Raul::Atom& value)
+ void set_variable(const Raul::Path& path, const Raul::URI& key, const Raul::Atom& value)
{ if (_enabled) signal_variable_change.emit(path, key, value); }
- void set_property(const string& path, const string& key, const Raul::Atom& value)
+ void set_property(const Raul::Path& path, const Raul::URI& key, const Raul::Atom& value)
{ if (_enabled) signal_property_change.emit(path, key, value); }
- void set_port_value(const string& port_path, const Raul::Atom& value)
+ void set_port_value(const Raul::Path& port_path, const Raul::Atom& value)
{ if (_enabled) signal_port_value.emit(port_path, value); }
- void set_voice_value(const string& port_path, uint32_t voice, const Raul::Atom& value)
+ void set_voice_value(const Raul::Path& port_path, uint32_t voice, const Raul::Atom& value)
{ if (_enabled) signal_voice_value.emit(port_path, voice, value); }
- void activity(const string& port_path)
+ void activity(const Raul::Path& port_path)
{ if (_enabled) signal_activity.emit(port_path); }
- void program_add(const string& path, uint32_t bank, uint32_t program, const string& name)
+ void program_add(const Raul::Path& path, uint32_t bank, uint32_t program, const std::string& name)
{ if (_enabled) signal_program_add.emit(path, bank, program, name); }
- void program_remove(const string& path, uint32_t bank, uint32_t program)
+ void program_remove(const Raul::Path& path, uint32_t bank, uint32_t program)
{ if (_enabled) signal_program_remove.emit(path, bank, program); }
};
diff --git a/src/client/ThreadedSigClientInterface.hpp b/src/client/ThreadedSigClientInterface.hpp
index 1e4a2beb..714465c8 100644
--- a/src/client/ThreadedSigClientInterface.hpp
+++ b/src/client/ThreadedSigClientInterface.hpp
@@ -27,8 +27,6 @@
#include "SigClientInterface.hpp"
#include "raul/SRSWQueue.hpp"
-using std::string;
-
/** Returns nothing and takes no parameters (because they have all been bound) */
typedef sigc::slot<void> Closure;
@@ -70,7 +68,7 @@ public:
{
}
- virtual std::string uri() const { return "(internal)"; }
+ virtual Raul::URI uri() const { return "ingen:internal"; }
virtual void subscribe(Shared::EngineInterface* engine) { throw; }
@@ -88,60 +86,60 @@ public:
void response_ok(int32_t id)
{ push_sig(sigc::bind(response_ok_slot, id)); }
- void response_error(int32_t id, const string& msg)
+ void response_error(int32_t id, const std::string& msg)
{ push_sig(sigc::bind(response_error_slot, id, msg)); }
- void error(const string& msg)
+ void error(const std::string& msg)
{ push_sig(sigc::bind(error_slot, msg)); }
- void new_plugin(const string& uri, const string& type_uri, const string& symbol)
+ void new_plugin(const Raul::URI& uri, const Raul::URI& type_uri, const Raul::Symbol& symbol)
{ push_sig(sigc::bind(new_plugin_slot, uri, type_uri, symbol)); }
bool new_object(const Shared::GraphObject* object);
- void new_patch(const string& path, uint32_t poly)
+ void new_patch(const Raul::Path& path, uint32_t poly)
{ push_sig(sigc::bind(new_patch_slot, path, poly)); }
- void new_node(const string& path, const string& plugin_uri)
+ void new_node(const Raul::Path& path, const Raul::URI& plugin_uri)
{ push_sig(sigc::bind(new_node_slot, path, plugin_uri)); }
- void new_port(const string& path, const string& type, uint32_t index, bool is_output)
+ void new_port(const Raul::Path& path, const Raul::URI& type, uint32_t index, bool is_output)
{ push_sig(sigc::bind(new_port_slot, path, type, index, is_output)); }
- void connect(const string& src_port_path, const string& dst_port_path)
+ void connect(const Raul::Path& src_port_path, const Raul::Path& dst_port_path)
{ push_sig(sigc::bind(connection_slot, src_port_path, dst_port_path)); }
- void destroy(const string& path)
+ void destroy(const Raul::Path& path)
{ push_sig(sigc::bind(object_destroyed_slot, path)); }
- void clear_patch(const string& path)
+ void clear_patch(const Raul::Path& path)
{ push_sig(sigc::bind(clear_patch_slot, path)); }
- void rename(const string& old_path, const string& new_path)
+ void rename(const Raul::Path& old_path, const Raul::Path& new_path)
{ push_sig(sigc::bind(object_renamed_slot, old_path, new_path)); }
- void disconnect(const string& src_port_path, const string& dst_port_path)
+ void disconnect(const Raul::Path& src_port_path, const Raul::Path& dst_port_path)
{ push_sig(sigc::bind(disconnection_slot, src_port_path, dst_port_path)); }
- void set_variable(const string& path, const string& key, const Raul::Atom& value)
+ void set_variable(const Raul::Path& path, const Raul::URI& key, const Raul::Atom& value)
{ push_sig(sigc::bind(variable_change_slot, path, key, value)); }
- void set_property(const string& path, const string& key, const Raul::Atom& value)
+ void set_property(const Raul::Path& path, const Raul::URI& key, const Raul::Atom& value)
{ push_sig(sigc::bind(property_change_slot, path, key, value)); }
- void set_port_value(const string& port_path, const Raul::Atom& value)
+ void set_port_value(const Raul::Path& port_path, const Raul::Atom& value)
{ push_sig(sigc::bind(port_value_slot, port_path, value)); }
- void set_voice_value(const string& port_path, uint32_t voice, const Raul::Atom& value)
+ void set_voice_value(const Raul::Path& port_path, uint32_t voice, const Raul::Atom& value)
{ push_sig(sigc::bind(voice_value_slot, port_path, voice, value)); }
- void activity(const string& port_path)
+ void activity(const Raul::Path& port_path)
{ push_sig(sigc::bind(activity_slot, port_path)); }
- void program_add(const string& path, uint32_t bank, uint32_t program, const string& name)
+ void program_add(const Raul::Path& path, uint32_t bank, uint32_t program, const std::string& name)
{ push_sig(sigc::bind(program_add_slot, path, bank, program, name)); }
- void program_remove(const string& path, uint32_t bank, uint32_t program)
+ void program_remove(const Raul::Path& path, uint32_t bank, uint32_t program)
{ push_sig(sigc::bind(program_remove_slot, path, bank, program)); }
/** Process all queued events - Called from GTK thread to emit signals. */
@@ -156,27 +154,27 @@ private:
Raul::SRSWQueue<Closure> _sigs;
bool _attached;
- sigc::slot<void> bundle_begin_slot;
- sigc::slot<void> bundle_end_slot;
- sigc::slot<void, int32_t> response_ok_slot;
- sigc::slot<void, int32_t, string> response_error_slot;
- sigc::slot<void, string> error_slot;
- sigc::slot<void, string, string, string> new_plugin_slot;
- sigc::slot<void, string, uint32_t> new_patch_slot;
- sigc::slot<void, string, string> new_node_slot;
- sigc::slot<void, string, string, uint32_t, bool> new_port_slot;
- sigc::slot<void, string, string> connection_slot;
- sigc::slot<void, string> clear_patch_slot;
- sigc::slot<void, string> object_destroyed_slot;
- sigc::slot<void, string, string> object_renamed_slot;
- sigc::slot<void, string, string> disconnection_slot;
- sigc::slot<void, string, string, Raul::Atom> variable_change_slot;
- sigc::slot<void, string, string, Raul::Atom> property_change_slot;
- sigc::slot<void, string, Raul::Atom> port_value_slot;
- sigc::slot<void, string, uint32_t, Raul::Atom> voice_value_slot;
- sigc::slot<void, string> activity_slot;
- sigc::slot<void, string, uint32_t, uint32_t, string> program_add_slot;
- sigc::slot<void, string, uint32_t, uint32_t> program_remove_slot;
+ sigc::slot<void> bundle_begin_slot;
+ sigc::slot<void> bundle_end_slot;
+ sigc::slot<void, int32_t> response_ok_slot;
+ sigc::slot<void, int32_t, std::string> response_error_slot;
+ sigc::slot<void, std::string> error_slot;
+ sigc::slot<void, Raul::URI, Raul::URI, Raul::Symbol> new_plugin_slot;
+ sigc::slot<void, Raul::Path, uint32_t> new_patch_slot;
+ sigc::slot<void, Raul::Path, Raul::URI> new_node_slot;
+ sigc::slot<void, Raul::Path, Raul::URI, uint32_t, bool> new_port_slot;
+ sigc::slot<void, Raul::Path, Raul::Path> connection_slot;
+ sigc::slot<void, Raul::Path> clear_patch_slot;
+ sigc::slot<void, Raul::Path> object_destroyed_slot;
+ sigc::slot<void, Raul::Path, Raul::Path> object_renamed_slot;
+ sigc::slot<void, Raul::Path, Raul::Path> disconnection_slot;
+ sigc::slot<void, Raul::Path, Raul::URI, Raul::Atom> variable_change_slot;
+ sigc::slot<void, Raul::Path, Raul::URI, Raul::Atom> property_change_slot;
+ sigc::slot<void, Raul::Path, Raul::Atom> port_value_slot;
+ sigc::slot<void, Raul::Path, uint32_t, Raul::Atom> voice_value_slot;
+ sigc::slot<void, Raul::Path> activity_slot;
+ sigc::slot<void, Raul::Path, uint32_t, uint32_t, std::string> program_add_slot;
+ sigc::slot<void, Raul::Path, uint32_t, uint32_t> program_remove_slot;
};
diff --git a/src/common/interface/ClientInterface.hpp b/src/common/interface/ClientInterface.hpp
index 23e3c375..104427e6 100644
--- a/src/common/interface/ClientInterface.hpp
+++ b/src/common/interface/ClientInterface.hpp
@@ -23,6 +23,8 @@
#include <inttypes.h>
#include "interface/CommonInterface.hpp"
+namespace Raul { class Path; class URI; }
+
namespace Ingen {
namespace Shared {
@@ -37,7 +39,7 @@ class ClientInterface : public CommonInterface
public:
virtual ~ClientInterface() {}
- virtual std::string uri() const = 0;
+ virtual Raul::URI uri() const = 0;
virtual void response_ok(int32_t id) = 0;
virtual void response_error(int32_t id, const std::string& msg) = 0;
@@ -61,20 +63,20 @@ public:
virtual void error(const std::string& msg) = 0;
- virtual void new_plugin(const std::string& uri,
- const std::string& type_uri,
- const std::string& symbol) = 0;
+ virtual void new_plugin(const Raul::URI& uri,
+ const Raul::URI& type_uri,
+ const Raul::Symbol& symbol) = 0;
- virtual void activity(const std::string& path) = 0;
+ virtual void activity(const Raul::Path& path) = 0;
- virtual void program_add(const std::string& node_path,
+ virtual void program_add(const Raul::Path& node_path,
uint32_t bank,
uint32_t program,
const std::string& program_name) = 0;
- virtual void program_remove(const std::string& node_path,
- uint32_t bank,
- uint32_t program) = 0;
+ virtual void program_remove(const Raul::Path& node_path,
+ uint32_t bank,
+ uint32_t program) = 0;
};
diff --git a/src/common/interface/CommonInterface.hpp b/src/common/interface/CommonInterface.hpp
index 9bbef09d..aaa06628 100644
--- a/src/common/interface/CommonInterface.hpp
+++ b/src/common/interface/CommonInterface.hpp
@@ -23,7 +23,7 @@
#include "interface/CommonInterface.hpp"
#include "interface/GraphObject.hpp"
-namespace Raul { class Atom; }
+namespace Raul { class Atom; class Path; class URI; }
namespace Ingen {
namespace Shared {
@@ -47,44 +47,44 @@ public:
virtual bool new_object(const GraphObject* object) = 0;
- virtual void new_patch(const std::string& path,
- uint32_t poly) = 0;
+ virtual void new_patch(const Raul::Path& path,
+ uint32_t poly) = 0;
- virtual void new_node(const std::string& path,
- const std::string& plugin_uri) = 0;
+ virtual void new_node(const Raul::Path& path,
+ const Raul::URI& plugin_uri) = 0;
- virtual void new_port(const std::string& path,
- const std::string& type,
- uint32_t index,
- bool is_output) = 0;
+ virtual void new_port(const Raul::Path& path,
+ const Raul::URI& type,
+ uint32_t index,
+ bool is_output) = 0;
- virtual void rename(const std::string& old_path,
- const std::string& new_path) = 0;
+ virtual void rename(const Raul::Path& old_path,
+ const Raul::Path& new_path) = 0;
- virtual void connect(const std::string& src_port_path,
- const std::string& dst_port_path) = 0;
+ virtual void connect(const Raul::Path& src_port_path,
+ const Raul::Path& dst_port_path) = 0;
- virtual void disconnect(const std::string& src_port_path,
- const std::string& dst_port_path) = 0;
+ virtual void disconnect(const Raul::Path& src_port_path,
+ const Raul::Path& dst_port_path) = 0;
- virtual void set_variable(const std::string& subject_path,
- const std::string& predicate,
- const Raul::Atom& value) = 0;
+ virtual void set_variable(const Raul::Path& subject_path,
+ const Raul::URI& predicate,
+ const Raul::Atom& value) = 0;
- virtual void set_property(const std::string& subject_path,
- const std::string& predicate,
- const Raul::Atom& value) = 0;
+ virtual void set_property(const Raul::Path& subject_path,
+ const Raul::URI& predicate,
+ const Raul::Atom& value) = 0;
- virtual void set_port_value(const std::string& port_path,
+ virtual void set_port_value(const Raul::Path& port_path,
const Raul::Atom& value) = 0;
- virtual void set_voice_value(const std::string& port_path,
- uint32_t voice,
- const Raul::Atom& value) = 0;
+ virtual void set_voice_value(const Raul::Path& port_path,
+ uint32_t voice,
+ const Raul::Atom& value) = 0;
- virtual void destroy(const std::string& path) = 0;
+ virtual void destroy(const Raul::Path& path) = 0;
- virtual void clear_patch(const std::string& patch_path) = 0;
+ virtual void clear_patch(const Raul::Path& patch_path) = 0;
};
diff --git a/src/common/interface/DataType.hpp b/src/common/interface/DataType.hpp
index 52831e2a..c2ef6674 100644
--- a/src/common/interface/DataType.hpp
+++ b/src/common/interface/DataType.hpp
@@ -18,6 +18,8 @@
#ifndef DATATYPE_H
#define DATATYPE_H
+#include <raul/URI.hpp>
+
namespace Ingen {
namespace Shared {
@@ -40,14 +42,14 @@ public:
EVENT = 3
};
- DataType(const std::string& uri)
+ DataType(const Raul::URI& uri)
: _symbol(UNKNOWN)
{
- if (uri == type_uri(AUDIO)) {
+ if (uri.str() == type_uri(AUDIO)) {
_symbol = AUDIO;
- } else if (uri == type_uri(CONTROL)) {
+ } else if (uri.str() == type_uri(CONTROL)) {
_symbol = CONTROL;
- } else if (uri == type_uri(EVENT) || uri == "lv2ev:EventPort") {
+ } else if (uri.str() == type_uri(EVENT) || uri.str() == "lv2ev:EventPort") {
_symbol = EVENT;
}
}
diff --git a/src/common/interface/EngineInterface.hpp b/src/common/interface/EngineInterface.hpp
index 14289c20..b8462226 100644
--- a/src/common/interface/EngineInterface.hpp
+++ b/src/common/interface/EngineInterface.hpp
@@ -19,7 +19,6 @@
#define ENGINEINTERFACE_H
#include <inttypes.h>
-#include <string>
#include "interface/CommonInterface.hpp"
namespace Ingen {
@@ -38,7 +37,7 @@ class EngineInterface : public CommonInterface
public:
virtual ~EngineInterface() {}
- virtual std::string uri() const = 0;
+ virtual Raul::URI uri() const = 0;
// Responses
virtual void set_next_response_id(int32_t id) = 0;
@@ -46,7 +45,7 @@ public:
// Client registration
virtual void register_client(ClientInterface* client) = 0;
- virtual void unregister_client(const std::string& uri) = 0;
+ virtual void unregister_client(const Raul::URI& uri) = 0;
// Engine commands
virtual void load_plugins() = 0;
@@ -56,30 +55,30 @@ public:
// Object commands
- virtual void disconnect_all(const std::string& parent_patch_path,
- const std::string& path) = 0;
+ virtual void disconnect_all(const Raul::Path& parent_patch_path,
+ const Raul::Path& path) = 0;
- virtual void set_program(const std::string& node_path,
- uint32_t bank,
- uint32_t program) = 0;
+ virtual void set_program(const Raul::Path& node_path,
+ uint32_t bank,
+ uint32_t program) = 0;
- virtual void midi_learn(const std::string& node_path) = 0;
+ virtual void midi_learn(const Raul::Path& node_path) = 0;
// Requests
virtual void ping() = 0;
- virtual void request_plugin(const std::string& uri) = 0;
+ virtual void request_plugin(const Raul::URI& uri) = 0;
- virtual void request_object(const std::string& path) = 0;
+ virtual void request_object(const Raul::Path& path) = 0;
- virtual void request_port_value(const std::string& port_path) = 0;
+ virtual void request_port_value(const Raul::Path& port_path) = 0;
- virtual void request_variable(const std::string& path,
- const std::string& key) = 0;
+ virtual void request_variable(const Raul::Path& path,
+ const Raul::URI& key) = 0;
- virtual void request_property(const std::string& path,
- const std::string& key) = 0;
+ virtual void request_property(const Raul::Path& path,
+ const Raul::URI& key) = 0;
virtual void request_plugins() = 0;
diff --git a/src/common/interface/Resource.hpp b/src/common/interface/Resource.hpp
index 109e1021..d22f0a59 100644
--- a/src/common/interface/Resource.hpp
+++ b/src/common/interface/Resource.hpp
@@ -21,7 +21,7 @@
#include <string>
#include <map>
-namespace Raul { class Atom; }
+namespace Raul { class Atom; class URI; }
namespace Ingen {
namespace Shared {
@@ -30,16 +30,16 @@ namespace Shared {
class Resource
{
public:
- typedef std::map<std::string, Raul::Atom> Properties;
+ typedef std::map<Raul::URI, Raul::Atom> Properties;
- virtual const std::string uri() const = 0;
+ virtual const Raul::URI uri() const = 0;
virtual const Properties& properties() const = 0;
virtual Properties& properties() = 0;
- virtual void set_property(const std::string& uri,
- const Raul::Atom& value) = 0;
+ virtual void set_property(const Raul::URI& uri,
+ const Raul::Atom& value) = 0;
- virtual const Raul::Atom& get_property(const std::string& uri) const = 0;
+ virtual const Raul::Atom& get_property(const Raul::URI& uri) const = 0;
};
diff --git a/src/engine/ClientBroadcaster.cpp b/src/engine/ClientBroadcaster.cpp
index c9f881aa..b81a4f8a 100644
--- a/src/engine/ClientBroadcaster.cpp
+++ b/src/engine/ClientBroadcaster.cpp
@@ -35,7 +35,7 @@ namespace Ingen {
/** Register a client to receive messages over the notification band.
*/
void
-ClientBroadcaster::register_client(const string& uri, ClientInterface* client)
+ClientBroadcaster::register_client(const URI& uri, ClientInterface* client)
{
Clients::iterator i = _clients.find(uri);
@@ -53,7 +53,7 @@ ClientBroadcaster::register_client(const string& uri, ClientInterface* client)
* @return true if client was found and removed.
*/
bool
-ClientBroadcaster::unregister_client(const string& uri)
+ClientBroadcaster::unregister_client(const URI& uri)
{
size_t erased = _clients.erase(uri);
@@ -74,7 +74,7 @@ ClientBroadcaster::unregister_client(const string& uri)
* events, in anticipation of libom and multiple ways of responding to clients).
*/
ClientInterface*
-ClientBroadcaster::client(const string& uri)
+ClientBroadcaster::client(const URI& uri)
{
Clients::iterator i = _clients.find(uri);
if (i != _clients.end()) {
@@ -131,16 +131,15 @@ ClientBroadcaster::send_plugins(const NodeFactory::Plugins& plugins)
void
-ClientBroadcaster::send_destroyed(const string& path)
+ClientBroadcaster::send_destroyed(const Path& path)
{
- assert(path != "/");
for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
(*i).second->destroy(path);
}
void
-ClientBroadcaster::send_clear_patch(const string& patch_path)
+ClientBroadcaster::send_clear_patch(const Path& patch_path)
{
for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
(*i).second->clear_patch(patch_path);
@@ -150,12 +149,12 @@ void
ClientBroadcaster::send_connection(const SharedPtr<const ConnectionImpl> c)
{
for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
- (*i).second->connect(c->src_port()->path(), c->dst_port()->path());
+ (*i).second->connect(c->src_port()->path().str(), c->dst_port()->path().str());
}
void
-ClientBroadcaster::send_disconnection(const string& src_port_path, const string& dst_port_path)
+ClientBroadcaster::send_disconnection(const Path& src_port_path, const Path& dst_port_path)
{
for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
(*i).second->disconnect(src_port_path, dst_port_path);
@@ -167,7 +166,7 @@ ClientBroadcaster::send_disconnection(const string& src_port_path, const string&
* Like control changes, does not send update to client that set the variable, if applicable.
*/
void
-ClientBroadcaster::send_variable_change(const string& node_path, const string& key, const Atom& value)
+ClientBroadcaster::send_variable_change(const Path& node_path, const URI& key, const Atom& value)
{
for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
(*i).second->set_variable(node_path, key, value);
@@ -179,7 +178,7 @@ ClientBroadcaster::send_variable_change(const string& node_path, const string& k
* Like control changes, does not send update to client that set the property, if applicable.
*/
void
-ClientBroadcaster::send_property_change(const string& node_path, const string& key, const Atom& value)
+ClientBroadcaster::send_property_change(const Path& node_path, const URI& key, const Atom& value)
{
for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
(*i).second->set_property(node_path, key, value);
@@ -193,7 +192,7 @@ ClientBroadcaster::send_property_change(const string& node_path, const string& k
* forcing clients to ignore things to avoid feedback loops etc).
*/
void
-ClientBroadcaster::send_port_value(const string& port_path, const Raul::Atom& value)
+ClientBroadcaster::send_port_value(const Path& port_path, const Raul::Atom& value)
{
for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
(*i).second->set_port_value(port_path, value);
@@ -201,7 +200,7 @@ ClientBroadcaster::send_port_value(const string& port_path, const Raul::Atom& va
void
-ClientBroadcaster::send_activity(const string& path)
+ClientBroadcaster::send_activity(const Path& path)
{
for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
(*i).second->activity(path);
@@ -209,7 +208,7 @@ ClientBroadcaster::send_activity(const string& path)
void
-ClientBroadcaster::send_program_add(const string& node_path, int bank, int program, const string& name)
+ClientBroadcaster::send_program_add(const Path& node_path, int bank, int program, const string& name)
{
for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
(*i).second->program_add(node_path, bank, program, name);
@@ -217,7 +216,7 @@ ClientBroadcaster::send_program_add(const string& node_path, int bank, int progr
void
-ClientBroadcaster::send_program_remove(const string& node_path, int bank, int program)
+ClientBroadcaster::send_program_remove(const Path& node_path, int bank, int program)
{
for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
(*i).second->program_remove(node_path, bank, program);
@@ -239,7 +238,7 @@ ClientBroadcaster::send_object(const GraphObjectImpl* p, bool recursive)
/** Sends notification of an GraphObject's renaming
*/
void
-ClientBroadcaster::send_rename(const string& old_path, const string& new_path)
+ClientBroadcaster::send_rename(const Path& old_path, const Path& new_path)
{
for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
(*i).second->rename(old_path, new_path);
diff --git a/src/engine/ClientBroadcaster.hpp b/src/engine/ClientBroadcaster.hpp
index 80405d24..72d1dd90 100644
--- a/src/engine/ClientBroadcaster.hpp
+++ b/src/engine/ClientBroadcaster.hpp
@@ -26,7 +26,8 @@
#include "interface/ClientInterface.hpp"
#include "NodeFactory.hpp"
-using std::string;
+using Raul::URI;
+using Raul::Path;
namespace Ingen {
@@ -52,10 +53,10 @@ using Shared::ClientInterface;
class ClientBroadcaster
{
public:
- void register_client(const string& uri, ClientInterface* client);
- bool unregister_client(const string& uri);
+ void register_client(const URI& uri, ClientInterface* client);
+ bool unregister_client(const URI& uri);
- ClientInterface* client(const string& uri);
+ ClientInterface* client(const URI& uri);
//void send_client_registration(const string& url, int client_id);
@@ -63,26 +64,26 @@ public:
void bundle_end();
// Error that isn't the direct result of a request
- void send_error(const string& msg);
+ void send_error(const std::string& msg);
void send_plugins(const NodeFactory::Plugins& plugin_list);
void send_object(const GraphObjectImpl* p, bool recursive);
- void send_destroyed(const string& path);
- void send_clear_patch(const string& patch_path);
+ void send_destroyed(const Path& path);
+ void send_clear_patch(const Path& patch_path);
void send_connection(const SharedPtr<const ConnectionImpl> connection);
- void send_disconnection(const string& src_port_path, const string& dst_port_path);
- void send_rename(const string& old_path, const string& new_path);
- void send_variable_change(const string& node_path, const string& key, const Raul::Atom& value);
- void send_property_change(const string& node_path, const string& key, const Raul::Atom& value);
- void send_port_value(const string& port_path, const Raul::Atom& value);
- void send_activity(const string& path);
- void send_program_add(const string& node_path, int bank, int program, const string& name);
- void send_program_remove(const string& node_path, int bank, int program);
+ void send_disconnection(const Path& src_port_path, const Path& dst_port_path);
+ void send_rename(const Path& old_path, const Path& new_path);
+ void send_variable_change(const Path& node_path, const URI& key, const Raul::Atom& value);
+ void send_property_change(const Path& node_path, const URI& key, const Raul::Atom& value);
+ void send_port_value(const Path& port_path, const Raul::Atom& value);
+ void send_activity(const Path& path);
+ void send_program_add(const Path& node_path, int bank, int program, const std::string& name);
+ void send_program_remove(const Path& node_path, int bank, int program);
void send_plugins_to(ClientInterface*, const NodeFactory::Plugins& plugin_list);
private:
- typedef std::map<string, ClientInterface*> Clients;
+ typedef std::map<URI, ClientInterface*> Clients;
Clients _clients;
};
diff --git a/src/engine/Event.hpp b/src/engine/Event.hpp
index ddfb58c9..ee2658b5 100644
--- a/src/engine/Event.hpp
+++ b/src/engine/Event.hpp
@@ -21,6 +21,7 @@
#include <cassert>
#include "raul/SharedPtr.hpp"
#include "raul/Deletable.hpp"
+#include "raul/Path.hpp"
#include "types.hpp"
namespace Ingen {
@@ -57,10 +58,10 @@ public:
protected:
Event(Engine& engine, SharedPtr<Responder> responder, FrameTime time)
- : _engine(engine)
- , _responder(responder)
- , _time(time)
- , _executed(false)
+ : _engine(engine)
+ , _responder(responder)
+ , _time(time)
+ , _executed(false)
{}
Engine& _engine;
diff --git a/src/engine/GraphObjectImpl.cpp b/src/engine/GraphObjectImpl.cpp
index 461ebf0b..929eed2a 100644
--- a/src/engine/GraphObjectImpl.cpp
+++ b/src/engine/GraphObjectImpl.cpp
@@ -23,14 +23,14 @@
namespace Ingen {
void
-GraphObjectImpl::set_variable(const std::string& key, const Atom& value)
+GraphObjectImpl::set_variable(const Raul::URI& key, const Atom& value)
{
_variables[key] = value;
}
const Atom&
-GraphObjectImpl::get_variable(const std::string& key)
+GraphObjectImpl::get_variable(const Raul::URI& key)
{
static const Atom null_atom;
Properties::iterator i = _variables.find(key);
diff --git a/src/engine/GraphObjectImpl.hpp b/src/engine/GraphObjectImpl.hpp
index 5830c618..ccb5c7f9 100644
--- a/src/engine/GraphObjectImpl.hpp
+++ b/src/engine/GraphObjectImpl.hpp
@@ -57,7 +57,7 @@ public:
GraphObject* graph_parent() const { return _parent; }
- const std::string uri() const { return std::string("patch") + path(); }
+ const Raul::URI uri() const { return path(); }
inline GraphObjectImpl* parent() const { return _parent; }
const Symbol symbol() const { return _name; }
@@ -71,8 +71,8 @@ public:
assert(_name.find("/") == std::string::npos);
}
- const Raul::Atom& get_variable(const std::string& key);
- void set_variable(const std::string& key, const Raul::Atom& value);
+ const Raul::Atom& get_variable(const Raul::URI& key);
+ void set_variable(const Raul::URI& key, const Raul::Atom& value);
const Properties& variables() const { return _variables; }
Properties& variables() { return _variables; }
@@ -84,24 +84,23 @@ public:
const Path path() const {
if (_parent == NULL)
return Path(std::string("/").append(_name));
- else if (_parent->path() == "/")
+ else if (_parent->path().is_root())
return Path(std::string("/").append(_name));
else
- return Path(_parent->path() +"/"+ _name);
+ return Path(_parent->path().child(_name));
}
SharedPtr<GraphObject> find_child(const std::string& name) const;
protected:
GraphObjectImpl(GraphObjectImpl* parent, const std::string& name, bool polyphonic=false)
- : ResourceImpl(std::string("patch/") + (parent ? parent->path().base() : "/") + name)
+ : ResourceImpl((parent ? parent->path().base() : Path::root_uri) + name)
, _parent(parent)
, _name(name)
, _polyphonic(polyphonic)
{
assert(parent == NULL || _name.length() > 0);
assert(_name.find("/") == std::string::npos);
- assert(path().find("//") == std::string::npos);
}
GraphObjectImpl* _parent;
@@ -109,7 +108,7 @@ protected:
bool _polyphonic;
private:
- Properties _variables;
+ Properties _variables;
};
diff --git a/src/engine/HTTPClientSender.cpp b/src/engine/HTTPClientSender.cpp
index 4b7a2045..34357365 100644
--- a/src/engine/HTTPClientSender.cpp
+++ b/src/engine/HTTPClientSender.cpp
@@ -49,76 +49,76 @@ HTTPClientSender::error(const std::string& msg)
}
-void HTTPClientSender::new_node(const std::string& node_path,
- const std::string& plugin_uri)
+void HTTPClientSender::new_node(const Raul::Path& node_path,
+ const Raul::URI& plugin_uri)
{
//send("/ingen/new_node", "ss", node_path.c_str(), plugin_uri.c_str(), LO_ARGS_END);
}
void
-HTTPClientSender::new_port(const std::string& path,
- const std::string& type,
- uint32_t index,
- bool is_output)
+HTTPClientSender::new_port(const Raul::Path& path,
+ const Raul::URI& type,
+ uint32_t index,
+ bool is_output)
{
//send("/ingen/new_port", "sisi", path.c_str(), index, type.c_str(), is_output, LO_ARGS_END);
}
void
-HTTPClientSender::destroy(const std::string& path)
+HTTPClientSender::destroy(const Raul::Path& path)
{
- assert(path != "/");
- send_chunk(string("<").append(path).append("> a <http://www.w3.org/2002/07/owl#Nothing> ."));
+ assert(!path.is_root());
+ send_chunk(string("<").append(path.str()).append("> a <http://www.w3.org/2002/07/owl#Nothing> ."));
}
void
-HTTPClientSender::clear_patch(const std::string& patch_path)
+HTTPClientSender::clear_patch(const Raul::Path& patch_path)
{
- send_chunk(string("<").append(patch_path).append("> ingen:empty true ."));
+ send_chunk(string("<").append(patch_path.str()).append("> ingen:empty true ."));
}
void
-HTTPClientSender::connect(const std::string& src_path, const std::string& dst_path)
+HTTPClientSender::connect(const Raul::Path& src_path, const Raul::Path& dst_path)
{
string msg = string(
"@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n"
"@prefix ingen: <http://drobilla.net/ns/ingen#> .\n"
"@prefix lv2var: <http://lv2plug.in/ns/ext/instance-var#> .\n\n<").append(
"<> ingen:connection [\n"
- "\tingen:destination <").append(dst_path).append("> ;\n"
- "\tingen:source <").append(src_path).append(">\n] .\n");
+ "\tingen:destination <").append(dst_path.str()).append("> ;\n"
+ "\tingen:source <").append(src_path.str()).append(">\n] .\n");
send_chunk(msg);
}
void
-HTTPClientSender::disconnect(const std::string& src_path, const std::string& dst_path)
+HTTPClientSender::disconnect(const Raul::Path& src_path, const Raul::Path& dst_path)
{
//send("/ingen/disconnection", "ss", src_path.c_str(), dst_path.c_str(), LO_ARGS_END);
}
void
-HTTPClientSender::set_variable(const std::string& path, const std::string& key, const Atom& value)
+HTTPClientSender::set_variable(const Raul::Path& path, const Raul::URI& key, const Atom& value)
{
Redland::Node node = AtomRDF::atom_to_node(*_engine.world()->rdf_world, value);
string msg = string(
"@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n"
"@prefix ingenuity: <http://drobilla.net/ns/ingenuity#> .\n"
"@prefix lv2var: <http://lv2plug.in/ns/ext/instance-var#> .\n\n<").append(
- path).append("> lv2var:variable [\n"
- "rdf:predicate ").append(key).append(" ;\n"
+ path.str()).append("> lv2var:variable [\n"
+ "rdf:predicate ").append(key.str()).append(" ;\n"
"rdf:value ").append(node.to_string()).append("\n] .\n");
send_chunk(msg);
}
void
-HTTPClientSender::set_property(const std::string& path, const std::string& key, const Atom& value)
+HTTPClientSender::set_property(const Raul::Path& path, const Raul::URI& key, const Atom& value)
{
Redland::Node node = AtomRDF::atom_to_node(*_engine.world()->rdf_world, value);
string msg = string(
@@ -126,26 +126,26 @@ HTTPClientSender::set_property(const std::string& path, const std::string& key,
"@prefix ingen: <http://drobilla.net/ns/ingen#> .\n"
"@prefix ingenuity: <http://drobilla.net/ns/ingenuity#> .\n"
"@prefix lv2var: <http://lv2plug.in/ns/ext/instance-var#> .\n\n<").append(
- path).append("> ingen:property [\n"
- "rdf:predicate ").append(key).append(" ;\n"
+ path.str()).append("> ingen:property [\n"
+ "rdf:predicate ").append(key.str()).append(" ;\n"
"rdf:value ").append(node.to_string()).append("\n] .\n");
send_chunk(msg);
}
void
-HTTPClientSender::set_port_value(const std::string& port_path, const Raul::Atom& value)
+HTTPClientSender::set_port_value(const Raul::Path& port_path, const Raul::Atom& value)
{
Redland::Node node = AtomRDF::atom_to_node(*_engine.world()->rdf_world, value);
string msg = string(
"@prefix ingen: <http://drobilla.net/ns/ingen#> .\n\n<").append(
- port_path).append("> ingen:value ").append(node.to_string()).append(" .\n");
+ port_path.str()).append("> ingen:value ").append(node.to_string()).append(" .\n");
send_chunk(msg);
}
void
-HTTPClientSender::set_voice_value(const std::string& port_path, uint32_t voice, const Raul::Atom& value)
+HTTPClientSender::set_voice_value(const Raul::Path& port_path, uint32_t voice, const Raul::Atom& value)
{
/*lo_message m = lo_message_new();
lo_message_add_string(m, port_path.c_str());
@@ -155,11 +155,11 @@ HTTPClientSender::set_voice_value(const std::string& port_path, uint32_t voice,
void
-HTTPClientSender::activity(const std::string& path)
+HTTPClientSender::activity(const Raul::Path& path)
{
string msg = string(
"@prefix ingen: <http://drobilla.net/ns/ingen#> .\n\n<").append(
- path).append("> ingen:activity true .\n");
+ path.str()).append("> ingen:activity true .\n");
send_chunk(msg);
}
@@ -181,9 +181,9 @@ HTTPClientSender::new_object(const Shared::GraphObject* object)
void
-HTTPClientSender::new_plugin(const std::string& uri,
- const std::string& type_uri,
- const std::string& symbol)
+HTTPClientSender::new_plugin(const Raul::URI& uri,
+ const Raul::URI& type_uri,
+ const Raul::Symbol& symbol)
{
/*lo_message m = lo_message_new();
lo_message_add_string(m, uri.c_str());
@@ -195,25 +195,25 @@ HTTPClientSender::new_plugin(const std::string& uri,
void
-HTTPClientSender::new_patch(const std::string& path, uint32_t poly)
+HTTPClientSender::new_patch(const Raul::Path& path, uint32_t poly)
{
- //send_chunk(string("<").append(path).append("> a ingen:Patch"));
+ //send_chunk(string("<").append(path.str()).append("> a ingen:Patch"));
}
void
-HTTPClientSender::rename(const std::string& old_path, const std::string& new_path)
+HTTPClientSender::rename(const Raul::Path& old_path, const Raul::Path& new_path)
{
string msg = string(
"@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n"
"@prefix ingen: <http://drobilla.net/ns/ingen#> .\n\n<").append(
- old_path).append("> rdf:subject <").append(new_path).append("> .\n");
+ old_path.str()).append("> rdf:subject <").append(new_path.str()).append("> .\n");
send_chunk(msg);
}
void
-HTTPClientSender::program_add(const std::string& node_path, uint32_t bank, uint32_t program, const std::string& name)
+HTTPClientSender::program_add(const Raul::Path& node_path, uint32_t bank, uint32_t program, const std::string& name)
{
/*send("/ingen/program_add", "siis",
node_path.c_str(), bank, program, name.c_str(), LO_ARGS_END);*/
@@ -221,7 +221,7 @@ HTTPClientSender::program_add(const std::string& node_path, uint32_t bank, uint3
void
-HTTPClientSender::program_remove(const std::string& node_path, uint32_t bank, uint32_t program)
+HTTPClientSender::program_remove(const Raul::Path& node_path, uint32_t bank, uint32_t program)
{
/*send("/ingen/program_remove", "sii",
node_path.c_str(), bank, program, LO_ARGS_END);*/
diff --git a/src/engine/HTTPClientSender.hpp b/src/engine/HTTPClientSender.hpp
index 364549ee..1a06b7cf 100644
--- a/src/engine/HTTPClientSender.hpp
+++ b/src/engine/HTTPClientSender.hpp
@@ -59,7 +59,7 @@ public:
void transfer_begin() { HTTPSender::transfer_begin(); }
void transfer_end() { HTTPSender::transfer_end(); }
- std::string uri() const { return "http://example.org/"; }
+ Raul::URI uri() const { return "http://example.org/"; }
void subscribe(Shared::EngineInterface* engine) { }
@@ -74,58 +74,59 @@ public:
virtual bool new_object(const Shared::GraphObject* object);
- virtual void new_plugin(const std::string& uri,
- const std::string& type_uri,
- const std::string& symbol);
+ virtual void new_plugin(const Raul::URI& uri,
+ const Raul::URI& type_uri,
+ const Raul::Symbol& symbol);
- virtual void new_patch(const std::string& path, uint32_t poly);
+ virtual void new_patch(const Raul::Path& path,
+ uint32_t poly);
- virtual void new_node(const std::string& path,
- const std::string& plugin_uri);
+ virtual void new_node(const Raul::Path& path,
+ const Raul::URI& plugin_uri);
- virtual void new_port(const std::string& path,
- const std::string& type,
- uint32_t index,
- bool is_output);
+ virtual void new_port(const Raul::Path& path,
+ const Raul::URI& type,
+ uint32_t index,
+ bool is_output);
- virtual void clear_patch(const std::string& path);
+ virtual void clear_patch(const Raul::Path& path);
- virtual void destroy(const std::string& path);
+ virtual void destroy(const Raul::Path& path);
- virtual void rename(const std::string& old_path,
- const std::string& new_path);
+ virtual void rename(const Raul::Path& old_path,
+ const Raul::Path& new_path);
- virtual void connect(const std::string& src_port_path,
- const std::string& dst_port_path);
+ virtual void connect(const Raul::Path& src_port_path,
+ const Raul::Path& dst_port_path);
- virtual void disconnect(const std::string& src_port_path,
- const std::string& dst_port_path);
+ virtual void disconnect(const Raul::Path& src_port_path,
+ const Raul::Path& dst_port_path);
- virtual void set_variable(const std::string& subject_path,
- const std::string& predicate,
- const Raul::Atom& value);
+ virtual void set_variable(const Raul::Path& subject_path,
+ const Raul::URI& predicate,
+ const Raul::Atom& value);
- virtual void set_property(const std::string& subject_path,
- const std::string& predicate,
- const Raul::Atom& value);
+ virtual void set_property(const Raul::Path& subject_path,
+ const Raul::URI& predicate,
+ const Raul::Atom& value);
- virtual void set_port_value(const std::string& port_path,
- const Raul::Atom& value);
+ virtual void set_port_value(const Raul::Path& port_path,
+ const Raul::Atom& value);
- virtual void set_voice_value(const std::string& port_path,
- uint32_t voice,
- const Raul::Atom& value);
+ virtual void set_voice_value(const Raul::Path& port_path,
+ uint32_t voice,
+ const Raul::Atom& value);
- virtual void activity(const std::string& path);
+ virtual void activity(const Raul::Path& path);
- virtual void program_add(const std::string& node_path,
+ virtual void program_add(const Raul::Path& node_path,
uint32_t bank,
uint32_t program,
const std::string& program_name);
- virtual void program_remove(const std::string& node_path,
- uint32_t bank,
- uint32_t program);
+ virtual void program_remove(const Raul::Path& node_path,
+ uint32_t bank,
+ uint32_t program);
private:
Engine& _engine;
diff --git a/src/engine/HTTPEngineReceiver.cpp b/src/engine/HTTPEngineReceiver.cpp
index 4e279455..1d8d63a6 100644
--- a/src/engine/HTTPEngineReceiver.cpp
+++ b/src/engine/HTTPEngineReceiver.cpp
@@ -129,7 +129,7 @@ HTTPEngineReceiver::message_callback(SoupServer* server, SoupMessage* msg, const
cout << "PUT " << path << ":\n" << msg->request_body->data << endl;
}
- if (path == "/" || path == "") {
+ if (path == Path::root_uri || path == "") {
const string r = string("@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\n")
.append("\n<> rdfs:seeAlso <plugins> ;")
.append("\n rdfs:seeAlso <stream> ;")
diff --git a/src/engine/InternalPlugin.cpp b/src/engine/InternalPlugin.cpp
index 9f146068..465c6b3f 100644
--- a/src/engine/InternalPlugin.cpp
+++ b/src/engine/InternalPlugin.cpp
@@ -38,13 +38,14 @@ InternalPlugin::instantiate(const string& name,
SampleCount srate = engine.audio_driver()->sample_rate();
SampleCount buffer_size = engine.audio_driver()->buffer_size();
- if (uri() == NS_INTERNALS "Note") {
+ const string uri_str = uri().str();
+ if (uri_str == NS_INTERNALS "Note") {
return new NoteNode(name, polyphonic, parent, srate, buffer_size);
- } else if (uri() == NS_INTERNALS "Trigger") {
+ } else if (uri_str == NS_INTERNALS "Trigger") {
return new TriggerNode(name, polyphonic, parent, srate, buffer_size);
- } else if (uri() == NS_INTERNALS "Controller") {
+ } else if (uri_str == NS_INTERNALS "Controller") {
return new ControllerNode(name, polyphonic, parent, srate, buffer_size);
- } else if (uri() == NS_INTERNALS "Transport") {
+ } else if (uri_str == NS_INTERNALS "Transport") {
return new TransportNode(name, polyphonic, parent, srate, buffer_size);
} else {
return NULL;
diff --git a/src/engine/LADSPANode.cpp b/src/engine/LADSPANode.cpp
index b695befa..c6d22896 100644
--- a/src/engine/LADSPANode.cpp
+++ b/src/engine/LADSPANode.cpp
@@ -187,7 +187,7 @@ LADSPANode::instantiate()
port_name = name;
names.insert(make_pair(port_name, j));
- string port_path = path() + "/" + port_name;
+ Path port_path(path().child(port_name));
DataType type = DataType::AUDIO;
port_buffer_size = _buffer_size;
diff --git a/src/engine/LV2Node.cpp b/src/engine/LV2Node.cpp
index a9246b3a..27591499 100644
--- a/src/engine/LV2Node.cpp
+++ b/src/engine/LV2Node.cpp
@@ -173,7 +173,7 @@ LV2Node::instantiate()
slv2_value_free(ctx_ext_uri);
string port_name;
- string port_path;
+ Path port_path;
PortImpl* port = NULL;
@@ -190,7 +190,7 @@ LV2Node::instantiate()
port_name = slv2_value_as_string(slv2_port_get_symbol(plug, id));
assert(port_name.find("/") == string::npos);
- port_path = path() + "/" + port_name;
+ port_path = path().child(port_name);
DataType data_type = DataType::UNKNOWN;
if (slv2_port_is_a(plug, id, info->control_class)) {
diff --git a/src/engine/LV2Plugin.cpp b/src/engine/LV2Plugin.cpp
index 8efd5da2..9006a1ab 100644
--- a/src/engine/LV2Plugin.cpp
+++ b/src/engine/LV2Plugin.cpp
@@ -30,7 +30,7 @@ namespace Ingen {
const string
LV2Plugin::symbol() const
{
- string working = uri();
+ string working = uri().str();
if (working[working.length()-1] == '/')
working = working.substr(0, working.length()-1);
diff --git a/src/engine/NodeFactory.cpp b/src/engine/NodeFactory.cpp
index 9ec58d80..43043ea7 100644
--- a/src/engine/NodeFactory.cpp
+++ b/src/engine/NodeFactory.cpp
@@ -68,7 +68,7 @@ NodeFactory::~NodeFactory()
PluginImpl*
-NodeFactory::plugin(const string& uri)
+NodeFactory::plugin(const Raul::URI& uri)
{
const Plugins::const_iterator i = _plugins.find(uri);
return ((i != _plugins.end()) ? i->second : NULL);
diff --git a/src/engine/NodeFactory.hpp b/src/engine/NodeFactory.hpp
index 08b212fa..05fdf37a 100644
--- a/src/engine/NodeFactory.hpp
+++ b/src/engine/NodeFactory.hpp
@@ -18,16 +18,14 @@
#ifndef NODEFACTORY_H
#define NODEFACTORY_H
-#include "ingen-config.h"
-#include "module/global.hpp"
-
#include <list>
#include <map>
#include <string>
#include <pthread.h>
#include <glibmm/module.h>
-
-using std::string;
+#include "ingen-config.h"
+#include "module/global.hpp"
+#include "raul/URI.hpp"
namespace Ingen {
@@ -57,13 +55,15 @@ public:
void load_plugins();
- typedef std::map<std::string,PluginImpl*> Plugins;
+ typedef std::map<Raul::URI, PluginImpl*> Plugins;
const Plugins& plugins() const { return _plugins; }
- PluginImpl* plugin(const string& uri);
+ PluginImpl* plugin(const Raul::URI& uri);
/** DEPRECATED */
- PluginImpl* plugin(const string& type, const string& lib, const string& label);
+ PluginImpl* plugin(const std::string& type,
+ const std::string& lib,
+ const std::string& label);
private:
#ifdef HAVE_LADSPA_H
diff --git a/src/engine/OSCClientSender.cpp b/src/engine/OSCClientSender.cpp
index 1357258e..47bf589e 100644
--- a/src/engine/OSCClientSender.cpp
+++ b/src/engine/OSCClientSender.cpp
@@ -128,8 +128,8 @@ OSCClientSender::error(const std::string& msg)
* this one (/ingen/new_node), followed by a series of /ingen/new_port commands,
* followed by /ingen/new_node_end. </p> \n \n
*/
-void OSCClientSender::new_node(const std::string& node_path,
- const std::string& plugin_uri)
+void OSCClientSender::new_node(const Raul::Path& node_path,
+ const Raul::URI& plugin_uri)
{
send("/ingen/new_node", "ss", node_path.c_str(), plugin_uri.c_str(), LO_ARGS_END);
}
@@ -152,10 +152,10 @@ void OSCClientSender::new_node(const std::string& node_path,
* as variable.</p> \n \n
*/
void
-OSCClientSender::new_port(const std::string& path,
- const std::string& type,
- uint32_t index,
- bool is_output)
+OSCClientSender::new_port(const Raul::Path& path,
+ const Raul::URI& type,
+ uint32_t index,
+ bool is_output)
{
send("/ingen/new_port", "sisi", path.c_str(), index, type.c_str(), is_output, LO_ARGS_END);
}
@@ -166,10 +166,8 @@ OSCClientSender::new_port(const std::string& path,
* \arg \b path (string) - Path of object (which no longer exists) </p> \n \n
*/
void
-OSCClientSender::destroy(const std::string& path)
+OSCClientSender::destroy(const Raul::Path& path)
{
- assert(path != "/");
-
send("/ingen/destroyed", "s", path.c_str(), LO_ARGS_END);
}
@@ -179,7 +177,7 @@ OSCClientSender::destroy(const std::string& path)
* \arg \b path (string) - Path of patch (which is now empty)</p> \n \n
*/
void
-OSCClientSender::clear_patch(const std::string& patch_path)
+OSCClientSender::clear_patch(const Raul::Path& patch_path)
{
send("/ingen/clear_patch", "s", patch_path.c_str(), LO_ARGS_END);
}
@@ -191,7 +189,7 @@ OSCClientSender::clear_patch(const std::string& patch_path)
* \arg \b dst-path (string) - Path of the destination port</p> \n \n
*/
void
-OSCClientSender::connect(const std::string& src_port_path, const std::string& dst_port_path)
+OSCClientSender::connect(const Raul::Path& src_port_path, const Raul::Path& dst_port_path)
{
send("/ingen/new_connection", "ss", src_port_path.c_str(), dst_port_path.c_str(), LO_ARGS_END);
}
@@ -203,7 +201,7 @@ OSCClientSender::connect(const std::string& src_port_path, const std::string& ds
* \arg \b dst-path (string) - Path of the destination port</p> \n \n
*/
void
-OSCClientSender::disconnect(const std::string& src_port_path, const std::string& dst_port_path)
+OSCClientSender::disconnect(const Raul::Path& src_port_path, const Raul::Path& dst_port_path)
{
send("/ingen/disconnection", "ss", src_port_path.c_str(), dst_port_path.c_str(), LO_ARGS_END);
}
@@ -216,7 +214,7 @@ OSCClientSender::disconnect(const std::string& src_port_path, const std::string&
* \arg \b value (string)</p> \n \n
*/
void
-OSCClientSender::set_variable(const std::string& path, const std::string& key, const Atom& value)
+OSCClientSender::set_variable(const Raul::Path& path, const Raul::URI& key, const Atom& value)
{
lo_message m = lo_message_new();
lo_message_add_string(m, path.c_str());
@@ -233,7 +231,7 @@ OSCClientSender::set_variable(const std::string& path, const std::string& key, c
* \arg \b value (string)</p> \n \n
*/
void
-OSCClientSender::set_property(const std::string& path, const std::string& key, const Atom& value)
+OSCClientSender::set_property(const Raul::Path& path, const Raul::URI& key, const Atom& value)
{
lo_message m = lo_message_new();
lo_message_add_string(m, path.c_str());
@@ -249,7 +247,7 @@ OSCClientSender::set_property(const std::string& path, const std::string& key, c
* \arg \b value (any) - New value of port </p> \n \n
*/
void
-OSCClientSender::set_port_value(const std::string& port_path, const Raul::Atom& value)
+OSCClientSender::set_port_value(const Raul::Path& port_path, const Raul::Atom& value)
{
lo_message m = lo_message_new();
lo_message_add_string(m, port_path.c_str());
@@ -265,7 +263,7 @@ OSCClientSender::set_port_value(const std::string& port_path, const Raul::Atom&
* \arg \b value (any) - New value of port </p> \n \n
*/
void
-OSCClientSender::set_voice_value(const std::string& port_path, uint32_t voice, const Raul::Atom& value)
+OSCClientSender::set_voice_value(const Raul::Path& port_path, uint32_t voice, const Raul::Atom& value)
{
lo_message m = lo_message_new();
lo_message_add_string(m, port_path.c_str());
@@ -279,7 +277,7 @@ OSCClientSender::set_voice_value(const std::string& port_path, uint32_t voice, c
* \arg \b path (string) - Path of object </p> \n \n
*/
void
-OSCClientSender::activity(const std::string& path)
+OSCClientSender::activity(const Raul::Path& path)
{
if (!_enabled)
return;
@@ -296,9 +294,9 @@ OSCClientSender::activity(const std::string& path)
* \arg \b name (string) - Descriptive human-readable name of plugin (e.g. "ADSR Envelope")
*/
void
-OSCClientSender::new_plugin(const std::string& uri,
- const std::string& type_uri,
- const std::string& symbol)
+OSCClientSender::new_plugin(const Raul::URI& uri,
+ const Raul::URI& type_uri,
+ const Raul::Symbol& symbol)
{
lo_message m = lo_message_new();
lo_message_add_string(m, uri.c_str());
@@ -343,7 +341,7 @@ OSCClientSender::new_object(const Shared::GraphObject* object)
* \arg \b poly (int) - Polyphony of new patch (\em not a boolean like new_node) </p> \n \n
*/
void
-OSCClientSender::new_patch(const std::string& path, uint32_t poly)
+OSCClientSender::new_patch(const Raul::Path& path, uint32_t poly)
{
send("/ingen/new_patch", "si", path.c_str(), poly, LO_ARGS_END);
}
@@ -355,7 +353,7 @@ OSCClientSender::new_patch(const std::string& path, uint32_t poly)
* \arg \b new-path (string) - New path of object </p> \n \n
*/
void
-OSCClientSender::rename(const std::string& old_path, const std::string& new_path)
+OSCClientSender::rename(const Raul::Path& old_path, const Raul::Path& new_path)
{
send("/ingen/rename", "ss", old_path.c_str(), new_path.c_str(), LO_ARGS_END);
}
@@ -364,7 +362,7 @@ OSCClientSender::rename(const std::string& old_path, const std::string& new_path
/** Sends information about a program associated with a node.
*/
void
-OSCClientSender::program_add(const std::string& node_path, uint32_t bank, uint32_t program, const std::string& name)
+OSCClientSender::program_add(const Raul::Path& node_path, uint32_t bank, uint32_t program, const std::string& name)
{
send("/ingen/program_add", "siis",
node_path.c_str(), bank, program, name.c_str(), LO_ARGS_END);
@@ -372,7 +370,7 @@ OSCClientSender::program_add(const std::string& node_path, uint32_t bank, uint32
void
-OSCClientSender::program_remove(const std::string& node_path, uint32_t bank, uint32_t program)
+OSCClientSender::program_remove(const Raul::Path& node_path, uint32_t bank, uint32_t program)
{
send("/ingen/program_remove", "sii",
node_path.c_str(), bank, program, LO_ARGS_END);
diff --git a/src/engine/OSCClientSender.hpp b/src/engine/OSCClientSender.hpp
index 6d93b381..db8e2ba1 100644
--- a/src/engine/OSCClientSender.hpp
+++ b/src/engine/OSCClientSender.hpp
@@ -39,7 +39,7 @@ namespace Shared { class EngineInterface; }
class OSCClientSender : public Shared::ClientInterface, public Shared::OSCSender
{
public:
- OSCClientSender(const std::string& url)
+ OSCClientSender(const Raul::URI& url)
: _url(url)
{
_address = lo_address_new_from_url(url.c_str());
@@ -58,7 +58,7 @@ public:
void transfer_begin() { OSCSender::transfer_begin(); }
void transfer_end() { OSCSender::transfer_end(); }
- std::string uri() const { return lo_address_get_url(_address); }
+ Raul::URI uri() const { return lo_address_get_url(_address); }
void subscribe(Shared::EngineInterface* engine) { }
@@ -70,64 +70,65 @@ public:
void response_error(int32_t id, const std::string& msg);
void error(const std::string& msg);
-
- virtual void new_plugin(const std::string& uri,
- const std::string& type_uri,
- const std::string& symbol);
virtual bool new_object(const Shared::GraphObject* object);
+
+ virtual void new_plugin(const Raul::URI& uri,
+ const Raul::URI& type_uri,
+ const Raul::Symbol& symbol);
- virtual void new_patch(const std::string& path, uint32_t poly);
+ virtual void new_patch(const Raul::Path& path,
+ uint32_t poly);
- virtual void new_node(const std::string& path,
- const std::string& plugin_uri);
+ virtual void new_node(const Raul::Path& path,
+ const Raul::URI& plugin_uri);
- virtual void new_port(const std::string& path,
- const std::string& type,
- uint32_t index,
- bool is_output);
+ virtual void new_port(const Raul::Path& path,
+ const Raul::URI& type,
+ uint32_t index,
+ bool is_output);
- virtual void clear_patch(const std::string& path);
+ virtual void clear_patch(const Raul::Path& path);
- virtual void destroy(const std::string& path);
+ virtual void destroy(const Raul::Path& path);
- virtual void rename(const std::string& old_path,
- const std::string& new_path);
+ virtual void rename(const Raul::Path& old_path,
+ const Raul::Path& new_path);
- virtual void connect(const std::string& src_port_path,
- const std::string& dst_port_path);
+ virtual void connect(const Raul::Path& src_port_path,
+ const Raul::Path& dst_port_path);
- virtual void disconnect(const std::string& src_port_path,
- const std::string& dst_port_path);
+ virtual void disconnect(const Raul::Path& src_port_path,
+ const Raul::Path& dst_port_path);
- virtual void set_variable(const std::string& subject_path,
- const std::string& predicate,
- const Raul::Atom& value);
+ virtual void set_variable(const Raul::Path& subject_path,
+ const Raul::URI& predicate,
+ const Raul::Atom& value);
- virtual void set_property(const std::string& subject_path,
- const std::string& predicate,
- const Raul::Atom& value);
+ virtual void set_property(const Raul::Path& subject_path,
+ const Raul::URI& predicate,
+ const Raul::Atom& value);
- virtual void set_port_value(const std::string& port_path,
- const Raul::Atom& value);
+ virtual void set_port_value(const Raul::Path& port_path,
+ const Raul::Atom& value);
- virtual void set_voice_value(const std::string& port_path,
- uint32_t voice,
- const Raul::Atom& value);
+ virtual void set_voice_value(const Raul::Path& port_path,
+ uint32_t voice,
+ const Raul::Atom& value);
- virtual void activity(const std::string& path);
+ virtual void activity(const Raul::Path& path);
- virtual void program_add(const std::string& node_path,
+ virtual void program_add(const Raul::Path& node_path,
uint32_t bank,
uint32_t program,
const std::string& program_name);
- virtual void program_remove(const std::string& node_path,
- uint32_t bank,
- uint32_t program);
+ virtual void program_remove(const Raul::Path& node_path,
+ uint32_t bank,
+ uint32_t program);
private:
- std::string _url;
+ Raul::URI _url;
};
diff --git a/src/engine/ObjectSender.cpp b/src/engine/ObjectSender.cpp
index e261bc97..a0202db0 100644
--- a/src/engine/ObjectSender.cpp
+++ b/src/engine/ObjectSender.cpp
@@ -103,8 +103,6 @@ ObjectSender::send_node(ClientInterface* client, const NodeImpl* node, bool recu
{
PluginImpl* const plugin = node->plugin_impl();
- assert(node->path().length() > 0);
-
if (plugin->type() == Plugin::Patch) {
send_patch(client, (PatchImpl*)node, recursive);
return;
diff --git a/src/engine/QueuedEngineInterface.cpp b/src/engine/QueuedEngineInterface.cpp
index 4c24c405..3dcd2ddb 100644
--- a/src/engine/QueuedEngineInterface.cpp
+++ b/src/engine/QueuedEngineInterface.cpp
@@ -79,7 +79,7 @@ QueuedEngineInterface::register_client(ClientInterface* client)
void
-QueuedEngineInterface::unregister_client(const string& uri)
+QueuedEngineInterface::unregister_client(const URI& uri)
{
push_queued(new UnregisterClientEvent(_engine, _responder, now(), uri));
if (_responder && _responder->client() && _responder->client()->uri() == uri) {
@@ -153,56 +153,56 @@ QueuedEngineInterface::new_object(const GraphObject* object)
void
-QueuedEngineInterface::new_patch(const string& path,
- uint32_t poly)
+QueuedEngineInterface::new_patch(const Path& path,
+ uint32_t poly)
{
push_queued(new CreatePatchEvent(_engine, _responder, now(), path, poly));
}
// FIXME: use index
-void QueuedEngineInterface::new_port(const string& path,
- const string& type,
- uint32_t index,
- bool direction)
+void QueuedEngineInterface::new_port(const Path& path,
+ const URI& type,
+ uint32_t index,
+ bool direction)
{
push_queued(new CreatePortEvent(_engine, _responder, now(), path, type, direction, this));
}
void
-QueuedEngineInterface::new_node(const string& path,
- const string& plugin_uri)
+QueuedEngineInterface::new_node(const Path& path,
+ const URI& plugin_uri)
{
push_queued(new CreateNodeEvent(_engine, _responder, now(), path, plugin_uri, true));
}
void
-QueuedEngineInterface::rename(const string& old_path,
- const string& new_path)
+QueuedEngineInterface::rename(const Path& old_path,
+ const Path& new_path)
{
push_queued(new RenameEvent(_engine, _responder, now(), old_path, new_path));
}
void
-QueuedEngineInterface::destroy(const string& path)
+QueuedEngineInterface::destroy(const Path& path)
{
push_queued(new DestroyEvent(_engine, _responder, now(), this, path));
}
void
-QueuedEngineInterface::clear_patch(const string& patch_path)
+QueuedEngineInterface::clear_patch(const Path& patch_path)
{
push_queued(new ClearPatchEvent(_engine, _responder, now(), this, patch_path));
}
void
-QueuedEngineInterface::connect(const string& src_port_path,
- const string& dst_port_path)
+QueuedEngineInterface::connect(const Path& src_port_path,
+ const Path& dst_port_path)
{
push_queued(new ConnectionEvent(_engine, _responder, now(), src_port_path, dst_port_path));
@@ -210,23 +210,23 @@ QueuedEngineInterface::connect(const string& src_port_path,
void
-QueuedEngineInterface::disconnect(const string& src_port_path,
- const string& dst_port_path)
+QueuedEngineInterface::disconnect(const Path& src_port_path,
+ const Path& dst_port_path)
{
push_queued(new DisconnectionEvent(_engine, _responder, now(), src_port_path, dst_port_path));
}
void
-QueuedEngineInterface::disconnect_all(const string& patch_path,
- const string& path)
+QueuedEngineInterface::disconnect_all(const Path& patch_path,
+ const Path& path)
{
push_queued(new DisconnectAllEvent(_engine, _responder, now(), patch_path, path));
}
void
-QueuedEngineInterface::set_port_value(const string& port_path,
+QueuedEngineInterface::set_port_value(const Path& port_path,
const Raul::Atom& value)
{
push_queued(new SetPortValueEvent(_engine, _responder, true, now(), port_path, value));
@@ -234,7 +234,7 @@ QueuedEngineInterface::set_port_value(const string& port_path,
void
-QueuedEngineInterface::set_voice_value(const string& port_path,
+QueuedEngineInterface::set_voice_value(const Path& port_path,
uint32_t voice,
const Raul::Atom& value)
{
@@ -243,34 +243,34 @@ QueuedEngineInterface::set_voice_value(const string& port_path,
void
-QueuedEngineInterface::set_program(const string& node_path,
- uint32_t bank,
- uint32_t program)
+QueuedEngineInterface::set_program(const Path& node_path,
+ uint32_t bank,
+ uint32_t program)
{
std::cerr << "FIXME: set program" << std::endl;
}
void
-QueuedEngineInterface::midi_learn(const string& node_path)
+QueuedEngineInterface::midi_learn(const Path& node_path)
{
push_queued(new MidiLearnEvent(_engine, _responder, now(), node_path));
}
void
-QueuedEngineInterface::set_variable(const string& path,
- const string& predicate,
- const Atom& value)
+QueuedEngineInterface::set_variable(const Path& path,
+ const URI& predicate,
+ const Atom& value)
{
push_queued(new SetMetadataEvent(_engine, _responder, now(), false, path, predicate, value));
}
void
-QueuedEngineInterface::set_property(const string& path,
- const string& predicate,
- const Atom& value)
+QueuedEngineInterface::set_property(const Path& path,
+ const URI& predicate,
+ const Atom& value)
{
push_queued(new SetMetadataEvent(_engine, _responder, now(), true, path, predicate, value));
}
@@ -289,35 +289,35 @@ QueuedEngineInterface::ping()
void
-QueuedEngineInterface::request_plugin(const string& uri)
+QueuedEngineInterface::request_plugin(const URI& uri)
{
push_queued(new RequestPluginEvent(_engine, _responder, now(), uri));
}
void
-QueuedEngineInterface::request_object(const string& path)
+QueuedEngineInterface::request_object(const Path& path)
{
push_queued(new RequestObjectEvent(_engine, _responder, now(), path));
}
void
-QueuedEngineInterface::request_port_value(const string& port_path)
+QueuedEngineInterface::request_port_value(const Path& port_path)
{
push_queued(new RequestPortValueEvent(_engine, _responder, now(), port_path));
}
void
-QueuedEngineInterface::request_variable(const string& object_path, const string& key)
+QueuedEngineInterface::request_variable(const Path& object_path, const URI& key)
{
push_queued(new RequestMetadataEvent(_engine, _responder, now(), false, object_path, key));
}
void
-QueuedEngineInterface::request_property(const string& object_path, const string& key)
+QueuedEngineInterface::request_property(const Path& object_path, const URI& key)
{
push_queued(new RequestMetadataEvent(_engine, _responder, now(), true, object_path, key));
}
diff --git a/src/engine/QueuedEngineInterface.hpp b/src/engine/QueuedEngineInterface.hpp
index bd90e097..7e2dd4d0 100644
--- a/src/engine/QueuedEngineInterface.hpp
+++ b/src/engine/QueuedEngineInterface.hpp
@@ -53,13 +53,13 @@ public:
QueuedEngineInterface(Engine& engine, size_t queue_size);
virtual ~QueuedEngineInterface() {}
- std::string uri() const { return "ingen:internal"; }
+ Raul::URI uri() const { return "ingen:internal"; }
void set_next_response_id(int32_t id);
// Client registration
virtual void register_client(ClientInterface* client);
- virtual void unregister_client(const string& uri);
+ virtual void unregister_client(const Raul::URI& uri);
// Engine commands
virtual void load_plugins();
@@ -71,66 +71,68 @@ public:
virtual void bundle_begin();
virtual void bundle_end();
- // Object commands
+ // CommonInterface object commands
virtual bool new_object(const Shared::GraphObject* object);
-
- virtual void new_patch(const string& path,
- uint32_t poly);
-
- virtual void new_port(const string& path,
- const string& type,
- uint32_t index,
- bool direction);
- virtual void new_node(const string& path,
- const string& plugin_uri);
+ virtual void new_patch(const Raul::Path& path,
+ uint32_t poly);
- virtual void rename(const string& old_path,
- const string& new_name);
-
- virtual void destroy(const string& path);
-
- virtual void clear_patch(const string& patch_path);
+ virtual void new_node(const Raul::Path& path,
+ const Raul::URI& plugin_uri);
- virtual void connect(const string& src_port_path,
- const string& dst_port_path);
-
- virtual void disconnect(const string& src_port_path,
- const string& dst_port_path);
-
- virtual void disconnect_all(const string& patch_path,
- const string& path);
-
- virtual void set_port_value(const string& port_path,
- const Raul::Atom& value);
+ virtual void new_port(const Raul::Path& path,
+ const Raul::URI& type,
+ uint32_t index,
+ bool is_output);
- virtual void set_voice_value(const string& port_path,
- uint32_t voice,
- const Raul::Atom& value);
+ virtual void rename(const Raul::Path& old_path,
+ const Raul::Path& new_path);
- virtual void set_program(const string& node_path,
- uint32_t bank,
- uint32_t program);
-
- virtual void midi_learn(const string& node_path);
-
- virtual void set_variable(const string& path,
- const string& predicate,
+ virtual void connect(const Raul::Path& src_port_path,
+ const Raul::Path& dst_port_path);
+
+ virtual void disconnect(const Raul::Path& src_port_path,
+ const Raul::Path& dst_port_path);
+
+ virtual void set_variable(const Raul::Path& subject_path,
+ const Raul::URI& predicate,
const Raul::Atom& value);
- virtual void set_property(const string& path,
- const string& predicate,
+ virtual void set_property(const Raul::Path& subject_path,
+ const Raul::URI& predicate,
const Raul::Atom& value);
+ virtual void set_port_value(const Raul::Path& port_path,
+ const Raul::Atom& value);
+
+ virtual void set_voice_value(const Raul::Path& port_path,
+ uint32_t voice,
+ const Raul::Atom& value);
+
+ virtual void destroy(const Raul::Path& path);
+
+ virtual void clear_patch(const Raul::Path& patch_path);
+
+ // EngineInterface object commands
+
+ virtual void disconnect_all(const Raul::Path& parent_patch_path,
+ const Raul::Path& path);
+
+ virtual void set_program(const Raul::Path& node_path,
+ uint32_t bank,
+ uint32_t program);
+
+ virtual void midi_learn(const Raul::Path& node_path);
+
// Requests //
virtual void ping();
- virtual void request_plugin(const string& uri);
- virtual void request_object(const string& path);
- virtual void request_port_value(const string& port_path);
- virtual void request_variable(const string& object_path, const string& key);
- virtual void request_property(const string& object_path, const string& key);
+ virtual void request_plugin(const Raul::URI& uri);
+ virtual void request_object(const Raul::Path& path);
+ virtual void request_port_value(const Raul::Path& port_path);
+ virtual void request_variable(const Raul::Path& object_path, const Raul::URI& key);
+ virtual void request_property(const Raul::Path& object_path, const Raul::URI& key);
virtual void request_plugins();
virtual void request_all_objects();
diff --git a/src/engine/events/AllNotesOffEvent.cpp b/src/engine/events/AllNotesOffEvent.cpp
index fcb68b31..8e009760 100644
--- a/src/engine/events/AllNotesOffEvent.cpp
+++ b/src/engine/events/AllNotesOffEvent.cpp
@@ -36,7 +36,7 @@ AllNotesOffEvent::AllNotesOffEvent(Engine& engine, SharedPtr<Responder> responde
/** Note off event with lookup - triggered by OSC.
*/
-AllNotesOffEvent::AllNotesOffEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& patch_path)
+AllNotesOffEvent::AllNotesOffEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Path& patch_path)
: Event(engine, responder, timestamp),
_patch_path(patch_path),
_patch(NULL)
@@ -49,7 +49,7 @@ AllNotesOffEvent::execute(ProcessContext& context)
{
Event::execute(context);
- if (_patch == NULL && _patch_path != "")
+ if (!_patch)
_patch = _engine.engine_store()->find_patch(_patch_path);
//if (_patch != NULL)
diff --git a/src/engine/events/AllNotesOffEvent.hpp b/src/engine/events/AllNotesOffEvent.hpp
index 3e4d56b3..41f7e25b 100644
--- a/src/engine/events/AllNotesOffEvent.hpp
+++ b/src/engine/events/AllNotesOffEvent.hpp
@@ -19,8 +19,6 @@
#define ALLNOTESOFFEVENT_H
#include "Event.hpp"
-#include <string>
-using std::string;
namespace Ingen {
@@ -35,14 +33,14 @@ class AllNotesOffEvent : public Event
{
public:
AllNotesOffEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, PatchImpl* patch);
- AllNotesOffEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& patch_path);
+ AllNotesOffEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Raul::Path& patch_path);
void execute(ProcessContext& context);
void post_process();
private:
- const string _patch_path;
- PatchImpl* _patch;
+ const Raul::Path _patch_path;
+ PatchImpl* _patch;
};
diff --git a/src/engine/events/ClearPatchEvent.cpp b/src/engine/events/ClearPatchEvent.cpp
index 2be2e4a8..e3632e08 100644
--- a/src/engine/events/ClearPatchEvent.cpp
+++ b/src/engine/events/ClearPatchEvent.cpp
@@ -33,7 +33,7 @@
namespace Ingen {
-ClearPatchEvent::ClearPatchEvent(Engine& engine, SharedPtr<Responder> responder, FrameTime time, QueuedEventSource* source, const string& patch_path)
+ClearPatchEvent::ClearPatchEvent(Engine& engine, SharedPtr<Responder> responder, FrameTime time, QueuedEventSource* source, const Path& patch_path)
: QueuedEvent(engine, responder, time, true, source)
, _patch_path(patch_path)
, _process(false)
@@ -151,7 +151,7 @@ ClearPatchEvent::post_process()
}
} else {
- _responder->respond_error(string("Patch ") + _patch_path + " not found");
+ _responder->respond_error(string("Patch ") + _patch_path.str() + " not found");
}
_source->unblock(); // FIXME: can be done earlier in execute?
diff --git a/src/engine/events/ClearPatchEvent.hpp b/src/engine/events/ClearPatchEvent.hpp
index 75226dd9..b5fcf716 100644
--- a/src/engine/events/ClearPatchEvent.hpp
+++ b/src/engine/events/ClearPatchEvent.hpp
@@ -18,7 +18,6 @@
#ifndef CLEARPATCHEVENT_H
#define CLEARPATCHEVENT_H
-#include <string>
#include "raul/Array.hpp"
#include "raul/Table.hpp"
#include "raul/Path.hpp"
@@ -26,8 +25,6 @@
#include "EngineStore.hpp"
#include "PatchImpl.hpp"
-using std::string;
-
namespace Ingen {
class PatchImpl;
@@ -41,18 +38,18 @@ class DriverPort;
class ClearPatchEvent : public QueuedEvent
{
public:
- ClearPatchEvent(Engine& engine, SharedPtr<Responder> responder, FrameTime time, QueuedEventSource* source, const string& patch_path);
+ ClearPatchEvent(Engine& engine, SharedPtr<Responder> responder, FrameTime time, QueuedEventSource* source, const Raul::Path& patch_path);
void pre_process();
void execute(ProcessContext& context);
void post_process();
private:
- const string _patch_path;
+ const Raul::Path _patch_path;
SharedPtr<PatchImpl> _patch;
bool _process;
- Raul::Array<PortImpl*>* _ports_array; ///< New (external) ports for Patch
- CompiledPatch* _compiled_patch; ///< Patch's new process order
+ Raul::Array<PortImpl*>* _ports_array; ///< New (external) ports for Patch
+ CompiledPatch* _compiled_patch; ///< Patch's new process order
typedef Raul::Array<Raul::List<DriverPort*>::Node*> DriverPorts;
DriverPorts* _driver_ports;
diff --git a/src/engine/events/ConnectionEvent.cpp b/src/engine/events/ConnectionEvent.cpp
index e751c0b9..13e160c9 100644
--- a/src/engine/events/ConnectionEvent.cpp
+++ b/src/engine/events/ConnectionEvent.cpp
@@ -35,7 +35,7 @@ using std::string;
namespace Ingen {
-ConnectionEvent::ConnectionEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& src_port_path, const string& dst_port_path)
+ConnectionEvent::ConnectionEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Path& src_port_path, const Path& dst_port_path)
: QueuedEvent(engine, responder, timestamp)
, _src_port_path(src_port_path)
, _dst_port_path(dst_port_path)
diff --git a/src/engine/events/ConnectionEvent.hpp b/src/engine/events/ConnectionEvent.hpp
index 2bc8369f..53254e77 100644
--- a/src/engine/events/ConnectionEvent.hpp
+++ b/src/engine/events/ConnectionEvent.hpp
@@ -18,13 +18,11 @@
#ifndef CONNECTIONEVENT_H
#define CONNECTIONEVENT_H
-#include <string>
#include "raul/Path.hpp"
#include "QueuedEvent.hpp"
#include "PatchImpl.hpp"
#include "InputPort.hpp"
#include "types.hpp"
-using std::string;
namespace Raul {
template <typename T> class ListNode;
@@ -50,7 +48,7 @@ class CompiledPatch;
class ConnectionEvent : public QueuedEvent
{
public:
- ConnectionEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& src_port_path, const string& dst_port_path);
+ ConnectionEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Raul::Path& src_port_path, const Raul::Path& dst_port_path);
void pre_process();
void execute(ProcessContext& context);
diff --git a/src/engine/events/CreateNodeEvent.cpp b/src/engine/events/CreateNodeEvent.cpp
index 41470d45..f34f75c3 100644
--- a/src/engine/events/CreateNodeEvent.cpp
+++ b/src/engine/events/CreateNodeEvent.cpp
@@ -36,8 +36,7 @@
namespace Ingen {
-CreateNodeEvent::CreateNodeEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& path,
- const string& plugin_uri, bool polyphonic)
+CreateNodeEvent::CreateNodeEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Path& path, const URI& plugin_uri, bool polyphonic)
: QueuedEvent(engine, responder, timestamp)
, _path(path)
, _plugin_uri(plugin_uri)
@@ -47,14 +46,15 @@ CreateNodeEvent::CreateNodeEvent(Engine& engine, SharedPtr<Responder> responder,
, _compiled_patch(NULL)
, _node_already_exists(false)
{
- if (_plugin_uri.substr(0, 3) == "om:") {
+ string uri = _plugin_uri.str();
+ if (uri.substr(0, 3) == "om:") {
size_t colon = 2;
- _plugin_uri = _plugin_uri.substr(colon + 1);
- if ((colon = _plugin_uri.find(":")) == string::npos)
+ uri = uri.substr(colon + 1);
+ if ((colon = uri.find(":")) == string::npos)
return;
- _plugin_type = _plugin_uri.substr(0, colon + 1);
- _plugin_label = _plugin_uri.substr(colon + 1);
- _plugin_uri = "";
+ _plugin_type = uri.substr(0, colon + 1);
+ _plugin_label = uri.substr(colon + 1);
+ uri = "";
}
}
@@ -70,8 +70,8 @@ CreateNodeEvent::pre_process()
_patch = _engine.engine_store()->find_patch(_path.parent());
- PluginImpl* const plugin = (_plugin_uri != "")
- ? _engine.node_factory()->plugin(_plugin_uri)
+ PluginImpl* const plugin = (_plugin_label == "")
+ ? _engine.node_factory()->plugin(_plugin_uri.str())
: _engine.node_factory()->plugin(_plugin_type, _plugin_lib, _plugin_label);
if (_patch && plugin) {
@@ -115,19 +115,14 @@ CreateNodeEvent::post_process()
{
string msg;
if (_node_already_exists) {
- msg = string("Could not create node - ").append(_path);// + " already exists.";
+ msg = string("Could not create node - ").append(_path.str());// + " already exists.";
_responder->respond_error(msg);
} else if (_patch == NULL) {
- msg = "Could not find patch '" + _path.parent() +"' for add_node.";
+ msg = "Could not find patch '" + _path.parent().str() +"' to add node.";
_responder->respond_error(msg);
} else if (_node == NULL) {
msg = "Unable to load node ";
- msg += _path + " (you're missing the plugin ";
- if (_plugin_uri != "")
- msg += _plugin_uri;
- else
- msg += _plugin_lib + ":" + _plugin_label + " (" + _plugin_type + ")";
- msg += ")";
+ msg += _path.str() + " (you're missing the plugin " + _plugin_uri.str() + ")";
_responder->respond_error(msg);
} else {
_responder->respond_ok();
diff --git a/src/engine/events/CreateNodeEvent.hpp b/src/engine/events/CreateNodeEvent.hpp
index 61fd2c5c..cba84cd0 100644
--- a/src/engine/events/CreateNodeEvent.hpp
+++ b/src/engine/events/CreateNodeEvent.hpp
@@ -18,13 +18,8 @@
#ifndef CREATENODEEVENT_H
#define CREATENODEEVENT_H
-#include "QueuedEvent.hpp"
-#include "raul/Path.hpp"
#include <string>
-using std::string;
-
-namespace Raul { template <typename T> class Array; }
-template<typename T> class TreeNode;
+#include "QueuedEvent.hpp"
namespace Ingen {
@@ -43,8 +38,8 @@ public:
CreateNodeEvent(Engine& engine,
SharedPtr<Responder> responder,
SampleCount timestamp,
- const string& node_path,
- const string& plugin_uri,
+ const Raul::Path& node_path,
+ const Raul::URI& plugin_uri,
bool poly);
void pre_process();
@@ -52,12 +47,11 @@ public:
void post_process();
private:
- string _patch_name;
Raul::Path _path;
- string _plugin_uri; ///< If nonempty then type, library, label, are ignored
- string _plugin_type;
- string _plugin_lib;
- string _plugin_label;
+ Raul::URI _plugin_uri; ///< If nonempty then type, library, label, are ignored
+ std::string _plugin_type;
+ std::string _plugin_lib;
+ std::string _plugin_label;
bool _polyphonic;
PatchImpl* _patch;
NodeImpl* _node;
diff --git a/src/engine/events/CreatePatchEvent.cpp b/src/engine/events/CreatePatchEvent.cpp
index 56796557..392a1cc2 100644
--- a/src/engine/events/CreatePatchEvent.cpp
+++ b/src/engine/events/CreatePatchEvent.cpp
@@ -30,9 +30,9 @@
namespace Ingen {
-CreatePatchEvent::CreatePatchEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& path, int poly)
+CreatePatchEvent::CreatePatchEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Raul::Path& path, int poly)
: QueuedEvent(engine, responder, timestamp)
- , _path(Raul::Path::pathify(path))
+ , _path(path)
, _patch(NULL)
, _parent(NULL)
, _compiled_patch(NULL)
@@ -45,13 +45,7 @@ CreatePatchEvent::CreatePatchEvent(Engine& engine, SharedPtr<Responder> responde
void
CreatePatchEvent::pre_process()
{
- if (!Path::is_valid(_path)) {
- _error = INVALID_PATH;
- QueuedEvent::pre_process();
- return;
- }
-
- if (_path == "/" || _engine.engine_store()->find_object(_path) != NULL) {
+ if (_path.is_root() || _engine.engine_store()->find_object(_path) != NULL) {
_error = OBJECT_EXISTS;
QueuedEvent::pre_process();
return;
@@ -102,13 +96,12 @@ CreatePatchEvent::execute(ProcessContext& context)
if (_patch != NULL) {
if (_parent == NULL) {
- assert(_path == "/");
+ assert(_path.is_root());
assert(_patch->parent_patch() == NULL);
_engine.audio_driver()->set_root_patch(_patch);
} else {
assert(_parent != NULL);
- assert(_path != "/");
-
+ assert(!_path.is_root());
if (_parent->compiled_patch() != NULL)
_engine.maid()->push(_parent->compiled_patch());
_parent->compiled_patch(_compiled_patch);
@@ -120,34 +113,32 @@ CreatePatchEvent::execute(ProcessContext& context)
void
CreatePatchEvent::post_process()
{
- if (_responder.get()) {
- if (_error == NO_ERROR) {
-
+ string msg;
+ if (_responder) {
+ switch (_error) {
+ case NO_ERROR:
_responder->respond_ok();
-
// Don't send ports/nodes that have been added since prepare()
// (otherwise they would be sent twice)
- //_engine.broadcaster()->send_patch(_patch, false);
_engine.broadcaster()->send_object(_patch, false);
-
- } else if (_error == INVALID_PATH) {
- string msg = "Attempt to create patch with illegal path ";
- msg.append(_path);
- _responder->respond_error(msg);
- } else if (_error == OBJECT_EXISTS) {
+ break;
+ case OBJECT_EXISTS:
_responder->respond_ok();
/*string msg = "Unable to create patch: ";
msg.append(_path).append(" already exists.");
_responder->respond_error(msg);*/
- } else if (_error == PARENT_NOT_FOUND) {
- string msg = "Unable to create patch: Parent ";
- msg.append(Path(_path).parent()).append(" not found.");
+ break;
+ case PARENT_NOT_FOUND:
+ msg = "Unable to create patch: Parent ";
+ msg.append(Path(_path).parent().str()).append(" not found.");
_responder->respond_error(msg);
- } else if (_error == INVALID_POLY) {
- string msg = "Unable to create patch ";
- msg.append(_path).append(": ").append("Invalid polyphony respondered.");
+ break;
+ case INVALID_POLY:
+ msg = "Unable to create patch ";
+ msg.append(_path.str()).append(": ").append("Invalid polyphony respondered.");
_responder->respond_error(msg);
- } else {
+ break;
+ default:
_responder->respond_error("Unable to load patch.");
}
}
diff --git a/src/engine/events/CreatePatchEvent.hpp b/src/engine/events/CreatePatchEvent.hpp
index 0dfb3e50..c2759341 100644
--- a/src/engine/events/CreatePatchEvent.hpp
+++ b/src/engine/events/CreatePatchEvent.hpp
@@ -18,12 +18,8 @@
#ifndef CREATEPATCHEVENT_H
#define CREATEPATCHEVENT_H
-#include <string>
#include "QueuedEvent.hpp"
-namespace Raul { template<typename T> class Array; }
-template<typename T> class TreeNode;
-
namespace Ingen {
class PatchImpl;
@@ -37,21 +33,21 @@ class CompiledPatch;
class CreatePatchEvent : public QueuedEvent
{
public:
- CreatePatchEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const std::string& path, int poly);
+ CreatePatchEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Raul::Path& path, int poly);
void pre_process();
void execute(ProcessContext& context);
void post_process();
private:
- enum ErrorType { NO_ERROR, OBJECT_EXISTS, PARENT_NOT_FOUND, INVALID_POLY, INVALID_PATH };
+ enum ErrorType { NO_ERROR, OBJECT_EXISTS, PARENT_NOT_FOUND, INVALID_POLY };
- const std::string _path;
- PatchImpl* _patch;
- PatchImpl* _parent;
- CompiledPatch* _compiled_patch;
- int _poly;
- ErrorType _error;
+ const Raul::Path _path;
+ PatchImpl* _patch;
+ PatchImpl* _parent;
+ CompiledPatch* _compiled_patch;
+ int _poly;
+ ErrorType _error;
};
diff --git a/src/engine/events/CreatePortEvent.cpp b/src/engine/events/CreatePortEvent.cpp
index 0e0dabd2..870a190c 100644
--- a/src/engine/events/CreatePortEvent.cpp
+++ b/src/engine/events/CreatePortEvent.cpp
@@ -40,8 +40,8 @@ namespace Ingen {
CreatePortEvent::CreatePortEvent(Engine& engine,
SharedPtr<Responder> responder,
SampleCount timestamp,
- const string& path,
- const string& type,
+ const Raul::Path& path,
+ const Raul::URI& type,
bool is_output,
QueuedEventSource* source)
: QueuedEvent(engine, responder, timestamp, true, source)
@@ -83,7 +83,7 @@ CreatePortEvent::pre_process()
assert(_patch->path() == _path.parent());
size_t buffer_size = 1;
- if (_type != "ingen:Float")
+ if (_type.str() != "ingen:Float")
buffer_size = _engine.audio_driver()->buffer_size();
const uint32_t old_num_ports = _patch->num_ports();
@@ -106,10 +106,10 @@ CreatePortEvent::pre_process()
_engine.engine_store()->add(_patch_port);
if (!_patch->parent()) {
- if (_type == "lv2:AudioPort") {
+ if (_type.str() == "lv2:AudioPort") {
_driver_port = _engine.audio_driver()->create_port(
dynamic_cast<DuplexPort*>(_patch_port));
- } else if (_type == "lv2ev:EventPort") {
+ } else if (_type.str() == "lv2ev:EventPort") {
_driver_port = _engine.midi_driver()->create_port(
dynamic_cast<DuplexPort*>(_patch_port));
}
@@ -136,9 +136,9 @@ CreatePortEvent::execute(ProcessContext& context)
}
if (_driver_port) {
- if (_type == "lv2:AudioPort") {
+ if (_type.str() == "lv2:AudioPort") {
_engine.audio_driver()->add_port(_driver_port);
- } else if (_type == "lv2ev:EventPort") {
+ } else if (_type.str() == "lv2ev:EventPort") {
_engine.midi_driver()->add_port(_driver_port);
}
}
@@ -158,11 +158,11 @@ CreatePortEvent::post_process()
_engine.broadcaster()->send_object(_patch_port, true);
break;
case UNKNOWN_TYPE:
- msg = string("Could not create port ") + _path + " (Unknown type)";
+ msg = string("Could not create port ") + _path.str() + " (Unknown type)";
_responder->respond_error(msg);
break;
case CREATION_FAILED:
- msg = string("Could not create port ") + _path + " (Creation failed)";
+ msg = string("Could not create port ") + _path.str() + " (Creation failed)";
_responder->respond_error(msg);
break;
}
diff --git a/src/engine/events/CreatePortEvent.hpp b/src/engine/events/CreatePortEvent.hpp
index 4a8233b7..2587f2f0 100644
--- a/src/engine/events/CreatePortEvent.hpp
+++ b/src/engine/events/CreatePortEvent.hpp
@@ -22,8 +22,6 @@
#include "raul/Path.hpp"
#include "raul/Array.hpp"
#include "interface/DataType.hpp"
-#include <string>
-using std::string;
template <typename T> class Array;
@@ -41,7 +39,7 @@ class DriverPort;
class CreatePortEvent : public QueuedEvent
{
public:
- CreatePortEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& path, const string& type, bool is_output, QueuedEventSource* source);
+ CreatePortEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Raul::Path& path, const Raul::URI& type, bool is_output, QueuedEventSource* source);
void pre_process();
void execute(ProcessContext& context);
@@ -57,7 +55,7 @@ private:
ErrorType _error;
Raul::Path _path;
- string _type;
+ Raul::URI _type;
bool _is_output;
DataType _data_type;
PatchImpl* _patch;
diff --git a/src/engine/events/DestroyEvent.cpp b/src/engine/events/DestroyEvent.cpp
index a9597638..469d73f1 100644
--- a/src/engine/events/DestroyEvent.cpp
+++ b/src/engine/events/DestroyEvent.cpp
@@ -34,7 +34,7 @@
namespace Ingen {
-DestroyEvent::DestroyEvent(Engine& engine, SharedPtr<Responder> responder, FrameTime time, QueuedEventSource* source, const string& path)
+DestroyEvent::DestroyEvent(Engine& engine, SharedPtr<Responder> responder, FrameTime time, QueuedEventSource* source, const Raul::Path& path)
: QueuedEvent(engine, responder, time, true, source)
, _path(path)
, _store_iterator(engine.engine_store()->end())
@@ -71,7 +71,7 @@ DestroyEvent::pre_process()
_removed_table = _engine.engine_store()->remove(_store_iterator);
}
- if (_node != NULL && _path != "/") {
+ if (_node != NULL && !_path.is_root()) {
assert(_node->parent_patch());
_patch_node_listnode = _node->parent_patch()->remove_node(_path.name());
if (_patch_node_listnode) {
@@ -168,10 +168,10 @@ void
DestroyEvent::post_process()
{
if (!_node && !_port) {
- if (_path == "/") {
+ if (_path.is_root()) {
_responder->respond_error("You can not destroy the root patch (/)");
} else {
- string msg = string("Could not find object ") + _path + " to destroy";
+ string msg = string("Could not find object ") + _path.str() + " to destroy";
_responder->respond_error(msg);
}
}
diff --git a/src/engine/events/DestroyEvent.hpp b/src/engine/events/DestroyEvent.hpp
index 59ff80ee..a3ed4bee 100644
--- a/src/engine/events/DestroyEvent.hpp
+++ b/src/engine/events/DestroyEvent.hpp
@@ -18,19 +18,14 @@
#ifndef DESTROYEVENT_H
#define DESTROYEVENT_H
-#include <string>
-#include "raul/Path.hpp"
#include "QueuedEvent.hpp"
#include "EngineStore.hpp"
#include "PatchImpl.hpp"
-using std::string;
-
namespace Raul {
template<typename T> class Array;
template<typename T> class ListNode;
}
-template<typename T> class TreeNode;
namespace Ingen {
@@ -49,7 +44,7 @@ class CompiledPatch;
class DestroyEvent : public QueuedEvent
{
public:
- DestroyEvent(Engine& engine, SharedPtr<Responder> responder, FrameTime timestamp, QueuedEventSource* source, const string& path);
+ DestroyEvent(Engine& engine, SharedPtr<Responder> responder, FrameTime timestamp, QueuedEventSource* source, const Raul::Path& path);
~DestroyEvent();
void pre_process();
@@ -57,16 +52,16 @@ public:
void post_process();
private:
- Path _path;
- EngineStore::iterator _store_iterator;
- SharedPtr<NodeImpl> _node; ///< Non-NULL iff a node
- SharedPtr<PortImpl> _port; ///< Non-NULL iff a port
- Raul::List<DriverPort*>::Node* _driver_port;
- PatchImpl::Nodes::Node* _patch_node_listnode;
- Raul::List<PortImpl*>::Node* _patch_port_listnode;
- Raul::Array<PortImpl*>* _ports_array; ///< New (external) ports for Patch
- CompiledPatch* _compiled_patch; ///< Patch's new process order
- DisconnectAllEvent* _disconnect_event;
+ Raul::Path _path;
+ EngineStore::iterator _store_iterator;
+ SharedPtr<NodeImpl> _node; ///< Non-NULL iff a node
+ SharedPtr<PortImpl> _port; ///< Non-NULL iff a port
+ Raul::List<DriverPort*>::Node* _driver_port;
+ PatchImpl::Nodes::Node* _patch_node_listnode;
+ Raul::List<PortImpl*>::Node* _patch_port_listnode;
+ Raul::Array<PortImpl*>* _ports_array; ///< New (external) ports for Patch
+ CompiledPatch* _compiled_patch; ///< Patch's new process order
+ DisconnectAllEvent* _disconnect_event;
SharedPtr< Table<Path, SharedPtr<Shared::GraphObject> > > _removed_table;
};
diff --git a/src/engine/events/DisablePortMonitoringEvent.cpp b/src/engine/events/DisablePortMonitoringEvent.cpp
index cecc8dfd..1c75f06c 100644
--- a/src/engine/events/DisablePortMonitoringEvent.cpp
+++ b/src/engine/events/DisablePortMonitoringEvent.cpp
@@ -15,7 +15,6 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <string>
#include "interface/ClientInterface.hpp"
#include "events/DisablePortMonitoringEvent.hpp"
#include "Responder.hpp"
@@ -25,18 +24,16 @@
#include "ClientBroadcaster.hpp"
#include "AudioBuffer.hpp"
-using std::string;
-
namespace Ingen {
-DisablePortMonitoringEvent::DisablePortMonitoringEvent(Engine& engine,
+DisablePortMonitoringEvent::DisablePortMonitoringEvent(Engine& engine,
SharedPtr<Responder> responder,
SampleCount timestamp,
- const std::string& port_path)
-: QueuedEvent(engine, responder, timestamp),
- _port_path(port_path),
- _port(NULL)
+ const Raul::Path& port_path)
+ : QueuedEvent(engine, responder, timestamp)
+ , _port_path(port_path)
+ , _port(NULL)
{
}
diff --git a/src/engine/events/DisablePortMonitoringEvent.hpp b/src/engine/events/DisablePortMonitoringEvent.hpp
index 7a8e23f7..2ac802f6 100644
--- a/src/engine/events/DisablePortMonitoringEvent.hpp
+++ b/src/engine/events/DisablePortMonitoringEvent.hpp
@@ -15,21 +15,14 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef DISABLEPORTNOTIFICATIONEVENT_H
-#define DISABLEPORTNOTIFICATIONEVENT_H
+#ifndef DISABLEPORTMONITORINGEVENT_H
+#define DISABLEPORTMONITORINGEVENT_H
-#include <string>
#include "QueuedEvent.hpp"
#include "types.hpp"
-using std::string;
-
namespace Ingen {
-class PortImpl;
-namespace Shared { class ClientInterface; }
-using Shared::ClientInterface;
-
/** Disable sending of dynamic value change notifications for a port.
*
@@ -41,18 +34,18 @@ public:
DisablePortMonitoringEvent(Engine& engine,
SharedPtr<Responder> responder,
SampleCount timestamp,
- const std::string& port_path);
+ const Raul::Path& port_path);
void pre_process();
void execute(ProcessContext& context);
void post_process();
private:
- const std::string _port_path;
- Port* _port;
+ const Raul::Path _port_path;
+ Port* _port;
};
} // namespace Ingen
-#endif // DISABLEPORTNOTIFICATIONEVENT_H
+#endif // DISABLEPORTMONITORINGEVENT_H
diff --git a/src/engine/events/DisconnectAllEvent.cpp b/src/engine/events/DisconnectAllEvent.cpp
index 8057a17e..2a8a2b4f 100644
--- a/src/engine/events/DisconnectAllEvent.cpp
+++ b/src/engine/events/DisconnectAllEvent.cpp
@@ -37,7 +37,7 @@
namespace Ingen {
-DisconnectAllEvent::DisconnectAllEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& parent_path, const string& node_path)
+DisconnectAllEvent::DisconnectAllEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Path& parent_path, const Path& node_path)
: QueuedEvent(engine, responder, timestamp)
, _parent_path(parent_path)
, _path(node_path)
@@ -163,10 +163,10 @@ DisconnectAllEvent::post_process()
fmt % _path;
switch (_error) {
case INVALID_PARENT_PATH:
- fmt % string("Invalid parent path: ").append(_parent_path);
+ fmt % string("Invalid parent path: ").append(_parent_path.str());
break;
case PARENT_NOT_FOUND:
- fmt % string("Unable to find parent: ").append(_parent_path);
+ fmt % string("Unable to find parent: ").append(_parent_path.str());
break;
case OBJECT_NOT_FOUND:
fmt % string("Unable to find object");
diff --git a/src/engine/events/DisconnectAllEvent.hpp b/src/engine/events/DisconnectAllEvent.hpp
index d6e96e38..5fff30d6 100644
--- a/src/engine/events/DisconnectAllEvent.hpp
+++ b/src/engine/events/DisconnectAllEvent.hpp
@@ -18,13 +18,10 @@
#ifndef DISCONNECTNODEEVENT_H
#define DISCONNECTNODEEVENT_H
-#include <string>
#include "raul/List.hpp"
#include "raul/Path.hpp"
#include "QueuedEvent.hpp"
-using std::string;
-
namespace Ingen {
class DisconnectionEvent;
@@ -43,7 +40,7 @@ class OutputPort;
class DisconnectAllEvent : public QueuedEvent
{
public:
- DisconnectAllEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& parent_path, const string& node_path);
+ DisconnectAllEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Raul::Path& parent_path, const Raul::Path& node_path);
DisconnectAllEvent(Engine& engine, PatchImpl* parent, GraphObjectImpl* object);
~DisconnectAllEvent();
diff --git a/src/engine/events/DisconnectionEvent.cpp b/src/engine/events/DisconnectionEvent.cpp
index 47263755..3e7d41a0 100644
--- a/src/engine/events/DisconnectionEvent.cpp
+++ b/src/engine/events/DisconnectionEvent.cpp
@@ -15,7 +15,6 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <string>
#include "raul/Maid.hpp"
#include "raul/Path.hpp"
#include "DisconnectionEvent.hpp"
@@ -29,15 +28,13 @@
#include "PortImpl.hpp"
#include "EngineStore.hpp"
-using std::string;
-
namespace Ingen {
//// DisconnectionEvent ////
-DisconnectionEvent::DisconnectionEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& src_port_path, const string& dst_port_path)
+DisconnectionEvent::DisconnectionEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Raul::Path& src_port_path, const Raul::Path& dst_port_path)
: QueuedEvent(engine, responder, timestamp)
, _src_port_path(src_port_path)
, _dst_port_path(dst_port_path)
@@ -202,7 +199,7 @@ DisconnectionEvent::post_process()
} else {
// FIXME: better error messages
string msg = "Unable to disconnect ";
- msg.append(_src_port_path + " -> " + _dst_port_path);
+ msg.append(_src_port_path.str() + " -> " + _dst_port_path.str());
cerr << "DISCONNECTION ERROR " << (unsigned)_error << endl;
_responder->respond_error(msg);
}
diff --git a/src/engine/events/DisconnectionEvent.hpp b/src/engine/events/DisconnectionEvent.hpp
index 1ecf40a0..afca463a 100644
--- a/src/engine/events/DisconnectionEvent.hpp
+++ b/src/engine/events/DisconnectionEvent.hpp
@@ -18,12 +18,10 @@
#ifndef DISCONNECTIONEVENT_H
#define DISCONNECTIONEVENT_H
-#include <string>
#include "raul/Path.hpp"
#include "QueuedEvent.hpp"
#include "types.hpp"
#include "PatchImpl.hpp"
-using std::string;
namespace Raul {
template <typename T> class ListNode;
@@ -48,7 +46,7 @@ class CompiledPatch;
class DisconnectionEvent : public QueuedEvent
{
public:
- DisconnectionEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& src_port_path, const string& dst_port_path);
+ DisconnectionEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Raul::Path& src_port_path, const Raul::Path& dst_port_path);
DisconnectionEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, PortImpl* const src_port, PortImpl* const dst_port);
void pre_process();
diff --git a/src/engine/events/LoadPluginsEvent.hpp b/src/engine/events/LoadPluginsEvent.hpp
index cd9a2884..476cf3ad 100644
--- a/src/engine/events/LoadPluginsEvent.hpp
+++ b/src/engine/events/LoadPluginsEvent.hpp
@@ -18,7 +18,6 @@
#ifndef LOADPLUGINSEVENT_H
#define LOADPLUGINSEVENT_H
-#include <list>
#include "QueuedEvent.hpp"
namespace Ingen {
@@ -31,10 +30,10 @@ namespace Ingen {
class LoadPluginsEvent : public QueuedEvent
{
public:
- LoadPluginsEvent(Engine& engine,
+ LoadPluginsEvent(Engine& engine,
SharedPtr<Responder> responder,
- SampleCount timestamp,
- QueuedEventSource* source);
+ SampleCount timestamp,
+ QueuedEventSource* source);
void pre_process();
void post_process();
diff --git a/src/engine/events/MidiLearnEvent.cpp b/src/engine/events/MidiLearnEvent.cpp
index 5bcbe1d2..d098c59c 100644
--- a/src/engine/events/MidiLearnEvent.cpp
+++ b/src/engine/events/MidiLearnEvent.cpp
@@ -27,7 +27,7 @@
namespace Ingen {
-MidiLearnEvent::MidiLearnEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& node_path)
+MidiLearnEvent::MidiLearnEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Raul::Path& node_path)
: QueuedEvent(engine, responder, timestamp)
, _error(NO_ERROR)
, _node_path(node_path)
@@ -67,10 +67,10 @@ MidiLearnEvent::post_process()
_responder->respond_ok();
} else if (_node == NULL) {
string msg = "Did not find node '";
- msg.append(_node_path).append("' for MIDI learn.");
+ msg.append(_node_path.str()).append("' for MIDI learn.");
_responder->respond_error(msg);
} else {
- const string msg = string("Node '") + _node_path + "' is not capable of MIDI learn.";
+ const string msg = string("Node '") + _node_path.str() + "' is not capable of MIDI learn.";
_responder->respond_error(msg);
}
}
diff --git a/src/engine/events/MidiLearnEvent.hpp b/src/engine/events/MidiLearnEvent.hpp
index 667ff06c..149b81b7 100644
--- a/src/engine/events/MidiLearnEvent.hpp
+++ b/src/engine/events/MidiLearnEvent.hpp
@@ -21,7 +21,6 @@
#include "QueuedEvent.hpp"
#include "InternalController.hpp"
#include "types.hpp"
-#include <string>
namespace Ingen {
@@ -36,7 +35,7 @@ class ControlChangeEvent;
class MidiLearnEvent : public QueuedEvent
{
public:
- MidiLearnEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const std::string& node_path);
+ MidiLearnEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Raul::Path& node_path);
void pre_process();
void execute(ProcessContext& context);
@@ -48,9 +47,9 @@ private:
INVALID_NODE_TYPE
};
- ErrorType _error;
- const std::string _node_path;
- NodeImpl* _node;
+ ErrorType _error;
+ const Raul::Path _node_path;
+ NodeImpl* _node;
};
diff --git a/src/engine/events/NoteEvent.cpp b/src/engine/events/NoteEvent.cpp
index 43f59e3c..589e8462 100644
--- a/src/engine/events/NoteEvent.cpp
+++ b/src/engine/events/NoteEvent.cpp
@@ -47,7 +47,7 @@ NoteEvent::NoteEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount
*
* Triggered by OSC.
*/
-NoteEvent::NoteEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& node_path, bool on, uint8_t note_num, uint8_t velocity)
+NoteEvent::NoteEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Path& node_path, bool on, uint8_t note_num, uint8_t velocity)
: Event(engine, responder, timestamp),
_node(NULL),
_node_path(node_path),
@@ -72,14 +72,14 @@ NoteEvent::execute(ProcessContext& context)
if (_node != NULL && _node->plugin()->type() == Plugin::Internal) {
if (_on) {
- if (_node->plugin_impl()->uri() == NS_INTERNALS "Note")
+ if (_node->plugin_impl()->uri().str() == NS_INTERNALS "Note")
((NoteNode*)_node)->note_on(context, _note_num, _velocity, _time);
- else if (_node->plugin_impl()->uri() == NS_INTERNALS "Trigger")
+ else if (_node->plugin_impl()->uri().str() == NS_INTERNALS "Trigger")
((TriggerNode*)_node)->note_on(context, _note_num, _velocity, _time);
} else {
- if (_node->plugin_impl()->uri() == NS_INTERNALS "Note")
+ if (_node->plugin_impl()->uri().str() == NS_INTERNALS "Note")
((NoteNode*)_node)->note_off(context, _note_num, _time);
- else if (_node->plugin_impl()->uri() == NS_INTERNALS "Trigger")
+ else if (_node->plugin_impl()->uri().str() == NS_INTERNALS "Trigger")
((TriggerNode*)_node)->note_off(context, _note_num, _time);
}
}
diff --git a/src/engine/events/NoteEvent.hpp b/src/engine/events/NoteEvent.hpp
index 443b8d14..eac5b1f5 100644
--- a/src/engine/events/NoteEvent.hpp
+++ b/src/engine/events/NoteEvent.hpp
@@ -20,8 +20,6 @@
#include "Event.hpp"
#include "types.hpp"
-#include <string>
-using std::string;
namespace Ingen {
@@ -46,7 +44,7 @@ public:
NoteEvent(Engine& engine,
SharedPtr<Responder> responder,
SampleCount timestamp,
- const string& node_path,
+ const Raul::Path& node_path,
bool on,
uint8_t note_num,
uint8_t velocity);
@@ -55,11 +53,11 @@ public:
void post_process();
private:
- NodeImpl* _node;
- const string _node_path;
- bool _on;
- uint8_t _note_num;
- uint8_t _velocity;
+ NodeImpl* _node;
+ const Raul::Path _node_path;
+ bool _on;
+ uint8_t _note_num;
+ uint8_t _velocity;
};
diff --git a/src/engine/events/RegisterClientEvent.cpp b/src/engine/events/RegisterClientEvent.cpp
index a8f68e21..80281dc3 100644
--- a/src/engine/events/RegisterClientEvent.cpp
+++ b/src/engine/events/RegisterClientEvent.cpp
@@ -23,11 +23,11 @@
namespace Ingen {
-RegisterClientEvent::RegisterClientEvent(Engine& engine,
+RegisterClientEvent::RegisterClientEvent(Engine& engine,
SharedPtr<Responder> responder,
- SampleCount timestamp,
- const string& uri,
- ClientInterface* client)
+ SampleCount timestamp,
+ const URI& uri,
+ ClientInterface* client)
: QueuedEvent(engine, responder, timestamp)
, _uri(uri)
, _client(client)
diff --git a/src/engine/events/RegisterClientEvent.hpp b/src/engine/events/RegisterClientEvent.hpp
index 9e12b5ba..d75c92e6 100644
--- a/src/engine/events/RegisterClientEvent.hpp
+++ b/src/engine/events/RegisterClientEvent.hpp
@@ -18,12 +18,9 @@
#ifndef REGISTERCLIENTEVENT_H
#define REGISTERCLIENTEVENT_H
-#include "QueuedEvent.hpp"
+#include "raul/URI.hpp"
#include "interface/ClientInterface.hpp"
-#include <string>
-using std::string;
-using Ingen::Shared::ClientInterface;
-using Ingen::Responder;
+#include "QueuedEvent.hpp"
namespace Ingen {
@@ -35,18 +32,18 @@ namespace Ingen {
class RegisterClientEvent : public QueuedEvent
{
public:
- RegisterClientEvent(Engine& engine,
- SharedPtr<Responder> responder,
- SampleCount timestamp,
- const string& uri,
- ClientInterface* client);
+ RegisterClientEvent(Engine& engine,
+ SharedPtr<Responder> responder,
+ SampleCount timestamp,
+ const Raul::URI& uri,
+ Shared::ClientInterface* client);
void pre_process();
void post_process();
private:
- string _uri;
- ClientInterface* _client;
+ Raul::URI _uri;
+ Shared::ClientInterface* _client;
};
diff --git a/src/engine/events/RenameEvent.cpp b/src/engine/events/RenameEvent.cpp
index 8ce1bf9c..b2116cc4 100644
--- a/src/engine/events/RenameEvent.cpp
+++ b/src/engine/events/RenameEvent.cpp
@@ -31,7 +31,7 @@ using namespace std;
namespace Ingen {
-RenameEvent::RenameEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& path, const string& new_path)
+RenameEvent::RenameEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Path& path, const Path& new_path)
: QueuedEvent(engine, responder, timestamp)
, _old_path(path)
, _new_path(new_path)
@@ -50,12 +50,11 @@ RenameEvent::~RenameEvent()
void
RenameEvent::pre_process()
{
- if ((!Raul::Path::is_valid(_new_path) || !_old_path.parent().is_parent_of(_new_path))) {
- _error = BAD_PATH;
+ if (!_old_path.parent().is_parent_of(_new_path)) {
+ _error = PARENT_DIFFERS;
QueuedEvent::pre_process();
return;
}
-
_store_iterator = _engine.engine_store()->find(_old_path);
if (_store_iterator == _engine.engine_store()->end()) {
_error = OBJECT_NOT_FOUND;
@@ -109,7 +108,7 @@ RenameEvent::execute(ProcessContext& context)
driver_port = _engine.midi_driver()->driver_port(_new_path);
if (driver_port)
- driver_port->set_name(_new_path);
+ driver_port->set_name(_new_path.str());
}
}
@@ -124,13 +123,13 @@ RenameEvent::post_process()
_engine.broadcaster()->send_rename(_old_path, _new_path);
} else {
if (_error == OBJECT_EXISTS)
- msg.append("Object already exists at ").append(_new_path);
+ msg.append("Object already exists at ").append(_new_path.str());
else if (_error == OBJECT_NOT_FOUND)
- msg.append("Could not find object ").append(_old_path);
+ msg.append("Could not find object ").append(_old_path.str());
else if (_error == OBJECT_NOT_RENAMABLE)
- msg.append(_old_path).append(" is not renamable");
- else if (_error == BAD_PATH)
- msg.append(_new_path).append(" is not a valid target path");
+ msg.append(_old_path.str()).append(" is not renamable");
+ else if (_error == PARENT_DIFFERS)
+ msg.append(_new_path.str()).append(" is a child of a different patch");
_responder->respond_error(msg);
}
diff --git a/src/engine/events/RenameEvent.hpp b/src/engine/events/RenameEvent.hpp
index 2cbf6902..23dd47b3 100644
--- a/src/engine/events/RenameEvent.hpp
+++ b/src/engine/events/RenameEvent.hpp
@@ -18,16 +18,10 @@
#ifndef RENAMEEVENT_H
#define RENAMEEVENT_H
-#include <string>
#include "raul/Path.hpp"
#include "QueuedEvent.hpp"
#include "EngineStore.hpp"
-using std::string;
-
-template<typename T> class TreeNode;
-template<typename T> class ListNode;
-
namespace Ingen {
class PatchImpl;
@@ -40,7 +34,7 @@ class PatchImpl;
class RenameEvent : public QueuedEvent
{
public:
- RenameEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& old_path, const string& new_path);
+ RenameEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Raul::Path& old_path, const Raul::Path& new_path);
~RenameEvent();
void pre_process();
@@ -53,14 +47,14 @@ private:
OBJECT_NOT_FOUND,
OBJECT_EXISTS,
OBJECT_NOT_RENAMABLE,
- BAD_PATH
+ PARENT_DIFFERS
};
- Path _old_path;
- string _new_path;
- PatchImpl* _parent_patch;
- EngineStore::iterator _store_iterator;
- ErrorType _error;
+ Raul::Path _old_path;
+ Raul::Path _new_path;
+ PatchImpl* _parent_patch;
+ EngineStore::iterator _store_iterator;
+ ErrorType _error;
};
diff --git a/src/engine/events/RequestAllObjectsEvent.hpp b/src/engine/events/RequestAllObjectsEvent.hpp
index 0537575a..9e4701a0 100644
--- a/src/engine/events/RequestAllObjectsEvent.hpp
+++ b/src/engine/events/RequestAllObjectsEvent.hpp
@@ -18,17 +18,11 @@
#ifndef REQUESTALLOBJECTSEVENT_H
#define REQUESTALLOBJECTSEVENT_H
-#include <string>
#include "QueuedEvent.hpp"
-using std::string;
namespace Ingen {
-namespace Shared {
- class ClientInterface;
-} using Shared::ClientInterface;
-
/** A request from a client to send notification of all objects (ie refresh).
*
* \ingroup engine
diff --git a/src/engine/events/RequestMetadataEvent.cpp b/src/engine/events/RequestMetadataEvent.cpp
index 628b11c4..75ff2a65 100644
--- a/src/engine/events/RequestMetadataEvent.cpp
+++ b/src/engine/events/RequestMetadataEvent.cpp
@@ -15,7 +15,6 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <string>
#include "interface/ClientInterface.hpp"
#include "RequestMetadataEvent.hpp"
#include "Responder.hpp"
@@ -24,8 +23,6 @@
#include "EngineStore.hpp"
#include "ClientBroadcaster.hpp"
-using std::string;
-
namespace Ingen {
@@ -33,8 +30,8 @@ RequestMetadataEvent::RequestMetadataEvent(Engine& engine,
SharedPtr<Responder> responder,
SampleCount timestamp,
bool property,
- const string& node_path,
- const string& key)
+ const Path& node_path,
+ const URI& key)
: QueuedEvent(engine, responder, timestamp)
, _path(node_path)
, _property(property)
@@ -69,8 +66,7 @@ RequestMetadataEvent::post_process()
{
if (_responder->client()) {
if (!_object) {
- string msg = "Unable to find variable subject ";
- msg += _path;
+ const string msg = "Unable to find variable subject " + _path.str();
_responder->respond_error(msg);
} else {
_responder->respond_ok();
diff --git a/src/engine/events/RequestMetadataEvent.hpp b/src/engine/events/RequestMetadataEvent.hpp
index 3a1d8827..d3480b7c 100644
--- a/src/engine/events/RequestMetadataEvent.hpp
+++ b/src/engine/events/RequestMetadataEvent.hpp
@@ -18,17 +18,13 @@
#ifndef REQUESTMETADATAEVENT_H
#define REQUESTMETADATAEVENT_H
-#include <string>
#include "QueuedEvent.hpp"
#include "raul/Atom.hpp"
-using std::string;
+#include "raul/URI.hpp"
namespace Ingen {
class GraphObjectImpl;
-namespace Shared {
- class ClientInterface;
-} using Shared::ClientInterface;
/** A request from a client for a piece of variable.
@@ -42,16 +38,16 @@ public:
SharedPtr<Responder> responder,
SampleCount timestamp,
bool property,
- const string& path,
- const string& key);
+ const Raul::Path& path,
+ const Raul::URI& key);
void pre_process();
void post_process();
private:
- string _path;
+ Raul::Path _path;
bool _property;
- string _key;
+ Raul::URI _key;
Raul::Atom _value;
GraphObjectImpl* _object;
};
diff --git a/src/engine/events/RequestObjectEvent.cpp b/src/engine/events/RequestObjectEvent.cpp
index c7fdd2d8..6ee97388 100644
--- a/src/engine/events/RequestObjectEvent.cpp
+++ b/src/engine/events/RequestObjectEvent.cpp
@@ -15,7 +15,6 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <string>
#include "RequestObjectEvent.hpp"
#include "interface/ClientInterface.hpp"
#include "Responder.hpp"
@@ -28,15 +27,13 @@
#include "ObjectSender.hpp"
#include "ProcessContext.hpp"
-using std::string;
-
namespace Ingen {
-RequestObjectEvent::RequestObjectEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& path)
-: QueuedEvent(engine, responder, timestamp),
- _path(path),
- _object(NULL)
+RequestObjectEvent::RequestObjectEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Path& path)
+ : QueuedEvent(engine, responder, timestamp)
+ , _path(path)
+ , _object(NULL)
{
}
diff --git a/src/engine/events/RequestObjectEvent.hpp b/src/engine/events/RequestObjectEvent.hpp
index 52459ada..79db5b19 100644
--- a/src/engine/events/RequestObjectEvent.hpp
+++ b/src/engine/events/RequestObjectEvent.hpp
@@ -18,17 +18,12 @@
#ifndef REQUESTOBJECTEVENT_H
#define REQUESTOBJECTEVENT_H
-#include <string>
#include "QueuedEvent.hpp"
#include "types.hpp"
-using std::string;
-
namespace Ingen {
class GraphObjectImpl;
-namespace Shared { class ClientInterface; }
-using Shared::ClientInterface;
/** A request from a client to send the value of a port.
@@ -38,14 +33,14 @@ using Shared::ClientInterface;
class RequestObjectEvent : public QueuedEvent
{
public:
- RequestObjectEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& port_path);
+ RequestObjectEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Raul::Path& port_path);
void pre_process();
void execute(ProcessContext& context);
void post_process();
private:
- const string _path;
+ const Raul::Path _path;
GraphObjectImpl* _object;
};
diff --git a/src/engine/events/RequestPluginEvent.cpp b/src/engine/events/RequestPluginEvent.cpp
index 3acdceed..98e70f2f 100644
--- a/src/engine/events/RequestPluginEvent.cpp
+++ b/src/engine/events/RequestPluginEvent.cpp
@@ -15,7 +15,6 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <string>
#include "interface/ClientInterface.hpp"
#include "RequestPluginEvent.hpp"
#include "Responder.hpp"
@@ -27,15 +26,13 @@
#include "PluginImpl.hpp"
#include "ProcessContext.hpp"
-using std::string;
-
namespace Ingen {
-RequestPluginEvent::RequestPluginEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& uri)
-: QueuedEvent(engine, responder, timestamp),
- _uri(uri),
- _plugin(NULL)
+RequestPluginEvent::RequestPluginEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const URI& uri)
+ : QueuedEvent(engine, responder, timestamp)
+ , _uri(uri)
+ , _plugin(NULL)
{
}
diff --git a/src/engine/events/RequestPluginEvent.hpp b/src/engine/events/RequestPluginEvent.hpp
index 8f936098..eece8610 100644
--- a/src/engine/events/RequestPluginEvent.hpp
+++ b/src/engine/events/RequestPluginEvent.hpp
@@ -18,12 +18,10 @@
#ifndef REQUESTPLUGINEVENT_H
#define REQUESTPLUGINEVENT_H
-#include <string>
+#include "raul/URI.hpp"
#include "QueuedEvent.hpp"
#include "types.hpp"
-using std::string;
-
namespace Ingen {
class PluginImpl;
@@ -36,14 +34,14 @@ class PluginImpl;
class RequestPluginEvent : public QueuedEvent
{
public:
- RequestPluginEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& uri);
+ RequestPluginEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Raul::URI& uri);
void pre_process();
void execute(ProcessContext& context);
void post_process();
private:
- const string _uri;
+ const Raul::URI _uri;
const PluginImpl* _plugin;
};
diff --git a/src/engine/events/RequestPortValueEvent.cpp b/src/engine/events/RequestPortValueEvent.cpp
index 0bb9867a..b4502ae2 100644
--- a/src/engine/events/RequestPortValueEvent.cpp
+++ b/src/engine/events/RequestPortValueEvent.cpp
@@ -15,7 +15,6 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <string>
#include "RequestPortValueEvent.hpp"
#include "interface/ClientInterface.hpp"
#include "Responder.hpp"
@@ -26,16 +25,14 @@
#include "AudioBuffer.hpp"
#include "ProcessContext.hpp"
-using std::string;
-
namespace Ingen {
-RequestPortValueEvent::RequestPortValueEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& port_path)
-: QueuedEvent(engine, responder, timestamp),
- _port_path(port_path),
- _port(NULL),
- _value(0.0)
+RequestPortValueEvent::RequestPortValueEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Path& port_path)
+ : QueuedEvent(engine, responder, timestamp)
+ , _port_path(port_path)
+ , _port(NULL)
+ , _value(0.0)
{
}
diff --git a/src/engine/events/RequestPortValueEvent.hpp b/src/engine/events/RequestPortValueEvent.hpp
index dd52c535..79ca4bfe 100644
--- a/src/engine/events/RequestPortValueEvent.hpp
+++ b/src/engine/events/RequestPortValueEvent.hpp
@@ -18,17 +18,12 @@
#ifndef REQUESTPORTVALUEEVENT_H
#define REQUESTPORTVALUEEVENT_H
-#include <string>
#include "QueuedEvent.hpp"
#include "types.hpp"
-using std::string;
-
namespace Ingen {
class PortImpl;
-namespace Shared { class ClientInterface; }
-using Shared::ClientInterface;
/** A request from a client to send the value of a port.
@@ -38,16 +33,16 @@ using Shared::ClientInterface;
class RequestPortValueEvent : public QueuedEvent
{
public:
- RequestPortValueEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& port_path);
+ RequestPortValueEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Raul::Path& port_path);
void pre_process();
void execute(ProcessContext& context);
void post_process();
private:
- const string _port_path;
- PortImpl* _port;
- Sample _value;
+ const Raul::Path _port_path;
+ PortImpl* _port;
+ Sample _value;
};
diff --git a/src/engine/events/SendPortActivityEvent.hpp b/src/engine/events/SendPortActivityEvent.hpp
index dfbb8a10..29c7f1a8 100644
--- a/src/engine/events/SendPortActivityEvent.hpp
+++ b/src/engine/events/SendPortActivityEvent.hpp
@@ -18,10 +18,8 @@
#ifndef SENDPORTACTIVITYEVENT_H
#define SENDPORTACTIVITYEVENT_H
-#include <string>
#include "Event.hpp"
#include "types.hpp"
-using std::string;
namespace Ingen {
diff --git a/src/engine/events/SendPortValueEvent.hpp b/src/engine/events/SendPortValueEvent.hpp
index ad9ae5a1..8eaaee1a 100644
--- a/src/engine/events/SendPortValueEvent.hpp
+++ b/src/engine/events/SendPortValueEvent.hpp
@@ -18,10 +18,8 @@
#ifndef SENDPORTVALUEEVENT_H
#define SENDPORTVALUEEVENT_H
-#include <string>
#include "engine/Event.hpp"
#include "engine/types.hpp"
-using std::string;
namespace Ingen {
diff --git a/src/engine/events/SetMetadataEvent.cpp b/src/engine/events/SetMetadataEvent.cpp
index e0b51f2b..679433a9 100644
--- a/src/engine/events/SetMetadataEvent.cpp
+++ b/src/engine/events/SetMetadataEvent.cpp
@@ -36,8 +36,8 @@ SetMetadataEvent::SetMetadataEvent(
SharedPtr<Responder> responder,
SampleCount timestamp,
bool property,
- const string& path,
- const string& key,
+ const Path& path,
+ const URI& key,
const Atom& value)
: QueuedEvent(engine, responder, timestamp)
, _error(NO_ERROR)
@@ -56,12 +56,6 @@ SetMetadataEvent::SetMetadataEvent(
void
SetMetadataEvent::pre_process()
{
- if (!Path::is_valid(_path)) {
- _error = INVALID_PATH;
- QueuedEvent::pre_process();
- return;
- }
-
_object = _engine.engine_store()->find_object(_path);
if (_object == NULL) {
_error = NOT_FOUND;
@@ -79,10 +73,10 @@ SetMetadataEvent::pre_process()
_patch = dynamic_cast<PatchImpl*>(_object);
- if (_key == "ingen:broadcast") {
+ if (_key.str() == "ingen:broadcast") {
_special_type = ENABLE_BROADCAST;
} else if (_patch) {
- if (!_property && _key == "ingen:enabled") {
+ if (!_property && _key.str() == "ingen:enabled") {
if (_value.type() == Atom::BOOL) {
_special_type = ENABLE;
if (_value.get_bool() && !_patch->compiled_patch())
@@ -90,13 +84,13 @@ SetMetadataEvent::pre_process()
} else {
_error = BAD_TYPE;
}
- } else if (!_property && _key == "ingen:polyphonic") {
+ } else if (!_property && _key.str() == "ingen:polyphonic") {
if (_value.type() == Atom::BOOL) {
_special_type = POLYPHONIC;
} else {
_error = BAD_TYPE;
}
- } else if (_property && _key == "ingen:polyphony") {
+ } else if (_property && _key.str() == "ingen:polyphony") {
if (_value.type() == Atom::INT) {
_special_type = POLYPHONY;
_patch->prepare_internal_poly(_value.get_int32());
@@ -165,11 +159,6 @@ SetMetadataEvent::post_process()
case INTERNAL:
_responder->respond_error("Internal error");
break;
- case INVALID_PATH:
- _responder->respond_error((boost::format(
- "Invalid path '%1%' setting '%2%'")
- % _path % _key).str());
- break;
case BAD_TYPE:
_responder->respond_error((boost::format("Bad type for '%1%'") % _key).str());
break;
diff --git a/src/engine/events/SetMetadataEvent.hpp b/src/engine/events/SetMetadataEvent.hpp
index 09774fe9..e4f64a11 100644
--- a/src/engine/events/SetMetadataEvent.hpp
+++ b/src/engine/events/SetMetadataEvent.hpp
@@ -18,11 +18,9 @@
#ifndef SETMETADATAEVENT_H
#define SETMETADATAEVENT_H
-#include <string>
-#include "QueuedEvent.hpp"
+#include "raul/URI.hpp"
#include "raul/Atom.hpp"
-
-using std::string;
+#include "QueuedEvent.hpp"
namespace Ingen {
@@ -42,8 +40,8 @@ public:
SharedPtr<Responder> responder,
SampleCount timestamp,
bool property,
- const string& path,
- const string& key,
+ const Raul::Path& path,
+ const Raul::URI& key,
const Raul::Atom& value);
void pre_process();
@@ -51,7 +49,7 @@ public:
void post_process();
private:
- enum { NO_ERROR, NOT_FOUND, INTERNAL, INVALID_PATH, BAD_TYPE } _error;
+ enum { NO_ERROR, NOT_FOUND, INTERNAL, BAD_TYPE } _error;
enum {
NONE,
ENABLE,
@@ -62,8 +60,8 @@ private:
bool _property;
bool _success;
- string _path;
- string _key;
+ Raul::Path _path;
+ Raul::URI _key;
Raul::Atom _value;
GraphObjectImpl* _object;
PatchImpl* _patch;
diff --git a/src/engine/events/SetPortValueEvent.cpp b/src/engine/events/SetPortValueEvent.cpp
index 48813c72..b6318d48 100644
--- a/src/engine/events/SetPortValueEvent.cpp
+++ b/src/engine/events/SetPortValueEvent.cpp
@@ -42,7 +42,7 @@ SetPortValueEvent::SetPortValueEvent(Engine& engine,
SharedPtr<Responder> responder,
bool queued,
SampleCount timestamp,
- const string& port_path,
+ const Raul::Path& port_path,
const Raul::Atom& value)
: QueuedEvent(engine, responder, timestamp)
, _queued(queued)
@@ -62,7 +62,7 @@ SetPortValueEvent::SetPortValueEvent(Engine& engine,
bool queued,
SampleCount timestamp,
uint32_t voice_num,
- const string& port_path,
+ const Raul::Path& port_path,
const Raul::Atom& value)
: QueuedEvent(engine, responder, timestamp)
, _queued(queued)
@@ -85,14 +85,9 @@ void
SetPortValueEvent::pre_process()
{
if (_queued) {
- if (_port == NULL) {
- if (Path::is_valid(_port_path))
- _port = _engine.engine_store()->find_port(_port_path);
- else
- _error = ILLEGAL_PATH;
- }
-
- if (_port == NULL && _error == NO_ERROR)
+ if (_port == NULL)
+ _port = _engine.engine_store()->find_port(_port_path);
+ if (_port == NULL)
_error = PORT_NOT_FOUND;
}
@@ -123,14 +118,10 @@ SetPortValueEvent::execute(ProcessContext& context)
void
SetPortValueEvent::apply(uint32_t start, uint32_t nframes)
{
- if (_error == NO_ERROR && _port == NULL) {
- if (Path::is_valid(_port_path))
- _port = _engine.engine_store()->find_port(_port_path);
- else
- _error = ILLEGAL_PATH;
- }
+ if (_error == NO_ERROR && !_port)
+ _port = _engine.engine_store()->find_port(_port_path);
- if (_port == NULL) {
+ if (!_port) {
if (_error == NO_ERROR)
_error = PORT_NOT_FOUND;
/*} else if (_port->buffer(0)->capacity() < _data_size) {
@@ -202,31 +193,32 @@ SetPortValueEvent::apply(uint32_t start, uint32_t nframes)
void
SetPortValueEvent::post_process()
{
- if (_error == NO_ERROR) {
+ string msg;
+ std::ostringstream ss;
+ switch (_error) {
+ case NO_ERROR:
assert(_port != NULL);
_responder->respond_ok();
_engine.broadcaster()->send_port_value(_port_path, _value);
-
- } else if (_error == ILLEGAL_PATH) {
- string msg = "Illegal port path \"";
- msg.append(_port_path).append("\"");
- _responder->respond_error(msg);
-
- } else if (_error == ILLEGAL_VOICE) {
- std::ostringstream ss;
+ break;
+ case TYPE_MISMATCH:
+ _responder->respond_error("type mismatch");
+ break;
+ case ILLEGAL_VOICE:
ss << "Illegal voice number " << _voice_num;
_responder->respond_error(ss.str());
-
- } else if (_error == PORT_NOT_FOUND) {
- string msg = "Unable to find port ";
- msg.append(_port_path).append(" for set_port_value");
+ break;
+ case PORT_NOT_FOUND:
+ msg = "Unable to find port ";
+ msg.append(_port_path.str()).append(" for set_port_value");
_responder->respond_error(msg);
-
- } else if (_error == NO_SPACE) {
- std::ostringstream msg("Attempt to write ");
- msg << _value.data_size() << " bytes to " << _port_path << ", with capacity "
+ break;
+ case NO_SPACE:
+ ss << "Attempt to write " << _value.data_size() << " bytes to "
+ << _port_path.str() << ", with capacity "
<< _port->buffer_size() << endl;
- _responder->respond_error(msg.str());
+ _responder->respond_error(ss.str());
+ break;
}
}
diff --git a/src/engine/events/SetPortValueEvent.hpp b/src/engine/events/SetPortValueEvent.hpp
index 64af26c9..f1385e26 100644
--- a/src/engine/events/SetPortValueEvent.hpp
+++ b/src/engine/events/SetPortValueEvent.hpp
@@ -18,11 +18,9 @@
#ifndef SETPORTVALUEEVENT_H
#define SETPORTVALUEEVENT_H
-#include <string>
#include "raul/Atom.hpp"
#include "QueuedEvent.hpp"
#include "types.hpp"
-using std::string;
namespace Ingen {
@@ -45,7 +43,7 @@ public:
SharedPtr<Responder> responder,
bool queued,
SampleCount timestamp,
- const string& port_path,
+ const Raul::Path& port_path,
const Raul::Atom& value);
SetPortValueEvent(Engine& engine,
@@ -53,7 +51,7 @@ public:
bool queued,
SampleCount timestamp,
uint32_t voice_num,
- const string& port_path,
+ const Raul::Path& port_path,
const Raul::Atom& value);
~SetPortValueEvent();
@@ -63,15 +61,20 @@ public:
void post_process();
private:
- enum ErrorType { NO_ERROR, PORT_NOT_FOUND, NO_SPACE,
- ILLEGAL_PATH, ILLEGAL_VOICE, TYPE_MISMATCH };
+ enum ErrorType {
+ NO_ERROR,
+ PORT_NOT_FOUND,
+ NO_SPACE,
+ ILLEGAL_VOICE,
+ TYPE_MISMATCH
+ };
void apply(uint32_t start, uint32_t nframes);
bool _queued;
bool _omni;
uint32_t _voice_num;
- const string _port_path;
+ const Raul::Path _port_path;
const Raul::Atom _value;
PortImpl* _port;
ErrorType _error;
diff --git a/src/engine/events/UnregisterClientEvent.cpp b/src/engine/events/UnregisterClientEvent.cpp
index 72ab8048..02296ec9 100644
--- a/src/engine/events/UnregisterClientEvent.cpp
+++ b/src/engine/events/UnregisterClientEvent.cpp
@@ -24,9 +24,9 @@
namespace Ingen {
-UnregisterClientEvent::UnregisterClientEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& uri)
-: QueuedEvent(engine, responder, timestamp)
-, _uri(uri)
+UnregisterClientEvent::UnregisterClientEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const URI& uri)
+ : QueuedEvent(engine, responder, timestamp)
+ , _uri(uri)
{
}
diff --git a/src/engine/events/UnregisterClientEvent.hpp b/src/engine/events/UnregisterClientEvent.hpp
index c21bc5da..f62940fa 100644
--- a/src/engine/events/UnregisterClientEvent.hpp
+++ b/src/engine/events/UnregisterClientEvent.hpp
@@ -19,16 +19,10 @@
#define UNREGISTERCLIENTEVENT_H
#include "QueuedEvent.hpp"
-#include <string>
-using std::string;
+#include "raul/URI.hpp"
namespace Ingen {
-namespace Shared {
- class ClientInterface;
-}
-using Shared::ClientInterface;
-
/** Unregisters an OSC client so it no longer receives notifications.
*
@@ -37,15 +31,15 @@ using Shared::ClientInterface;
class UnregisterClientEvent : public QueuedEvent
{
public:
- UnregisterClientEvent(Engine& engine,
+ UnregisterClientEvent(Engine& engine,
SharedPtr<Responder> responder,
- SampleCount timestamp,
- const string& uri);
+ SampleCount timestamp,
+ const Raul::URI& uri);
void post_process();
private:
- string _uri;
+ Raul::URI _uri;
};
diff --git a/src/gui/BreadCrumb.hpp b/src/gui/BreadCrumb.hpp
index 5de175c0..846064d2 100644
--- a/src/gui/BreadCrumb.hpp
+++ b/src/gui/BreadCrumb.hpp
@@ -61,7 +61,7 @@ public:
void set_path(const Raul::Path& path)
{
remove();
- const string text = (path == "/") ? "/" : path.name().c_str();
+ const std::string text = (path.is_root()) ? "/" : path.name().c_str();
Gtk::Label* lab = manage(new Gtk::Label(text));
lab->set_padding(0, 0);
lab->show();
diff --git a/src/gui/BreadCrumbBox.cpp b/src/gui/BreadCrumbBox.cpp
index 7edaed9f..6a131806 100644
--- a/src/gui/BreadCrumbBox.cpp
+++ b/src/gui/BreadCrumbBox.cpp
@@ -19,9 +19,12 @@
#include "BreadCrumb.hpp"
#include "App.hpp"
#include "client/SigClientInterface.hpp"
+
namespace Ingen {
namespace GUI {
+using namespace std;
+using namespace Raul;
BreadCrumbBox::BreadCrumbBox()
: Gtk::HBox()
@@ -120,7 +123,7 @@ BreadCrumbBox::build(Path path, SharedPtr<PatchView> view)
root_but->set_active(root_but->path() == _active_path);
Path working_path = "/";
- string suffix = path.substr(1);
+ string suffix = path.chop_scheme().substr(1);
while (suffix.length() > 0) {
if (suffix[0] == '/')
suffix = suffix.substr(1);
diff --git a/src/gui/ConnectWindow.cpp b/src/gui/ConnectWindow.cpp
index 028ce1df..f255ebdc 100644
--- a/src/gui/ConnectWindow.cpp
+++ b/src/gui/ConnectWindow.cpp
@@ -167,14 +167,19 @@ ConnectWindow::connect(bool existing)
#ifdef HAVE_LIBLO
if (_mode == CONNECT_REMOTE) {
if (!existing) {
- const string url = (_widgets_loaded ? (string)_url_entry->get_text() : world->engine->uri());
- world->engine = SharedPtr<EngineInterface>(new OSCEngineSender(url));
+ Raul::URI engine_url("http://localhost:16180");
+ if (_widgets_loaded) {
+ const std::string& url_str = _url_entry->get_text();
+ if (Raul::URI::is_valid(url_str))
+ engine_url = url_str;
+ }
+ world->engine = SharedPtr<EngineInterface>(new OSCEngineSender(engine_url));
}
SharedPtr<ThreadedSigClientInterface> tsci(new ThreadedSigClientInterface(1024));
SharedPtr<Raul::Deletable> client;
- const string& uri = world->engine->uri();
+ const string& uri = world->engine->uri().str();
const string& scheme = uri.substr(0, uri.find(":"));
if (scheme == "osc.udp" || scheme == "osc.tcp")
client = SharedPtr<OSCClientReceiver>(new OSCClientReceiver(16181, tsci)); // FIXME: port
diff --git a/src/gui/ControlPanel.cpp b/src/gui/ControlPanel.cpp
index 0d7feafd..ccfb54d2 100644
--- a/src/gui/ControlPanel.cpp
+++ b/src/gui/ControlPanel.cpp
@@ -25,6 +25,7 @@
#include "GladeFactory.hpp"
using namespace std;
+using namespace Raul;
namespace Ingen {
namespace GUI {
@@ -251,17 +252,17 @@ ControlPanel::specific_voice_selected()
void
-ControlPanel::parent_property_changed(const std::string& predicate, const Raul::Atom& value)
+ControlPanel::parent_property_changed(const Raul::URI& predicate, const Raul::Atom& value)
{
- if (predicate == "ingen:polyphony" && value.type() == Atom::INT)
+ if (predicate.str() == "ingen:polyphony" && value.type() == Atom::INT)
_voice_spinbutton->set_range(0, value.get_int32() - 1);
}
void
-ControlPanel::variable_changed(const std::string& predicate, const Raul::Atom& value)
+ControlPanel::variable_changed(const Raul::URI& predicate, const Raul::Atom& value)
{
- if (predicate == "ingen:polyphonic" && value.type() == Atom::BOOL) {
+ if (predicate.str() == "ingen:polyphonic" && value.type() == Atom::BOOL) {
if (value.get_bool())
_voice_control_box->show();
else
diff --git a/src/gui/ControlPanel.hpp b/src/gui/ControlPanel.hpp
index ef73ea16..4e2204ef 100644
--- a/src/gui/ControlPanel.hpp
+++ b/src/gui/ControlPanel.hpp
@@ -54,13 +54,13 @@ public:
void init(SharedPtr<NodeModel> node, uint32_t poly);
- Control* find_port(const Path& path) const;
+ Control* find_port(const Raul::Path& path) const;
void add_port(SharedPtr<PortModel> port);
- void remove_port(const Path& path);
+ void remove_port(const Raul::Path& path);
- void enable_port(const Path& path);
- void disable_port(const Path& path);
+ void enable_port(const Raul::Path& path);
+ void disable_port(const Raul::Path& path);
size_t num_controls() const { return _controls.size(); }
std::pair<int,int> ideal_size() const { return _ideal_size; }
@@ -72,8 +72,8 @@ private:
void all_voices_selected();
void specific_voice_selected();
- void variable_changed(const std::string& predicate, const Raul::Atom& value);
- void parent_property_changed(const std::string& predicate, const Raul::Atom& value);
+ void variable_changed(const Raul::URI& predicate, const Raul::Atom& value);
+ void parent_property_changed(const Raul::URI& predicate, const Raul::Atom& value);
bool _callback_enabled;
diff --git a/src/gui/Controls.cpp b/src/gui/Controls.cpp
index 99335503..f163befe 100644
--- a/src/gui/Controls.cpp
+++ b/src/gui/Controls.cpp
@@ -29,9 +29,10 @@
#include "App.hpp"
using namespace std;
-using namespace Ingen::Client;
+using namespace Raul;
namespace Ingen {
+using namespace Client;
namespace GUI {
@@ -187,13 +188,13 @@ SliderControl::set_value(const Atom& atom)
void
-SliderControl::port_variable_change(const string& key, const Atom& value)
+SliderControl::port_variable_change(const URI& key, const Atom& value)
{
_enable_signal = false;
- if (key == "lv2:minimum" && value.type() == Atom::FLOAT)
+ if (key.str() == "lv2:minimum" && value.type() == Atom::FLOAT)
set_range(value.get_float(), _slider->get_adjustment()->get_upper());
- else if (key == "lv2:maximum" && value.type() == Atom::FLOAT)
+ else if (key.str() == "lv2:maximum" && value.type() == Atom::FLOAT)
set_range(_slider->get_adjustment()->get_lower(), value.get_float());
_enable_signal = true;
diff --git a/src/gui/Controls.hpp b/src/gui/Controls.hpp
index db480dc2..d83a0bff 100644
--- a/src/gui/Controls.hpp
+++ b/src/gui/Controls.hpp
@@ -26,7 +26,6 @@
#include "raul/SharedPtr.hpp"
namespace Ingen { namespace Client { class PortModel; } }
-using namespace Ingen::Client;
namespace Ingen {
namespace GUI {
@@ -44,23 +43,23 @@ public:
Control(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& glade_xml);
virtual ~Control();
- virtual void init(ControlPanel* panel, SharedPtr<PortModel> pm);
+ virtual void init(ControlPanel* panel, SharedPtr<Client::PortModel> pm);
virtual void enable() = 0;
virtual void disable() = 0;
- inline const SharedPtr<PortModel> port_model() const { return _port_model; }
+ inline const SharedPtr<Client::PortModel> port_model() const { return _port_model; }
protected:
- virtual void set_value(const Atom& value) = 0;
+ virtual void set_value(const Raul::Atom& value) = 0;
virtual void set_range(float min, float max) {}
void menu_properties();
- ControlPanel* _control_panel;
- SharedPtr<PortModel> _port_model;
- sigc::connection _control_connection;
- bool _enable_signal;
+ ControlPanel* _control_panel;
+ SharedPtr<Client::PortModel> _port_model;
+ sigc::connection _control_connection;
+ bool _enable_signal;
Gtk::Menu* _menu;
Gtk::MenuItem* _menu_properties;
@@ -75,7 +74,7 @@ class SliderControl : public Control
{
public:
SliderControl(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& glade_xml);
- void init(ControlPanel* panel, SharedPtr<PortModel> pm);
+ void init(ControlPanel* panel, SharedPtr<Client::PortModel> pm);
void enable();
void disable();
@@ -84,11 +83,11 @@ public:
void set_max(float val);
private:
- void set_name(const string& name);
- void set_value(const Atom& value);
+ void set_name(const std::string& name);
+ void set_value(const Raul::Atom& value);
void set_range(float min, float max);
- void port_variable_change(const string& key, const Raul::Atom& value);
+ void port_variable_change(const Raul::URI& key, const Raul::Atom& value);
void update_range();
void update_value_from_slider();
@@ -142,14 +141,14 @@ class ToggleControl : public Control
public:
ToggleControl(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& xml);
- void init(ControlPanel* panel, SharedPtr<PortModel> pm);
+ void init(ControlPanel* panel, SharedPtr<Client::PortModel> pm);
void enable();
void disable();
private:
- void set_name(const string& name);
- void set_value(const Atom& value);
+ void set_name(const std::string& name);
+ void set_value(const Raul::Atom& value);
void toggled();
diff --git a/src/gui/LoadPatchWindow.cpp b/src/gui/LoadPatchWindow.cpp
index 573c6311..7ae755ad 100644
--- a/src/gui/LoadPatchWindow.cpp
+++ b/src/gui/LoadPatchWindow.cpp
@@ -137,7 +137,7 @@ LoadPatchWindow::ok_clicked()
if (_replace)
App::instance().engine()->clear_patch(_patch->path());
- if (_patch->path() != "/") {
+ if (!_patch->path().is_root()) {
parent = _patch->path().parent();
symbol = _patch->symbol();
}
diff --git a/src/gui/LoadPluginWindow.cpp b/src/gui/LoadPluginWindow.cpp
index c0188ba5..1cc48b27 100644
--- a/src/gui/LoadPluginWindow.cpp
+++ b/src/gui/LoadPluginWindow.cpp
@@ -29,7 +29,7 @@
#include "PatchCanvas.hpp"
using namespace std;
-
+using namespace Raul;
namespace Ingen {
namespace GUI {
@@ -222,7 +222,7 @@ LoadPluginWindow::set_plugins(SharedPtr<const ClientStore::Plugins> m)
row[_plugins_columns._col_type] = "LADSPA";
else
row[_plugins_columns._col_type] = plugin->type_uri();
- row[_plugins_columns._col_uri] = plugin->uri();
+ row[_plugins_columns._col_uri] = plugin->uri().str();
row[_plugins_columns._col_label] = plugin->name();
row[_plugins_columns._col_plugin_model] = plugin;
}
@@ -251,7 +251,7 @@ LoadPluginWindow::add_plugin(SharedPtr<PluginModel> plugin)
row[_plugins_columns._col_name] = plugin->name();
row[_plugins_columns._col_type] = plugin->type_uri();
- row[_plugins_columns._col_uri] = plugin->uri();
+ row[_plugins_columns._col_uri] = plugin->uri().str();
row[_plugins_columns._col_label] = plugin->name();
row[_plugins_columns._col_plugin_model] = plugin;
}
@@ -396,11 +396,7 @@ LoadPluginWindow::filter_changed()
case CriteriaColumns::TYPE:
field = plugin->type_uri(); break;
case CriteriaColumns::URI:
- field = plugin->uri(); break;
- /*case CriteriaColumns::LIBRARY:
- field = plugin->lib_name(); break;
- case CriteriaColumns::LABEL:
- field = plugin->plug_label(); break;*/
+ field = plugin->uri().str(); break;
default:
throw;
}
@@ -413,7 +409,7 @@ LoadPluginWindow::filter_changed()
model_row[_plugins_columns._col_name] = plugin->name();
model_row[_plugins_columns._col_type] = plugin->type_uri();
- model_row[_plugins_columns._col_uri] = plugin->uri();
+ model_row[_plugins_columns._col_uri] = plugin->uri().str();
model_row[_plugins_columns._col_plugin_model] = plugin;
++num_visible;
diff --git a/src/gui/LoadPluginWindow.hpp b/src/gui/LoadPluginWindow.hpp
index 6ed76ded..7abeea41 100644
--- a/src/gui/LoadPluginWindow.hpp
+++ b/src/gui/LoadPluginWindow.hpp
@@ -119,7 +119,7 @@ private:
void plugin_activated(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* col);
void plugin_selection_changed();
- string generate_module_name(int offset = 0);
+ std::string generate_module_name(int offset = 0);
GraphObject::Properties _initial_data;
diff --git a/src/gui/LoadRemotePatchWindow.cpp b/src/gui/LoadRemotePatchWindow.cpp
index e70c6d3b..ecfe5240 100644
--- a/src/gui/LoadRemotePatchWindow.cpp
+++ b/src/gui/LoadRemotePatchWindow.cpp
@@ -141,7 +141,7 @@ LoadRemotePatchWindow::open_clicked()
if (_replace)
App::instance().engine()->clear_patch(_patch->path());
- if (_patch->path() != "/")
+ if (!_patch->path().is_root())
parent = _patch->path().parent();
App::instance().loader()->load_patch(true, uri, Path("/"),
diff --git a/src/gui/NewSubpatchWindow.cpp b/src/gui/NewSubpatchWindow.cpp
index 6fa2a430..c6be5230 100644
--- a/src/gui/NewSubpatchWindow.cpp
+++ b/src/gui/NewSubpatchWindow.cpp
@@ -22,6 +22,9 @@
#include "NewSubpatchWindow.hpp"
#include "PatchView.hpp"
+using namespace std;
+using namespace Raul;
+
namespace Ingen {
namespace GUI {
diff --git a/src/gui/NodeControlWindow.cpp b/src/gui/NodeControlWindow.cpp
index 293d28f5..2ea2a55c 100644
--- a/src/gui/NodeControlWindow.cpp
+++ b/src/gui/NodeControlWindow.cpp
@@ -45,7 +45,7 @@ NodeControlWindow::NodeControlWindow(SharedPtr<NodeModel> node, uint32_t poly)
property_resizable() = true;
set_border_width(5);
- set_title(_node->path() + " Controls");
+ set_title(_node->path().str() + " Controls");
Glib::RefPtr<Gnome::Glade::Xml> xml = GladeFactory::new_glade_reference("warehouse_win");
xml->get_widget_derived("control_panel_vbox", _control_panel);
@@ -73,7 +73,7 @@ NodeControlWindow::NodeControlWindow(SharedPtr<NodeModel> node, ControlPanel* pa
property_resizable() = true;
set_border_width(5);
- set_title(_node->path() + " Controls");
+ set_title(_node->path().str() + " Controls");
_control_panel->reparent(*this);
diff --git a/src/gui/NodeMenu.cpp b/src/gui/NodeMenu.cpp
index defce091..5917b400 100644
--- a/src/gui/NodeMenu.cpp
+++ b/src/gui/NodeMenu.cpp
@@ -118,8 +118,8 @@ NodeMenu::init(SharedPtr<NodeModel> node)
else
_randomize_menuitem->hide();
- if (plugin && (plugin->uri() == "http://drobilla.net/ns/ingen-internals#Controller"
- || plugin->uri() == "http://drobilla.net/ns/ingen-internals#Trigger"))
+ if (plugin && (plugin->uri().str() == "http://drobilla.net/ns/ingen-internals#Controller"
+ || plugin->uri().str() == "http://drobilla.net/ns/ingen-internals#Trigger"))
_learn_menuitem->show();
else
_learn_menuitem->hide();
diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp
index b137ebc1..efc2febd 100644
--- a/src/gui/NodeModule.cpp
+++ b/src/gui/NodeModule.cpp
@@ -36,6 +36,7 @@
#include "NodeMenu.hpp"
using namespace std;
+using namespace Raul;
namespace Ingen {
namespace GUI {
@@ -370,21 +371,28 @@ NodeModule::store_location()
void
-NodeModule::set_variable(const string& key, const Atom& value)
+NodeModule::set_variable(const URI& key, const Atom& value)
{
- if (key == "ingenuity:canvas-x" && value.type() == Atom::FLOAT) {
- move_to(value.get_float(), property_y());
- } else if (key == "ingenuity:canvas-y" && value.type() == Atom::FLOAT) {
- move_to(property_x(), value.get_float());
- } else if (key == "ingen:polyphonic" && value.type() == Atom::BOOL) {
- set_stacked_border(value.get_bool());
- } else if (key == "ingen:selected" && value.type() == Atom::BOOL) {
- if (value.get_bool() != selected()) {
- if (value.get_bool())
- _canvas.lock()->select_item(shared_from_this());
- else
- _canvas.lock()->unselect_item(shared_from_this());
+ switch (value.type()) {
+ case Atom::FLOAT:
+ if (key.str() == "ingenuity:canvas-x") {
+ move_to(value.get_float(), property_y());
+ } else if (key.str() == "ingenuity:canvas-y") {
+ move_to(property_x(), value.get_float());
+ }
+ break;
+ case Atom::BOOL:
+ if (key.str() == "ingen:polyphonic") {
+ set_stacked_border(value.get_bool());
+ } else if (key.str() == "ingen:selected") {
+ if (value.get_bool() != selected()) {
+ if (value.get_bool())
+ _canvas.lock()->select_item(shared_from_this());
+ else
+ _canvas.lock()->unselect_item(shared_from_this());
+ }
}
+ default: break;
}
}
diff --git a/src/gui/NodeModule.hpp b/src/gui/NodeModule.hpp
index 35691dcc..47dfa374 100644
--- a/src/gui/NodeModule.hpp
+++ b/src/gui/NodeModule.hpp
@@ -77,7 +77,7 @@ protected:
void set_selected(bool b);
void rename();
- void set_variable(const std::string& predicate, const Raul::Atom& value);
+ void set_variable(const Raul::URI& predicate, const Raul::Atom& value);
void add_port(SharedPtr<PortModel> port, bool resize=true);
diff --git a/src/gui/NodePropertiesWindow.cpp b/src/gui/NodePropertiesWindow.cpp
index 7885b906..3739cd5e 100644
--- a/src/gui/NodePropertiesWindow.cpp
+++ b/src/gui/NodePropertiesWindow.cpp
@@ -21,9 +21,11 @@
#include "client/PluginModel.hpp"
#include "NodePropertiesWindow.hpp"
+using namespace std;
+using namespace Raul;
+
namespace Ingen {
namespace GUI {
-using std::string;
NodePropertiesWindow::NodePropertiesWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& glade_xml)
@@ -47,15 +49,15 @@ NodePropertiesWindow::set_node(SharedPtr<NodeModel> node_model)
_node_model = node_model;
- set_title(node_model->path() + " Properties");
+ set_title(node_model->path().str() + " Properties");
- _node_path_label->set_text(node_model->path());
+ _node_path_label->set_text(node_model->path().str());
_node_polyphonic_toggle->set_active(node_model->polyphonic());
const PluginModel* pm = dynamic_cast<const PluginModel*>(node_model->plugin());
if (pm) {
_plugin_type_label->set_text(pm->type_uri());
- _plugin_uri_label->set_text(pm->uri());
+ _plugin_uri_label->set_text(pm->uri().str());
const Atom& name = pm->get_property("doap:name");
if (name.is_valid())
_plugin_name_label->set_text(pm->get_property("doap:name").get_string());
diff --git a/src/gui/ObjectMenu.cpp b/src/gui/ObjectMenu.cpp
index 801561e3..904ada74 100644
--- a/src/gui/ObjectMenu.cpp
+++ b/src/gui/ObjectMenu.cpp
@@ -22,6 +22,8 @@
#include "ObjectMenu.hpp"
#include "WindowFactory.hpp"
+using namespace Raul;
+
namespace Ingen {
namespace GUI {
@@ -84,10 +86,10 @@ ObjectMenu::on_menu_polyphonic()
void
-ObjectMenu::variable_changed(const std::string& predicate, const Raul::Atom& value)
+ObjectMenu::variable_changed(const URI& predicate, const Atom& value)
{
_enable_signal = false;
- if (predicate == "ingen:polyphonic" && value.type() == Atom::BOOL)
+ if (predicate.str() == "ingen:polyphonic" && value.type() == Atom::BOOL)
_polyphonic_menuitem->set_active(value.get_bool());
_enable_signal = true;
}
diff --git a/src/gui/ObjectMenu.hpp b/src/gui/ObjectMenu.hpp
index edd25353..3c59580c 100644
--- a/src/gui/ObjectMenu.hpp
+++ b/src/gui/ObjectMenu.hpp
@@ -50,7 +50,7 @@ protected:
void on_menu_destroy();
void on_menu_properties();
- void variable_changed(const std::string& predicate, const Raul::Atom& value);
+ void variable_changed(const Raul::URI& predicate, const Raul::Atom& value);
bool _enable_signal;
SharedPtr<ObjectModel> _object;
diff --git a/src/gui/PatchCanvas.cpp b/src/gui/PatchCanvas.cpp
index 9b9c466b..57df4a61 100644
--- a/src/gui/PatchCanvas.cpp
+++ b/src/gui/PatchCanvas.cpp
@@ -667,7 +667,7 @@ PatchCanvas::paste()
clipboard.set_plugins(App::instance().store()->plugins());
// mkdir -p
- string to_create = _patch->path().substr(1);
+ string to_create = _patch->path().chop_scheme().substr(1);
string created = "/";
clipboard.new_patch("/", _patch->poly());
size_t first_slash;
@@ -679,14 +679,14 @@ PatchCanvas::paste()
to_create = to_create.substr(first_slash + 1);
}
- if (_patch->path() != "/")
+ if (!_patch->path().is_root())
clipboard.new_patch(_patch->path(), _patch->poly());
boost::optional<Raul::Path> data_path;
boost::optional<Raul::Path> parent;
boost::optional<Raul::Symbol> symbol;
- if (_patch->path() != "/") {
+ if (!_patch->path().is_root()) {
parent = _patch->path();
}
@@ -695,7 +695,7 @@ PatchCanvas::paste()
parent, symbol);
for (Store::iterator i = clipboard.begin(); i != clipboard.end(); ++i) {
- if (_patch->path() == "/" && i->first == "/") {
+ if (_patch->path().is_root() && i->first.is_root()) {
//cout << "Skipping root" << endl;
continue;
}
@@ -705,7 +705,7 @@ PatchCanvas::paste()
GraphObject::Properties::iterator y = i->second->variables().find("ingenuity:canvas-y");
if (y != i->second->variables().end())
y->second = y->second.get_float() + (20.0f * _paste_count);
- if (i->first.parent() == "/") {
+ if (i->first.parent().is_root()) {
GraphObject::Properties::iterator s = i->second->variables().find("ingen:selected");
if (s != i->second->variables().end())
s->second = true;
@@ -724,11 +724,11 @@ PatchCanvas::paste()
}
// Orphan connections (just in case...)
- for (ClientStore::ConnectionRecords::const_iterator i = clipboard.connection_records().begin();
+ /*for (ClientStore::ConnectionRecords::const_iterator i = clipboard.connection_records().begin();
i != clipboard.connection_records().end(); ++i) {
cout << "WARNING: Orphan connection paste: " << i->first << " -> " << i->second << endl;
App::instance().engine()->connect(i->first, i->second);
- }
+ }*/
}
diff --git a/src/gui/PatchPortModule.cpp b/src/gui/PatchPortModule.cpp
index 200ce12f..ffb05e8d 100644
--- a/src/gui/PatchPortModule.cpp
+++ b/src/gui/PatchPortModule.cpp
@@ -30,6 +30,8 @@
#include "WindowFactory.hpp"
#include "PortMenu.hpp"
+using namespace Raul;
+
namespace Ingen {
namespace GUI {
@@ -130,32 +132,41 @@ PatchPortModule::set_name(const std::string& n)
void
-PatchPortModule::set_variable(const string& key, const Atom& value)
+PatchPortModule::set_variable(const URI& key, const Atom& value)
{
- if (key == "ingen:polyphonic" && value.type() == Atom::BOOL) {
- set_stacked_border(value.get_bool());
- } else if (key == "ingen:selected" && value.type() == Atom::BOOL) {
- if (value.get_bool() != selected()) {
- if (value.get_bool())
- _canvas.lock()->select_item(shared_from_this());
- else
- _canvas.lock()->unselect_item(shared_from_this());
+ if (value.type() == Atom::BOOL) {
+ if (key.str() == "ingen:polyphonic") {
+ set_stacked_border(value.get_bool());
+ } else if (key.str() == "ingen:selected") {
+ if (value.get_bool() != selected()) {
+ if (value.get_bool())
+ _canvas.lock()->select_item(shared_from_this());
+ else
+ _canvas.lock()->unselect_item(shared_from_this());
+ }
}
}
}
void
-PatchPortModule::set_property(const string& key, const Atom& value)
+PatchPortModule::set_property(const URI& key, const Atom& value)
{
- if (key == "ingenuity:canvas-x" && value.type() == Atom::FLOAT) {
- move_to(value.get_float(), property_y());
- } else if (key == "ingenuity:canvas-y" && value.type() == Atom::FLOAT) {
- move_to(property_x(), value.get_float());
- } else if (key == "lv2:name" && value.type() == Atom::STRING && _human_name_visible) {
- set_name(value.get_string());
- } else if (key == "lv2:symbol" && value.type() == Atom::STRING && !_human_name_visible) {
- set_name(value.get_string());
+ switch (value.type()) {
+ case Atom::FLOAT:
+ if (key.str() == "ingenuity:canvas-x") {
+ move_to(value.get_float(), property_y());
+ } else if (key.str() == "ingenuity:canvas-y") {
+ move_to(property_x(), value.get_float());
+ }
+ break;
+ case Atom::STRING:
+ if (key.str() == "lv2:name" && _human_name_visible) {
+ set_name(value.get_string());
+ } else if (key.str() == "lv2:symbol" && !_human_name_visible) {
+ set_name(value.get_string());
+ }
+ default: break;
}
}
diff --git a/src/gui/PatchPortModule.hpp b/src/gui/PatchPortModule.hpp
index 62c968ef..2a1cf704 100644
--- a/src/gui/PatchPortModule.hpp
+++ b/src/gui/PatchPortModule.hpp
@@ -22,6 +22,7 @@
#include <boost/enable_shared_from_this.hpp>
#include <libgnomecanvasmm.h>
#include "flowcanvas/Module.hpp"
+#include "raul/URI.hpp"
#include "Port.hpp"
namespace Raul { class Atom; }
@@ -68,8 +69,8 @@ protected:
void set_port(SharedPtr<Port> port) { _port = port; }
- void set_variable(const std::string& predicate, const Raul::Atom& value);
- void set_property(const std::string& predicate, const Raul::Atom& value);
+ void set_variable(const Raul::URI& predicate, const Raul::Atom& value);
+ void set_property(const Raul::URI& predicate, const Raul::Atom& value);
SharedPtr<PortModel> _model;
SharedPtr<Port> _port;
diff --git a/src/gui/PatchPropertiesWindow.cpp b/src/gui/PatchPropertiesWindow.cpp
index 055c8386..0fc080e0 100644
--- a/src/gui/PatchPropertiesWindow.cpp
+++ b/src/gui/PatchPropertiesWindow.cpp
@@ -22,6 +22,7 @@
#include "App.hpp"
using namespace std;
+using namespace Raul;
namespace Ingen {
namespace GUI {
@@ -49,7 +50,7 @@ PatchPropertiesWindow::PatchPropertiesWindow(BaseObjectType* cobject, const Glib
void
PatchPropertiesWindow::set_patch(SharedPtr<PatchModel> patch_model)
{
- property_title() = patch_model->path() + " Properties";
+ property_title() = patch_model->path().str() + " Properties";
_patch_model = patch_model;
const Atom& name_atom = _patch_model->get_property("doap:name");
diff --git a/src/gui/PatchTreeWindow.cpp b/src/gui/PatchTreeWindow.cpp
index f3a24920..0b699f64 100644
--- a/src/gui/PatchTreeWindow.cpp
+++ b/src/gui/PatchTreeWindow.cpp
@@ -25,6 +25,7 @@
#include "WindowFactory.hpp"
using namespace std;
+using namespace Raul;
namespace Ingen {
namespace GUI {
@@ -88,8 +89,8 @@ PatchTreeWindow::add_patch(SharedPtr<PatchModel> pm)
if (!pm->parent()) {
Gtk::TreeModel::iterator iter = _patch_treestore->append();
Gtk::TreeModel::Row row = *iter;
- if (pm->path() == "/") {
- row[_patch_tree_columns.name_col] = App::instance().engine()->uri();
+ if (pm->path().is_root()) {
+ row[_patch_tree_columns.name_col] = App::instance().engine()->uri().str();
} else {
row[_patch_tree_columns.name_col] = pm->path().name();
}
@@ -193,20 +194,18 @@ PatchTreeWindow::event_patch_enabled_toggled(const Glib::ustring& path_str)
Gtk::TreeModel::Row row = *active;
SharedPtr<PatchModel> pm = row[_patch_tree_columns.patch_model_col];
- Glib::ustring patch_path = pm->path();
-
assert(pm);
if (_enable_signal)
- App::instance().engine()->set_variable(patch_path, "ingen:enabled", (bool)!pm->enabled());
+ App::instance().engine()->set_variable(pm->path(), "ingen:enabled", (bool)!pm->enabled());
}
void
-PatchTreeWindow::patch_variable_changed(const string& key, const Raul::Atom& value, const Path& path)
+PatchTreeWindow::patch_variable_changed(const URI& key, const Atom& value, const Path& path)
{
_enable_signal = false;
- if (key == "ingen:enabled" && value.type() == Atom::BOOL) {
+ if (key.str() == "ingen:enabled" && value.type() == Atom::BOOL) {
Gtk::TreeModel::iterator i = find_patch(_patch_treestore->children(), path);
if (i != _patch_treestore->children().end()) {
Gtk::TreeModel::Row row = *i;
diff --git a/src/gui/PatchTreeWindow.hpp b/src/gui/PatchTreeWindow.hpp
index 64e20b7c..3998891c 100644
--- a/src/gui/PatchTreeWindow.hpp
+++ b/src/gui/PatchTreeWindow.hpp
@@ -25,10 +25,7 @@ namespace Raul { class Path; }
namespace Ingen {
-namespace Client {
- class ClientStore;
-}
-using Ingen::Client::ClientStore;
+namespace Client { class ClientStore; }
namespace GUI {
@@ -45,15 +42,15 @@ class PatchTreeWindow : public Gtk::Window
public:
PatchTreeWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& refGlade);
- void init(ClientStore& store);
+ void init(Client::ClientStore& store);
void new_object(SharedPtr<Client::ObjectModel> object);
- void patch_variable_changed(const string& key, const Raul::Atom& value, const Path& path);
- void patch_renamed(const Path& old_path, const Path& new_path);
+ void patch_variable_changed(const Raul::URI& key, const Raul::Atom& value, const Raul::Path& path);
+ void patch_renamed(const Raul::Path& old_path, const Raul::Path& new_path);
void add_patch(SharedPtr<Client::PatchModel> pm);
- void remove_patch(const Path& path);
+ void remove_patch(const Raul::Path& path);
void show_patch_menu(GdkEventButton* ev);
protected:
@@ -61,7 +58,7 @@ protected:
void event_patch_activated(const Gtk::TreeModel::Path& path, Gtk::TreeView::Column* col);
void event_patch_enabled_toggled(const Glib::ustring& path_str);
- Gtk::TreeModel::iterator find_patch(Gtk::TreeModel::Children root, const Path& path);
+ Gtk::TreeModel::iterator find_patch(Gtk::TreeModel::Children root, const Raul::Path& path);
PatchTreeView* _patches_treeview;
diff --git a/src/gui/PatchView.cpp b/src/gui/PatchView.cpp
index 911c7c73..9b4f291a 100644
--- a/src/gui/PatchView.cpp
+++ b/src/gui/PatchView.cpp
@@ -31,6 +31,9 @@
#include "PatchTreeWindow.hpp"
#include "GladeFactory.hpp"
+using namespace std;
+using namespace Raul;
+
namespace Ingen {
namespace GUI {
@@ -226,16 +229,16 @@ PatchView::refresh_clicked()
void
-PatchView::property_changed(const std::string& predicate, const Raul::Atom& value)
+PatchView::property_changed(const Raul::URI& predicate, const Raul::Atom& value)
{
}
void
-PatchView::variable_changed(const std::string& predicate, const Raul::Atom& value)
+PatchView::variable_changed(const Raul::URI& predicate, const Raul::Atom& value)
{
_enable_signal = false;
- if (predicate == "ingen:enabled") {
+ if (predicate.str() == "ingen:enabled") {
if (value.type() == Atom::BOOL)
_process_but->set_active(value.get_bool());
else
diff --git a/src/gui/PatchView.hpp b/src/gui/PatchView.hpp
index 488674e5..705af7b8 100644
--- a/src/gui/PatchView.hpp
+++ b/src/gui/PatchView.hpp
@@ -84,8 +84,8 @@ private:
void canvas_item_entered(Gnome::Canvas::Item* item);
void canvas_item_left(Gnome::Canvas::Item* item);
- void property_changed(const std::string& predicate, const Raul::Atom& value);
- void variable_changed(const std::string& predicate, const Raul::Atom& value);
+ void property_changed(const Raul::URI& predicate, const Raul::Atom& value);
+ void variable_changed(const Raul::URI& predicate, const Raul::Atom& value);
void zoom_full();
diff --git a/src/gui/PatchWindow.cpp b/src/gui/PatchWindow.cpp
index e8e2d7e0..d1248920 100644
--- a/src/gui/PatchWindow.cpp
+++ b/src/gui/PatchWindow.cpp
@@ -92,7 +92,7 @@ PatchWindow::PatchWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glad
xml->get_widget("patch_help_about_menuitem", _menu_help_about);
_menu_view_control_window->property_sensitive() = false;
- string engine_name = App::instance().engine()->uri();
+ string engine_name = App::instance().engine()->uri().str();
if (engine_name == "ingen:internal")
engine_name = "internal engine";
_status_bar->push(string("Connected to ") + engine_name, STATUS_CONTEXT_ENGINE);
@@ -251,7 +251,7 @@ PatchWindow::set_patch(SharedPtr<PatchModel> patch, SharedPtr<PatchView> view)
((int)_view->canvas()->width() - width)/2,
((int)_view->canvas()->height() - height)/2);
- set_title(_patch->path() + " - Ingen");
+ set_title(_patch->path().str() + " - Ingen");
new_port_connection = patch->signal_new_port.connect(
sigc::mem_fun(this, &PatchWindow::patch_port_added));
@@ -300,7 +300,7 @@ PatchWindow::patch_port_removed(SharedPtr<PortModel> port)
void
PatchWindow::object_entered(ObjectModel* model)
{
- string msg = model->path();
+ string msg = model->path().str();
NodeModel* node = dynamic_cast<NodeModel*>(model);
if (node) {
PluginModel* plugin = (PluginModel*)node->plugin();
diff --git a/src/gui/Port.cpp b/src/gui/Port.cpp
index c819a957..922dea77 100644
--- a/src/gui/Port.cpp
+++ b/src/gui/Port.cpp
@@ -29,6 +29,7 @@
using namespace Ingen::Client;
using namespace std;
+using namespace Raul;
namespace Ingen {
namespace GUI {
@@ -136,14 +137,17 @@ Port::set_control(float value, bool signal)
void
-Port::variable_changed(const string& key, const Atom& value)
+Port::variable_changed(const URI& key, const Atom& value)
{
- if ( (key == "lv2:minimum") && value.type() == Atom::FLOAT)
- set_control_min(value.get_float());
- else if ( (key == "lv2:maximum") && value.type() == Atom::FLOAT)
- set_control_max(value.get_float());
- else if ( (key == "lv2:toggled") && value.type() == Atom::BOOL)
- set_toggled(value.get_bool());
+ if (value.type() == Atom::FLOAT) {
+ if ((key.str() == "lv2:minimum"))
+ set_control_min(value.get_float());
+ else if ((key.str() == "lv2:maximum"))
+ set_control_max(value.get_float());
+ } else if (value.type() == Atom::BOOL) {
+ if ((key.str() == "lv2:toggled"))
+ set_toggled(value.get_bool());
+ }
}
diff --git a/src/gui/Port.hpp b/src/gui/Port.hpp
index e3801424..10e00a88 100644
--- a/src/gui/Port.hpp
+++ b/src/gui/Port.hpp
@@ -58,7 +58,7 @@ public:
private:
- void variable_changed(const std::string& key, const Raul::Atom& value);
+ void variable_changed(const Raul::URI& key, const Raul::Atom& value);
void renamed();
diff --git a/src/gui/PortPropertiesWindow.cpp b/src/gui/PortPropertiesWindow.cpp
index 89d17154..3333ae70 100644
--- a/src/gui/PortPropertiesWindow.cpp
+++ b/src/gui/PortPropertiesWindow.cpp
@@ -25,8 +25,10 @@
#include "PortPropertiesWindow.hpp"
using namespace std;
+using namespace Raul;
namespace Ingen {
+using namespace Client;
namespace GUI {
@@ -62,7 +64,7 @@ PortPropertiesWindow::present(SharedPtr<PortModel> pm)
_port_model = pm;
- set_title(pm->path() + " Properties");
+ set_title(pm->path().str() + " Properties");
float min = 0.0f, max = 1.0f;
boost::shared_ptr<NodeModel> parent = PtrCast<NodeModel>(_port_model->parent());
@@ -90,14 +92,16 @@ PortPropertiesWindow::present(SharedPtr<PortModel> pm)
void
-PortPropertiesWindow::variable_change(const string& key, const Atom& value)
+PortPropertiesWindow::variable_change(const URI& key, const Atom& value)
{
//_enable_signal = false;
- if (key == "lv2:minimum" && value.type() == Atom::FLOAT)
- _min_spinner->set_value(value.get_float());
- else if (key == "lv2:maximum" && value.type() == Atom::FLOAT)
- _max_spinner->set_value(value.get_float());
+ if (value.type() == Atom::FLOAT) {
+ if (key.str() == "lv2:minimum")
+ _min_spinner->set_value(value.get_float());
+ else if (key.str() == "lv2:maximum")
+ _max_spinner->set_value(value.get_float());
+ }
//_enable_signal = true;
}
diff --git a/src/gui/PortPropertiesWindow.hpp b/src/gui/PortPropertiesWindow.hpp
index 63b27192..2cf160bc 100644
--- a/src/gui/PortPropertiesWindow.hpp
+++ b/src/gui/PortPropertiesWindow.hpp
@@ -22,7 +22,6 @@
#include <libglademm.h>
#include "raul/SharedPtr.hpp"
#include "client/PortModel.hpp"
-using namespace Ingen::Client;
namespace Ingen {
namespace GUI {
@@ -39,10 +38,10 @@ class PortPropertiesWindow : public Gtk::Window
public:
PortPropertiesWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& refGlade);
- void present(SharedPtr<PortModel> port_model);
+ void present(SharedPtr<Client::PortModel> port_model);
private:
- void variable_change(const string& key, const Atom& value);
+ void variable_change(const Raul::URI& key, const Raul::Atom& value);
void min_changed();
void max_changed();
@@ -54,12 +53,12 @@ private:
float _initial_min;
float _initial_max;
- SharedPtr<PortModel> _port_model;
- Gtk::SpinButton* _min_spinner;
- Gtk::SpinButton* _max_spinner;
- Gtk::Button* _cancel_button;
- Gtk::Button* _ok_button;
- std::list<sigc::connection> _connections;
+ SharedPtr<Client::PortModel> _port_model;
+ Gtk::SpinButton* _min_spinner;
+ Gtk::SpinButton* _max_spinner;
+ Gtk::Button* _cancel_button;
+ Gtk::Button* _ok_button;
+ std::list<sigc::connection> _connections;
};
} // namespace GUI
diff --git a/src/gui/RenameWindow.cpp b/src/gui/RenameWindow.cpp
index 92adb322..8770a89e 100644
--- a/src/gui/RenameWindow.cpp
+++ b/src/gui/RenameWindow.cpp
@@ -23,7 +23,8 @@
#include "App.hpp"
#include "RenameWindow.hpp"
-using std::string;
+using namespace std;
+using namespace Raul;
namespace Ingen {
namespace GUI {
diff --git a/src/gui/ThreadedLoader.cpp b/src/gui/ThreadedLoader.cpp
index 64a77d0a..2b185257 100644
--- a/src/gui/ThreadedLoader.cpp
+++ b/src/gui/ThreadedLoader.cpp
@@ -93,7 +93,7 @@ ThreadedLoader::load_patch(bool merge,
Glib::ustring engine_base = "";
if (engine_parent) {
if (merge)
- engine_base = engine_parent.get();
+ engine_base = engine_parent.get().str();
else
engine_base = engine_parent.get().base();
}
diff --git a/src/gui/UploadPatchWindow.hpp b/src/gui/UploadPatchWindow.hpp
index c81a278e..7bc08bfb 100644
--- a/src/gui/UploadPatchWindow.hpp
+++ b/src/gui/UploadPatchWindow.hpp
@@ -40,8 +40,8 @@ class UploadPatchWindow;
class UploadThread : public Raul::Thread {
public:
UploadThread(UploadPatchWindow* win,
- const string& str,
- const string& url);
+ const std::string& str,
+ const std::string& url);
private:
static size_t curl_read_cb(void* ptr, size_t size, size_t nmemb, void *stream);
diff --git a/src/ingen/main.cpp b/src/ingen/main.cpp
index 31f4a4ad..8fcda46f 100644
--- a/src/ingen/main.cpp
+++ b/src/ingen/main.cpp
@@ -253,7 +253,7 @@ main(int argc, char** argv)
const Glib::ustring path = args.path_arg;
if (Path::is_valid(path)) {
const Path p(path);
- if (p != "/") {
+ if (!p.is_root()) {
parent = p.parent();
const string s = p.name();
if (Symbol::is_valid(s))
diff --git a/src/serialisation/Parser.cpp b/src/serialisation/Parser.cpp
index f64e96ab..c68d6ccf 100644
--- a/src/serialisation/Parser.cpp
+++ b/src/serialisation/Parser.cpp
@@ -180,7 +180,7 @@ Parser::parse_string(
{
Redland::Model model(*world->rdf_world, str.c_str(), str.length(), base_uri);
- cout << "Parsing " << (data_path ? (string)*data_path : "*") << " from string";
+ cout << "Parsing " << (data_path ? data_path->str() : "*") << " from string";
if (base_uri != "")
cout << "(base " << base_uri << ")";
cout << endl;
@@ -274,7 +274,7 @@ Parser::parse(
const Redland::Node::Type res = Redland::Node::RESOURCE;
const Glib::ustring query_str = data_path
- ? Glib::ustring("SELECT DISTINCT ?t WHERE { <") + data_path->substr(1) + "> a ?t . }"
+ ? Glib::ustring("SELECT DISTINCT ?t WHERE { <") + data_path->chop_start("/") + "> a ?t . }"
: Glib::ustring("SELECT DISTINCT ?s ?t WHERE { ?s a ?t . }");
Redland::Query query(*world->rdf_world, query_str);
@@ -288,8 +288,8 @@ Parser::parse(
const Redland::Node out_port_class (*world->rdf_world, res, NS_LV2 "OutputPort");
const Redland::Node lv2_class (*world->rdf_world, res, NS_LV2 "Plugin");
- const Redland::Node subject_node = (data_path && *data_path != "/")
- ? Redland::Node(*world->rdf_world, res, data_path->substr(1))
+ const Redland::Node subject_node = (data_path && !data_path->is_root())
+ ? Redland::Node(*world->rdf_world, res, data_path->chop_start("/"))
: model.base_uri();
std::string path_str;
@@ -325,7 +325,7 @@ Parser::parse(
string path = (parent && symbol)
? parent->base() + *symbol
- : (parent ? parent->base() : "/") + path_str.substr(1);
+ : (parent ? parent->base() : "/") + path_str.substr(path_str.find("/")+1);
if (!Path::is_valid(path)) {
cerr << "WARNING: Invalid path '" << path << "' transformed to /" << endl;
@@ -345,7 +345,7 @@ Parser::parse(
return boost::optional<Path>();
}
- if (data_path && subject.to_string() == *data_path)
+ if (data_path && subject.to_string() == data_path->str())
root_path = ret;
} else if (is_plugin) {
diff --git a/src/serialisation/Serialiser.cpp b/src/serialisation/Serialiser.cpp
index a1f4f902..cb598eb7 100644
--- a/src/serialisation/Serialiser.cpp
+++ b/src/serialisation/Serialiser.cpp
@@ -145,7 +145,7 @@ Serialiser::to_string(SharedPtr<GraphObject> object,
Redland::Resource base_rdf_node(_model->world(), base_uri);
for (GraphObject::Properties::const_iterator v = extra_rdf.begin(); v != extra_rdf.end(); ++v) {
if (v->first.find(":") != string::npos) {
- _model->add_statement(base_rdf_node, v->first,
+ _model->add_statement(base_rdf_node, v->first.str(),
AtomRDF::atom_to_node(_model->world(), v->second));
} else {
cerr << "Warning: not serialising extra RDF with key '" << v->first << "'" << endl;
@@ -227,7 +227,7 @@ Redland::Node
Serialiser::instance_rdf_node(const Path& path)
{
assert(_model);
- assert(path.substr(0, _root_path.length()) == _root_path);
+ assert(path.is_child_of(_root_path));
if (path == _root_path)
return Redland::Resource(_model->world(), _base_uri);
@@ -241,7 +241,7 @@ Redland::Node
Serialiser::class_rdf_node(const Path& path)
{
assert(_model);
- assert(path.substr(0, _root_path.length()) == _root_path);
+ assert(path.is_child_of(_root_path));
if (path == _root_path)
return Redland::Resource(_model->world(), _base_uri);
@@ -272,7 +272,7 @@ Serialiser::serialise(SharedPtr<GraphObject> object) throw (std::logic_error)
SharedPtr<Shared::Node> node = PtrCast<Shared::Node>(object);
if (node) {
- const Redland::Resource plugin_id(_model->world(), node->plugin()->uri());
+ const Redland::Resource plugin_id(_model->world(), node->plugin()->uri().str());
serialise_node(node, plugin_id, instance_rdf_node(node->path()));
return;
}
@@ -305,7 +305,7 @@ Serialiser::serialise_patch(SharedPtr<Shared::Patch> patch, const Redland::Node&
_model->add_statement(patch_id, "lv2:symbol",
Redland::Literal(_model->world(), s->second.get_string()));
// Otherwise take the one from our path (if possible)
- } else if (patch->path() != "/") {
+ } else if (!patch->path().is_root()) {
_model->add_statement(patch_id, "lv2:symbol",
Redland::Literal(_model->world(), patch->path().name()));
} else {
@@ -329,7 +329,7 @@ Serialiser::serialise_patch(SharedPtr<Shared::Patch> patch, const Redland::Node&
serialise_patch(patch, class_id);
serialise_node(patch, class_id, node_id);
} else if (node) {
- const Redland::Resource class_id(_model->world(), node->plugin()->uri());
+ const Redland::Resource class_id(_model->world(), node->plugin()->uri().str());
const Redland::Node node_id(instance_rdf_node(n->second->path()));
_model->add_statement(patch_id, "ingen:node", node_id);
serialise_node(node, class_id, node_id);
@@ -364,7 +364,7 @@ Serialiser::serialise_plugin(const Shared::Plugin& plugin)
{
assert(_model);
- const Redland::Node plugin_id = Redland::Resource(_model->world(), plugin.uri());
+ const Redland::Node plugin_id = Redland::Resource(_model->world(), plugin.uri().str());
_model->add_statement(plugin_id, "rdf:type",
Redland::Resource(_model->world(), plugin.type_uri()));
@@ -480,7 +480,7 @@ Serialiser::serialise_properties(Redland::Node subject, const GraphObject::Prope
for (GraphObject::Properties::const_iterator v = properties.begin(); v != properties.end(); ++v) {
if (v->first.find(":") && v->second.is_valid()) {
const Redland::Node value = AtomRDF::atom_to_node(_model->world(), v->second);
- _model->add_statement(subject, v->first, value);
+ _model->add_statement(subject, v->first.str(), value);
} else {
cerr << "Warning: unable to serialize property \'" << v->first << "\'" << endl;
}
@@ -492,9 +492,9 @@ void
Serialiser::serialise_variables(Redland::Node subject, const GraphObject::Properties& variables)
{
for (GraphObject::Properties::const_iterator v = variables.begin(); v != variables.end(); ++v) {
- if (v->first.find(":") && v->first != "ingen:document") {
+ if (v->first.find(":") && v->first.str() != "ingen:document") {
if (v->second.is_valid()) {
- const Redland::Resource key(_model->world(), v->first);
+ const Redland::Resource key(_model->world(), v->first.str());
const Redland::Node value = AtomRDF::atom_to_node(_model->world(), v->second);
if (value.is_valid()) {
_model->add_statement(subject, key, value);
diff --git a/src/shared/Builder.cpp b/src/shared/Builder.cpp
index 9da71a09..d1ddee32 100644
--- a/src/shared/Builder.cpp
+++ b/src/shared/Builder.cpp
@@ -41,10 +41,8 @@ Builder::build(SharedPtr<const GraphObject> object)
{
SharedPtr<const Patch> patch = PtrCast<const Patch>(object);
if (patch) {
- if (object->path() != "/") {
- const string path_str = object->path();
- _interface.new_patch(path_str, patch->internal_polyphony());
- }
+ if (!object->path().is_root())
+ _interface.new_patch(object->path(), patch->internal_polyphony());
build_object(object);
/*for (Patch::Connections::const_iterator i = patch->connections().begin();
@@ -95,9 +93,8 @@ Builder::build_object(SharedPtr<const GraphObject> object)
for (GraphObject::Properties::const_iterator i = object->properties().begin();
i != object->properties().end(); ++i) {
- if (object->path() == "/")
+ if (object->path().is_root())
continue;
- string path_str = object->path();
_interface.set_property(object->path(), i->first, i->second);
}
}
diff --git a/src/shared/ClashAvoider.cpp b/src/shared/ClashAvoider.cpp
index 39338e99..24569369 100644
--- a/src/shared/ClashAvoider.cpp
+++ b/src/shared/ClashAvoider.cpp
@@ -27,7 +27,7 @@ namespace Shared {
/** Always returns a valid Raul::Path */
-const std::string
+const Path
ClashAvoider::map_path(const Raul::Path& in)
{
//cout << "MAP PATH: " << in;
@@ -69,7 +69,7 @@ ClashAvoider::map_path(const Raul::Path& in)
return i.first->second;
}
parent = parent.parent();
- } while (parent != "/");
+ } while (!parent.is_root());
// No clash, use symbol unmodified
if (!exists(in) && _symbol_map.find(in) == _symbol_map.end()) {
@@ -141,100 +141,100 @@ ClashAvoider::new_object(const GraphObject* object)
void
-ClashAvoider::new_patch(const std::string& path,
- uint32_t poly)
+ClashAvoider::new_patch(const Raul::Path& path,
+ uint32_t poly)
{
- if (path != "/")
+ if (!path.is_root())
_target.new_patch(map_path(path), poly);
}
void
-ClashAvoider::new_node(const std::string& path,
- const std::string& plugin_uri)
+ClashAvoider::new_node(const Raul::Path& path,
+ const Raul::URI& plugin_uri)
{
_target.new_node(map_path(path), plugin_uri);
}
void
-ClashAvoider::new_port(const std::string& path,
- const std::string& type,
- uint32_t index,
- bool is_output)
+ClashAvoider::new_port(const Raul::Path& path,
+ const Raul::URI& type,
+ uint32_t index,
+ bool is_output)
{
_target.new_port(map_path(path), type, index, is_output);
}
void
-ClashAvoider::rename(const std::string& old_path,
- const std::string& new_path)
+ClashAvoider::rename(const Raul::Path& old_path,
+ const Raul::Path& new_path)
{
_target.rename(map_path(old_path), map_path(new_path));
}
void
-ClashAvoider::connect(const std::string& src_port_path,
- const std::string& dst_port_path)
+ClashAvoider::connect(const Raul::Path& src_port_path,
+ const Raul::Path& dst_port_path)
{
_target.connect(map_path(src_port_path), map_path(dst_port_path));
}
void
-ClashAvoider::disconnect(const std::string& src_port_path,
- const std::string& dst_port_path)
+ClashAvoider::disconnect(const Raul::Path& src_port_path,
+ const Raul::Path& dst_port_path)
{
_target.disconnect(map_path(src_port_path), map_path(dst_port_path));
}
void
-ClashAvoider::set_variable(const std::string& subject_path,
- const std::string& predicate,
- const Raul::Atom& value)
+ClashAvoider::set_variable(const Raul::Path& subject_path,
+ const Raul::URI& predicate,
+ const Raul::Atom& value)
{
_target.set_variable(map_path(subject_path), predicate, value);
}
void
-ClashAvoider::set_property(const std::string& subject_path,
- const std::string& predicate,
- const Raul::Atom& value)
+ClashAvoider::set_property(const Raul::Path& subject_path,
+ const Raul::URI& predicate,
+ const Raul::Atom& value)
{
_target.set_property(map_path(subject_path), predicate, value);
}
void
-ClashAvoider::set_port_value(const std::string& port_path,
- const Raul::Atom& value)
+ClashAvoider::set_port_value(const Raul::Path& port_path,
+ const Raul::Atom& value)
{
_target.set_port_value(map_path(port_path), value);
}
void
-ClashAvoider::set_voice_value(const std::string& port_path,
- uint32_t voice,
- const Raul::Atom& value)
+ClashAvoider::set_voice_value(const Raul::Path& port_path,
+ uint32_t voice,
+ const Raul::Atom& value)
{
_target.set_voice_value(map_path(port_path), voice, value);
}
void
-ClashAvoider::destroy(const std::string& path)
+ClashAvoider::destroy(const Raul::Path& path)
{
_target.destroy(map_path(path));
}
void
-ClashAvoider::clear_patch(const std::string& path)
+ClashAvoider::clear_patch(const Raul::Path& path)
{
_target.clear_patch(map_path(path));
}
diff --git a/src/shared/ClashAvoider.hpp b/src/shared/ClashAvoider.hpp
index 3d154e8d..0692a59a 100644
--- a/src/shared/ClashAvoider.hpp
+++ b/src/shared/ClashAvoider.hpp
@@ -48,49 +48,49 @@ public:
// Object commands
- bool new_object(const GraphObject* object);
+ virtual bool new_object(const GraphObject* object);
- void new_patch(const std::string& path,
- uint32_t poly);
+ virtual void new_patch(const Raul::Path& path,
+ uint32_t poly);
- void new_node(const std::string& path,
- const std::string& plugin_uri);
+ virtual void new_node(const Raul::Path& path,
+ const Raul::URI& plugin_uri);
- void new_port(const std::string& path,
- const std::string& type,
- uint32_t index,
- bool is_output);
+ virtual void new_port(const Raul::Path& path,
+ const Raul::URI& type,
+ uint32_t index,
+ bool is_output);
- void rename(const std::string& old_path,
- const std::string& new_path);
+ virtual void rename(const Raul::Path& old_path,
+ const Raul::Path& new_path);
- void connect(const std::string& src_port_path,
- const std::string& dst_port_path);
+ virtual void connect(const Raul::Path& src_port_path,
+ const Raul::Path& dst_port_path);
- void disconnect(const std::string& src_port_path,
- const std::string& dst_port_path);
+ virtual void disconnect(const Raul::Path& src_port_path,
+ const Raul::Path& dst_port_path);
- void set_variable(const std::string& subject_path,
- const std::string& predicate,
- const Raul::Atom& value);
+ virtual void set_variable(const Raul::Path& subject_path,
+ const Raul::URI& predicate,
+ const Raul::Atom& value);
- void set_property(const std::string& subject_path,
- const std::string& predicate,
- const Raul::Atom& value);
+ virtual void set_property(const Raul::Path& subject_path,
+ const Raul::URI& predicate,
+ const Raul::Atom& value);
- void set_port_value(const std::string& port_path,
- const Raul::Atom& value);
+ virtual void set_port_value(const Raul::Path& port_path,
+ const Raul::Atom& value);
- void set_voice_value(const std::string& port_path,
- uint32_t voice,
- const Raul::Atom& value);
+ virtual void set_voice_value(const Raul::Path& port_path,
+ uint32_t voice,
+ const Raul::Atom& value);
- void destroy(const std::string& path);
+ virtual void destroy(const Raul::Path& path);
+
+ virtual void clear_patch(const Raul::Path& patch_path);
- void clear_patch(const std::string& path);
-
private:
- const std::string map_path(const Raul::Path& in);
+ const Raul::Path map_path(const Raul::Path& in);
Store& _store;
CommonInterface& _target;
diff --git a/src/shared/ResourceImpl.cpp b/src/shared/ResourceImpl.cpp
index 10c57fbe..d2c1a06b 100644
--- a/src/shared/ResourceImpl.cpp
+++ b/src/shared/ResourceImpl.cpp
@@ -23,14 +23,14 @@ namespace Shared {
void
-ResourceImpl::set_property(const std::string& uri, const Raul::Atom& value)
+ResourceImpl::set_property(const Raul::URI& uri, const Raul::Atom& value)
{
_properties[uri] = value;
}
const Raul::Atom&
-ResourceImpl::get_property(const std::string& uri) const
+ResourceImpl::get_property(const Raul::URI& uri) const
{
static const Raul::Atom nil;
Properties::const_iterator i = _properties.find(uri);
diff --git a/src/shared/ResourceImpl.hpp b/src/shared/ResourceImpl.hpp
index 2d438487..ca588d8f 100644
--- a/src/shared/ResourceImpl.hpp
+++ b/src/shared/ResourceImpl.hpp
@@ -19,6 +19,7 @@
#define RESOURCEIMPL_HPP
#include <map>
+#include "raul/URI.hpp"
#include "interface/Resource.hpp"
namespace Ingen {
@@ -28,21 +29,19 @@ namespace Shared {
class ResourceImpl : virtual public Resource
{
public:
- typedef std::map<std::string, Raul::Atom> Properties;
+ ResourceImpl(const Raul::URI& uri) : _uri(uri) {}
- ResourceImpl(const std::string& uri) : _uri(uri) {}
-
- virtual const std::string uri() const { return _uri; }
+ virtual const Raul::URI uri() const { return _uri.str(); }
const Properties& properties() const { return _properties; }
Properties& properties() { return _properties; }
- const Raul::Atom& get_property(const std::string& uri) const;
- void set_property(const std::string& uri, const Raul::Atom& value);
+ const Raul::Atom& get_property(const Raul::URI& uri) const;
+ void set_property(const Raul::URI& uri, const Raul::Atom& value);
private:
- std::string _uri;
- Properties _properties;
+ Raul::URI _uri;
+ Properties _properties;
};