Skip to content
Merged
2 changes: 1 addition & 1 deletion cmake/templates/hpx.ixx.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) 2025 Haokun Wu
// Copyright (c) 2025 Hartmut Kaiser
// Copyright (c) 2025-@HPX_COPYRIGHT_YEAR@ Hartmut Kaiser
//
// SPDX-License-Identifier: BSL-1.0
// Distributed under the Boost Software License, Version 1.0. (See accompanying
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#pragma once

#include <hpx/config.hpp>
#include <hpx/actions/transfer_action.hpp>
#include <hpx/modules/actions.hpp>
#include <hpx/async_distributed/transfer_continuation_action.hpp>
#include <hpx/modules/actions_base.hpp>
#include <hpx/modules/naming_base.hpp>
Expand Down
1 change: 1 addition & 0 deletions components/component_storage/src/component_module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

#include <hpx/config.hpp>
#include <hpx/modules/actions.hpp>
#include <hpx/async_distributed/transfer_continuation_action.hpp>
#include <hpx/modules/actions_base.hpp>
#include <hpx/modules/components_base.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/// classes are asynchronous API which return the futures.

#include <hpx/config.hpp>
#include <hpx/actions/transfer_action.hpp>
#include <hpx/modules/actions.hpp>
#include <hpx/async_distributed/transfer_continuation_action.hpp>
#include <hpx/components/client_base.hpp>
#include <hpx/modules/actions_base.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
/// classes are asynchronous API which return the futures.

#include <hpx/config.hpp>
#include <hpx/actions/transfer_action.hpp>
#include <hpx/assert.hpp>
#include <hpx/modules/actions.hpp>
#include <hpx/async_distributed/transfer_continuation_action.hpp>
#include <hpx/components/client_base.hpp>
#include <hpx/components/get_ptr.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#pragma once

#include <hpx/config.hpp>
#include <hpx/actions/transfer_action.hpp>
#include <hpx/modules/actions.hpp>
#include <hpx/async_distributed/transfer_continuation_action.hpp>
#include <hpx/modules/actions_base.hpp>
#include <hpx/modules/components_base.hpp>
Expand Down
1 change: 1 addition & 0 deletions components/iostreams/src/component_module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <hpx/components/iostreams/server/output_stream.hpp>
#include <hpx/components/iostreams/standard_streams.hpp>

#include <hpx/modules/actions.hpp>
#include <hpx/async_distributed/transfer_continuation_action.hpp>
#include <hpx/modules/actions_base.hpp>
#include <hpx/modules/components_base.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#pragma once

#include <hpx/config.hpp>
#include <hpx/actions/transfer_action.hpp>
#include <hpx/modules/actions.hpp>
#include <hpx/async_distributed/transfer_continuation_action.hpp>
#include <hpx/modules/actions_base.hpp>
#include <hpx/modules/components_base.hpp>
Expand Down
5 changes: 5 additions & 0 deletions libs/full/actions/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@ set(actions_headers
hpx/actions/actions_fwd.hpp
hpx/actions/base_action.hpp
hpx/actions/invoke_function.hpp
hpx/actions/macros.hpp
hpx/actions/post_helper_fwd.hpp
hpx/actions/post_helper.hpp
hpx/actions/register_action.hpp
hpx/actions/transfer_base_action.hpp
hpx/actions/transfer_action.hpp
)

set(actions_macro_headers hpx/actions/macros.hpp)

