actions_base: add auto-registration to reflect_action#7298
Merged
hkaiser merged 9 commits intoMay 28, 2026
Conversation
reflect_action now includes a static register_action_invocation_count member that automatically registers the action's invocation counter during static initialization — no HPX_REGISTER_ACTION call needed. This follows HPX's existing auto-registration pattern (already used by register_action<Action> in register_action.hpp) and eliminates boilerplate for reflection-based plain actions. The explicit transfer_action instantiation (for shared library export) still requires HPX_REGISTER_ACTION for non-reflection builds, but reflect_action users can omit it entirely. Signed-off-by: Priyanshi507 <hiiuiuiabi@gmail.com>
Signed-off-by: Priyanshi507 <hiiuiuiabi@gmail.com>
Collaborator
|
Can one of the admins verify this patch? |
Signed-off-by: Priyanshi507 <hiiuiuiabi@gmail.com>
Up to standards ✅🟢 Issues
|
Signed-off-by: Priyanshi507 <hiiuiuiabi@gmail.com>
Signed-off-by: Priyanshi507 <hiiuiuiabi@gmail.com>
hkaiser
reviewed
May 27, 2026
Add Derived template parameter following the same pattern as
plain_action for future extensibility:
template <std::meta::info F, typename Derived = void>
struct reflect_action
: basic_action<detail::plain_function,
func_type,
detail::action_type_t<reflect_action<F, Derived>, Derived>>
This allows user-defined types to derive from reflect_action<F>
to customize behavior, matching the extensibility of make_action_t.
Signed-off-by: Priyanshi507 <hiiuiuiabi@gmail.com>
…strar_ Both the in-class declaration and out-of-class definition of invocation_count_registrar_ now consistently use reflect_action<F, Derived>. Signed-off-by: Priyanshi507 <hiiuiuiabi@gmail.com>
…trar_ Signed-off-by: Priyanshi507 <hiiuiuiabi@gmail.com>
hkaiser
previously approved these changes
May 27, 2026
Contributor
hkaiser
left a comment
There was a problem hiding this comment.
Otherwise, LGTM, thanks!
Inside reflect_action's class body, 'reflect_action' refers to 'reflect_action<F, Derived>' via the injected class name, so we can simplify: - action_type_t<reflect_action<F, Derived>, Derived> -> action_type_t<reflect_action, Derived> - register_action_invocation_count<reflect_action<F, Derived>> -> register_action_invocation_count<reflect_action> Suggested by hkaiser. Signed-off-by: Priyanshi507 <hiiuiuiabi@gmail.com>
1 task
Priyanshi507
added a commit
to Priyanshi507/hpx
that referenced
this pull request
Jun 2, 2026
…t_action) Summary Extends reflect_action with reflect_component_action<F> — a C++26 reflection-based replacement for HPX_DEFINE_COMPONENT_ACTION. Before (3 manual steps): HPX_DEFINE_COMPONENT_ACTION(server, compute, compute_action) HPX_REGISTER_ACTION_DECLARATION(compute_action) HPX_REGISTER_ACTION(compute_action) After (single line): HPX_COMPONENT_ACTION(server, compute, compute_action); Design - reflect_component_action_base<F> extracts component_type via parent_of(F) and func_type via type_of(F) — two-step workaround following the same pattern as reflect_action_base<F> - reflect_component_action<F, Derived> inherits from basic_action<component_type, func_type, action_type_t<...>> - Auto-registration via static invocation_count_registrar_ member following the same pattern as reflect_action<F> - HPX_COMPONENT_ACTION(component, func, name) macro as cross-compiler fallback (GCC trunk + Clang P2996) Depends on - PR TheHPXProject#7298 (merged) — reflect_action with Derived parameter Signed-off-by: Priyanshi507 <hiiuiuiabi@gmail.com>
Priyanshi507
added a commit
to Priyanshi507/hpx
that referenced
this pull request
Jun 2, 2026
…t_action) Summary Extends reflect_action with reflect_component_action<F> — a C++26 reflection-based replacement for HPX_DEFINE_COMPONENT_ACTION. Before (3 manual steps): HPX_DEFINE_COMPONENT_ACTION(server, compute, compute_action) HPX_REGISTER_ACTION_DECLARATION(compute_action) HPX_REGISTER_ACTION(compute_action) After (single line): HPX_COMPONENT_ACTION(server, compute, compute_action); Design - reflect_component_action_base<F> extracts component_type via parent_of(F) and func_type via type_of(F) — two-step workaround following the same pattern as reflect_action_base<F> - reflect_component_action<F, Derived> inherits from basic_action<component_type, func_type, action_type_t<...>> - Auto-registration via static invocation_count_registrar_ member following the same pattern as reflect_action<F> - HPX_COMPONENT_ACTION(component, func, name) macro as cross-compiler fallback (GCC trunk + Clang P2996) Depends on - PR TheHPXProject#7298 (merged) — reflect_action with Derived parameter Signed-off-by: Priyanshi507 <hiiuiuiabi@gmail.com>
Priyanshi507
added a commit
to Priyanshi507/hpx
that referenced
this pull request
Jun 3, 2026
…t_action) Summary Extends reflect_action with reflect_component_action<F> — a C++26 reflection-based replacement for HPX_DEFINE_COMPONENT_ACTION. Before (3 manual steps): HPX_DEFINE_COMPONENT_ACTION(server, compute, compute_action) HPX_REGISTER_ACTION_DECLARATION(compute_action) HPX_REGISTER_ACTION(compute_action) After (single line): HPX_COMPONENT_ACTION(server, compute, compute_action); Design - reflect_component_action_base<F> extracts component_type via parent_of(F) and func_type via type_of(F) — two-step workaround following the same pattern as reflect_action_base<F> - reflect_component_action<F, Derived> inherits from basic_action<component_type, func_type, action_type_t<...>> - Auto-registration via static invocation_count_registrar_ member following the same pattern as reflect_action<F> - HPX_COMPONENT_ACTION(component, func, name) macro as cross-compiler fallback (GCC trunk + Clang P2996) Depends on - PR TheHPXProject#7298 (merged) — reflect_action with Derived parameter Signed-off-by: Priyanshi507 <hiiuiuiabi@gmail.com>
Priyanshi507
added a commit
to Priyanshi507/hpx
that referenced
this pull request
Jun 3, 2026
…t_action) Summary Extends reflect_action with reflect_component_action<F> — a C++26 reflection-based replacement for HPX_DEFINE_COMPONENT_ACTION. Before (3 manual steps): HPX_DEFINE_COMPONENT_ACTION(server, compute, compute_action) HPX_REGISTER_ACTION_DECLARATION(compute_action) HPX_REGISTER_ACTION(compute_action) After (single line): HPX_COMPONENT_ACTION(server, compute, compute_action); Design - reflect_component_action_base<F> extracts component_type via parent_of(F) and func_type via type_of(F) — two-step workaround following the same pattern as reflect_action_base<F> - reflect_component_action<F, Derived> inherits from basic_action<component_type, func_type, action_type_t<...>> - Auto-registration via static invocation_count_registrar_ member following the same pattern as reflect_action<F> - HPX_COMPONENT_ACTION(component, func, name) macro as cross-compiler fallback (GCC trunk + Clang P2996) Depends on - PR TheHPXProject#7298 (merged) — reflect_action with Derived parameter Signed-off-by: Priyanshi507 <hiiuiuiabi@gmail.com>
Priyanshi507
added a commit
to Priyanshi507/hpx
that referenced
this pull request
Jun 3, 2026
…t_action) Summary Extends reflect_action with reflect_component_action<F> — a C++26 reflection-based replacement for HPX_DEFINE_COMPONENT_ACTION. Before (3 manual steps): HPX_DEFINE_COMPONENT_ACTION(server, compute, compute_action) HPX_REGISTER_ACTION_DECLARATION(compute_action) HPX_REGISTER_ACTION(compute_action) After (single line): HPX_COMPONENT_ACTION(server, compute, compute_action); Design - reflect_component_action_base<F> extracts component_type via parent_of(F) and func_type via type_of(F) — two-step workaround following the same pattern as reflect_action_base<F> - reflect_component_action<F, Derived> inherits from basic_action<component_type, func_type, action_type_t<...>> - Auto-registration via static invocation_count_registrar_ member following the same pattern as reflect_action<F> - HPX_COMPONENT_ACTION(component, func, name) macro as cross-compiler fallback (GCC trunk + Clang P2996) Depends on - PR TheHPXProject#7298 (merged) — reflect_action with Derived parameter Signed-off-by: Priyanshi507 <hiiuiuiabi@gmail.com>
Priyanshi507
added a commit
to Priyanshi507/hpx
that referenced
this pull request
Jun 3, 2026
…t_action) Summary Extends reflect_action with reflect_component_action<F> — a C++26 reflection-based replacement for HPX_DEFINE_COMPONENT_ACTION. Before (3 manual steps): HPX_DEFINE_COMPONENT_ACTION(server, compute, compute_action) HPX_REGISTER_ACTION_DECLARATION(compute_action) HPX_REGISTER_ACTION(compute_action) After (single line): HPX_COMPONENT_ACTION(server, compute, compute_action); Design - reflect_component_action_base<F> extracts component_type via parent_of(F) and func_type via type_of(F) — two-step workaround following the same pattern as reflect_action_base<F> - reflect_component_action<F, Derived> inherits from basic_action<component_type, func_type, action_type_t<...>> - Auto-registration via static invocation_count_registrar_ member following the same pattern as reflect_action<F> - HPX_COMPONENT_ACTION(component, func, name) macro as cross-compiler fallback (GCC trunk + Clang P2996) Depends on - PR TheHPXProject#7298 (merged) — reflect_action with Derived parameter Signed-off-by: Priyanshi507 <hiiuiuiabi@gmail.com>
Priyanshi507
added a commit
to Priyanshi507/hpx
that referenced
this pull request
Jun 4, 2026
…t_action) Summary Extends reflect_action with reflect_component_action<F> — a C++26 reflection-based replacement for HPX_DEFINE_COMPONENT_ACTION. Before (3 manual steps): HPX_DEFINE_COMPONENT_ACTION(server, compute, compute_action) HPX_REGISTER_ACTION_DECLARATION(compute_action) HPX_REGISTER_ACTION(compute_action) After (single line): HPX_COMPONENT_ACTION(server, compute, compute_action); Design - reflect_component_action_base<F> extracts component_type via parent_of(F) and func_type via type_of(F) — two-step workaround following the same pattern as reflect_action_base<F> - reflect_component_action<F, Derived> inherits from basic_action<component_type, func_type, action_type_t<...>> - Auto-registration via static invocation_count_registrar_ member following the same pattern as reflect_action<F> - HPX_COMPONENT_ACTION(component, func, name) macro as cross-compiler fallback (GCC trunk + Clang P2996) Depends on - PR TheHPXProject#7298 (merged) — reflect_action with Derived parameter Signed-off-by: Priyanshi507 <hiiuiuiabi@gmail.com>
Priyanshi507
added a commit
to Priyanshi507/hpx
that referenced
this pull request
Jun 4, 2026
…t_action) Summary Extends reflect_action with reflect_component_action<F> — a C++26 reflection-based replacement for HPX_DEFINE_COMPONENT_ACTION. Before (3 manual steps): HPX_DEFINE_COMPONENT_ACTION(server, compute, compute_action) HPX_REGISTER_ACTION_DECLARATION(compute_action) HPX_REGISTER_ACTION(compute_action) After (single line): HPX_COMPONENT_ACTION(server, compute, compute_action); Design - reflect_component_action_base<F> extracts component_type via parent_of(F) and func_type via type_of(F) — two-step workaround following the same pattern as reflect_action_base<F> - reflect_component_action<F, Derived> inherits from basic_action<component_type, func_type, action_type_t<...>> - Auto-registration via static invocation_count_registrar_ member following the same pattern as reflect_action<F> - HPX_COMPONENT_ACTION(component, func, name) macro as cross-compiler fallback (GCC trunk + Clang P2996) Depends on - PR TheHPXProject#7298 (merged) — reflect_action with Derived parameter Signed-off-by: Priyanshi507 <hiiuiuiabi@gmail.com>
Priyanshi507
added a commit
to Priyanshi507/hpx
that referenced
this pull request
Jun 4, 2026
…t_action) Summary Extends reflect_action with reflect_component_action<F> — a C++26 reflection-based replacement for HPX_DEFINE_COMPONENT_ACTION. Before (3 manual steps): HPX_DEFINE_COMPONENT_ACTION(server, compute, compute_action) HPX_REGISTER_ACTION_DECLARATION(compute_action) HPX_REGISTER_ACTION(compute_action) After (single line): HPX_COMPONENT_ACTION(server, compute, compute_action); Design - reflect_component_action_base<F> extracts component_type via parent_of(F) and func_type via type_of(F) — two-step workaround following the same pattern as reflect_action_base<F> - reflect_component_action<F, Derived> inherits from basic_action<component_type, func_type, action_type_t<...>> - Auto-registration via static invocation_count_registrar_ member following the same pattern as reflect_action<F> - HPX_COMPONENT_ACTION(component, func, name) macro as cross-compiler fallback (GCC trunk + Clang P2996) Depends on - PR TheHPXProject#7298 (merged) — reflect_action with Derived parameter Signed-off-by: Priyanshi507 <hiiuiuiabi@gmail.com>
Priyanshi507
added a commit
to Priyanshi507/hpx
that referenced
this pull request
Jun 4, 2026
…t_action) Summary Extends reflect_action with reflect_component_action<F> — a C++26 reflection-based replacement for HPX_DEFINE_COMPONENT_ACTION. Before (3 manual steps): HPX_DEFINE_COMPONENT_ACTION(server, compute, compute_action) HPX_REGISTER_ACTION_DECLARATION(compute_action) HPX_REGISTER_ACTION(compute_action) After (single line): HPX_COMPONENT_ACTION(server, compute, compute_action); Design - reflect_component_action_base<F> extracts component_type via parent_of(F) and func_type via type_of(F) — two-step workaround following the same pattern as reflect_action_base<F> - reflect_component_action<F, Derived> inherits from basic_action<component_type, func_type, action_type_t<...>> - Auto-registration via static invocation_count_registrar_ member following the same pattern as reflect_action<F> - HPX_COMPONENT_ACTION(component, func, name) macro as cross-compiler fallback (GCC trunk + Clang P2996) Depends on - PR TheHPXProject#7298 (merged) — reflect_action with Derived parameter Signed-off-by: Priyanshi507 <hiiuiuiabi@gmail.com>
Priyanshi507
added a commit
to Priyanshi507/hpx
that referenced
this pull request
Jun 4, 2026
…t_action) Summary Extends reflect_action with reflect_component_action<F> — a C++26 reflection-based replacement for HPX_DEFINE_COMPONENT_ACTION. Before (3 manual steps): HPX_DEFINE_COMPONENT_ACTION(server, compute, compute_action) HPX_REGISTER_ACTION_DECLARATION(compute_action) HPX_REGISTER_ACTION(compute_action) After (single line): HPX_COMPONENT_ACTION(server, compute, compute_action); Design - reflect_component_action_base<F> extracts component_type via parent_of(F) and func_type via type_of(F) — two-step workaround following the same pattern as reflect_action_base<F> - reflect_component_action<F, Derived> inherits from basic_action<component_type, func_type, action_type_t<...>> - Auto-registration via static invocation_count_registrar_ member following the same pattern as reflect_action<F> - HPX_COMPONENT_ACTION(component, func, name) macro as cross-compiler fallback (GCC trunk + Clang P2996) Depends on - PR TheHPXProject#7298 (merged) — reflect_action with Derived parameter Signed-off-by: Priyanshi507 <hiiuiuiabi@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
reflect_actionnow automatically registers its invocation countervia a static
register_action_invocation_countmember — eliminatingthe need for
HPX_REGISTER_ACTIONfor reflection-based plain actions.Design
Follows HPX's existing auto-registration pattern already used by
register_action<Action>inregister_action.hpp:What's still needed
The explicit
transfer_action<reflect_action<F>>instantiation(for shared library export) still requires
HPX_REGISTER_ACTIONin non-reflection builds. For reflection builds, users can omit
HPX_REGISTER_ACTIONentirely.Depends on
reflect_actioncorebasic_actionintegrationChecklist