diff options
author | David Robillard <d@drobilla.net> | 2012-07-30 23:22:44 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-07-30 23:22:44 +0000 |
commit | 9088edb2534a616b757197662d77abcb0291470b (patch) | |
tree | fc3c86d6a7af39642768d4b864dd38438f9a2e48 /src | |
parent | 0e1bf6ddfc77866ff6477a3f394c030c2a5e1b39 (diff) | |
download | ingen-9088edb2534a616b757197662d77abcb0291470b.tar.gz ingen-9088edb2534a616b757197662d77abcb0291470b.tar.bz2 ingen-9088edb2534a616b757197662d77abcb0291470b.zip |
Merge Resource and ResourceImpl, eliminating more virtual inheritance.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4577 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r-- | src/Resource.cpp (renamed from src/shared/ResourceImpl.cpp) | 50 | ||||
-rw-r--r-- | src/client/ClientStore.cpp | 4 | ||||
-rw-r--r-- | src/client/ObjectModel.cpp | 6 | ||||
-rw-r--r-- | src/client/PluginModel.cpp | 6 | ||||
-rw-r--r-- | src/gui/PortMenu.cpp | 2 | ||||
-rw-r--r-- | src/server/GraphObjectImpl.cpp | 2 | ||||
-rw-r--r-- | src/server/GraphObjectImpl.hpp | 14 | ||||
-rw-r--r-- | src/server/PluginImpl.hpp | 5 | ||||
-rw-r--r-- | src/server/events/Delta.cpp | 4 | ||||
-rw-r--r-- | src/server/events/Delta.hpp | 28 | ||||
-rw-r--r-- | src/shared/wscript | 3 |
11 files changed, 61 insertions, 63 deletions
diff --git a/src/shared/ResourceImpl.cpp b/src/Resource.cpp index be3d445f..13959a13 100644 --- a/src/shared/ResourceImpl.cpp +++ b/src/Resource.cpp @@ -16,7 +16,7 @@ #include <utility> -#include "ingen/shared/ResourceImpl.hpp" +#include "ingen/Resource.hpp" #include "ingen/shared/URIs.hpp" #include "raul/Atom.hpp" #include "raul/log.hpp" @@ -24,12 +24,11 @@ using namespace std; namespace Ingen { -namespace Shared { void -ResourceImpl::add_property(const Raul::URI& uri, - const Raul::Atom& value, - Graph ctx) +Resource::add_property(const Raul::URI& uri, + const Raul::Atom& value, + Graph ctx) { // Ignore duplicate statements typedef Resource::Properties::const_iterator iterator; @@ -45,9 +44,9 @@ ResourceImpl::add_property(const Raul::URI& uri, } const Raul::Atom& -ResourceImpl::set_property(const Raul::URI& uri, - const Raul::Atom& value, - Resource::Graph ctx) +Resource::set_property(const Raul::URI& uri, + const Raul::Atom& value, + Resource::Graph ctx) { // Erase existing property in this context for (Properties::iterator i = _properties.find(uri); @@ -67,7 +66,7 @@ ResourceImpl::set_property(const Raul::URI& uri, } void -ResourceImpl::remove_property(const Raul::URI& uri, const Raul::Atom& value) +Resource::remove_property(const Raul::URI& uri, const Raul::Atom& value) { if (value == _uris.wildcard) { _properties.erase(uri); @@ -83,7 +82,7 @@ ResourceImpl::remove_property(const Raul::URI& uri, const Raul::Atom& value) } bool -ResourceImpl::has_property(const Raul::URI& uri, const Raul::Atom& value) const +Resource::has_property(const Raul::URI& uri, const Raul::Atom& value) const { Properties::const_iterator i = _properties.find(uri); for (; (i != _properties.end()) && (i->first == uri); ++i) { @@ -95,13 +94,13 @@ ResourceImpl::has_property(const Raul::URI& uri, const Raul::Atom& value) const } const Raul::Atom& -ResourceImpl::set_property(const Raul::URI& uri, const Raul::Atom& value) const +Resource::set_property(const Raul::URI& uri, const Raul::Atom& value) const { - return const_cast<ResourceImpl*>(this)->set_property(uri, value); + return const_cast<Resource*>(this)->set_property(uri, value); } const Raul::Atom& -ResourceImpl::get_property(const Raul::URI& uri) const +Resource::get_property(const Raul::URI& uri) const { static const Raul::Atom nil; Properties::const_iterator i = _properties.find(uri); @@ -109,12 +108,12 @@ ResourceImpl::get_property(const Raul::URI& uri) const } bool -ResourceImpl::type(const URIs& uris, - const Properties& properties, - bool& patch, - bool& node, - bool& port, - bool& is_output) +Resource::type(const Shared::URIs& uris, + const Properties& properties, + bool& patch, + bool& node, + bool& port, + bool& is_output) { typedef Resource::Properties::const_iterator iterator; const std::pair<iterator, iterator> types_range = properties.equal_range(uris.rdf_type); @@ -123,7 +122,7 @@ ResourceImpl::type(const URIs& uris, for (iterator i = types_range.first; i != types_range.second; ++i) { const Raul::Atom& atom = i->second; if (atom.type() != uris.forge.URI && atom.type() != uris.forge.URID) { - Raul::warn << "[ResourceImpl] Non-URI type " << uris.forge.str(atom) << endl; + Raul::warn << "[Resource] Non-URI type " << uris.forge.str(atom) << endl; continue; } @@ -154,7 +153,7 @@ ResourceImpl::type(const URIs& uris, } void -ResourceImpl::set_properties(const Properties& p) +Resource::set_properties(const Properties& p) { /* Note a simple loop that calls set_property is inappropriate here since it will not correctly set multiple properties in p (notably rdf:type) @@ -170,7 +169,7 @@ ResourceImpl::set_properties(const Properties& p) } void -ResourceImpl::add_properties(const Properties& p) +Resource::add_properties(const Properties& p) { typedef Resource::Properties::const_iterator iterator; for (iterator i = p.begin(); i != p.end(); ++i) @@ -178,7 +177,7 @@ ResourceImpl::add_properties(const Properties& p) } void -ResourceImpl::remove_properties(const Properties& p) +Resource::remove_properties(const Properties& p) { typedef Resource::Properties::const_iterator iterator; for (iterator i = p.begin(); i != p.end(); ++i) { @@ -186,7 +185,7 @@ ResourceImpl::remove_properties(const Properties& p) _properties.erase(i->first); } else { for (Properties::iterator j = _properties.find(i->first); - (j != _properties.end()) && (j->first == i->first); ++j) { + (j != _properties.end()) && (j->first == i->first); ++j) { if (j->second == i->second) { _properties.erase(j); break; @@ -197,7 +196,7 @@ ResourceImpl::remove_properties(const Properties& p) } Resource::Properties -ResourceImpl::properties(Resource::Graph ctx) const +Resource::properties(Resource::Graph ctx) const { if (ctx == Resource::DEFAULT) { return properties(); @@ -216,5 +215,4 @@ ResourceImpl::properties(Resource::Graph ctx) const return props; } -} // namespace Shared } // namespace Ingen diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp index 75acef63..56d94b2e 100644 --- a/src/client/ClientStore.cpp +++ b/src/client/ClientStore.cpp @@ -279,8 +279,8 @@ ClientStore::put(const Raul::URI& uri, #endif bool is_patch, is_node, is_port, is_output; - ResourceImpl::type(uris(), properties, - is_patch, is_node, is_port, is_output); + Resource::type(uris(), properties, + is_patch, is_node, is_port, is_output); // Check if uri is a plugin Iterator t = properties.find(_uris.rdf_type); diff --git a/src/client/ObjectModel.cpp b/src/client/ObjectModel.cpp index e7e7a5d8..9a5009ba 100644 --- a/src/client/ObjectModel.cpp +++ b/src/client/ObjectModel.cpp @@ -23,14 +23,14 @@ namespace Ingen { namespace Client { ObjectModel::ObjectModel(Shared::URIs& uris, const Raul::Path& path) - : ResourceImpl(uris, path) + : GraphObject(uris, path) , _path(path) , _symbol((path == Raul::Path::root()) ? "root" : path.symbol()) { } ObjectModel::ObjectModel(const ObjectModel& copy) - : ResourceImpl(copy) + : GraphObject(copy) , _parent(copy._parent) , _path(copy._path) , _symbol(copy._symbol) @@ -82,7 +82,7 @@ ObjectModel::set(SharedPtr<ObjectModel> o) for (Properties::const_iterator v = o->properties().begin(); v != o->properties().end(); ++v) { - ResourceImpl::set_property(v->first, v->second); + Resource::set_property(v->first, v->second); _signal_property.emit(v->first, v->second); } } diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp index e3ac9273..f4df6d1c 100644 --- a/src/client/PluginModel.cpp +++ b/src/client/PluginModel.cpp @@ -44,7 +44,7 @@ PluginModel::PluginModel(Shared::URIs& uris, const Raul::URI& uri, const Raul::URI& type_uri, const Resource::Properties& properties) - : ResourceImpl(uris, uri) + : Plugin(uris, uri) , _type(type_from_uri(type_uri.str())) { add_properties(properties); @@ -66,7 +66,7 @@ const Raul::Atom& PluginModel::get_property(const Raul::URI& key) const { static const Raul::Atom nil; - const Raul::Atom& val = ResourceImpl::get_property(key); + const Raul::Atom& val = Resource::get_property(key); if (val.is_valid()) return val; @@ -145,7 +145,7 @@ PluginModel::set(SharedPtr<PluginModel> p) for (Properties::const_iterator v = p->properties().begin(); v != p->properties().end(); ++v) { - ResourceImpl::set_property(v->first, v->second); + Resource::set_property(v->first, v->second); _signal_property.emit(v->first, v->second); } diff --git a/src/gui/PortMenu.cpp b/src/gui/PortMenu.cpp index 241811e5..cd611199 100644 --- a/src/gui/PortMenu.cpp +++ b/src/gui/PortMenu.cpp @@ -150,7 +150,7 @@ PortMenu::on_menu_expose() const std::string label = node->label() + " " + node->port_label(port); const Raul::Path path = node->path().str() + "_" + port->symbol().c_str(); - Shared::ResourceImpl r(*_object.get()); + Ingen::Resource r(*_object.get()); r.remove_property(uris.lv2_index, uris.wildcard); r.set_property(uris.lv2_symbol, _app->forge().alloc(path.symbol())); r.set_property(uris.lv2_name, _app->forge().alloc(label.c_str())); diff --git a/src/server/GraphObjectImpl.cpp b/src/server/GraphObjectImpl.cpp index 901be3eb..050992c8 100644 --- a/src/server/GraphObjectImpl.cpp +++ b/src/server/GraphObjectImpl.cpp @@ -28,7 +28,7 @@ namespace Server { GraphObjectImpl::GraphObjectImpl(Ingen::Shared::URIs& uris, GraphObjectImpl* parent, const Raul::Symbol& symbol) - : ResourceImpl(uris, parent ? parent->path().child(symbol) : Raul::Path::root()) + : GraphObject(uris, parent ? parent->path().child(symbol) : "/") , _parent(parent) , _path(parent ? parent->path().child(symbol) : "/") , _symbol(symbol) diff --git a/src/server/GraphObjectImpl.hpp b/src/server/GraphObjectImpl.hpp index b2fa864e..5df7b565 100644 --- a/src/server/GraphObjectImpl.hpp +++ b/src/server/GraphObjectImpl.hpp @@ -17,15 +17,16 @@ #ifndef INGEN_ENGINE_GRAPHOBJECTIMPL_HPP #define INGEN_ENGINE_GRAPHOBJECTIMPL_HPP -#include <string> -#include <map> -#include <cstddef> #include <cassert> +#include <cstddef> +#include <map> +#include <string> + +#include "ingen/GraphObject.hpp" +#include "ingen/Resource.hpp" #include "raul/Deletable.hpp" #include "raul/Path.hpp" #include "raul/SharedPtr.hpp" -#include "ingen/GraphObject.hpp" -#include "ingen/shared/ResourceImpl.hpp" namespace Raul { class Maid; } @@ -48,8 +49,7 @@ class BufferFactory; * * \ingroup engine */ -class GraphObjectImpl : virtual public GraphObject - , public Ingen::Shared::ResourceImpl +class GraphObjectImpl : public GraphObject { public: virtual ~GraphObjectImpl() {} diff --git a/src/server/PluginImpl.hpp b/src/server/PluginImpl.hpp index 7ad7193c..968c43f6 100644 --- a/src/server/PluginImpl.hpp +++ b/src/server/PluginImpl.hpp @@ -23,7 +23,7 @@ #include <boost/utility.hpp> #include "ingen/Plugin.hpp" -#include "ingen/shared/ResourceImpl.hpp" +#include "ingen/Resource.hpp" namespace Ingen { @@ -41,14 +41,13 @@ class BufferFactory; * Conceptually, a Node is an instance of this. */ class PluginImpl : public Plugin - , public Ingen::Shared::ResourceImpl , public boost::noncopyable { public: PluginImpl(Ingen::Shared::URIs& uris, Type type, const std::string& uri) - : ResourceImpl(uris, uri) + : Plugin(uris, uri) , _type(type) {} diff --git a/src/server/events/Delta.cpp b/src/server/events/Delta.cpp index 1adb9ba1..4e9ca791 100644 --- a/src/server/events/Delta.cpp +++ b/src/server/events/Delta.cpp @@ -109,7 +109,7 @@ Delta::pre_process() _object = is_graph_object ? _engine.engine_store()->find_object(Raul::Path(_subject.str())) - : static_cast<Shared::ResourceImpl*>(_engine.node_factory()->plugin(_subject)); + : static_cast<Ingen::Resource*>(_engine.node_factory()->plugin(_subject)); if (!_object && (!is_graph_object || !_create)) { return Event::pre_process_done(NOT_FOUND, _subject); @@ -120,7 +120,7 @@ Delta::pre_process() if (is_graph_object && !_object) { Raul::Path path(_subject.str()); bool is_patch = false, is_node = false, is_port = false, is_output = false; - Shared::ResourceImpl::type(uris, _properties, is_patch, is_node, is_port, is_output); + Ingen::Resource::type(uris, _properties, is_patch, is_node, is_port, is_output); if (is_patch) { _create_event = new CreatePatch( diff --git a/src/server/events/Delta.hpp b/src/server/events/Delta.hpp index e7d708ae..6bb6508a 100644 --- a/src/server/events/Delta.hpp +++ b/src/server/events/Delta.hpp @@ -26,7 +26,7 @@ namespace Ingen { -namespace Shared { class ResourceImpl; } +class Resource; namespace Server { @@ -97,19 +97,19 @@ private: typedef std::vector<SetPortValue*> SetEvents; - Event* _create_event; - SetEvents _set_events; - std::vector<SpecialType> _types; - std::vector<SpecialType> _remove_types; - Raul::URI _subject; - Resource::Properties _properties; - Resource::Properties _remove; - Ingen::Shared::ResourceImpl* _object; - PatchImpl* _patch; - CompiledPatch* _compiled_patch; - Resource::Graph _context; - ControlBindings::Key _binding; - bool _create; + Event* _create_event; + SetEvents _set_events; + std::vector<SpecialType> _types; + std::vector<SpecialType> _remove_types; + Raul::URI _subject; + Resource::Properties _properties; + Resource::Properties _remove; + Ingen::Resource* _object; + PatchImpl* _patch; + CompiledPatch* _compiled_patch; + Resource::Graph _context; + ControlBindings::Key _binding; + bool _create; SharedPtr<ControlBindings::Bindings> _old_bindings; }; diff --git a/src/shared/wscript b/src/shared/wscript index 751951e1..8a873653 100644 --- a/src/shared/wscript +++ b/src/shared/wscript @@ -9,7 +9,6 @@ sources = [ 'Configuration.cpp', 'Forge.cpp', 'LV2Features.cpp', - 'ResourceImpl.cpp', 'Store.cpp', 'URIMap.cpp', 'URIs.cpp', @@ -24,6 +23,7 @@ def build(bld): includes = ['../..'], name = 'libingen_shared', target = 'ingen_shared', + use = 'libingen', vnum = '0.0.0', install_path = '${LIBDIR}', lib = ['dl']) @@ -36,6 +36,7 @@ def build(bld): includes = ['../..'], name = 'libingen_shared_profiled', target = 'ingen_shared_profiled', + use = 'libingen', install_path = '', lib = ['dl'] + bld.env['INGEN_TEST_LIBS'], cxxflags = bld.env['INGEN_TEST_CXXFLAGS']) |