Skip to content
Snippets Groups Projects
  • Nat Goodspeed's avatar
    2bafe0dc
    Extend LLEventAPI to directly call other functions & methods. · 2bafe0dc
    Nat Goodspeed authored
    Until now, LLEventAPI has only been able to register functions specifically
    accepting(const LLSD&). Typically you add a wrapper method to your LLEventAPI
    subclass, register that, have it extract desired params from the incoming LLSD
    and then call the actual function of interest.
    With help from Alain, added new LLEventAPI::add() methods capable of
    registering functions/methods with arbitrary parameter signatures. The code
    uses boost::fusion magic to implicitly match incoming LLSD arguments to the
    function's formal parameter list, bypassing the need for an explicit helper
    method.
    New add() methods caused an ambiguity with a previous convenience overload.
    Removed that overload and fixed the one existing usage.
    Replaced LLEventDispatcher::get() with try_call() -- it's no longer easy to
    return a Callable for caller to call directly. But the one known use of that
    feature simply used it to avoid fatal LL_ERRS on unknown function-name string,
    hence the try_call() approach actually addresses that case more directly.
    Added indra/common/lleventdispatcher_test.cpp to exercise new functionality.
    2bafe0dc
    History
    Extend LLEventAPI to directly call other functions & methods.
    Nat Goodspeed authored
    Until now, LLEventAPI has only been able to register functions specifically
    accepting(const LLSD&). Typically you add a wrapper method to your LLEventAPI
    subclass, register that, have it extract desired params from the incoming LLSD
    and then call the actual function of interest.
    With help from Alain, added new LLEventAPI::add() methods capable of
    registering functions/methods with arbitrary parameter signatures. The code
    uses boost::fusion magic to implicitly match incoming LLSD arguments to the
    function's formal parameter list, bypassing the need for an explicit helper
    method.
    New add() methods caused an ambiguity with a previous convenience overload.
    Removed that overload and fixed the one existing usage.
    Replaced LLEventDispatcher::get() with try_call() -- it's no longer easy to
    return a Callable for caller to call directly. But the one known use of that
    feature simply used it to avoid fatal LL_ERRS on unknown function-name string,
    hence the try_call() approach actually addresses that case more directly.
    Added indra/common/lleventdispatcher_test.cpp to exercise new functionality.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.