Skip to content

Comments

Add support for passing arguments to constructors#223

Merged
ahcorde merged 4 commits intoros:rollingfrom
pum1k:rolling
Feb 20, 2026
Merged

Add support for passing arguments to constructors#223
ahcorde merged 4 commits intoros:rollingfrom
pum1k:rolling

Conversation

@pum1k
Copy link
Contributor

@pum1k pum1k commented Dec 17, 2025

This PR adds the ability to pass arguments to constructors of the derived classes. As a result, users can now create plugins that are not default constructible, removing the need for initialize method.

To achieve this, a new customization point was added: template struct InterfaceTraits. Specializing this struct allows users to define signature of the constructors that will be required by the derived classes.

If users do not specialize this structure, default constructor is assumed and there are no changes to the behavior.

- added InterfaceTraits type trait that can be used to define the
  constructor arguments used by the derived classes
- changed class loaders to pass arguments to the derived classes based
  on the information stored in InterfaceTraits

Signed-off-by: pum1k <55055380+pum1k@users.noreply.github.com>
@pum1k
Copy link
Contributor Author

pum1k commented Jan 29, 2026

Hi @ahcorde,
could you, please, review this PR and merge it if it is ok? I don't know who to ask, so i found you on other PRs. Sorry for the ping if you are not the right person to ask.

@ahcorde ahcorde self-requested a review February 5, 2026 11:35
@ahcorde
Copy link
Contributor

ahcorde commented Feb 5, 2026

Pulls: #223
Gist: https://gist.githubusercontent.com/ahcorde/2ac0c58c497edec9c4feac045a457731/raw/a0614acd74a344d977449d35533388fef9da1a02/ros2.repos
BUILD args: --packages-above-and-dependencies class_loader
TEST args: --packages-above class_loader
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/18135

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

Signed-off-by: pum1k <55055380+pum1k@users.noreply.github.com>
@pum1k
Copy link
Contributor Author

pum1k commented Feb 6, 2026

The Linux-rhel failure should alredy be fixed. Windows issue looks like a compiler bug in template deduction. It should be fixable with a slight change in the implementation.

Signed-off-by: pum1k <55055380+pum1k@users.noreply.github.com>
@pum1k
Copy link
Contributor Author

pum1k commented Feb 6, 2026

The MSVC problem should also be fixed now.

@ahcorde
Copy link
Contributor

ahcorde commented Feb 6, 2026

Pulls: #223
Gist: https://gist.githubusercontent.com/ahcorde/e7e87da95786dcd916c7761dad0bb56f/raw/a0614acd74a344d977449d35533388fef9da1a02/ros2.repos
BUILD args: --packages-above-and-dependencies class_loader
TEST args: --packages-above class_loader
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/18142

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

@pum1k
Copy link
Contributor Author

pum1k commented Feb 13, 2026

Is there anything else I need to do before this can be merged?

@pum1k
Copy link
Contributor Author

pum1k commented Feb 18, 2026

@ahcorde, can you, please, review this?

Signed-off-by: pum1k <55055380+pum1k@users.noreply.github.com>
@pum1k pum1k requested a review from ahcorde February 19, 2026 14:36
@ahcorde
Copy link
Contributor

ahcorde commented Feb 19, 2026

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

@ahcorde ahcorde merged commit 5c27948 into ros:rolling Feb 20, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants