summaryrefslogtreecommitdiffstats
path: root/src/shared
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 /src/shared
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
Diffstat (limited to 'src/shared')
-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
5 files changed, 72 insertions, 76 deletions
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;
};