From 3a75bcc2e42b8569959f184c7fdf5c3dbe52954e Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Thu, 13 Sep 2012 16:41:08 +0200 Subject: [PATCH] supernova: slot_resolver - add lookup table to resolve slot_names from index Signed-off-by: Tim Blechmann --- server/supernova/server/synth_definition.hpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/server/supernova/server/synth_definition.hpp b/server/supernova/server/synth_definition.hpp index 0021a950f..7e53c1d2b 100644 --- a/server/supernova/server/synth_definition.hpp +++ b/server/supernova/server/synth_definition.hpp @@ -86,6 +86,10 @@ protected: map_type * elem = new map_type(str, i); bool success = slot_resolver_map.insert(*elem).second; assert(success); + + if (i >= slot_names.size()) + slot_names.resize(i+1, nullptr); + slot_names[i] = elem->name(); } public: @@ -110,6 +114,17 @@ public: } /*@}*/ + size_t number_of_slots() const + { + return slot_names.size(); + } + + const char * name_of_slot(size_t slot_index) const + { + assert(slot_index < slot_names.size()); + return slot_names[slot_index]; + } + private: static const int resolver_map_bucket_count = 512; @@ -118,6 +133,8 @@ private: > slot_resolver_map_t; slot_resolver_map_t::bucket_type buckets[resolver_map_bucket_count]; slot_resolver_map_t slot_resolver_map; + + std::vector slot_names; }; } /* namespace detail */ -- 2.11.4.GIT