Skip to content

Conversation

@MiguelCompany
Copy link
Member

@MiguelCompany MiguelCompany commented May 8, 2025

Description

This PR adds C++ code generation for IDL interfaces (a.k.a RPC).

  • The generated client interface provides an asynchronous API based on std::future.
  • The generated server interface allows for aggregating the operation implementation (thus decoupling the DDS logic from the operation logic)
  • Includes support for custom extension @feed.

This PR depends on the following ones and must be merged after them:

Contributor Checklist

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.

@MiguelCompany MiguelCompany added this to the v4.1.0 milestone May 8, 2025
* Refs #22761. Add builtin `@feed` annotation.

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

* Refs #22761. Add auxiliary STG utilities to Operation class.

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

* Refs #22761. Add auxiliary STG utilities to Param class.

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

---------

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
* Refs #22768. Added test file for exceptions.

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

* Refs #22768. Add new flag to context.

In order to know that at least one exception is to be generated.

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

* Refs #22768. Generate exceptions on main header file.

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

* Refs #22768. Generate serialization code for exceptions.

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

* Refs #22768. Serialization of exception message.

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

* Refs #22768. Update IDL parser.

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

* Refs #22768. Mark exceptions as DLL API.

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

* Refs #22768. Apply suggestion.

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

* Refs #22768. Update submodules.

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

---------

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
* Refs #22909. Add file to test interfaces generation.

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

* Refs #22909. Add generation of interfaces to TypesHeader template.

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

* Refs #22909. Fail for output feed parameters.

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

* Refs #22909. Add include directives for input feed.

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

* Refs #22909. Add include directives for output feed.

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

* Refs #22909. Add include directives for futures.

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

* Refs #22909. Address review comment.

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

* Refs #22909. Fix namespace.

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

* Refs #22909. Update test submodule.

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

---------

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
* Refs #22917. Add check method in Context.

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

* Refs #22917. Set scope when creating interfaces.

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

* Refs #22917. Generate basic details file.

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

* Refs #22917. Generate Reply struct.

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

* Refs #22917. Generate Request struct.

* Refs #22917. Generate operation details.

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

* Refs #22917. Include interface details in `TypesCdrAuxHeader`.

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

---------

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
* Refs #22996. Skeleton for TypesCdrAuxHeaderImpl.

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

* Refs #22996. Added code to get reply type.

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

* Refs #22996. Added Operation `getOutTypeCode` and `getResultTypeCode`

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

* Refs #22996. Added typecode for Exception.

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

* Refs #22996. Generate serialization code for replies.

* Refs #22996. Generate serialization code for operation inputs.

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

* Refs #22996. Generate serialization code for input feeds.

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

* Refs #22996. Generate serialization code for requests.

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

* Refs #22996. Generate code in PubSubTypeHeader.

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

* Refs #22996. Skeleton for code generation in PubSubTypeSource.

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

* Refs #22996. Code generation in PubSubTypeSource.

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

---------

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
* Refs #23017. Add virtual destructor to interface abstract class.

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

* Refs #23017. Skeleton for client creation code.

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

* Refs #23017. Skeleton for client class.

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

* Refs #23017. Generate processing thread code.

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

* Refs #23017. Add `process_reply` implementation.

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

* Refs #23017. Code for basic requests.

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

* Refs #23017. Improve linters.

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

* Refs #23017. Code for basic replies.

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

* Refs #23017. Add support for operation exceptions.

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

* Refs #23017. Skeleton for output feeds.

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

* Refs #23017. Generate code for input feeds.

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

* Refs #23017. Add cancellation logic to output feeds.

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

* Refs #23017. Validation and exceptions in output feeds.

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

* Refs #23017. Initial implementation for `read` methods.

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

* Refs #23017. Linters.

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

* Refs #23017. Improve cancel method.

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

* Refs #23017. Process values in output feeds.

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

* Refs #23017. Return values before exception.

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

* Refs #23017. Exceptions finish the feed instead of cancelling it.

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

