diff options
-rw-r--r-- | src/shared/LV2URIMap.cpp | 32 | ||||
-rw-r--r-- | src/shared/LV2URIMap.hpp | 4 |
2 files changed, 9 insertions, 27 deletions
diff --git a/src/shared/LV2URIMap.cpp b/src/shared/LV2URIMap.cpp index 3666c2a3..d0c71acf 100644 --- a/src/shared/LV2URIMap.cpp +++ b/src/shared/LV2URIMap.cpp @@ -18,6 +18,7 @@ #define __STDC_LIMIT_MACROS 1 #include <cassert> #include <stdint.h> +#include <glib.h> #include "raul/log.hpp" #include "object.lv2/object.h" #include "LV2URIMap.hpp" @@ -30,9 +31,7 @@ namespace Shared { LV2URIMap::LV2URIMap() - : uri_map() - , next_uri_id(1) - , object_class_bool(uri_to_id(NULL, LV2_OBJECT_URI "#Bool")) + : object_class_bool(uri_to_id(NULL, LV2_OBJECT_URI "#Bool")) , object_class_string(uri_to_id(NULL, LV2_OBJECT_URI "#String")) , object_class_int32(uri_to_id(NULL, LV2_OBJECT_URI "#Int32")) , object_class_float32(uri_to_id(NULL, LV2_OBJECT_URI "#Float32")) @@ -53,7 +52,12 @@ uint32_t LV2URIMap::uri_to_id(const char* map, const char* uri) { - return uri_map_uri_to_id(this, map, uri); + const uint32_t ret = static_cast<uint32_t>(g_quark_from_string(uri)); + debug << "[LV2URIMap] "; + if (map) + debug << map << " : "; + debug << uri << " => " << ret << endl; + return ret; } @@ -62,26 +66,8 @@ LV2URIMap::uri_map_uri_to_id(LV2_URI_Map_Callback_Data callback_data, const char* map, const char* uri) { - // TODO: map ignored, < UINT16_MAX assumed - LV2URIMap* me = (LV2URIMap*)callback_data; - uint32_t ret = 0; - - URIMap::iterator i = me->uri_map.find(uri); - if (i != me->uri_map.end()) { - ret = i->second; - } else { - ret = me->next_uri_id++; - me->uri_map.insert(make_pair(string(uri), ret)); - } - - debug << "[LV2URIMap] "; - if (map) - debug << map << " : "; - debug << uri << " => " << ret << endl; - - assert(ret <= UINT16_MAX); - return ret; + return me->uri_to_id(map, uri); } diff --git a/src/shared/LV2URIMap.hpp b/src/shared/LV2URIMap.hpp index ae43a9f2..b1e6a89f 100644 --- a/src/shared/LV2URIMap.hpp +++ b/src/shared/LV2URIMap.hpp @@ -47,16 +47,12 @@ public: uint32_t uri_to_id(const char* map, const char* uri); private: - typedef std::map<std::string, uint32_t> URIMap; - static uint32_t uri_map_uri_to_id(LV2_URI_Map_Callback_Data callback_data, const char* map, const char* uri); LV2_Feature uri_map_feature; LV2_URI_Map_Feature uri_map_feature_data; - URIMap uri_map; - uint32_t next_uri_id; public: const uint32_t object_class_bool; |