![]() |
HPX_REGISTER_ACTION_DECLARATION_TEMPLATE — Declare the necessary component action boilerplate code for actions taking template type arguments.
// In header: <hpx/runtime/actions/action_support.hpp>
HPX_REGISTER_ACTION_DECLARATION_TEMPLATE(TEMPLATE, TYPE)
The macro HPX_REGISTER_ACTION_DECLARATION_TEMPLATE can be used to declare all the boilerplate code which is required for proper functioning of component actions in the context of HPX, if those actions take template type arguments.
The parameter template specifies the list of template type declarations for the action type. This argument has to be wrapped into an additional pair of parenthesis.
The parameter action is the type of the action to declare the boilerplate for. This argument has to be wrapped into an additional pair of parenthesis.
Example:
namespace app { // Define a simple component exposing one action 'print_greating' class HPX_COMPONENT_EXPORT server : public hpx::components::simple_component_base<server> { template <typename T> void print_greating (T t) { hpx::cout << "Hey " << t << ", how are you?\n" << hpx::flush; } // Component actions need to be declared, this also defines the // type 'print_greating_action' representing the action. // Actions with template arguments (like print_greating<>() // above) require special type definitions. The simplest way // to define such an action type is by deriving from the HPX // facility make_action: template <typename T> struct print_greating_action : hpx::actions::make_action< void (server::*)(T), &server::template print_greating<T>, print_greating_action<T> > {}; }; } // Declare boilerplate code required for each of the component actions. HPX_REGISTER_ACTION_DECLARATION_TEMPLATE((template T), (app::server::print_greating_action<T>));
![]() |
Note |
---|---|
This macro has to be used once for each of the component actions defined as above. It has to be visible in all translation units using the action, thus it is recommended to place it into the header file defining the component. |