* Refs #23017. Process incoming exceptions in output feeds.

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

* Refs #23017. Fail when reply is for a different operation.

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

* Refs #23017. Add feed cancellation to request type.

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

* Refs #23017. Implement feed cancellation on client reader.

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

* Refs #23017. Fix atomic initialization.

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

* Refs #23017. Make generated code compatible with C++11.

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

---------

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
* Refs #23069. Skeleton for server creation code.

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

* Refs #23069. Skeleton for server class.

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

* Refs #23069. Initial implementation for run and stop.

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

* Refs #23069. Request validation.

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

* Refs #23069. Initial processing code.

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

* Refs #23069. Prepare method per operation.

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

* Refs #23069. Thread pool implementation.

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

* Refs #23069. Generate operation prototypes.

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

* Refs #23069. Generate operation empty implementations.

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

* Refs #23069. Generate skeleton for calling operations.

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

* Refs #23069. Code for calling basic operations.

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

* Refs #23069. Code for handling user exceptions.

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

* Refs #23069. Code for output feed writers.

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

* Refs #23069. Code for handling output feed operations.

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

* Refs #23069. Refactor to improve readability.

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

* Refs #23069. Generate code to handle output feed cancellation.

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

* Refs #23069. Fix client code for output feed cancellation.

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

* Refs #23069. Infrastructure for input feed processing.

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

* Refs #23069. Generate code for input feed readers.

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

* Refs #23069. Improve readability.

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

* Refs #23069. Code for operations with input feeds.

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

* Refs #23069. Generate declatation of implementation interface.

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

* Refs #23069. ServerLogic depends on implementation interface.

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

* Refs #23069. Generate empty implementation interface.

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

* Refs #23069. Fix linters.

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

* Refs #23069. Avoid processing `feed_cancel_` when not generated.

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

* Refs #23069. Log error when trying to cancel a non-feed request.

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

* Refs #23069. Cancel requests before terminating thread pool.

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

* Refs #23079. Change dll export macro.

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

* Refs #23079. Remove unnecessary namespace aliasing.

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

* Refs #23079. Remove detail namespace in server implementation.

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

* Refs #23079. Avoid nested structures (not supported by Swig).

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

---------

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
@MiguelCompany MiguelCompany changed the title [23153] Generate code for interfaces in Fast DDS Gen [23153] Generate code for interfaces May 8, 2025
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>
@MiguelCompany MiguelCompany requested a review from richiware May 9, 2025 10:37
@github-actions github-actions bot added the ci-pending PR which CI is running label May 9, 2025
Copy link
Member

@richiware richiware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The generated code for the following IDL is not compiling.

exception MyEx
{
    long id;
    string message;
};

interface MyIf
{
    exception MyEx2
    {
        long id;
        string message;
    };

    struct MySt
    {
        char array[30];
    };

    void test1(in short s, out string m) raises (MyEx);

    string test2(inout char s, inout string m) raises (MyEx2);

    @feed
     MySt test3(in long id) raises (MyEx);
};

@MiguelCompany MiguelCompany requested review from richiware and removed request for richiware May 12, 2025 11:58
Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
This fixes link issues when we have an IDL that includes another IDL where all the structures are declared as nested.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
@MiguelCompany MiguelCompany removed the request for review from richiprosima May 12, 2025 14:50
Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
@MiguelCompany MiguelCompany requested review from richiware and removed request for richiware May 13, 2025 08:32
Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
@MiguelCompany MiguelCompany requested review from richiware and removed request for richiware May 13, 2025 13:39
@MiguelCompany MiguelCompany changed the title [23153] Generate code for interfaces [23153] Generate code for interfaces and support @nested May 14, 2025
richiware
richiware previously approved these changes May 14, 2025
Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
@MiguelCompany MiguelCompany merged commit 7d9011d into master May 14, 2025
4 checks passed
@MiguelCompany MiguelCompany deleted the feature/rpc/main branch May 14, 2025 10:57
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.

3 participants