diff options
author | David Robillard <d@drobilla.net> | 2012-03-14 23:38:53 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-03-14 23:38:53 +0000 |
commit | f8ca7f3cf6f4a0e967eacfd2e1f9a8ae9625c015 (patch) | |
tree | a1e7bff65900df78c2283fec7093454a18340195 /include/ingen | |
parent | 31f009967ea0a1664c05d38ea1c126e0c678b20a (diff) | |
download | ingen-f8ca7f3cf6f4a0e967eacfd2e1f9a8ae9625c015.tar.gz ingen-f8ca7f3cf6f4a0e967eacfd2e1f9a8ae9625c015.tar.bz2 ingen-f8ca7f3cf6f4a0e967eacfd2e1f9a8ae9625c015.zip |
Use the host URI map/unmap when running as a plugin.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4058 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'include/ingen')
-rw-r--r-- | include/ingen/client/ClientStore.hpp | 2 | ||||
-rw-r--r-- | include/ingen/shared/LV2URIMap.hpp | 71 | ||||
-rw-r--r-- | include/ingen/shared/ResourceImpl.hpp | 6 | ||||
-rw-r--r-- | include/ingen/shared/URIs.hpp | 3 | ||||
-rw-r--r-- | include/ingen/shared/World.hpp | 9 |
5 files changed, 69 insertions, 22 deletions
diff --git a/include/ingen/client/ClientStore.hpp b/include/ingen/client/ClientStore.hpp index 12392db6..b6042086 100644 --- a/include/ingen/client/ClientStore.hpp +++ b/include/ingen/client/ClientStore.hpp @@ -36,6 +36,8 @@ namespace Raul { class Atom; } namespace Ingen { +namespace Shared { class URIs; } + class GraphObject; namespace Client { diff --git a/include/ingen/shared/LV2URIMap.hpp b/include/ingen/shared/LV2URIMap.hpp index 98508fd1..fc41f3bf 100644 --- a/include/ingen/shared/LV2URIMap.hpp +++ b/include/ingen/shared/LV2URIMap.hpp @@ -24,22 +24,62 @@ #include <boost/utility.hpp> #include "ingen/shared/LV2Features.hpp" -#include "ingen/shared/URIs.hpp" #include "lv2/lv2plug.in/ns/ext/uri-map/uri-map.h" +#include "lv2/lv2plug.in/ns/ext/urid/urid.h" #include "raul/URI.hpp" namespace Ingen { namespace Shared { -/** Implementation of the LV2 URI Map extension - */ -class LV2URIMap : public boost::noncopyable, public LV2Features::Feature { +/** URI to Integer Map */ +class LV2URIMap : public boost::noncopyable { public: - LV2URIMap(URIs& uris); - - SharedPtr<LV2_Feature> feature(Shared::World*, Node*) { - return SharedPtr<LV2_Feature>(&uri_map_feature, NullDeleter<LV2_Feature>); - } + LV2URIMap(LV2_URID_Map* map, LV2_URID_Unmap* unmap); + virtual ~LV2URIMap() {} + + uint32_t map_uri(const char* uri); + const char* unmap_uri(uint32_t urid); + + class Feature : public LV2Features::Feature { + public: + Feature(const char* URI, void* data) { + _feature.URI = URI; + _feature.data = data; + } + + SharedPtr<LV2_Feature> feature(Shared::World*, Node*) { + return SharedPtr<LV2_Feature>(&_feature, NullDeleter<LV2_Feature>); + } + + private: + LV2_Feature _feature; + }; + + class URIMapFeature : public Feature { + public: + URIMapFeature(LV2URIMap* map); + + private: + LV2_URI_Map_Feature _feature_data; + }; + + class URIDMapFeature : public Feature { + public: + URIDMapFeature(LV2URIMap* map, LV2_URID_Map* urid_map); + private: + LV2_URID_Map _feature_data; + }; + + class URIDUnmapFeature : public Feature { + public: + URIDUnmapFeature(LV2URIMap* map, LV2_URID_Unmap* urid_unmap); + private: + LV2_URID_Unmap _feature_data; + }; + + SharedPtr<URIMapFeature> uri_map_feature() { return _uri_map_feature; } + SharedPtr<URIDMapFeature> urid_map_feature() { return _urid_map_feature; } + SharedPtr<URIDUnmapFeature> urid_unmap_feature() { return _urid_unmap_feature; } virtual uint32_t uri_to_id(const char* map, const char* uri); virtual const char* id_to_uri(const char* map, uint32_t id); @@ -52,16 +92,17 @@ private: const char* map, const char* uri); - LV2_Feature uri_map_feature; - LV2_URI_Map_Feature uri_map_feature_data; + static LV2_URID urid_map(LV2_URID_Map_Handle handle, const char* uri); + static const char* urid_unmap(LV2_URID_Map_Handle handle, LV2_URID urid); typedef std::map<uint16_t, uint32_t> EventToGlobal; typedef std::map<uint32_t, uint16_t> GlobalToEvent; - EventToGlobal _event_to_global; - GlobalToEvent _global_to_event; - - URIs& _uris; + SharedPtr<URIMapFeature> _uri_map_feature; + SharedPtr<URIDMapFeature> _urid_map_feature; + SharedPtr<URIDUnmapFeature> _urid_unmap_feature; + EventToGlobal _event_to_global; + GlobalToEvent _global_to_event; }; } // namespace Shared diff --git a/include/ingen/shared/ResourceImpl.hpp b/include/ingen/shared/ResourceImpl.hpp index fea21023..8069c480 100644 --- a/include/ingen/shared/ResourceImpl.hpp +++ b/include/ingen/shared/ResourceImpl.hpp @@ -18,10 +18,10 @@ #ifndef INGEN_SHARED_RESOURCEIMPL_HPP #define INGEN_SHARED_RESOURCEIMPL_HPP -#include "raul/URI.hpp" -#include "raul/SharedPtr.hpp" - #include "ingen/Resource.hpp" +#include "ingen/shared/URIs.hpp" +#include "raul/SharedPtr.hpp" +#include "raul/URI.hpp" namespace Ingen { namespace Shared { diff --git a/include/ingen/shared/URIs.hpp b/include/ingen/shared/URIs.hpp index 01464589..7490526d 100644 --- a/include/ingen/shared/URIs.hpp +++ b/include/ingen/shared/URIs.hpp @@ -33,9 +33,6 @@ class URIs : public boost::noncopyable { public: URIs(Raul::Forge& forge); - uint32_t map_uri(const char* uri); - const char* unmap_uri(uint32_t urid); - struct Quark : public Raul::URI { Quark(const char* str); const char* c_str() const; diff --git a/include/ingen/shared/World.hpp b/include/ingen/shared/World.hpp index fba565e5..e062dea6 100644 --- a/include/ingen/shared/World.hpp +++ b/include/ingen/shared/World.hpp @@ -23,6 +23,8 @@ #include <boost/shared_ptr.hpp> #include <boost/utility.hpp> +#include "lv2/lv2plug.in/ns/ext/urid/urid.h" + #include "raul/Configuration.hpp" #include "raul/SharedPtr.hpp" @@ -56,7 +58,12 @@ class Store; */ class World : public boost::noncopyable { public: - World(Raul::Configuration* conf, int& argc, char**& argv); + World(Raul::Configuration* conf, + int& argc, + char**& argv, + LV2_URID_Map* map, + LV2_URID_Unmap* unmap); + virtual ~World(); virtual bool load_module(const char* name); |