diff options
author | David Robillard <d@drobilla.net> | 2009-05-27 23:21:34 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2009-05-27 23:21:34 +0000 |
commit | 2f595631859574bfa7779ebb42f42b8590f5424c (patch) | |
tree | c91c0cddcd93af991161c6cde4eceaaf45c5c8d5 /src/shared | |
parent | 20ff9af76b21b751ac29b354cf557e86b69c52f7 (diff) | |
download | ingen-2f595631859574bfa7779ebb42f42b8590f5424c.tar.gz ingen-2f595631859574bfa7779ebb42f42b8590f5424c.tar.bz2 ingen-2f595631859574bfa7779ebb42f42b8590f5424c.zip |
Remove 'property' vs 'variable' dichotomy in favour of 'meta objects' (to match serialisation).
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2016 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/Builder.cpp | 14 | ||||
-rw-r--r-- | src/shared/ClashAvoider.cpp | 17 | ||||
-rw-r--r-- | src/shared/ClashAvoider.hpp | 6 | ||||
-rw-r--r-- | src/shared/ResourceImpl.cpp | 7 | ||||
-rw-r--r-- | src/shared/ResourceImpl.hpp | 9 |
5 files changed, 22 insertions, 31 deletions
diff --git a/src/shared/Builder.cpp b/src/shared/Builder.cpp index ba26d962..37c193fb 100644 --- a/src/shared/Builder.cpp +++ b/src/shared/Builder.cpp @@ -93,16 +93,12 @@ Builder::connect(SharedPtr<const GraphObject> object) void Builder::build_object(SharedPtr<const GraphObject> object) { - for (GraphObject::Properties::const_iterator i = object->variables().begin(); - i != object->variables().end(); ++i) - _interface.set_variable(object->path(), i->first, i->second); - - for (GraphObject::Properties::const_iterator i = object->properties().begin(); - i != object->properties().end(); ++i) { - if (object->path().is_root()) - continue; + typedef GraphObject::Properties::const_iterator iterator; + iterator i = object->meta().properties().begin(); + for (; i != object->meta().properties().end(); ++i) + _interface.set_property(object->meta().uri(), i->first, i->second); + for (i = object->properties().begin(); i != object->properties().end(); ++i) _interface.set_property(object->path(), i->first, i->second); - } } diff --git a/src/shared/ClashAvoider.cpp b/src/shared/ClashAvoider.cpp index c7e08269..408f303a 100644 --- a/src/shared/ClashAvoider.cpp +++ b/src/shared/ClashAvoider.cpp @@ -143,10 +143,10 @@ ClashAvoider::exists(const Raul::Path& path) const void -ClashAvoider::put(const Raul::Path& path, +ClashAvoider::put(const Raul::URI& path, const Shared::Resource::Properties& properties) { - _target.put(map_path(path), properties); + _target.put(map_uri(path), properties); } @@ -175,20 +175,11 @@ ClashAvoider::disconnect(const Raul::Path& src_port_path, void -ClashAvoider::set_variable(const Raul::URI& subject_path, +ClashAvoider::set_property(const Raul::URI& subject, const Raul::URI& predicate, const Raul::Atom& value) { - _target.set_variable(map_uri(subject_path), predicate, value); -} - - -void -ClashAvoider::set_property(const Raul::URI& subject_path, - const Raul::URI& predicate, - const Raul::Atom& value) -{ - _target.set_property(map_uri(subject_path), predicate, value); + _target.set_property(map_uri(subject), predicate, value); } diff --git a/src/shared/ClashAvoider.hpp b/src/shared/ClashAvoider.hpp index 2fc4b13b..81c21f45 100644 --- a/src/shared/ClashAvoider.hpp +++ b/src/shared/ClashAvoider.hpp @@ -48,7 +48,7 @@ public: // Object commands - virtual void put(const Raul::Path& path, + virtual void put(const Raul::URI& path, const Resource::Properties& properties); virtual void move(const Raul::Path& old_path, @@ -60,10 +60,6 @@ public: virtual void disconnect(const Raul::Path& src_port_path, const Raul::Path& dst_port_path); - virtual void set_variable(const Raul::URI& subject_path, - const Raul::URI& predicate, - const Raul::Atom& value); - virtual void set_property(const Raul::URI& subject_path, const Raul::URI& predicate, const Raul::Atom& value); diff --git a/src/shared/ResourceImpl.cpp b/src/shared/ResourceImpl.cpp index 27a33e07..69d294a4 100644 --- a/src/shared/ResourceImpl.cpp +++ b/src/shared/ResourceImpl.cpp @@ -25,6 +25,13 @@ namespace Ingen { namespace Shared { +const Raul::URI +ResourceImpl::meta_uri(const Raul::URI& base, const Raul::URI& uri) +{ + return string("#") + uri.chop_start("/"); +} + + void ResourceImpl::add_property(const Raul::URI& uri, const Raul::Atom& value) { diff --git a/src/shared/ResourceImpl.hpp b/src/shared/ResourceImpl.hpp index b436ddc9..1f8dbedd 100644 --- a/src/shared/ResourceImpl.hpp +++ b/src/shared/ResourceImpl.hpp @@ -32,7 +32,7 @@ class ResourceImpl : virtual public Resource public: ResourceImpl(const Raul::URI& uri) : _uri(uri) {} - virtual const Raul::URI uri() const { return _uri.str(); } + virtual const Raul::URI uri() const { return _uri.str(); } const Properties& properties() const { return _properties; } Properties& properties() { return _properties; } @@ -40,6 +40,9 @@ public: const Raul::Atom& get_property(const Raul::URI& uri) const; void set_property(const Raul::URI& uri, const Raul::Atom& value); void add_property(const Raul::URI& uri, const Raul::Atom& value); + void merge_properties(const Properties& p); + + sigc::signal<void, const Raul::URI&, const Raul::Atom&> signal_property; /** Get the ingen type from a set of Properties. * If some coherent ingen type is found, true is returned and the appropriate @@ -51,9 +54,7 @@ public: bool& node, bool& port, bool& is_output, DataType& data_type); - void merge_properties(const Properties& p); - - sigc::signal<void, const Raul::URI&, const Raul::Atom&> signal_property; + static const Raul::URI meta_uri(const Raul::URI& base, const Raul::URI& uri); private: Raul::URI _uri; |