# Default location is $HPX_ROOT/libs/actions/include_compatibility
# cmake-format: off
set(actions_compat_headers
Expand All @@ -43,8 +46,10 @@ include(HPX_AddModule)
add_hpx_module(
full actions
GLOBAL_HEADER_GEN ON
GLOBAL_HEADER_MODULE_GEN ON
SOURCES ${actions_sources}
HEADERS ${actions_headers}
MACRO_HEADERS ${actions_macro_headers}
COMPAT_HEADERS ${actions_compat_headers}
MODULE_DEPENDENCIES hpx_actions_base hpx_components_base hpx_naming_base
hpx_parcelset_base
Expand Down
8 changes: 4 additions & 4 deletions libs/full/actions/include/hpx/actions/actions_fwd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ namespace hpx::actions {

/// \cond NOINTERNAL

struct base_action;
struct HPX_EXPORT base_action_data;
HPX_CXX_EXPORT struct base_action;
HPX_CXX_EXPORT struct HPX_EXPORT base_action_data;

///////////////////////////////////////////////////////////////////////////
template <typename Action>
HPX_CXX_EXPORT template <typename Action>
struct transfer_action;

template <typename Action>
HPX_CXX_EXPORT template <typename Action>
struct transfer_continuation_action;
/// \endcond
} // namespace hpx::actions
Expand Down
116 changes: 7 additions & 109 deletions libs/full/actions/include/hpx/actions/base_action.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace hpx::actions {
// The \a base_action class is an abstract class used as the base class
// for all action types. It's main purpose is to allow polymorphic
// serialization of action instances through a unique_ptr.
struct base_action
HPX_CXX_EXPORT struct base_action
{
/// Destructor
virtual ~base_action();
Expand Down Expand Up @@ -138,7 +138,7 @@ namespace hpx::actions {
};

///////////////////////////////////////////////////////////////////////////
struct base_action_data : base_action
HPX_CXX_EXPORT struct base_action_data : base_action
{
base_action_data() = default;

Expand Down Expand Up @@ -184,119 +184,17 @@ namespace hpx::actions {
// serialization support for basic_action
namespace hpx::serialization {

template <typename Archive, typename Component, typename R,
HPX_CXX_EXPORT template <typename Archive, typename Component, typename R,
typename... Args, typename Derived>
HPX_FORCEINLINE void serialize(Archive& /* ar */,
::hpx::actions::basic_action<Component, R(Args...), Derived>& /* t */,
unsigned int const /* version */ = 0)
constexpr void serialize(Archive&,
::hpx::actions::basic_action<Component, R(Args...), Derived>&,
unsigned int const) noexcept
{
}
} // namespace hpx::serialization

#include <hpx/config/warnings_suffix.hpp>

// Helper macro for action serialization, each of the defined actions needs to
// be registered with the serialization library
#define HPX_DEFINE_GET_ACTION_NAME(action) \
HPX_DEFINE_GET_ACTION_NAME_(action, action) \
/**/

#define HPX_DEFINE_GET_ACTION_NAME_(action, actionname) \
HPX_DEFINE_GET_ACTION_NAME_ITT(action, actionname) \
namespace hpx::actions::detail { \
template <> \
HPX_ALWAYS_EXPORT char const* get_action_name</**/ action>() noexcept \
{ \
return HPX_PP_STRINGIZE(actionname); \
} \
} \
/**/
/**/

///////////////////////////////////////////////////////////////////////////////
#if defined(HPX_HAVE_ITTNOTIFY) && HPX_HAVE_ITTNOTIFY != 0 && \
!defined(HPX_HAVE_APEX)
#define HPX_DEFINE_GET_ACTION_NAME_ITT(action, actionname) \
namespace hpx::actions::detail { \
template <> \
HPX_ALWAYS_EXPORT util::itt::string_handle const& \
get_action_name_itt</**/ action>() noexcept \
{ \
static util::itt::string_handle sh(HPX_PP_STRINGIZE(actionname)); \
return sh; \
} \
} \
/**/

#define HPX_REGISTER_ACTION_DECLARATION_NO_DEFAULT_GUID_ITT(action) \
namespace hpx::actions::detail { \
template <> \
HPX_ALWAYS_EXPORT util::itt::string_handle const& \
get_action_name_itt</**/ action>() noexcept; \
} \
/**/
#else // HPX_HAVE_ITTNOTIFY != 0 && !defined(HPX_HAVE_APEX)
#define HPX_DEFINE_GET_ACTION_NAME_ITT(action, actionname) /**/
#define HPX_REGISTER_ACTION_DECLARATION_NO_DEFAULT_GUID_ITT(action) /**/
#endif // HPX_HAVE_ITTNOTIFY != 0 && !defined(HPX_HAVE_APEX)

#define HPX_REGISTER_ACTION_DECLARATION_NO_DEFAULT_GUID(action) \
HPX_REGISTER_ACTION_DECLARATION_NO_DEFAULT_GUID_ITT(action) \
namespace hpx::actions::detail { \
template <> \
HPX_ALWAYS_EXPORT char const* get_action_name<action>() noexcept; \
} \
HPX_REGISTER_ACTION_EXTERN_DECLARATION(action) \
\
namespace hpx::traits { \
template <> \
struct is_action</**/ action> : std::true_type \
{ \
}; \
template <> \
struct needs_automatic_registration</**/ action> : std::false_type \
{ \
}; \
} \
/**/

#define HPX_REGISTER_ACTION_DECLARATION_2(action, actionname) \
HPX_REGISTER_ACTION_DECLARATION_NO_DEFAULT_GUID(action) \
/**/

#if defined(HPX_MSVC) || defined(HPX_MINGW)
#define HPX_REGISTER_ACTION_2(action, actionname) \
HPX_DEFINE_GET_ACTION_NAME_(action, actionname) \
HPX_REGISTER_ACTION_INVOCATION_COUNT(action) \
HPX_REGISTER_PER_ACTION_DATA_COUNTER_TYPES(action) \
namespace hpx::actions { \
template struct HPX_ALWAYS_EXPORT transfer_action</**/ action>; \
template struct HPX_ALWAYS_EXPORT \
transfer_continuation_action</**/ action>; \
} \
/**/
#define HPX_REGISTER_ACTION_EXTERN_DECLARATION(action) /**/

#else // defined(HPX_MSVC) || defined(HPX_MINGW)

#define HPX_REGISTER_ACTION_2(action, actionname) \
HPX_DEFINE_GET_ACTION_NAME_(action, actionname) \
HPX_REGISTER_ACTION_INVOCATION_COUNT(action) \
HPX_REGISTER_PER_ACTION_DATA_COUNTER_TYPES(action) \
namespace hpx::actions { \
template struct transfer_action</**/ action>; \
template struct transfer_continuation_action</**/ action>; \
} \
/**/
#define HPX_REGISTER_ACTION_EXTERN_DECLARATION(action) \
namespace hpx::actions { \
extern template struct HPX_ALWAYS_IMPORT transfer_action</**/ action>; \
extern template struct HPX_ALWAYS_IMPORT \
transfer_continuation_action</**/ action>; \
} \
/**/

#endif // defined(HPX_MSVC) || defined(HPX_MINGW)
#include <hpx/actions/macros.hpp>

HPX_TRAITS_SERIALIZED_WITH_ID(hpx::actions::base_action)
HPX_TRAITS_SERIALIZED_WITH_ID(hpx::actions::base_action_data)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace hpx::components::server {

///////////////////////////////////////////////////////////////////////////
// action definition exposing invoke_function<>
template <typename F, typename... Ts>
HPX_CXX_EXPORT template <typename F, typename... Ts>
struct invoke_function_action
: ::hpx::actions::action<util::invoke_result_t<F, Ts...> (*)(F, Ts...),
&detail::invoke_function<F, Ts...>::call,
Expand Down
120 changes: 120 additions & 0 deletions libs/full/actions/include/hpx/actions/macros.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
// Copyright (c) 2026 Arpit Khandelwal
//
// SPDX-License-Identifier: BSL-1.0
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

#pragma once

Comment thread
arpittkhandelwal marked this conversation as resolved.
#include <hpx/config.hpp>
#include <hpx/actions_base/macros.hpp>
#include <hpx/modules/preprocessor.hpp>

#include <type_traits>

#if defined(HPX_HAVE_NETWORKING)

// Helper macro for action serialization; each of the defined actions needs to
// be registered with the serialization library.

#define HPX_DEFINE_GET_ACTION_NAME(action) \
HPX_DEFINE_GET_ACTION_NAME_(action, action) \
/**/

#define HPX_DEFINE_GET_ACTION_NAME_(action, actionname) \
HPX_DEFINE_GET_ACTION_NAME_ITT(action, actionname) \
namespace hpx::actions::detail { \
template <> \
HPX_ALWAYS_EXPORT char const* get_action_name</**/ action>() noexcept \
{ \
return HPX_PP_STRINGIZE(actionname); \
} \
} \
/**/

///////////////////////////////////////////////////////////////////////////////
#if defined(HPX_HAVE_ITTNOTIFY) && HPX_HAVE_ITTNOTIFY != 0 && \
!defined(HPX_HAVE_APEX)
#define HPX_DEFINE_GET_ACTION_NAME_ITT(action, actionname) \
namespace hpx::actions::detail { \
template <> \
HPX_ALWAYS_EXPORT util::itt::string_handle const& \
get_action_name_itt</**/ action>() noexcept \
{ \
static util::itt::string_handle sh(HPX_PP_STRINGIZE(actionname)); \
return sh; \
} \
} \
/**/

#define HPX_REGISTER_ACTION_DECLARATION_NO_DEFAULT_GUID_ITT(action) \
namespace hpx::actions::detail { \
template <> \
HPX_ALWAYS_EXPORT util::itt::string_handle const& \
get_action_name_itt</**/ action>() noexcept; \
} \
/**/
#else // HPX_HAVE_ITTNOTIFY != 0 && !defined(HPX_HAVE_APEX)
#define HPX_DEFINE_GET_ACTION_NAME_ITT(action, actionname) /**/
#define HPX_REGISTER_ACTION_DECLARATION_NO_DEFAULT_GUID_ITT(action) /**/
#endif // HPX_HAVE_ITTNOTIFY != 0 && !defined(HPX_HAVE_APEX)

#define HPX_REGISTER_ACTION_DECLARATION_NO_DEFAULT_GUID(action) \
HPX_REGISTER_ACTION_DECLARATION_NO_DEFAULT_GUID_ITT(action) \
namespace hpx::actions::detail { \
template <> \
HPX_ALWAYS_EXPORT char const* get_action_name<action>() noexcept; \
} \
HPX_REGISTER_ACTION_EXTERN_DECLARATION(action) \
\
namespace hpx::traits { \
template <> \
struct is_action</**/ action> : std::true_type \
{ \
}; \
template <> \
struct needs_automatic_registration</**/ action> : std::false_type \
{ \
}; \
} \
/**/

#define HPX_REGISTER_ACTION_DECLARATION_2(action, actionname) \
HPX_REGISTER_ACTION_DECLARATION_NO_DEFAULT_GUID(action) \
/**/

#if defined(HPX_MSVC) || defined(HPX_MINGW)
#define HPX_REGISTER_ACTION_2(action, actionname) \
HPX_DEFINE_GET_ACTION_NAME_(action, actionname) \
HPX_REGISTER_ACTION_INVOCATION_COUNT(action) \
HPX_REGISTER_PER_ACTION_DATA_COUNTER_TYPES(action) \
namespace hpx::actions { \
template struct HPX_ALWAYS_EXPORT transfer_action</**/ action>; \
template struct HPX_ALWAYS_EXPORT \
transfer_continuation_action</**/ action>; \
} \
/**/
#define HPX_REGISTER_ACTION_EXTERN_DECLARATION(action) /**/

#else // defined(HPX_MSVC) || defined(HPX_MINGW)

#define HPX_REGISTER_ACTION_2(action, actionname) \
HPX_DEFINE_GET_ACTION_NAME_(action, actionname) \
HPX_REGISTER_ACTION_INVOCATION_COUNT(action) \
HPX_REGISTER_PER_ACTION_DATA_COUNTER_TYPES(action) \
namespace hpx::actions { \
template struct transfer_action</**/ action>; \
template struct transfer_continuation_action</**/ action>; \
} \
/**/
#define HPX_REGISTER_ACTION_EXTERN_DECLARATION(action) \
namespace hpx::actions { \
extern template struct HPX_ALWAYS_IMPORT transfer_action</**/ action>; \
extern template struct HPX_ALWAYS_IMPORT \
transfer_continuation_action</**/ action>; \
} \
/**/

#endif // defined(HPX_MSVC) || defined(HPX_MINGW)

#endif // HPX_HAVE_NETWORKING
Loading
Loading