diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2022-12-20 13:09:42 -0500 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2023-07-13 12:34:32 -0400 |
commit | 45464ee2d2b83b750d45b860e6117a4b74242ead (patch) | |
tree | 5799b9d1d268f3dc9303d2782f5fec95ed926bd7 | |
parent | b6bbd86e5e6a23ef8bc81fa2374a82f05b4d18ed (diff) |
DRTVWR-558: Pull in LLEventDispatcher / LLDispatchListener fixes.
For LLEventDispatcher::add(), use simpler std::enable_if construct that avoids
the need to restate the whole conditional.
Derive LLDispatchListener from LLEventStream, instead of containing an
instance. This sets up for LazyEventAPI. Don't allow tweaking an
LLDispatchListener (or subclass LLEventAPI) name.
(cherry-picked from af4fbc1f8a9 on the lazy-eventpump branch)
(cherry picked from commit 419e7a4230ae662b035ae771af8e7d8bceb2c8b1)
-rw-r--r-- | indra/llcommon/lleventdispatcher.h | 128 |
1 files changed, 0 insertions, 128 deletions
diff --git a/indra/llcommon/lleventdispatcher.h b/indra/llcommon/lleventdispatcher.h index 99f03fe0bc..09b786b69e 100644 --- a/indra/llcommon/lleventdispatcher.h +++ b/indra/llcommon/lleventdispatcher.h @@ -165,27 +165,12 @@ public: * When calling this name, pass an LLSD::Array. Each entry in turn will be * converted to the corresponding parameter type using LLSDParam. */ -<<<<<<< variant A // enable_if usage per https://stackoverflow.com/a/39913395/5533635 template<typename Function, typename = typename std::enable_if< boost::function_types::is_nonmember_callable_builtin<Function>::value >::type> void add(const std::string& name, const std::string& desc, Function f); ->>>>>>> variant B - template<typename Function> - typename std::enable_if< - boost::function_types::is_nonmember_callable_builtin<Function>::value - >::type add(const std::string& name, - const std::string& desc, - Function f); -####### Ancestor - template<typename Function> - typename boost::enable_if< boost::function_types::is_nonmember_callable_builtin<Function> - >::type add(const std::string& name, - const std::string& desc, - Function f); -======= end /** * Register a nonstatic class method with arbitrary parameters. @@ -204,7 +189,6 @@ public: * When calling this name, pass an LLSD::Array. Each entry in turn will be * converted to the corresponding parameter type using LLSDParam. */ -<<<<<<< variant A template<typename Method, typename InstanceGetter, typename = typename std::enable_if< boost::function_types::is_member_function_pointer<Method>::value && @@ -212,23 +196,6 @@ public: >::type> void add(const std::string& name, const std::string& desc, Method f, const InstanceGetter& getter); ->>>>>>> variant B - template<typename Method, typename InstanceGetter> - typename std::enable_if< - boost::function_types::is_member_function_pointer<Method>::value && - ! std::is_convertible<InstanceGetter, LLSD>::value - >::type add(const std::string& name, - const std::string& desc, - Method f, - const InstanceGetter& getter); -####### Ancestor - template<typename Method, typename InstanceGetter> - typename boost::enable_if< boost::function_types::is_member_function_pointer<Method> - >::type add(const std::string& name, - const std::string& desc, - Method f, - const InstanceGetter& getter); -======= end /** * Register a free function with arbitrary parameters. (This also works @@ -245,31 +212,12 @@ public: * an LLSD::Array using LLSDArgsMapper and then convert each entry in turn * to the corresponding parameter type using LLSDParam. */ -<<<<<<< variant A template<typename Function, typename = typename std::enable_if< boost::function_types::is_nonmember_callable_builtin<Function>::value >::type> void add(const std::string& name, const std::string& desc, Function f, const LLSD& params, const LLSD& defaults=LLSD()); ->>>>>>> variant B - template<typename Function> - typename std::enable_if< - boost::function_types::is_nonmember_callable_builtin<Function>::value - >::type add(const std::string& name, - const std::string& desc, - Function f, - const LLSD& params, - const LLSD& defaults=LLSD()); -####### Ancestor - template<typename Function> - typename boost::enable_if< boost::function_types::is_nonmember_callable_builtin<Function> - >::type add(const std::string& name, - const std::string& desc, - Function f, - const LLSD& params, - const LLSD& defaults=LLSD()); -======= end /** * Register a nonstatic class method with arbitrary parameters. @@ -292,7 +240,6 @@ public: * an LLSD::Array using LLSDArgsMapper and then convert each entry in turn * to the corresponding parameter type using LLSDParam. */ -<<<<<<< variant A template<typename Method, typename InstanceGetter, typename = typename std::enable_if< boost::function_types::is_member_function_pointer<Method>::value && @@ -301,27 +248,6 @@ public: void add(const std::string& name, const std::string& desc, Method f, const InstanceGetter& getter, const LLSD& params, const LLSD& defaults=LLSD()); ->>>>>>> variant B - template<typename Method, typename InstanceGetter> - typename std::enable_if< - boost::function_types::is_member_function_pointer<Method>::value && - ! std::is_convertible<InstanceGetter, LLSD>::value - >::type add(const std::string& name, - const std::string& desc, - Method f, - const InstanceGetter& getter, - const LLSD& params, - const LLSD& defaults=LLSD()); -####### Ancestor - template<typename Method, typename InstanceGetter> - typename boost::enable_if< boost::function_types::is_member_function_pointer<Method> - >::type add(const std::string& name, - const std::string& desc, - Method f, - const InstanceGetter& getter, - const LLSD& params, - const LLSD& defaults=LLSD()); -======= end //@} @@ -531,18 +457,8 @@ struct LLEventDispatcher::invoker<Function,To,To> } }; -<<<<<<< variant A template<typename Function, typename> void LLEventDispatcher::add(const std::string& name, const std::string& desc, Function f) ->>>>>>> variant B -template<typename Function> -typename std::enable_if< boost::function_types::is_nonmember_callable_builtin<Function>::value >::type -LLEventDispatcher::add(const std::string& name, const std::string& desc, Function f) -####### Ancestor -template<typename Function> -typename boost::enable_if< boost::function_types::is_nonmember_callable_builtin<Function> >::type -LLEventDispatcher::add(const std::string& name, const std::string& desc, Function f) -======= end { // Construct an invoker_function, a callable accepting const args_source&. // Add to DispatchMap an ArrayParamsDispatchEntry that will handle the @@ -551,24 +467,9 @@ LLEventDispatcher::add(const std::string& name, const std::string& desc, Functio boost::function_types::function_arity<Function>::value); } -<<<<<<< variant A template<typename Method, typename InstanceGetter, typename> void LLEventDispatcher::add(const std::string& name, const std::string& desc, Method f, const InstanceGetter& getter) ->>>>>>> variant B -template<typename Method, typename InstanceGetter> -typename std::enable_if< - boost::function_types::is_member_function_pointer<Method>::value && - ! std::is_convertible<InstanceGetter, LLSD>::value ->::type -LLEventDispatcher::add(const std::string& name, const std::string& desc, Method f, - const InstanceGetter& getter) -####### Ancestor -template<typename Method, typename InstanceGetter> -typename boost::enable_if< boost::function_types::is_member_function_pointer<Method> >::type -LLEventDispatcher::add(const std::string& name, const std::string& desc, Method f, - const InstanceGetter& getter) -======= end { // Subtract 1 from the compile-time arity because the getter takes care of // the first parameter. We only need (arity - 1) additional arguments. @@ -576,47 +477,18 @@ LLEventDispatcher::add(const std::string& name, const std::string& desc, Method boost::function_types::function_arity<Method>::value - 1); } -<<<<<<< variant A template<typename Function, typename> void LLEventDispatcher::add(const std::string& name, const std::string& desc, Function f, const LLSD& params, const LLSD& defaults) ->>>>>>> variant B -template<typename Function> -typename std::enable_if< boost::function_types::is_nonmember_callable_builtin<Function>::value >::type -LLEventDispatcher::add(const std::string& name, const std::string& desc, Function f, - const LLSD& params, const LLSD& defaults) -####### Ancestor -template<typename Function> -typename boost::enable_if< boost::function_types::is_nonmember_callable_builtin<Function> >::type -LLEventDispatcher::add(const std::string& name, const std::string& desc, Function f, - const LLSD& params, const LLSD& defaults) -======= end { // See comments for previous is_nonmember_callable_builtin add(). addMapParamsDispatchEntry(name, desc, make_invoker(f), params, defaults); } -<<<<<<< variant A template<typename Method, typename InstanceGetter, typename> void LLEventDispatcher::add(const std::string& name, const std::string& desc, Method f, const InstanceGetter& getter, const LLSD& params, const LLSD& defaults) ->>>>>>> variant B -template<typename Method, typename InstanceGetter> -typename std::enable_if< - boost::function_types::is_member_function_pointer<Method>::value && - ! std::is_convertible<InstanceGetter, LLSD>::value ->::type -LLEventDispatcher::add(const std::string& name, const std::string& desc, Method f, - const InstanceGetter& getter, - const LLSD& params, const LLSD& defaults) -####### Ancestor -template<typename Method, typename InstanceGetter> -typename boost::enable_if< boost::function_types::is_member_function_pointer<Method> >::type -LLEventDispatcher::add(const std::string& name, const std::string& desc, Method f, - const InstanceGetter& getter, - const LLSD& params, const LLSD& defaults) -======= end { addMapParamsDispatchEntry(name, desc, make_invoker(f, getter), params, defaults); } |