HPX - High Performance ParalleX

PrevUpHomeNext

Macro HPX_DEFINE_COMPONENT_CONST_ACTION

HPX_DEFINE_COMPONENT_CONST_ACTION — */

Synopsis

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

HPX_DEFINE_COMPONENT_CONST_ACTION(...)

Description

Registers a const member function of a component as an action type with HPX

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

The parameter component is the type of the component exposing the const 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.

Example: 

namespace app
{
    // Define a simple component exposing one action 'print_greating'
    class HPX_COMPONENT_EXPORT server
      : public hpx::components::simple_component_base<server>
    {
        void print_greating() const
        {
            hpx::cout << "Hey, how are you?\n" << hpx::flush;
        }

        // Component actions need to be declared, this also defines the
        // type 'print_greating_action' representing the action.
        HPX_DEFINE_COMPONENT_CONST_ACTION(server, print_greating, print_greating_action);
    };
}
[Note] Note

This macro should be used for const member functions only. Use the macro HPX_DEFINE_COMPONENT_ACTION for non-const member functions.

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_CONST_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 first argument with an appended suffix '_action' resolves to a valid, unqualified C++ type name.


PrevUpHomeNext