From 2f595631859574bfa7779ebb42f42b8590f5424c Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 27 May 2009 23:21:34 +0000 Subject: 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 --- src/engine/GraphObjectImpl.cpp | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) (limited to 'src/engine/GraphObjectImpl.cpp') diff --git a/src/engine/GraphObjectImpl.cpp b/src/engine/GraphObjectImpl.cpp index ef4e2cd4..40cdc792 100644 --- a/src/engine/GraphObjectImpl.cpp +++ b/src/engine/GraphObjectImpl.cpp @@ -27,26 +27,38 @@ namespace Ingen { using namespace Shared; + +GraphObjectImpl::GraphObjectImpl(GraphObjectImpl* parent, const std::string& name, bool polyphonic) + : ResourceImpl((parent ? parent->path().base() : Raul::Path::root_uri) + name) + , _parent(parent) + , _name(name) + , _meta(std::string("meta:#") + path().chop_start("/")) + , _polyphonic(polyphonic) +{ + assert(parent == NULL || _name.length() > 0); + assert(_name.find("/") == std::string::npos); +} + + +void +GraphObjectImpl::add_meta_property(const Raul::URI& key, const Atom& value) +{ + _meta.add_property(key, value); +} + + void -GraphObjectImpl::set_variable(const Raul::URI& key, const Atom& value) +GraphObjectImpl::set_meta_property(const Raul::URI& key, const Atom& value) { - // Ignore duplicate statements - typedef Resource::Properties::const_iterator iterator; - const std::pair range = _variables.equal_range(key); - for (iterator i = range.first; i != range.second; ++i) - if (i->second == value) - return; - - _variables.insert(make_pair(key, value)); + _meta.set_property(key, value); } const Atom& -GraphObjectImpl::get_variable(const Raul::URI& key) +GraphObjectImpl::get_property(const Raul::URI& key) const { - static const Atom null_atom; - Properties::iterator i = _variables.find(key); - return (i != _variables.end()) ? (*i).second : null_atom; + Resource::Properties::const_iterator i = properties().find(key); + return (i != properties().end()) ? i->second : _meta.get_property(key); } -- cgit v1.2.1