Skip to content

[22850] Fix python code generation for bounded strings#440

Merged
MiguelCompany merged 7 commits intomasterfrom
bugfix/22835
Feb 25, 2025
Merged

[22850] Fix python code generation for bounded strings#440
MiguelCompany merged 7 commits intomasterfrom
bugfix/22835

Conversation

@MiguelCompany
Copy link
Member

@MiguelCompany MiguelCompany commented Feb 24, 2025

Description

This PR introduces the following improvements on the code generated for SWIG interfaces:

  1. A setter for fixed_string members receiving a standard string is added.
  2. A %template for each fixed_string member is generated.

This allows setting bounded string members with either of the following alternatives:

  1. struct_name.member_name("string value")
  2. fixed_str = fixed_string_16("string value")
    struct_name.member_name(fixed_str)
    

@Mergifyio backport 4.0.x

Contributor Checklist

  • Commit messages follow the project guidelines.
  • Tests that thoroughly check the new feature have been added/Regression tests checking the bug and its fix have been added; the added tests pass locally
  • N/A: New feature has been documented/Current behavior is correctly described in the documentation.
  • Applicable backports have been included in the description.

Reviewer Checklist

  • The PR has a milestone assigned.
  • The title and description correctly express the PR's purpose.
  • Check contributor checklist is correct.
  • Check CI results: changes do not issue any warning.
  • Check CI results: failing tests are unrelated with the changes.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
@github-actions github-actions bot added ci-pending PR which CI is running labels Feb 25, 2025
@MiguelCompany MiguelCompany merged commit 8eaca9a into master Feb 25, 2025
4 checks passed
@MiguelCompany MiguelCompany deleted the bugfix/22835 branch February 25, 2025 11:08
@MiguelCompany
Copy link
Member Author

@Mergifyio backport 4.0.x

@mergify
Copy link

mergify bot commented Feb 25, 2025

backport 4.0.x

✅ Backports have been created

Details

mergify bot pushed a commit that referenced this pull request Feb 25, 2025
* Refs #22835. SWIG extend to set fixed_string from std::string.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #22835. SWIG export template for fixed_string members.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #22835. Fix access to typecode.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #22835. Fix max size typo.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #22835. Fix exported template name.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #22835. Fix extend code.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #22850. Apply suggestions from review.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

---------

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
(cherry picked from commit 8eaca9a)
MiguelCompany added a commit that referenced this pull request Feb 26, 2025
* Refs #22835. SWIG extend to set fixed_string from std::string.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #22835. SWIG export template for fixed_string members.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #22835. Fix access to typecode.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #22835. Fix max size typo.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #22835. Fix exported template name.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #22835. Fix extend code.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #22850. Apply suggestions from review.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

---------

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
(cherry picked from commit 8eaca9a)

Co-authored-by: Miguel Company <miguelcompany@eprosima.com>
@MiguelCompany
Copy link
Member Author

@Mergifyio backport 3.3.x

@mergify
Copy link

mergify bot commented Feb 26, 2025

backport 3.3.x

✅ Backports have been created

Details

mergify bot pushed a commit that referenced this pull request Feb 26, 2025
* Refs #22835. SWIG extend to set fixed_string from std::string.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #22835. SWIG export template for fixed_string members.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #22835. Fix access to typecode.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #22835. Fix max size typo.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #22835. Fix exported template name.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #22835. Fix extend code.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #22850. Apply suggestions from review.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

---------

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
(cherry picked from commit 8eaca9a)

# Conflicts:
#	src/main/java/com/eprosima/fastcdr/idl/templates/TypesSwigInterface.stg
MiguelCompany added a commit that referenced this pull request Apr 25, 2025
* Refs #22835. SWIG extend to set fixed_string from std::string.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #22835. SWIG export template for fixed_string members.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #22835. Fix access to typecode.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #22835. Fix max size typo.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #22835. Fix exported template name.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #22835. Fix extend code.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #22850. Apply suggestions from review.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

---------

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
(cherry picked from commit 8eaca9a)

# Conflicts:
#	src/main/java/com/eprosima/fastcdr/idl/templates/TypesSwigInterface.stg
MiguelCompany added a commit that referenced this pull request Sep 23, 2025
* Refs #22835. SWIG extend to set fixed_string from std::string.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #22835. SWIG export template for fixed_string members.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #22835. Fix access to typecode.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #22835. Fix max size typo.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #22835. Fix exported template name.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #22835. Fix extend code.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #22850. Apply suggestions from review.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

---------

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
(cherry picked from commit 8eaca9a)

# Conflicts:
#	src/main/java/com/eprosima/fastcdr/idl/templates/TypesSwigInterface.stg
MiguelCompany added a commit that referenced this pull request Sep 25, 2025
* Refs #22835. SWIG extend to set fixed_string from std::string.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #22835. SWIG export template for fixed_string members.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #22835. Fix access to typecode.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #22835. Fix max size typo.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #22835. Fix exported template name.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #22835. Fix extend code.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #22850. Apply suggestions from review.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

---------

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
(cherry picked from commit 8eaca9a)

# Conflicts:
#	src/main/java/com/eprosima/fastcdr/idl/templates/TypesSwigInterface.stg
MiguelCompany added a commit that referenced this pull request Sep 25, 2025
* Fix python code generation for bounded strings (#440)

* Refs #22835. SWIG extend to set fixed_string from std::string.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #22835. SWIG export template for fixed_string members.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #22835. Fix access to typecode.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #22835. Fix max size typo.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #22835. Fix exported template name.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #22835. Fix extend code.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #22850. Apply suggestions from review.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

---------

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
(cherry picked from commit 8eaca9a)

# Conflicts:
#	src/main/java/com/eprosima/fastcdr/idl/templates/TypesSwigInterface.stg

* Fix conflicts

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Conditional build of fastcdr v2 features

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Always import optional header

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

---------

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
Co-authored-by: Miguel Company <miguelcompany@eprosima.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-pending PR which CI is running

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants