HPX_DEFINE_COMPONENT_ACTION — Registers a member function of a component as an action type with HPX.


// In header: <hpx/runtime/actions/component_action.hpp>



The macro HPX_DEFINE_COMPONENT_ACTION can be used to register a member function of a component as an action type named action_type.

The parameter component is the type of the component exposing the member function func which should be associated with the newly defined action type. The parameter action_type is the name of the action type to register with HPX.


*        namespace app
*        {
*            // Define a simple component exposing one action 'print_greeting'
*            class HPX_COMPONENT_EXPORT server
*              : public hpx::components::simple_component_base<server>
*            {
*                void print_greeting() const
*                {
*                    hpx::cout << "Hey, how are you?\n" << hpx::flush;
*                }
*                // Component actions need to be declared, this also defines the
*                // type 'print_greeting_action' representing the action.
*                HPX_DEFINE_COMPONENT_ACTION(server, print_greeting,
*                    print_greeting_action);
*            };
*        }

The first argument must provide the type name of the component the action is defined for.

The second argument must provide the member function name the action should wrap.

[Note] Note

The macro HPX_DEFINE_COMPONENT_ACTION can be used with 2 or 3 arguments. The third argument is optional.

The default value for the third argument (the typename of the defined action) is derived from the name of the function (as passed as the second argument) by appending '_action'. The third argument can be omitted only if the second argument with an appended suffix '_action' resolves to a valid, unqualified C++ type name.