diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2012-04-11 11:01:00 -0400 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2012-04-11 11:01:00 -0400 |
commit | 5459f2ee987014e88ece017632d73829d844cb6f (patch) | |
tree | 99777042193e1362698365a7d3508b87619bbc18 /indra/llcommon/llinitparam.h | |
parent | 4287dcaacf0804a5a73dbf37c629471e2855733c (diff) |
Fix Linux UI issues introduced by moving llinitparam to llcommon.
In a number of places, the viewer uses a lookup based on std::type_info*. We
used to use std::map<std::type_info*, whatever>. But on Linux,
&typeid(SomeType) can produce different pointer values, depending on the
dynamic load module in which the code is executed. Introduce
LLTypeInfoLookup<T>, with an API that deliberately mimics
std::map<std::type_info*, T>. LLTypeInfoLookup::find() first tries an
efficient search for the specified std::type_info*. But if that fails, it
scans the underlying container for a match on the std::type_info::name()
string. If found, it caches the new std::type_info* to optimize subsequent
lookups with the same pointer.
Use LLTypeInfoLookup instead of std::map<std::type_info*, ...> in
llinitparam.h and llregistry.h.
Introduce LLSortedVector<KEY, VALUE>, a std::vector<std::pair<KEY, VALUE>>
maintained in sorted order with binary-search lookup. It presents a subset of
the std::map<KEY, VALUE> API.
Diffstat (limited to 'indra/llcommon/llinitparam.h')
-rw-r--r-- | indra/llcommon/llinitparam.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/indra/llcommon/llinitparam.h b/indra/llcommon/llinitparam.h index beaf07e56b..ef6c6335d1 100644 --- a/indra/llcommon/llinitparam.h +++ b/indra/llcommon/llinitparam.h @@ -35,6 +35,7 @@ #include <boost/shared_ptr.hpp> #include "llerror.h" +#include "lltypeinfolookup.h" namespace LLInitParam { @@ -227,9 +228,9 @@ namespace LLInitParam typedef bool (*parser_write_func_t)(Parser& parser, const void*, name_stack_t&); typedef boost::function<void (name_stack_t&, S32, S32, const possible_values_t*)> parser_inspect_func_t; - typedef std::map<const std::type_info*, parser_read_func_t, CompareTypeID> parser_read_func_map_t; - typedef std::map<const std::type_info*, parser_write_func_t, CompareTypeID> parser_write_func_map_t; - typedef std::map<const std::type_info*, parser_inspect_func_t, CompareTypeID> parser_inspect_func_map_t; + typedef LLTypeInfoLookup<parser_read_func_t> parser_read_func_map_t; + typedef LLTypeInfoLookup<parser_write_func_t> parser_write_func_map_t; + typedef LLTypeInfoLookup<parser_inspect_func_t> parser_inspect_func_map_t; Parser(parser_read_func_map_t& read_map, parser_write_func_map_t& write_map, parser_inspect_func_map_t& inspect_map) : mParseSilently(false), |