The process of invoking a global function (or a member function of an object) with the help of the associated action is called 'applying the action'. Actions can have arguments, which will be supplied while the action is applied. At the minimum, one parameter is required to apply any action - the id of the locality the associated function should be invoked on (for global functions), or the id of the component instance (for member functions). Generally, HPX provides several ways to apply an action, all of which are described in the following sections.
Generally, HPX actions are very similar to 'normal'
C++ functions except that actions can be invoked remotely. The figure
below shows an overview of the main API exposed by HPX. This shows the
function invocation syntax as defined by the C++ language (dark gray),
the additional invocation syntax as provided through C++ Standard Library
features (medium gray), and the extensions added by HPX
(light gray). Where:
function to invoke;
return type of
action: action type defined by
a: an instance of the type
the global address the action is applied to.
This figure shows that HPX allows the user to apply
actions with a syntax similar to the C++ standard. In fact, all action
types have an overloaded function operator allowing to synchronously apply
the action. Further, HPX implements
hpx::async, which semantically works similar
to the way
std::async works for plain C++ function.
The similarity of applying an action to conventional function invocations
extends even further. HPX implements
Additionally, HPX exposes
hpx::async_continue, both of which refine
and extend the standard C++ facilities.
The different ways to invoke a function in HPX will be explained in more detail in the following sections