From ac1c7f697eaa7dfe739e78c9b6d4b238636b8477 Mon Sep 17 00:00:00 2001 From: Emilio Cuesta Date: Fri, 13 Feb 2026 17:42:03 +0100 Subject: [PATCH] Update RPC interface in Python Signed-off-by: Emilio Cuesta --- .../src/swig/fastdds/dds/rpc/exceptions.i | 16 - .../src/swig/fastdds/dds/rpc/interfaces.i | 9 - fastdds_python_examples/CMakeLists.txt | 1 - .../RPCExample/CalculatorExample.py | 204 --- fastdds_python_examples/RPCExample/README.md | 28 - .../RPCExample/calculator.idl | 41 - .../RPCExample/generated_code/CMakeLists.txt | 141 -- .../RPCExample/generated_code/calculator.hpp | 192 --- .../RPCExample/generated_code/calculator.i | 189 --- .../generated_code/calculatorCdrAux.hpp | 40 - .../generated_code/calculatorCdrAux.ipp | 1195 ---------------- .../generated_code/calculatorClient.cxx | 568 -------- .../generated_code/calculatorClient.hpp | 43 - .../generated_code/calculatorPubSubTypes.cxx | 349 ----- .../generated_code/calculatorPubSubTypes.hpp | 48 - .../generated_code/calculatorPubSubTypes.i | 30 - .../generated_code/calculatorServer.cxx | 687 ---------- .../generated_code/calculatorServer.hpp | 98 -- .../generated_code/calculatorServerImpl.hpp | 73 - .../calculatorTypeObjectSupport.cxx | 1213 ----------------- .../calculatorTypeObjectSupport.hpp | 72 - .../generated_code/calculator_details.hpp | 135 -- .../scripts/update_generated_code_from_idl.sh | 8 - 23 files changed, 5380 deletions(-) delete mode 100644 fastdds_python_examples/RPCExample/CalculatorExample.py delete mode 100644 fastdds_python_examples/RPCExample/README.md delete mode 100644 fastdds_python_examples/RPCExample/calculator.idl delete mode 100644 fastdds_python_examples/RPCExample/generated_code/CMakeLists.txt delete mode 100644 fastdds_python_examples/RPCExample/generated_code/calculator.hpp delete mode 100644 fastdds_python_examples/RPCExample/generated_code/calculator.i delete mode 100644 fastdds_python_examples/RPCExample/generated_code/calculatorCdrAux.hpp delete mode 100644 fastdds_python_examples/RPCExample/generated_code/calculatorCdrAux.ipp delete mode 100644 fastdds_python_examples/RPCExample/generated_code/calculatorClient.cxx delete mode 100644 fastdds_python_examples/RPCExample/generated_code/calculatorClient.hpp delete mode 100644 fastdds_python_examples/RPCExample/generated_code/calculatorPubSubTypes.cxx delete mode 100644 fastdds_python_examples/RPCExample/generated_code/calculatorPubSubTypes.hpp delete mode 100644 fastdds_python_examples/RPCExample/generated_code/calculatorPubSubTypes.i delete mode 100644 fastdds_python_examples/RPCExample/generated_code/calculatorServer.cxx delete mode 100644 fastdds_python_examples/RPCExample/generated_code/calculatorServer.hpp delete mode 100644 fastdds_python_examples/RPCExample/generated_code/calculatorServerImpl.hpp delete mode 100644 fastdds_python_examples/RPCExample/generated_code/calculatorTypeObjectSupport.cxx delete mode 100644 fastdds_python_examples/RPCExample/generated_code/calculatorTypeObjectSupport.hpp delete mode 100644 fastdds_python_examples/RPCExample/generated_code/calculator_details.hpp diff --git a/fastdds_python/src/swig/fastdds/dds/rpc/exceptions.i b/fastdds_python/src/swig/fastdds/dds/rpc/exceptions.i index 2acdaa64..533ce056 100644 --- a/fastdds_python/src/swig/fastdds/dds/rpc/exceptions.i +++ b/fastdds_python/src/swig/fastdds/dds/rpc/exceptions.i @@ -16,19 +16,3 @@ #include "fastdds/dds/rpc/exceptions.hpp" %} -// Base class should be included first -%include "fastdds/dds/rpc/exceptions/RpcException.hpp" -// Include first level inheritance -%include "fastdds/dds/rpc/exceptions/RpcBrokenPipeException.hpp" -%include "fastdds/dds/rpc/exceptions/RpcFeedCancelledException.hpp" -%include "fastdds/dds/rpc/exceptions/RpcOperationError.hpp" -%include "fastdds/dds/rpc/exceptions/RpcTimeoutException.hpp" -// This is the base class for second level inheritance -%include "fastdds/dds/rpc/RemoteExceptionCode_t.hpp" -%include "fastdds/dds/rpc/exceptions/RpcRemoteException.hpp" -// Include second level inheritance -%include "fastdds/dds/rpc/exceptions/RemoteInvalidArgumentError.hpp" -%include "fastdds/dds/rpc/exceptions/RemoteOutOfResourcesError.hpp" -%include "fastdds/dds/rpc/exceptions/RemoteUnknownExceptionError.hpp" -%include "fastdds/dds/rpc/exceptions/RemoteUnknownOperationError.hpp" -%include "fastdds/dds/rpc/exceptions/RemoteUnsupportedError.hpp" diff --git a/fastdds_python/src/swig/fastdds/dds/rpc/interfaces.i b/fastdds_python/src/swig/fastdds/dds/rpc/interfaces.i index 2abce39b..d3609709 100644 --- a/fastdds_python/src/swig/fastdds/dds/rpc/interfaces.i +++ b/fastdds_python/src/swig/fastdds/dds/rpc/interfaces.i @@ -15,12 +15,3 @@ %{ #include "fastdds/dds/rpc/interfaces.hpp" %} - -%include "std_shared_ptr.i" - -%shared_ptr(eprosima::fastdds::dds::rpc::RpcServer); -%ignore eprosima::fastdds::dds::rpc::RpcServer::execute_request; - -%include "fastdds/dds/rpc/interfaces/RpcRequest.hpp" -%include "fastdds/dds/rpc/interfaces/RpcServer.hpp" -%include "fastdds/dds/rpc/interfaces/RpcStatusCode.hpp" diff --git a/fastdds_python_examples/CMakeLists.txt b/fastdds_python_examples/CMakeLists.txt index b48e088d..f48d5657 100644 --- a/fastdds_python_examples/CMakeLists.txt +++ b/fastdds_python_examples/CMakeLists.txt @@ -21,4 +21,3 @@ project(FastDdsPythonExamples) ############################################################################### add_subdirectory(HelloWorldExample/generated_code) -add_subdirectory(RPCExample/generated_code) diff --git a/fastdds_python_examples/RPCExample/CalculatorExample.py b/fastdds_python_examples/RPCExample/CalculatorExample.py deleted file mode 100644 index 5996cb48..00000000 --- a/fastdds_python_examples/RPCExample/CalculatorExample.py +++ /dev/null @@ -1,204 +0,0 @@ -#!/usr/bin/env python3 -# # Copyright 2025 Proyectos y Sistemas de Mantenimiento SL (eProsima). -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -""" -Script to test Fast DDS python bindings for RPC -""" -import os -import argparse -import threading -import time - -import fastdds -import calculator - -DESCRIPTION = """Calculator RPC example for Fast DDS python bindings""" -USAGE = ('python3 CalculatorExample.py -p client|server [-d domainID -t server_threads]') - -### Server implementation ### - -class MyCalculatorImplementation(calculator.CalculatorServerImplementation): - def __init__(self): - super().__init__() - - def operation_call_print(self, info, operation_name): - print("Operation {op} called from client with id {id}".format(op=operation_name, id=info.get_client_id())) - - def addition(self, info, value1, value2): - self.operation_call_print(info, "addition") - return value1 + value2 - - def subtraction(self, info, value1, value2): - self.operation_call_print(info, "subtraction") - return value1 - value2 - - def representation_limits(self, info): - self.operation_call_print(info, "representation_limits") - ret_val = calculator.BasicCalculator_representation_limits_Out() - ret_val.min_value = -2147483648 - ret_val.max_value = 2147483647 - return ret_val - -### Server application ### - -def run_server(server): - server.run() - -class Server: - def __init__(self, domain, num_threads): - # Create participant - factory = fastdds.DomainParticipantFactory.get_instance() - self.participant_qos = fastdds.DomainParticipantQos() - factory.get_default_participant_qos(self.participant_qos) - self.participant = factory.create_participant(domain, self.participant_qos) - - # Create server - self.implementation = MyCalculatorImplementation() - self.server_qos = fastdds.ReplierQos() - self.server = calculator.create_CalculatorServer( - self.participant, "my_calculator", self.server_qos, num_threads, self.implementation) - - def run(self): - thr = threading.Thread(target=run_server, args=(self.server,)) - thr.start() - print("Server is running. Press any key to stop it.") - try: - input() - except: - pass - self.server.stop() - thr.join() - -### Client application ### - -class Client: - def __init__(self, domain): - # Create participant - factory = fastdds.DomainParticipantFactory.get_instance() - self.participant_qos = fastdds.DomainParticipantQos() - factory.get_default_participant_qos(self.participant_qos) - self.participant = factory.create_participant(domain, self.participant_qos) - - # Create client - self.client_qos = fastdds.RequesterQos() - self.client = calculator.create_CalculatorClient( - self.participant, "my_calculator", self.client_qos) - - def run(self): - # TODO: wait for server to be ready - time.sleep(2) - - self.perform_addition() - self.perform_subtraction() - self.perform_representation_limits() - - def perform_addition(self): - try: - # Perform basic addition - print("Performing addition(1, 2)") - result = self.client.addition(1, 2) - print("Result: {}".format(result.get())) - - # Perform addition with overflow - print("Performing addition(2147483647, 1)") - result = self.client.addition(2147483647, 1) - print("Result: {}".format(result=result.get())) - except Exception as e: - print("Exception: {}".format(type(e).__name__)) - print("Exception message: {}".format(e)) - - def perform_subtraction(self): - try: - # Perform basic subtraction - print("Performing subtraction(2, 1)") - result = self.client.subtraction(2, 1) - print("Result: {}".format(result.get())) - - # Perform subtraction with underflow - print("Performing subtraction(-2147483648, 1)") - result = self.client.subtraction(-2147483648, 1) - result.wait() - print("Result: {}".format(result=result.get())) - except Exception as e: - print("Exception: {}".format(type(e).__name__)) - print("Exception message: {}".format(e)) - - def perform_representation_limits(self): - try: - # Perform representation limits - print("Performing representation_limits()") - result = self.client.representation_limits() - data = result.get() - print("Result: {min}, {max}".format(min=data.min_value, max=data.max_value)) - except Exception as e: - print("Exception: {}".format(type(e).__name__)) - print("Exception message: {}".format(e)) - -def parse_options(): - """" - Parse arguments. - - :return: Parsed arguments. - """ - parser = argparse.ArgumentParser( - formatter_class=argparse.ArgumentDefaultsHelpFormatter, - add_help=True, - description=(DESCRIPTION), - usage=(USAGE) - ) - required_args = parser.add_argument_group('required arguments') - required_args.add_argument( - '-d', - '--domain', - type=int, - required=False, - help='DomainID.' - ) - required_args.add_argument( - '-p', - '--parameter', - type=str, - required=True, - help='Whether the application is run as client or server.' - ) - required_args.add_argument( - '-t', - '--server_threads', - type=int, - required=False, - help='Number of threads in the server pool. Only applies if the application is run as server.' - ) - return parser.parse_args() - -if __name__ == '__main__': - # Parse arguments - args = parse_options() - if not args.domain: - args.domain = 0 - if not args.server_threads: - args.server_threads = 1 - - if args.parameter == 'client': - print('Creating client.') - client = Client(args.domain) - client.run() - elif args.parameter == 'server': - print('Creating server.') - server = Server(args.domain, args.server_threads) - server.run() - else: - print('Error: Incorrect arguments.') - print(USAGE) - - exit() diff --git a/fastdds_python_examples/RPCExample/README.md b/fastdds_python_examples/RPCExample/README.md deleted file mode 100644 index bf57c1dc..00000000 --- a/fastdds_python_examples/RPCExample/README.md +++ /dev/null @@ -1,28 +0,0 @@ -# Python binding CalculatorExample - -This example implements a basic client/server RPC application. -In order to launch the example it is required to indicate if the application is run as client or server. -Therefore, open two terminals and move to the folder where the Python script is located. -On the first terminal run the server executing the following command: - -```bash -python3 CalculatorExample.py -p server -``` - -On the second terminal run the client as follows: - -```bash -python3 CalculatorExample.py -p client -``` - -The client application waits for two seconds for the server to be discovered, and then performs several RPC calls. -For each call, the operation result is shown. -On the server application, the GUID of the client and the requested operation is shown for each processed request. - -## Parameters - -This example allows the following parameters: - -* `--parameter`/`-p`: whether the application is run as client or server. This parameter is required. -* `--domain`/`-d`: domain ID where the application is run. This parameter is optional. In case that it is not provided by the user, domain ID will be 0. -* `--server_threads`/`-t`: the number of threads for processing requests (defaults to 1). This parameter only applies if the application is run as server. diff --git a/fastdds_python_examples/RPCExample/calculator.idl b/fastdds_python_examples/RPCExample/calculator.idl deleted file mode 100644 index ea61423c..00000000 --- a/fastdds_python_examples/RPCExample/calculator.idl +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2025 Proyectos y Sistemas de Mantenimiento SL (eProsima). -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -module calculator_base -{ - // This exception will be thrown when an operation result cannot be represented in a long - exception OverflowException - { - }; - - @nested - interface Adder - { - // Returns the result of value1 + value2 - long addition(in long value1, in long value2) raises(OverflowException); - }; - - @nested - interface Subtractor - { - // Returns the result of value1 - value2 - long subtraction(in long value1, in long value2) raises(OverflowException); - }; -}; - -interface Calculator : calculator_base::Adder, calculator_base::Subtractor -{ - // Returns the minimum and maximum representable values - void representation_limits(out long min_value, out long max_value); -}; diff --git a/fastdds_python_examples/RPCExample/generated_code/CMakeLists.txt b/fastdds_python_examples/RPCExample/generated_code/CMakeLists.txt deleted file mode 100644 index d00b75e0..00000000 --- a/fastdds_python_examples/RPCExample/generated_code/CMakeLists.txt +++ /dev/null @@ -1,141 +0,0 @@ - -# Copyright 2025 Proyectos y Sistemas de Mantenimiento SL (eProsima). -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -cmake_minimum_required(VERSION 3.20) - -# SWIG: use standard target name. -if(POLICY CMP0078) - cmake_policy(SET CMP0078 NEW) -endif() - -# SWIG: use SWIG_MODULE_NAME property. -if(POLICY CMP0086) - cmake_policy(SET CMP0086 NEW) -endif() - -############################################################################### -# Library for types defined in calculator IDL -############################################################################### - -message(STATUS "Configuring python wrapper for types in calculator...") - -############################################################################### -# Type library on C++ - -project(calculator) - -find_package(fastcdr REQUIRED) -find_package(fastdds 3 REQUIRED) - -set(CMAKE_POSITION_INDEPENDENT_CODE ON) - -if(NOT WIN32) - # Default values for shared library suffix in MacOS - if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") - set(CMAKE_SHARED_LIBRARY_SUFFIX ".so") - endif() -endif() - -#Create library for C++ types -add_library(${PROJECT_NAME} SHARED - calculatorTypeObjectSupport.cxx - calculatorPubSubTypes.cxx - calculatorClient.cxx - calculatorServer.cxx - ) -if(WIN32) - target_compile_definitions(${PROJECT_NAME} PRIVATE EPROSIMA_USER_DLL_EXPORT) -endif(WIN32) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) -target_include_directories(${PROJECT_NAME} PUBLIC - ${PROJECT_SOURCE_DIR} - ) -target_link_libraries(${PROJECT_NAME} - PUBLIC - fastcdr - fastdds - ) - -############################################################################### -# Python bindings for type - -find_package(SWIG) -if (NOT SWIG_FOUND) - # Trick to find swig4.1 in Ubuntu noble. - find_program(SWIG_EXECUTABLE NAMES swig4.1 swig) - find_package(SWIG REQUIRED) -endif() -include(${SWIG_USE_FILE}) -set(CMAKE_SWIG_FLAGS "") - -find_package(Python3 COMPONENTS Interpreter Development REQUIRED) -set(PYTHON_INCLUDE_PATH ${Python3_INCLUDE_DIRS}) -set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE}) -set(PYTHON_LIBRARIES ${Python3_LIBRARIES}) - -include_directories(${PYTHON_INCLUDE_PATH}) - -set(${PROJECT_NAME}_MODULE - calculatorWrapper - ) - -set(${PROJECT_NAME}_MODULE_FILES - calculator.i - ) - -SET_SOURCE_FILES_PROPERTIES( - ${${PROJECT_NAME}_MODULE_FILES} - PROPERTIES CPLUSPLUS ON - USE_TARGET_INCLUDE_DIRECTORIES TRUE - ) - -SWIG_ADD_LIBRARY(${${PROJECT_NAME}_MODULE} - TYPE SHARED - LANGUAGE python - SOURCES ${${PROJECT_NAME}_MODULE_FILES}) - -set_property(TARGET ${${PROJECT_NAME}_MODULE} PROPERTY CXX_STANDARD 11) -if(UNIX AND CMAKE_SIZEOF_VOID_P EQUAL 8) - set_property(TARGET ${${PROJECT_NAME}_MODULE} PROPERTY SWIG_COMPILE_DEFINITIONS SWIGWORDSIZE64) -endif() - -target_link_libraries(${${PROJECT_NAME}_MODULE} - Python3::Module - fastdds - ${PROJECT_NAME} - ) - -# Find the installation path -execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "from distutils import sysconfig; print(sysconfig.get_python_lib(plat_specific=True, prefix='${CMAKE_INSTALL_PREFIX}'))" - OUTPUT_VARIABLE _ABS_PYTHON_MODULE_PATH - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - -get_filename_component (_ABS_PYTHON_MODULE_PATH ${_ABS_PYTHON_MODULE_PATH} ABSOLUTE) -file (RELATIVE_PATH _REL_PYTHON_MODULE_PATH ${CMAKE_INSTALL_PREFIX} ${_ABS_PYTHON_MODULE_PATH}) -SET (PYTHON_MODULE_PATH - ${_REL_PYTHON_MODULE_PATH}/${PROJECT_NAME} - ) - -# Install -install(TARGETS ${PROJECT_NAME} - RUNTIME DESTINATION bin/ - LIBRARY DESTINATION lib/ - ARCHIVE DESTINATION lib/ - ) -install(TARGETS ${${PROJECT_NAME}_MODULE} DESTINATION ${PYTHON_MODULE_PATH}) -get_property(support_files TARGET ${${PROJECT_NAME}_MODULE} PROPERTY SWIG_SUPPORT_FILES) -install(FILES ${support_files} DESTINATION ${PYTHON_MODULE_PATH} RENAME __init__.py) - diff --git a/fastdds_python_examples/RPCExample/generated_code/calculator.hpp b/fastdds_python_examples/RPCExample/generated_code/calculator.hpp deleted file mode 100644 index 88f71b78..00000000 --- a/fastdds_python_examples/RPCExample/generated_code/calculator.hpp +++ /dev/null @@ -1,192 +0,0 @@ -// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/*! - * @file calculator.hpp - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen (version: 4.2.0). - */ - -#ifndef FAST_DDS_GENERATED__CALCULATOR_HPP -#define FAST_DDS_GENERATED__CALCULATOR_HPP - -#include -#include -#include -#include -#include -#include -#include - - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define eProsima_user_DllExport -#endif // _WIN32 - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(CALCULATOR_SOURCE) -#define CALCULATOR_DllAPI __declspec( dllexport ) -#else -#define CALCULATOR_DllAPI __declspec( dllimport ) -#endif // CALCULATOR_SOURCE -#else -#define CALCULATOR_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define CALCULATOR_DllAPI -#endif // _WIN32 - -namespace calculator_base { - -/*! - * @brief This class implements the user exception calculator_base::OverflowException - * @ingroup calculator - */ -class eProsima_user_DllExport OverflowException : public eprosima::fastdds::dds::rpc::RpcOperationError -{ -public: - - /** - * Default constructor. - */ - OverflowException() - : OverflowException("OverflowException") - { - } - - /** - * Constructor. - */ - OverflowException( - const std::string& message) - : eprosima::fastdds::dds::rpc::RpcOperationError(message) - { - } - - /** - * Constructor. - */ - OverflowException( - const char* message) - : eprosima::fastdds::dds::rpc::RpcOperationError(message) - { - } - - /** - * Copy constructor. - */ - OverflowException( - const OverflowException& other) noexcept = default; - - /** - * Copy assignment. - */ - OverflowException& operator =( - const OverflowException& other) noexcept = default; - - /** - * Destructor. - */ - virtual ~OverflowException() noexcept = default; - - - -private: - - -}; - - -/*! - * @brief This class represents the interface Adder defined by the user in the IDL file. - * @ingroup calculator - */ -class eProsima_user_DllExport Adder -{ -public: - virtual ~Adder() = default; - - - virtual eprosima::fastdds::dds::rpc::RpcFuture addition( - /*in*/ int32_t value1, - /*in*/ int32_t value2) = 0; - -}; - - - -/*! - * @brief This class represents the interface Subtractor defined by the user in the IDL file. - * @ingroup calculator - */ -class eProsima_user_DllExport Subtractor -{ -public: - virtual ~Subtractor() = default; - - - virtual eprosima::fastdds::dds::rpc::RpcFuture subtraction( - /*in*/ int32_t value1, - /*in*/ int32_t value2) = 0; - -}; - - - -} // namespace calculator_base - -namespace detail { - -struct Calculator_representation_limits_Out; - -} // namespace detail - -/*! - * @brief This class represents the interface Calculator defined by the user in the IDL file. - * @ingroup calculator - */ -class eProsima_user_DllExport Calculator : public calculator_base::Adder, public calculator_base::Subtractor -{ -public: - virtual ~Calculator() = default; - - - virtual eprosima::fastdds::dds::rpc::RpcFuture representation_limits( - ) = 0; - -}; - -namespace detail { - -struct Calculator_representation_limits_Out -{ - int32_t min_value; - int32_t max_value; -}; - - -} // namespace detail - - -#endif // _FAST_DDS_GENERATED_CALCULATOR_HPP_ - - diff --git a/fastdds_python_examples/RPCExample/generated_code/calculator.i b/fastdds_python_examples/RPCExample/generated_code/calculator.i deleted file mode 100644 index 539d1f2f..00000000 --- a/fastdds_python_examples/RPCExample/generated_code/calculator.i +++ /dev/null @@ -1,189 +0,0 @@ -// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/*! - * @file calculator.i - * This header file contains the SWIG interface of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen (version: 4.2.0). - */ - -%module(threads="1",directors="1",moduleimport="if __import__('os').name == 'nt': import win32api; win32api.LoadLibrary('calculator.dll')\nif __package__ or '.' in __name__:\n from . import _calculatorWrapper\nelse:\n import _calculatorWrapper") calculator - -// We have enabled threads because the RPC server directors will call the target language environment -// from the C++ server threads, but we don't want the calls from the target language to release their -// locks (e.g. Python GIL) when calling the C++ methods. -// See a very nice explanation at https://github.com/swig/swig/issues/927#issuecomment-289279243 -%feature("nothreadallow"); - -// If using windows in debug, it would try to use python_d, which would not be found. -%begin %{ -/* - * From: https://github.com/swig/swig/issues/2638 - * When a module uses a type in a module that is defined in a different module, - * a false positive memory leak is detected. - * The following line silences this warning. - */ -#define SWIG_PYTHON_SILENT_MEMLEAK -#ifdef _MSC_VER -#define SWIG_PYTHON_INTERPRETER_NO_DEBUG -#endif -#include -%} - -// SWIG helper modules -%include "exception.i" -%include "stdint.i" -%include "std_array.i" -%include "std_map.i" -%include "std_pair.i" -%include "std_shared_ptr.i" -%include "std_string.i" -%include "std_vector.i" -%include "typemaps.i" - -// Assignemt operators are ignored, as there is no such thing in Python. -// Trying to export them issues a warning -%ignore *::operator=; - -// Macro declarations -// Any macro used on the Fast DDS header files will give an error if it is not redefined here -#define FASTDDS_EXPORTED_API -#define eProsima_user_DllExport - - -%{ -#include "calculator.hpp" -#include "calculatorClient.hpp" -#include "calculatorServer.hpp" -#include "calculatorServerImpl.hpp" - -#include -%} - -%include -%import(module="fastdds") "fastcdr/xcdr/optional.hpp" -%import(module="fastdds") "fastcdr/cdr/fixed_size_string.hpp" -%import(module="fastdds") "fastdds/dds/core/LoanableCollection.hpp" -%import(module="fastdds") "fastdds/dds/core/LoanableTypedCollection.hpp" -%import(module="fastdds") "fastdds/dds/core/LoanableSequence.hpp" - -%import(module="fastdds") "fastdds/dds/rpc/exceptions/RpcException.hpp" -%import(module="fastdds") "fastdds/dds/rpc/exceptions/RpcOperationError.hpp" -%import(module="fastdds") "fastdds/dds/rpc/interfaces/RpcServer.hpp" - -%exception { - try - { - $action - } - catch (const eprosima::fastdds::dds::rpc::RpcException& ex) - { - SWIG_exception(SWIG_RuntimeError, ex.what()); - } - catch (const std::exception& ex) - { - SWIG_exception(SWIG_RuntimeError, ex.what()); - } - catch (...) - { - SWIG_exception(SWIG_RuntimeError,"Unknown exception"); - } -} - -// Code for std::future taken from https://github.com/swig/swig/issues/1828#issuecomment-648449092 -namespace eprosima::fastdds::dds::rpc -{ -template -class RpcFuture { - public: - RpcFuture() noexcept; - RpcFuture(RpcFuture &&) noexcept; - RpcFuture(const RpcFuture& rhs) = delete; - ~RpcFuture(); - RpcFuture& operator=(const RpcFuture& rhs) = delete; - RpcFuture& operator=(RpcFuture&&) noexcept; - - // retrieving the value - R get(); - - // functions to check state - bool valid() const noexcept; - void wait() const; - -/* - template - future_status wait_for(const chrono::duration& rel_time) const; - template - future_status wait_until(const chrono::time_point& abs_time) const; -*/ -}; - -} - -%shared_ptr(eprosima::fastdds::dds::rpc::RpcFuture); -%template(detail_Calculator_representation_limits_Out_rpc_future) eprosima::fastdds::dds::rpc::RpcFuture; - -%typemap(out, optimal="1") eprosima::fastdds::dds::rpc::RpcFuture { - std::shared_ptr<$1_ltype> *smartresult = new std::shared_ptr<$1_ltype>(new $1_ltype($1)); - $result = SWIG_NewPointerObj(SWIG_as_voidptr(smartresult), $descriptor(std::shared_ptr< eprosima::fastdds::dds::rpc::RpcFuture> *), SWIG_POINTER_OWN); -} - -%shared_ptr(eprosima::fastdds::dds::rpc::RpcFuture); -%template(int32_t_rpc_future) eprosima::fastdds::dds::rpc::RpcFuture; - -%typemap(out, optimal="1") eprosima::fastdds::dds::rpc::RpcFuture { - std::shared_ptr<$1_ltype> *smartresult = new std::shared_ptr<$1_ltype>(new $1_ltype($1)); - $result = SWIG_NewPointerObj(SWIG_as_voidptr(smartresult), $descriptor(std::shared_ptr< eprosima::fastdds::dds::rpc::RpcFuture> *), SWIG_POINTER_OWN); -} - -%exception; - -%define %traits_penumn(Type...) - %fragment(SWIG_Traits_frag(Type),"header", - fragment="StdTraits") { -namespace swig { - template <> struct traits< Type > { - typedef value_category category; - static const char* type_name() { return #Type; } - }; -} -} -%enddef - - - -%shared_ptr(calculator_base::Adder); - - - -%shared_ptr(calculator_base::Subtractor); - - - -%shared_ptr(Calculator); -%shared_ptr(CalculatorServer_IServerImplementation); -%shared_ptr(CalculatorServerImplementation); -%feature("director") CalculatorServerImplementation; - - -// Include the class interfaces -%include "calculator.hpp" -%include "calculatorClient.hpp" -%include "calculatorServer.hpp" -%include "calculatorServerImpl.hpp" - -// Include the corresponding TopicDataType -%include "calculatorPubSubTypes.i" - diff --git a/fastdds_python_examples/RPCExample/generated_code/calculatorCdrAux.hpp b/fastdds_python_examples/RPCExample/generated_code/calculatorCdrAux.hpp deleted file mode 100644 index f8723d1f..00000000 --- a/fastdds_python_examples/RPCExample/generated_code/calculatorCdrAux.hpp +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/*! - * @file calculatorCdrAux.hpp - * This source file contains some definitions of CDR related functions. - * - * This file was generated by the tool fastddsgen (version: 4.2.0). - */ - -#ifndef FAST_DDS_GENERATED__CALCULATORCDRAUX_HPP -#define FAST_DDS_GENERATED__CALCULATORCDRAUX_HPP - -#include "calculator.hpp" -#include "calculator_details.hpp" - - -namespace eprosima { -namespace fastcdr { - -class Cdr; -class CdrSizeCalculator; - - -} // namespace fastcdr -} // namespace eprosima - -#endif // FAST_DDS_GENERATED__CALCULATORCDRAUX_HPP - diff --git a/fastdds_python_examples/RPCExample/generated_code/calculatorCdrAux.ipp b/fastdds_python_examples/RPCExample/generated_code/calculatorCdrAux.ipp deleted file mode 100644 index 00e9d6cf..00000000 --- a/fastdds_python_examples/RPCExample/generated_code/calculatorCdrAux.ipp +++ /dev/null @@ -1,1195 +0,0 @@ -// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/*! - * @file calculatorCdrAux.ipp - * This source file contains some declarations of CDR related functions. - * - * This file was generated by the tool fastddsgen (version: 4.2.0). - */ - -#ifndef FAST_DDS_GENERATED__CALCULATORCDRAUX_IPP -#define FAST_DDS_GENERATED__CALCULATORCDRAUX_IPP - -#include "calculatorCdrAux.hpp" - -#include -#include - - -#include -using namespace eprosima::fastcdr::exception; - -namespace eprosima { -namespace fastcdr { - -template<> -eProsima_user_DllExport size_t calculate_serialized_size( - eprosima::fastcdr::CdrSizeCalculator& calculator, - const calculator_base::OverflowException& data, - size_t& current_alignment) -{ - using namespace calculator_base; - - static_cast(data); - - eprosima::fastcdr::EncodingAlgorithmFlag previous_encoding = calculator.get_encoding(); - size_t calculated_size {calculator.begin_calculate_type_serialized_size( - eprosima::fastcdr::CdrVersion::XCDRv2 == calculator.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - current_alignment)}; - - std::string msg = data.what(); - calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), msg, current_alignment); - - - calculated_size += calculator.end_calculate_type_serialized_size(previous_encoding, current_alignment); - - return calculated_size; -} - -template<> -eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& scdr, - const calculator_base::OverflowException& data) -{ - using namespace calculator_base; - - eprosima::fastcdr::Cdr::state current_state(scdr); - scdr.begin_serialize_type(current_state, - eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); - - scdr << eprosima::fastcdr::MemberId(0) << data.what(); - scdr.end_serialize_type(current_state); -} - -template<> -eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr, - calculator_base::OverflowException& data) -{ - using namespace calculator_base; - - cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - [&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool - { - bool ret_value = true; - switch (mid.id) - { - case 0: - { - std::string msg; - dcdr >> msg; - calculator_base::OverflowException tmp{msg}; - data = tmp; - break; - } - - default: - ret_value = false; - break; - } - return ret_value; - }); -} - -//{ calculator_base::Adder interface - -//{ addition -// Serialization methods for calculator_base::detail::Adder_addition_In -/* -struct Adder_addition_In -{ - int32_t value1; - int32_t value2; -}; -*/ -template<> -eProsima_user_DllExport size_t calculate_serialized_size( - eprosima::fastcdr::CdrSizeCalculator& calculator, - const ::calculator_base::detail::Adder_addition_In& data, - size_t& current_alignment) -{ - using namespace calculator_base::detail; - - static_cast(data); - - eprosima::fastcdr::EncodingAlgorithmFlag previous_encoding = calculator.get_encoding(); - size_t calculated_size {calculator.begin_calculate_type_serialized_size( - eprosima::fastcdr::CdrVersion::XCDRv2 == calculator.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - current_alignment)}; - - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), - data.value1, current_alignment); - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1), - data.value2, current_alignment); - - - calculated_size += calculator.end_calculate_type_serialized_size(previous_encoding, current_alignment); - - return calculated_size; -} - -template<> -eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& scdr, - const ::calculator_base::detail::Adder_addition_In& data) -{ - using namespace calculator_base::detail; - - eprosima::fastcdr::Cdr::state current_state(scdr); - scdr.begin_serialize_type(current_state, - eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); - - scdr - << eprosima::fastcdr::MemberId(0) << data.value1 - << eprosima::fastcdr::MemberId(1) << data.value2 -; - scdr.end_serialize_type(current_state); -} - -template<> -eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr, - ::calculator_base::detail::Adder_addition_In& data) -{ - using namespace calculator_base::detail; - - cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - [&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool - { - bool ret_value = true; - switch (mid.id) - { - case 0: - dcdr >> data.value1; - break; - - case 1: - dcdr >> data.value2; - break; - - default: - ret_value = false; - break; - } - return ret_value; - }); -} - -void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const ::calculator_base::detail::Adder_addition_In& data) -{ - static_cast(scdr); - static_cast(data); -} - - - -// Serialization methods for calculator_base::detail::Adder_addition_Out -/* -struct Adder_addition_Out -{ - int32_t return_; -}; -*/ -template<> -eProsima_user_DllExport size_t calculate_serialized_size( - eprosima::fastcdr::CdrSizeCalculator& calculator, - const ::calculator_base::detail::Adder_addition_Out& data, - size_t& current_alignment) -{ - using namespace calculator_base::detail; - - static_cast(data); - - eprosima::fastcdr::EncodingAlgorithmFlag previous_encoding = calculator.get_encoding(); - size_t calculated_size {calculator.begin_calculate_type_serialized_size( - eprosima::fastcdr::CdrVersion::XCDRv2 == calculator.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - current_alignment)}; - - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), - data.return_, current_alignment); - - - calculated_size += calculator.end_calculate_type_serialized_size(previous_encoding, current_alignment); - - return calculated_size; -} - -template<> -eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& scdr, - const ::calculator_base::detail::Adder_addition_Out& data) -{ - using namespace calculator_base::detail; - - eprosima::fastcdr::Cdr::state current_state(scdr); - scdr.begin_serialize_type(current_state, - eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); - - scdr - << eprosima::fastcdr::MemberId(0) << data.return_ -; - scdr.end_serialize_type(current_state); -} - -template<> -eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr, - ::calculator_base::detail::Adder_addition_Out& data) -{ - using namespace calculator_base::detail; - - cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - [&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool - { - bool ret_value = true; - switch (mid.id) - { - case 0: - dcdr >> data.return_; - break; - - default: - ret_value = false; - break; - } - return ret_value; - }); -} - -void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const ::calculator_base::detail::Adder_addition_Out& data) -{ - static_cast(scdr); - static_cast(data); -} - -// Serialization methods for calculator_base::detail::Adder_addition_Result -/* -struct Adder_addition_Result -{ - eprosima::fastcdr::optional result; - eprosima::fastcdr::optional calculator_base_OverflowException_ex; -}; -*/ -template<> -eProsima_user_DllExport size_t calculate_serialized_size( - eprosima::fastcdr::CdrSizeCalculator& calculator, - const ::calculator_base::detail::Adder_addition_Result& data, - size_t& current_alignment) -{ - using namespace calculator_base::detail; - - static_cast(data); - - eprosima::fastcdr::EncodingAlgorithmFlag previous_encoding = calculator.get_encoding(); - size_t calculated_size {calculator.begin_calculate_type_serialized_size( - eprosima::fastcdr::CdrVersion::XCDRv2 == calculator.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR, - current_alignment)}; - - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0x0784a8b4), - data.result, current_alignment); - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0x0254c1f7), - data.calculator_base_OverflowException_ex, current_alignment); - - - calculated_size += calculator.end_calculate_type_serialized_size(previous_encoding, current_alignment); - - return calculated_size; -} - -template<> -eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& scdr, - const ::calculator_base::detail::Adder_addition_Result& data) -{ - using namespace calculator_base::detail; - - eprosima::fastcdr::Cdr::state current_state(scdr); - scdr.begin_serialize_type(current_state, - eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR); - - scdr - << eprosima::fastcdr::MemberId(0x0784a8b4) << data.result - << eprosima::fastcdr::MemberId(0x0254c1f7) << data.calculator_base_OverflowException_ex -; - scdr.end_serialize_type(current_state); -} - -template<> -eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr, - ::calculator_base::detail::Adder_addition_Result& data) -{ - using namespace calculator_base::detail; - - cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR, - [&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool - { - bool ret_value = true; - switch (mid.id) - { - case 0x0784a8b4: - dcdr >> data.result; - break; - - case 0x0254c1f7: - dcdr >> data.calculator_base_OverflowException_ex; - break; - - default: - ret_value = false; - break; - } - return ret_value; - }); -} - -void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const ::calculator_base::detail::Adder_addition_Result& data) -{ - static_cast(scdr); - static_cast(data); -} - -//} // addition - - -//} // calculator_base::Adder interface - -//{ calculator_base::Subtractor interface - -//{ subtraction -// Serialization methods for calculator_base::detail::Subtractor_subtraction_In -/* -struct Subtractor_subtraction_In -{ - int32_t value1; - int32_t value2; -}; -*/ -template<> -eProsima_user_DllExport size_t calculate_serialized_size( - eprosima::fastcdr::CdrSizeCalculator& calculator, - const ::calculator_base::detail::Subtractor_subtraction_In& data, - size_t& current_alignment) -{ - using namespace calculator_base::detail; - - static_cast(data); - - eprosima::fastcdr::EncodingAlgorithmFlag previous_encoding = calculator.get_encoding(); - size_t calculated_size {calculator.begin_calculate_type_serialized_size( - eprosima::fastcdr::CdrVersion::XCDRv2 == calculator.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - current_alignment)}; - - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), - data.value1, current_alignment); - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1), - data.value2, current_alignment); - - - calculated_size += calculator.end_calculate_type_serialized_size(previous_encoding, current_alignment); - - return calculated_size; -} - -template<> -eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& scdr, - const ::calculator_base::detail::Subtractor_subtraction_In& data) -{ - using namespace calculator_base::detail; - - eprosima::fastcdr::Cdr::state current_state(scdr); - scdr.begin_serialize_type(current_state, - eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); - - scdr - << eprosima::fastcdr::MemberId(0) << data.value1 - << eprosima::fastcdr::MemberId(1) << data.value2 -; - scdr.end_serialize_type(current_state); -} - -template<> -eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr, - ::calculator_base::detail::Subtractor_subtraction_In& data) -{ - using namespace calculator_base::detail; - - cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - [&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool - { - bool ret_value = true; - switch (mid.id) - { - case 0: - dcdr >> data.value1; - break; - - case 1: - dcdr >> data.value2; - break; - - default: - ret_value = false; - break; - } - return ret_value; - }); -} - -void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const ::calculator_base::detail::Subtractor_subtraction_In& data) -{ - static_cast(scdr); - static_cast(data); -} - - - -// Serialization methods for calculator_base::detail::Subtractor_subtraction_Out -/* -struct Subtractor_subtraction_Out -{ - int32_t return_; -}; -*/ -template<> -eProsima_user_DllExport size_t calculate_serialized_size( - eprosima::fastcdr::CdrSizeCalculator& calculator, - const ::calculator_base::detail::Subtractor_subtraction_Out& data, - size_t& current_alignment) -{ - using namespace calculator_base::detail; - - static_cast(data); - - eprosima::fastcdr::EncodingAlgorithmFlag previous_encoding = calculator.get_encoding(); - size_t calculated_size {calculator.begin_calculate_type_serialized_size( - eprosima::fastcdr::CdrVersion::XCDRv2 == calculator.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - current_alignment)}; - - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), - data.return_, current_alignment); - - - calculated_size += calculator.end_calculate_type_serialized_size(previous_encoding, current_alignment); - - return calculated_size; -} - -template<> -eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& scdr, - const ::calculator_base::detail::Subtractor_subtraction_Out& data) -{ - using namespace calculator_base::detail; - - eprosima::fastcdr::Cdr::state current_state(scdr); - scdr.begin_serialize_type(current_state, - eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); - - scdr - << eprosima::fastcdr::MemberId(0) << data.return_ -; - scdr.end_serialize_type(current_state); -} - -template<> -eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr, - ::calculator_base::detail::Subtractor_subtraction_Out& data) -{ - using namespace calculator_base::detail; - - cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - [&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool - { - bool ret_value = true; - switch (mid.id) - { - case 0: - dcdr >> data.return_; - break; - - default: - ret_value = false; - break; - } - return ret_value; - }); -} - -void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const ::calculator_base::detail::Subtractor_subtraction_Out& data) -{ - static_cast(scdr); - static_cast(data); -} - -// Serialization methods for calculator_base::detail::Subtractor_subtraction_Result -/* -struct Subtractor_subtraction_Result -{ - eprosima::fastcdr::optional result; - eprosima::fastcdr::optional calculator_base_OverflowException_ex; -}; -*/ -template<> -eProsima_user_DllExport size_t calculate_serialized_size( - eprosima::fastcdr::CdrSizeCalculator& calculator, - const ::calculator_base::detail::Subtractor_subtraction_Result& data, - size_t& current_alignment) -{ - using namespace calculator_base::detail; - - static_cast(data); - - eprosima::fastcdr::EncodingAlgorithmFlag previous_encoding = calculator.get_encoding(); - size_t calculated_size {calculator.begin_calculate_type_serialized_size( - eprosima::fastcdr::CdrVersion::XCDRv2 == calculator.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR, - current_alignment)}; - - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0x0784a8b4), - data.result, current_alignment); - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0x0254c1f7), - data.calculator_base_OverflowException_ex, current_alignment); - - - calculated_size += calculator.end_calculate_type_serialized_size(previous_encoding, current_alignment); - - return calculated_size; -} - -template<> -eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& scdr, - const ::calculator_base::detail::Subtractor_subtraction_Result& data) -{ - using namespace calculator_base::detail; - - eprosima::fastcdr::Cdr::state current_state(scdr); - scdr.begin_serialize_type(current_state, - eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR); - - scdr - << eprosima::fastcdr::MemberId(0x0784a8b4) << data.result - << eprosima::fastcdr::MemberId(0x0254c1f7) << data.calculator_base_OverflowException_ex -; - scdr.end_serialize_type(current_state); -} - -template<> -eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr, - ::calculator_base::detail::Subtractor_subtraction_Result& data) -{ - using namespace calculator_base::detail; - - cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR, - [&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool - { - bool ret_value = true; - switch (mid.id) - { - case 0x0784a8b4: - dcdr >> data.result; - break; - - case 0x0254c1f7: - dcdr >> data.calculator_base_OverflowException_ex; - break; - - default: - ret_value = false; - break; - } - return ret_value; - }); -} - -void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const ::calculator_base::detail::Subtractor_subtraction_Result& data) -{ - static_cast(scdr); - static_cast(data); -} - -//} // subtraction - - -//} // calculator_base::Subtractor interface - -//{ Calculator interface - -//{ representation_limits -// Serialization methods for detail::Calculator_representation_limits_In -/* -struct Calculator_representation_limits_In -{ -}; -*/ -template<> -eProsima_user_DllExport size_t calculate_serialized_size( - eprosima::fastcdr::CdrSizeCalculator& calculator, - const ::detail::Calculator_representation_limits_In& data, - size_t& current_alignment) -{ - using namespace detail; - - static_cast(data); - - eprosima::fastcdr::EncodingAlgorithmFlag previous_encoding = calculator.get_encoding(); - size_t calculated_size {calculator.begin_calculate_type_serialized_size( - eprosima::fastcdr::CdrVersion::XCDRv2 == calculator.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - current_alignment)}; - - - - calculated_size += calculator.end_calculate_type_serialized_size(previous_encoding, current_alignment); - - return calculated_size; -} - -template<> -eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& scdr, - const ::detail::Calculator_representation_limits_In& data) -{ - using namespace detail; - - eprosima::fastcdr::Cdr::state current_state(scdr); - scdr.begin_serialize_type(current_state, - eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); - - static_cast(data); - - scdr.end_serialize_type(current_state); -} - -template<> -eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr, - ::detail::Calculator_representation_limits_In& data) -{ - using namespace detail; - - cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - [&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool - { - static_cast(data); - static_cast(dcdr); - static_cast(mid); - return false; - }); -} - -void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const ::detail::Calculator_representation_limits_In& data) -{ - static_cast(scdr); - static_cast(data); -} - - -// Serialization methods for detail::Calculator_representation_limits_Out -/* -struct Calculator_representation_limits_Out -{ - int32_t min_value; - int32_t max_value; -}; -*/ -template<> -eProsima_user_DllExport size_t calculate_serialized_size( - eprosima::fastcdr::CdrSizeCalculator& calculator, - const ::detail::Calculator_representation_limits_Out& data, - size_t& current_alignment) -{ - using namespace detail; - - static_cast(data); - - eprosima::fastcdr::EncodingAlgorithmFlag previous_encoding = calculator.get_encoding(); - size_t calculated_size {calculator.begin_calculate_type_serialized_size( - eprosima::fastcdr::CdrVersion::XCDRv2 == calculator.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - current_alignment)}; - - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), - data.min_value, current_alignment); - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1), - data.max_value, current_alignment); - - - calculated_size += calculator.end_calculate_type_serialized_size(previous_encoding, current_alignment); - - return calculated_size; -} - -template<> -eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& scdr, - const ::detail::Calculator_representation_limits_Out& data) -{ - using namespace detail; - - eprosima::fastcdr::Cdr::state current_state(scdr); - scdr.begin_serialize_type(current_state, - eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); - - scdr - << eprosima::fastcdr::MemberId(0) << data.min_value - << eprosima::fastcdr::MemberId(1) << data.max_value -; - scdr.end_serialize_type(current_state); -} - -template<> -eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr, - ::detail::Calculator_representation_limits_Out& data) -{ - using namespace detail; - - cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - [&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool - { - bool ret_value = true; - switch (mid.id) - { - case 0: - dcdr >> data.min_value; - break; - - case 1: - dcdr >> data.max_value; - break; - - default: - ret_value = false; - break; - } - return ret_value; - }); -} - -void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const ::detail::Calculator_representation_limits_Out& data) -{ - static_cast(scdr); - static_cast(data); -} - -// Serialization methods for detail::Calculator_representation_limits_Result -/* -struct Calculator_representation_limits_Result -{ - eprosima::fastcdr::optional result; -}; -*/ -template<> -eProsima_user_DllExport size_t calculate_serialized_size( - eprosima::fastcdr::CdrSizeCalculator& calculator, - const ::detail::Calculator_representation_limits_Result& data, - size_t& current_alignment) -{ - using namespace detail; - - static_cast(data); - - eprosima::fastcdr::EncodingAlgorithmFlag previous_encoding = calculator.get_encoding(); - size_t calculated_size {calculator.begin_calculate_type_serialized_size( - eprosima::fastcdr::CdrVersion::XCDRv2 == calculator.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR, - current_alignment)}; - - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0x0784a8b4), - data.result, current_alignment); - - - calculated_size += calculator.end_calculate_type_serialized_size(previous_encoding, current_alignment); - - return calculated_size; -} - -template<> -eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& scdr, - const ::detail::Calculator_representation_limits_Result& data) -{ - using namespace detail; - - eprosima::fastcdr::Cdr::state current_state(scdr); - scdr.begin_serialize_type(current_state, - eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR); - - scdr - << eprosima::fastcdr::MemberId(0x0784a8b4) << data.result -; - scdr.end_serialize_type(current_state); -} - -template<> -eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr, - ::detail::Calculator_representation_limits_Result& data) -{ - using namespace detail; - - cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR, - [&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool - { - bool ret_value = true; - switch (mid.id) - { - case 0x0784a8b4: - dcdr >> data.result; - break; - - default: - ret_value = false; - break; - } - return ret_value; - }); -} - -void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const ::detail::Calculator_representation_limits_Result& data) -{ - static_cast(scdr); - static_cast(data); -} - -//} // representation_limits - - -//{ top level - -// Serialization methods for detail::Calculator_Request -/* -struct Calculator_Request -{ - eprosima::fastcdr::optional addition; - eprosima::fastcdr::optional subtraction; - eprosima::fastcdr::optional representation_limits; -}; -*/ -template<> -eProsima_user_DllExport size_t calculate_serialized_size( - eprosima::fastcdr::CdrSizeCalculator& calculator, - const ::detail::Calculator_Request& data, - size_t& current_alignment) -{ - using namespace detail; - - static_cast(data); - - eprosima::fastcdr::EncodingAlgorithmFlag previous_encoding = calculator.get_encoding(); - size_t calculated_size {calculator.begin_calculate_type_serialized_size( - eprosima::fastcdr::CdrVersion::XCDRv2 == calculator.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR, - current_alignment)}; - - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0x04e82a2b), - data.addition, current_alignment); - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0x096bbc8d), - data.subtraction, current_alignment); - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0x0e205a8d), - data.representation_limits, current_alignment); - - - calculated_size += calculator.end_calculate_type_serialized_size(previous_encoding, current_alignment); - - return calculated_size; -} - -template<> -eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& scdr, - const ::detail::Calculator_Request& data) -{ - using namespace detail; - - eprosima::fastcdr::Cdr::state current_state(scdr); - scdr.begin_serialize_type(current_state, - eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR); - - scdr - << eprosima::fastcdr::MemberId(0x04e82a2b) << data.addition - << eprosima::fastcdr::MemberId(0x096bbc8d) << data.subtraction - << eprosima::fastcdr::MemberId(0x0e205a8d) << data.representation_limits -; - scdr.end_serialize_type(current_state); -} - -template<> -eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr, - ::detail::Calculator_Request& data) -{ - using namespace detail; - - cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR, - [&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool - { - bool ret_value = true; - switch (mid.id) - { - case 0x04e82a2b: - dcdr >> data.addition; - break; - - case 0x096bbc8d: - dcdr >> data.subtraction; - break; - - case 0x0e205a8d: - dcdr >> data.representation_limits; - break; - - default: - ret_value = false; - break; - } - return ret_value; - }); -} - -void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const ::detail::Calculator_Request& data) -{ - static_cast(scdr); - static_cast(data); -} - -// Serialization methods for detail::Calculator_Reply -/* -struct Calculator_Reply -{ - eprosima::fastcdr::optional addition; - eprosima::fastcdr::optional subtraction; - eprosima::fastcdr::optional representation_limits; - eprosima::fastcdr::optional remoteEx; -}; -*/ -template<> -eProsima_user_DllExport size_t calculate_serialized_size( - eprosima::fastcdr::CdrSizeCalculator& calculator, - const ::detail::Calculator_Reply& data, - size_t& current_alignment) -{ - using namespace detail; - - static_cast(data); - - eprosima::fastcdr::EncodingAlgorithmFlag previous_encoding = calculator.get_encoding(); - size_t calculated_size {calculator.begin_calculate_type_serialized_size( - eprosima::fastcdr::CdrVersion::XCDRv2 == calculator.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR, - current_alignment)}; - - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0x04e82a2b), - data.addition, current_alignment); - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0x096bbc8d), - data.subtraction, current_alignment); - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0x0e205a8d), - data.representation_limits, current_alignment); - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0x0f8e48f0), - data.remoteEx, current_alignment); - - - calculated_size += calculator.end_calculate_type_serialized_size(previous_encoding, current_alignment); - - return calculated_size; -} - -template<> -eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& scdr, - const ::detail::Calculator_Reply& data) -{ - using namespace detail; - - eprosima::fastcdr::Cdr::state current_state(scdr); - scdr.begin_serialize_type(current_state, - eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR); - - scdr - << eprosima::fastcdr::MemberId(0x04e82a2b) << data.addition - << eprosima::fastcdr::MemberId(0x096bbc8d) << data.subtraction - << eprosima::fastcdr::MemberId(0x0e205a8d) << data.representation_limits - << eprosima::fastcdr::MemberId(0x0f8e48f0) << data.remoteEx -; - scdr.end_serialize_type(current_state); -} - -template<> -eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr, - ::detail::Calculator_Reply& data) -{ - using namespace detail; - - cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR, - [&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool - { - bool ret_value = true; - switch (mid.id) - { - case 0x04e82a2b: - dcdr >> data.addition; - break; - - case 0x096bbc8d: - dcdr >> data.subtraction; - break; - - case 0x0e205a8d: - dcdr >> data.representation_limits; - break; - - case 0x0f8e48f0: - dcdr >> data.remoteEx; - break; - - default: - ret_value = false; - break; - } - return ret_value; - }); -} - -void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const ::detail::Calculator_Reply& data) -{ - static_cast(scdr); - static_cast(data); -} - -//} // top level - -//} // Calculator interface - - -} // namespace fastcdr -} // namespace eprosima - -#endif // FAST_DDS_GENERATED__CALCULATORCDRAUX_IPP - diff --git a/fastdds_python_examples/RPCExample/generated_code/calculatorClient.cxx b/fastdds_python_examples/RPCExample/generated_code/calculatorClient.cxx deleted file mode 100644 index 03fa8706..00000000 --- a/fastdds_python_examples/RPCExample/generated_code/calculatorClient.cxx +++ /dev/null @@ -1,568 +0,0 @@ -// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/*! - * @file calculatorClient.cxx - * Client implementation for interfaces - * - * This file was generated by the tool fastddsgen (version: 4.2.0). - */ - -#include "calculatorClient.hpp" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "calculator.hpp" -#include "calculator_details.hpp" -#include "calculatorPubSubTypes.hpp" - -namespace calculator_base { - - -} // namespace calculator_base - -//{ interface Calculator - -namespace detail { - -namespace fdds = eprosima::fastdds::dds; -namespace frpc = eprosima::fastdds::dds::rpc; -namespace frtps = eprosima::fastdds::rtps; - -class CalculatorClient : public Calculator -{ - - using RequestType = Calculator_Request; - using ReplyType = Calculator_Reply; - -public: - - CalculatorClient( - fdds::DomainParticipant& part, - const char* service_name, - const fdds::RequesterQos& qos) - : Calculator() - , participant_(part) - { - // Register the service type support - auto service_type = create_Calculator_service_type_support(); - auto ret = service_type.register_service_type(&participant_, "Calculator"); - if (ret != fdds::RETCODE_OK) - { - throw std::runtime_error("Error registering service type"); - } - - // Create the service - service_ = participant_.create_service(service_name, "Calculator"); - if (nullptr == service_) - { - throw std::runtime_error("Error creating service"); - } - - // Create the requester - requester_ = participant_.create_service_requester(service_, qos); - if (nullptr == requester_) - { - throw std::runtime_error("Error creating requester"); - } - - // Start the processing thread - start_thread(); - } - - ~CalculatorClient() override - { - // Stop the processing thread - stop_thread(); - - // Destroy the requester - if (nullptr != requester_) - { - participant_.delete_service_requester(service_->get_service_name(), requester_); - requester_ = nullptr; - } - - // Destroy the service - if (nullptr != service_) - { - participant_.delete_service(service_); - service_ = nullptr; - } - } - -private: - - void start_thread() - { - stop_thread_ = false; - processing_thread_ = std::thread(&CalculatorClient::run, this); - } - - void stop_thread() - { - stop_thread_ = true; - if (processing_thread_.joinable()) - { - processing_thread_.join(); - } - } - - void run() - { - while (!stop_thread_) - { - // Wait for a reply - if (requester_->get_requester_reader()->wait_for_unread_message({ 0, 100000000 })) - { - // Take and process the reply - frpc::RequestInfo req_info; - ReplyType reply; - auto ret = requester_->take_reply(&reply, req_info); - if (ret == fdds::RETCODE_OK) - { - process_reply(reply, req_info); - } - } - } - } - - void process_reply( - const ReplyType& reply, - const frpc::RequestInfo& req_info) - { - auto sample_id = req_info.related_sample_identity; - { - std::lock_guard _(mtx_); - auto it = pending_results_.find(sample_id); - if (it != pending_results_.end()) - { - bool should_erase = false; - it->second->process_reply(reply, req_info, should_erase); - if (should_erase) - { - pending_results_.erase(it); - } - } - } - } - - struct IReplyProcessor - { - frpc::RequestInfo info; - - virtual ~IReplyProcessor() = default; - - virtual void process_reply( - const ReplyType& reply, - const frpc::RequestInfo& req_info, - bool& should_remove) = 0; - - }; - - fdds::DomainParticipant& participant_; - frpc::Service* service_ = nullptr; - frpc::Requester* requester_ = nullptr; - std::atomic stop_thread_{false}; - std::thread processing_thread_; - std::mutex mtx_; - std::map> pending_results_; - - //{ request helpers - - template - std::future send_request_with_promise( - const RequestType& request, - std::shared_ptr result, - std::promise& promise) - { - result->info.related_sample_identity.writer_guid(requester_->get_requester_reader()->guid()); - if (fdds::RETCODE_OK == requester_->send_request((void*)&request, result->info)) - { - std::lock_guard _ (mtx_); - pending_results_[result->info.related_sample_identity] = result; - } - else - { - promise.set_exception( - std::make_exception_ptr(frpc::RpcBrokenPipeException(false))); - } - - return promise.get_future(); - } - - template - std::shared_ptr send_request_with_reader( - const RequestType& request, - std::shared_ptr result) - { - result->info.related_sample_identity.writer_guid(requester_->get_requester_reader()->guid()); - if (fdds::RETCODE_OK == requester_->send_request((void*)&request, result->info)) - { - std::lock_guard _ (mtx_); - pending_results_[result->info.related_sample_identity] = result; - } - else - { - result->set_exception( - std::make_exception_ptr(frpc::RpcBrokenPipeException(false))); - } - - return result; - } - - //} request helpers - - //{ reply helpers - - template - static void set_invalid_reply( - T& exception_receiver) - { - exception_receiver.set_exception( - std::make_exception_ptr(frpc::RemoteInvalidArgumentError("An invalid reply was received"))); - } - - template - static void set_remote_exception( - T& exception_receiver, - const frpc::RemoteExceptionCode_t& exception) - { - switch (exception) - { - case frpc::RemoteExceptionCode_t::REMOTE_EX_OK: - set_invalid_reply(exception_receiver); - break; - case frpc::RemoteExceptionCode_t::REMOTE_EX_UNSUPPORTED: - exception_receiver.set_exception(std::make_exception_ptr(frpc::RemoteUnsupportedError())); - break; - case frpc::RemoteExceptionCode_t::REMOTE_EX_INVALID_ARGUMENT: - exception_receiver.set_exception(std::make_exception_ptr(frpc::RemoteInvalidArgumentError())); - break; - case frpc::RemoteExceptionCode_t::REMOTE_EX_OUT_OF_RESOURCES: - exception_receiver.set_exception(std::make_exception_ptr(frpc::RemoteOutOfResourcesError())); - break; - case frpc::RemoteExceptionCode_t::REMOTE_EX_UNKNOWN_OPERATION: - exception_receiver.set_exception(std::make_exception_ptr(frpc::RemoteUnknownOperationError())); - break; - default: // REMOTE_EX_UNKNOWN_EXCEPTION - exception_receiver.set_exception(std::make_exception_ptr(frpc::RemoteUnknownExceptionError())); - break; - } - } - - static size_t count_reply_fields( - const ReplyType& reply) - { - size_t n_fields = 0; - n_fields += reply.addition.has_value() ? 1 : 0; - n_fields += reply.subtraction.has_value() ? 1 : 0; - n_fields += reply.representation_limits.has_value() ? 1 : 0; - n_fields += reply.remoteEx.has_value() ? 1 : 0; - return n_fields; - } - - template - static bool validate_reply( - std::promise& promise, - const ReplyType& reply) - { - // Check if the reply has one and only one field set - size_t n_fields = count_reply_fields(reply); - if (n_fields != 1u) - { - set_invalid_reply(promise); - return false; - } - - return true; - } - - struct IExceptionHolder - { - virtual ~IExceptionHolder() = default; - - virtual void set_exception( - std::exception_ptr exception) = 0; - }; - - static bool validate_reply( - IExceptionHolder& reader, - const ReplyType& reply) - { - // Check if the reply has one and only one field set - size_t n_fields = count_reply_fields(reply); - if (n_fields != 1u) - { - set_invalid_reply(reader); - return false; - } - return true; - } - - //} reply helpers - - //{ operation addition - -public: - - eprosima::fastdds::dds::rpc::RpcFuture addition( - /*in*/ int32_t value1, - /*in*/ int32_t value2) override - { - // Create a promise to hold the result - auto result = std::make_shared(); - - // Create and send the request - RequestType request; - request.addition = calculator_base::detail::Adder_addition_In{}; - request.addition->value1 = value1; - request.addition->value2 = value2; - - return send_request_with_promise(request, result, result->promise); - } - -private: - - struct addition_promise : public IReplyProcessor - { - std::promise promise; - - void process_reply( - const ReplyType& reply, - const frpc::RequestInfo& req_info, - bool& should_remove) override - { - should_remove = false; - if (req_info.related_sample_identity != info.related_sample_identity) - { - return; - } - - should_remove = true; - if (!validate_reply(promise, reply)) - { - return; - } - - if (reply.remoteEx.has_value()) - { - set_remote_exception(promise, reply.remoteEx.value()); - return; - } - - if (reply.addition.has_value()) - { - const auto& result = reply.addition.value(); - if (result.result.has_value()) - { - const auto& out = result.result.value(); - promise.set_value(out.return_); - return; - } - if (result.calculator_base_OverflowException_ex.has_value()) - { - promise.set_exception( - std::make_exception_ptr(result.calculator_base_OverflowException_ex.value())); - return; - } - } - - // If we reach this point, the reply is for another operation - set_invalid_reply(promise); - } - - }; - - - - //} operation addition - - //{ operation subtraction - -public: - - eprosima::fastdds::dds::rpc::RpcFuture subtraction( - /*in*/ int32_t value1, - /*in*/ int32_t value2) override - { - // Create a promise to hold the result - auto result = std::make_shared(); - - // Create and send the request - RequestType request; - request.subtraction = calculator_base::detail::Subtractor_subtraction_In{}; - request.subtraction->value1 = value1; - request.subtraction->value2 = value2; - - return send_request_with_promise(request, result, result->promise); - } - -private: - - struct subtraction_promise : public IReplyProcessor - { - std::promise promise; - - void process_reply( - const ReplyType& reply, - const frpc::RequestInfo& req_info, - bool& should_remove) override - { - should_remove = false; - if (req_info.related_sample_identity != info.related_sample_identity) - { - return; - } - - should_remove = true; - if (!validate_reply(promise, reply)) - { - return; - } - - if (reply.remoteEx.has_value()) - { - set_remote_exception(promise, reply.remoteEx.value()); - return; - } - - if (reply.subtraction.has_value()) - { - const auto& result = reply.subtraction.value(); - if (result.result.has_value()) - { - const auto& out = result.result.value(); - promise.set_value(out.return_); - return; - } - if (result.calculator_base_OverflowException_ex.has_value()) - { - promise.set_exception( - std::make_exception_ptr(result.calculator_base_OverflowException_ex.value())); - return; - } - } - - // If we reach this point, the reply is for another operation - set_invalid_reply(promise); - } - - }; - - - - //} operation subtraction - - //{ operation representation_limits - -public: - - eprosima::fastdds::dds::rpc::RpcFuture representation_limits( -) override - { - // Create a promise to hold the result - auto result = std::make_shared(); - - // Create and send the request - RequestType request; - request.representation_limits = detail::Calculator_representation_limits_In{}; - return send_request_with_promise(request, result, result->promise); - } - -private: - - struct representation_limits_promise : public IReplyProcessor - { - std::promise promise; - - void process_reply( - const ReplyType& reply, - const frpc::RequestInfo& req_info, - bool& should_remove) override - { - should_remove = false; - if (req_info.related_sample_identity != info.related_sample_identity) - { - return; - } - - should_remove = true; - if (!validate_reply(promise, reply)) - { - return; - } - - if (reply.remoteEx.has_value()) - { - set_remote_exception(promise, reply.remoteEx.value()); - return; - } - - if (reply.representation_limits.has_value()) - { - const auto& result = reply.representation_limits.value(); - if (result.result.has_value()) - { - const auto& out = result.result.value(); - promise.set_value(out); - return; - } - } - - // If we reach this point, the reply is for another operation - set_invalid_reply(promise); - } - - }; - - - - //} operation representation_limits - - -}; - -} // namespace detail - -std::shared_ptr create_CalculatorClient( - eprosima::fastdds::dds::DomainParticipant& part, - const char* service_name, - const eprosima::fastdds::dds::RequesterQos& qos) -{ - return std::make_shared(part, service_name, qos); -} - -//} interface CalculatorClient diff --git a/fastdds_python_examples/RPCExample/generated_code/calculatorClient.hpp b/fastdds_python_examples/RPCExample/generated_code/calculatorClient.hpp deleted file mode 100644 index 27cb4edf..00000000 --- a/fastdds_python_examples/RPCExample/generated_code/calculatorClient.hpp +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/*! - * @file calculatorClient.hpp - * Client implementation for interfaces - * - * This file was generated by the tool fastddsgen (version: 4.2.0). - */ - -#ifndef FAST_DDS_GENERATED__CALCULATOR_CLIENT_HPP -#define FAST_DDS_GENERATED__CALCULATOR_CLIENT_HPP - -#include - -#include -#include - -#include "calculator.hpp" - -namespace calculator_base { - - -} // namespace calculator_base - -extern eProsima_user_DllExport std::shared_ptr create_CalculatorClient( - eprosima::fastdds::dds::DomainParticipant& part, - const char* service_name, - const eprosima::fastdds::dds::RequesterQos& qos); - - -#endif // FAST_DDS_GENERATED__CALCULATOR_CLIENT_HPP diff --git a/fastdds_python_examples/RPCExample/generated_code/calculatorPubSubTypes.cxx b/fastdds_python_examples/RPCExample/generated_code/calculatorPubSubTypes.cxx deleted file mode 100644 index c86e522e..00000000 --- a/fastdds_python_examples/RPCExample/generated_code/calculatorPubSubTypes.cxx +++ /dev/null @@ -1,349 +0,0 @@ -// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/*! - * @file calculatorPubSubTypes.cpp - * This header file contains the implementation of the serialization functions. - * - * This file was generated by the tool fastddsgen (version: 4.2.0). - */ - -#include "calculatorPubSubTypes.hpp" - -#include -#include - -#include "calculatorCdrAux.hpp" -#include "calculatorTypeObjectSupport.hpp" - -using SerializedPayload_t = eprosima::fastdds::rtps::SerializedPayload_t; -using InstanceHandle_t = eprosima::fastdds::rtps::InstanceHandle_t; -using DataRepresentationId_t = eprosima::fastdds::dds::DataRepresentationId_t; - -namespace calculator_base { -} // namespace calculator_base - -// { Calculator interface - -class Calculator_RequestPubSubType : public eprosima::fastdds::dds::TopicDataType -{ -public: - // Alias for the type to be serialized. - typedef detail::Calculator_Request type; - - // Constructor - Calculator_RequestPubSubType() - { - set_name("Calculator_Request"); - uint32_t type_size = 56UL; - type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - max_serialized_type_size = type_size + 4; /*encapsulation*/ - is_compute_key_provided = false; - } - - // Destructor - ~Calculator_RequestPubSubType() override = default; - - // This function serializes the data. - eProsima_user_DllExport bool serialize( - const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t& payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override - { - const type* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.max_size); - // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::CdrVersion::XCDRv1 : eprosima::fastcdr::CdrVersion::XCDRv2); - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - ser.set_encoding_flag( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR : - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR2); - - try - { - // Serialize encapsulation - ser.serialize_encapsulation(); - // Serialize the object. - ser << *p_type; - ser.set_dds_cdr_options({0,0}); - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return false; - } - - // Get the serialized length - payload.length = static_cast(ser.get_serialized_data_length()); - return true; - } - - eProsima_user_DllExport bool deserialize( - eprosima::fastdds::rtps::SerializedPayload_t& payload, - void* data) override - { - try - { - // Convert DATA to pointer of your type - type* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.length); - - // Object that deserializes the data. - eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN); - - // Deserialize encapsulation. - deser.read_encapsulation(); - payload.encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - // Deserialize the object. - deser >> *p_type; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return false; - } - - return true; - } - - eProsima_user_DllExport uint32_t calculate_serialized_size( - const void* const data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override - { - try - { - eprosima::fastcdr::CdrSizeCalculator calculator( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::CdrVersion::XCDRv1 : eprosima::fastcdr::CdrVersion::XCDRv2); - size_t current_alignment {0}; - return static_cast(calculator.calculate_serialized_size( - *static_cast(data), current_alignment)) + - 4u /*encapsulation*/; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return 0; - } - } - - eProsima_user_DllExport bool compute_key( - eprosima::fastdds::rtps::SerializedPayload_t& payload, - eprosima::fastdds::rtps::InstanceHandle_t& ihandle, - bool force_md5 = false) override - { - static_cast(payload); - static_cast(ihandle); - static_cast(force_md5); - return false; - } - - eProsima_user_DllExport bool compute_key( - const void* const data, - eprosima::fastdds::rtps::InstanceHandle_t& ihandle, - bool force_md5 = false) override - { - static_cast(data); - static_cast(ihandle); - static_cast(force_md5); - return false; - } - - eProsima_user_DllExport void* create_data() override - { - return new type(); - } - - eProsima_user_DllExport void delete_data( - void* data) override - { - type* pData = static_cast(data); - delete pData; - } - - eProsima_user_DllExport void register_type_object_representation() override - { - register_Calculator_Request_type_identifier(type_identifiers_); - } - -}; - -class Calculator_ReplyPubSubType : public eprosima::fastdds::dds::TopicDataType -{ -public: - // Alias for the type to be serialized. - typedef detail::Calculator_Reply type; - - // Constructor - Calculator_ReplyPubSubType() - { - set_name("Calculator_Reply"); - uint32_t type_size = 56UL; - type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - max_serialized_type_size = type_size + 4; /*encapsulation*/ - is_compute_key_provided = false; - } - - // Destructor - ~Calculator_ReplyPubSubType() override = default; - - // This function serializes the data. - eProsima_user_DllExport bool serialize( - const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t& payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override - { - const type* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.max_size); - // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::CdrVersion::XCDRv1 : eprosima::fastcdr::CdrVersion::XCDRv2); - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - ser.set_encoding_flag( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR : - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR2); - - try - { - // Serialize encapsulation - ser.serialize_encapsulation(); - // Serialize the object. - ser << *p_type; - ser.set_dds_cdr_options({0,0}); - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return false; - } - - // Get the serialized length - payload.length = static_cast(ser.get_serialized_data_length()); - return true; - } - - eProsima_user_DllExport bool deserialize( - eprosima::fastdds::rtps::SerializedPayload_t& payload, - void* data) override - { - try - { - // Convert DATA to pointer of your type - type* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.length); - - // Object that deserializes the data. - eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN); - - // Deserialize encapsulation. - deser.read_encapsulation(); - payload.encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - // Deserialize the object. - deser >> *p_type; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return false; - } - - return true; - } - - eProsima_user_DllExport uint32_t calculate_serialized_size( - const void* const data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override - { - try - { - eprosima::fastcdr::CdrSizeCalculator calculator( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::CdrVersion::XCDRv1 : eprosima::fastcdr::CdrVersion::XCDRv2); - size_t current_alignment {0}; - return static_cast(calculator.calculate_serialized_size( - *static_cast(data), current_alignment)) + - 4u /*encapsulation*/; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return 0; - } - } - - eProsima_user_DllExport bool compute_key( - eprosima::fastdds::rtps::SerializedPayload_t& payload, - eprosima::fastdds::rtps::InstanceHandle_t& ihandle, - bool force_md5 = false) override - { - static_cast(payload); - static_cast(ihandle); - static_cast(force_md5); - return false; - } - - eProsima_user_DllExport bool compute_key( - const void* const data, - eprosima::fastdds::rtps::InstanceHandle_t& ihandle, - bool force_md5 = false) override - { - static_cast(data); - static_cast(ihandle); - static_cast(force_md5); - return false; - } - - eProsima_user_DllExport void* create_data() override - { - return new type(); - } - - eProsima_user_DllExport void delete_data( - void* data) override - { - type* pData = static_cast(data); - delete pData; - } - - eProsima_user_DllExport void register_type_object_representation() override - { - register_Calculator_Reply_type_identifier(type_identifiers_); - } - -}; - -eprosima::fastdds::dds::rpc::ServiceTypeSupport create_Calculator_service_type_support() -{ - eprosima::fastdds::dds::TypeSupport request_type( - new Calculator_RequestPubSubType()); - eprosima::fastdds::dds::TypeSupport reply_type( - new Calculator_ReplyPubSubType()); - return eprosima::fastdds::dds::rpc::ServiceTypeSupport( - request_type, reply_type); -} - -// } // Calculator interface - - -// Include auxiliary functions like for serializing/deserializing. -#include "calculatorCdrAux.ipp" diff --git a/fastdds_python_examples/RPCExample/generated_code/calculatorPubSubTypes.hpp b/fastdds_python_examples/RPCExample/generated_code/calculatorPubSubTypes.hpp deleted file mode 100644 index c2bb138a..00000000 --- a/fastdds_python_examples/RPCExample/generated_code/calculatorPubSubTypes.hpp +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/*! - * @file calculatorPubSubTypes.hpp - * This header file contains the declaration of the serialization functions. - * - * This file was generated by the tool fastddsgen (version: 4.2.0). - */ - - -#ifndef FAST_DDS_GENERATED__CALCULATOR_PUBSUBTYPES_HPP -#define FAST_DDS_GENERATED__CALCULATOR_PUBSUBTYPES_HPP - -#include -#include -#include -#include -#include -#include - -#include "calculator.hpp" - - -#if !defined(FASTDDS_GEN_API_VER) || (FASTDDS_GEN_API_VER != 3) -#error \ - Generated calculator is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. -#endif // FASTDDS_GEN_API_VER - -namespace calculator_base -{ -} // namespace calculator_base -eProsima_user_DllExport eprosima::fastdds::dds::rpc::ServiceTypeSupport create_Calculator_service_type_support(); - - -#endif // FAST_DDS_GENERATED__CALCULATOR_PUBSUBTYPES_HPP - diff --git a/fastdds_python_examples/RPCExample/generated_code/calculatorPubSubTypes.i b/fastdds_python_examples/RPCExample/generated_code/calculatorPubSubTypes.i deleted file mode 100644 index 05309056..00000000 --- a/fastdds_python_examples/RPCExample/generated_code/calculatorPubSubTypes.i +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/*! - * @file calculatorPubSubTypes.i - * This header file contains the SWIG interface of the serialization functions. - * - * This file was generated by the tool fastddsgen (version: 4.2.0). - */ - -%import(module="fastdds") "fastdds/dds/topic/TopicDataType.hpp"; - -%{ -#include "calculatorPubSubTypes.hpp" -%} - -#define FASTDDS_GEN_API_VER 3 - -%include "calculatorPubSubTypes.hpp" diff --git a/fastdds_python_examples/RPCExample/generated_code/calculatorServer.cxx b/fastdds_python_examples/RPCExample/generated_code/calculatorServer.cxx deleted file mode 100644 index e4273ecd..00000000 --- a/fastdds_python_examples/RPCExample/generated_code/calculatorServer.cxx +++ /dev/null @@ -1,687 +0,0 @@ -// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/*! - * @file calculatorServer.cxx - * Server implementation for interfaces - * - * This file was generated by the tool fastddsgen (version: 4.2.0). - */ - -#include "calculatorServer.hpp" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "calculator.hpp" -#include "calculator_details.hpp" -#include "calculatorPubSubTypes.hpp" - -namespace calculator_base { - - -} // namespace calculator_base - -//{ interface Calculator - -namespace detail { - -namespace fdds = eprosima::fastdds::dds; -namespace frpc = eprosima::fastdds::dds::rpc; -namespace frtps = eprosima::fastdds::rtps; - -class CalculatorServerLogic - : public frpc::RpcServer - , public std::enable_shared_from_this -{ - using RequestType = Calculator_Request; - using ReplyType = Calculator_Reply; - -public: - - CalculatorServerLogic( - fdds::DomainParticipant& part, - const char* service_name, - const fdds::ReplierQos& qos, - size_t thread_pool_size, - std::shared_ptr implementation) - : CalculatorServerLogic( - part, - service_name, - qos, - std::make_shared(*this, thread_pool_size), - std::move(implementation)) - { - } - - CalculatorServerLogic( - fdds::DomainParticipant& part, - const char* service_name, - const fdds::ReplierQos& qos, - std::shared_ptr scheduler, - std::shared_ptr implementation) - : frpc::RpcServer() - , participant_(part) - , request_scheduler_(scheduler) - , implementation_(std::move(implementation)) - { - // Register the service type support - auto service_type = create_Calculator_service_type_support(); - auto ret = service_type.register_service_type(&participant_, "Calculator"); - if (ret != fdds::RETCODE_OK) - { - throw std::runtime_error("Error registering service type"); - } - - // Create the service - service_ = participant_.create_service(service_name, "Calculator"); - if (nullptr == service_) - { - throw std::runtime_error("Error creating service"); - } - - // Create the replier - replier_ = participant_.create_service_replier(service_, qos); - if (nullptr == replier_) - { - throw std::runtime_error("Error creating requester"); - } - } - - ~CalculatorServerLogic() override - { - if (nullptr != replier_) - { - participant_.delete_service_replier(service_->get_service_name(), replier_); - } - - if (nullptr != service_) - { - participant_.delete_service(service_); - } - } - - void run() override - { - finish_condition_.set_trigger_value(false); - fdds::WaitSet waitset; - waitset.attach_condition(finish_condition_); - fdds::StatusCondition& status_condition = replier_->get_replier_reader()->get_statuscondition(); - status_condition.set_enabled_statuses(fdds::StatusMask::data_available()); - waitset.attach_condition(status_condition); - - while (true) - { - fdds::ConditionSeq active_conditions; - waitset.wait(active_conditions, fdds::c_TimeInfinite); - - // Early exit if the finish condition is triggered - if (finish_condition_.get_trigger_value()) - { - break; - } - - // Take and process the requests - auto ctx = std::make_shared(); - while (fdds::RETCODE_OK == ctx->take_from(replier_)) - { - if (ctx->validate_request()) - { - process_request(ctx); - } - else - { - ctx->send_exception(frpc::RemoteExceptionCode_t::REMOTE_EX_INVALID_ARGUMENT, replier_); - } - - // Prepare next request context - ctx = std::make_shared(); - } - } - } - - void stop() override - { - // Notify all threads to finish - finish_condition_.set_trigger_value(true); - - // Cancel all pending requests - { - std::lock_guard _(mtx_); - for (auto& it : processing_requests_) - { - it.second->cancel(); - } - processing_requests_.clear(); - } - - // Wait for all threads to finish - request_scheduler_->server_stopped(shared_from_this()); - } - - void execute_request( - const std::shared_ptr& request) override - { - auto ctx = std::dynamic_pointer_cast(request); - if (ctx) - { - execute_request(ctx); - } - else - { - throw std::runtime_error("Invalid request context type"); - } - } - -private: - - //{ Output feed helpers - - struct IOutputFeedCancellator - { - virtual ~IOutputFeedCancellator() = default; - virtual void cancel() = 0; - }; - - //} Output feed helpers - - //{ Input feed helpers - - struct IInputFeedProcessor - { - virtual ~IInputFeedProcessor() = default; - virtual bool process_additional_request( - const RequestType& request) = 0; - virtual void cancel_input_feed() = 0; - }; - - //} Input feed helpers - - //{ operation addition - - //} operation addition - - //{ operation subtraction - - //} operation subtraction - - //{ operation representation_limits - - //} operation representation_limits - - struct RequestContext : frpc::RpcRequest - { - RequestType request; - frpc::RequestInfo info; - frtps::GUID_t client_id; - fdds::PublicationBuiltinTopicData pub_data; - - struct addition_feeds_t - { - } - addition_feeds; - - struct subtraction_feeds_t - { - } - subtraction_feeds; - - struct representation_limits_feeds_t - { - } - representation_limits_feeds; - - const frtps::GUID_t& get_client_id() const override - { - return client_id; - } - - const frtps::RemoteLocatorList& get_client_locators() const override - { - return pub_data.remote_locators; - } - - fdds::ReturnCode_t take_from( - frpc::Replier* replier) - { - fdds::ReturnCode_t ret = replier->take_request(&request, info); - if (ret == fdds::RETCODE_OK) - { - client_id = info.sample_identity.writer_guid(); - ret = replier->get_replier_reader()->get_matched_publication_data(pub_data, client_id); - } - return ret; - } - - bool validate_request() const - { - size_t n_fields = 0; - n_fields += request.addition.has_value() ? 1 : 0; - n_fields += request.subtraction.has_value() ? 1 : 0; - n_fields += request.representation_limits.has_value() ? 1 : 0; - - return n_fields == 1U; - } - - void process_additional_request( - const std::shared_ptr& ctx, - frpc::Replier* replier, - bool& should_erase) - { - should_erase = false; - if (ctx->info.related_sample_identity == info.related_sample_identity) - { - // Pass request to input feed processors - should_erase = true; - for (const auto& input_feed : input_feed_processors_) - { - if (input_feed->process_additional_request(ctx->request)) - { - should_erase = false; - break; - } - } - - // If no input feed processor handled the request, send an exception - if (should_erase) - { - send_exception(frpc::RemoteExceptionCode_t::REMOTE_EX_INVALID_ARGUMENT, replier); - } - } - else - { - // This is not the expected request - should_erase = true; - } - } - - bool prepare( - frpc::Replier* replier) - { - if (request.addition.has_value()) - { - return prepare_addition(replier); - } - - if (request.subtraction.has_value()) - { - return prepare_subtraction(replier); - } - - if (request.representation_limits.has_value()) - { - return prepare_representation_limits(replier); - } - - - send_exception(frpc::RemoteExceptionCode_t::REMOTE_EX_UNKNOWN_OPERATION, replier); - return false; - } - - void send_exception( - frpc::RemoteExceptionCode_t ex, - frpc::Replier* replier) - { - ReplyType reply{}; - reply.remoteEx = ex; - replier->send_reply(&reply, info); - } - - void cancel() - { - // Cancel output feed - if (output_feed_cancellator_) - { - output_feed_cancellator_->cancel(); - } - - // Cancel input feeds - for (const auto& input_feed : input_feed_processors_) - { - input_feed->cancel_input_feed(); - } - } - - private: - - std::shared_ptr output_feed_cancellator_; - std::vector> input_feed_processors_; - - bool prepare_addition( - frpc::Replier* replier) - { - static_cast(replier); - return true; - } - - bool prepare_subtraction( - frpc::Replier* replier) - { - static_cast(replier); - return true; - } - - bool prepare_representation_limits( - frpc::Replier* replier) - { - static_cast(replier); - return true; - } - - }; - - struct ThreadPool - : public frpc::RpcServerSchedulingStrategy - { - ThreadPool( - CalculatorServerLogic& server, - size_t num_threads) - : server_(server) - { - // Create worker threads (at least one) - if (num_threads == 0) - { - num_threads = 1; - } - - auto process_requests = [this]() - { - while (!finished_) - { - std::shared_ptr req; - { - std::unique_lock lock(mtx_); - cv_.wait(lock, [this]() - { - return finished_ || !requests_.empty(); - }); - if (finished_) - { - break; - } - req = requests_.front(); - requests_.pop(); - } - - // Process the request - server_.execute_request(req); - } - }; - - for (size_t i = 0; i < num_threads; ++i) - { - threads_.emplace_back(process_requests); - } - } - - void schedule_request( - const std::shared_ptr& req, - const std::shared_ptr& server) override - { - static_cast(server); - - std::lock_guard lock(mtx_); - if (!finished_) - { - requests_.push(req); - cv_.notify_one(); - } - } - - void server_stopped( - const std::shared_ptr& server) override - { - static_cast(server); - - // Notify all threads in the pool to stop - { - std::lock_guard lock(mtx_); - finished_ = true; - cv_.notify_all(); - } - - // Wait for all threads to finish - for (auto& thread : threads_) - { - if (thread.joinable()) - { - thread.join(); - } - } - threads_.clear(); - } - - CalculatorServerLogic& server_; - std::mutex mtx_; - std::condition_variable cv_; - std::queue> requests_; - bool finished_{ false }; - std::vector threads_; - }; - - void process_request( - const std::shared_ptr& ctx) - { - auto id = ctx->info.related_sample_identity; - - { - std::lock_guard _(mtx_); - auto it = processing_requests_.find(id); - if (it != processing_requests_.end()) - { - bool should_erase = false; - it->second->process_additional_request(ctx, replier_, should_erase); - if (should_erase) - { - processing_requests_.erase(it); - } - return; - } - - if (!ctx->prepare(replier_)) - { - return; - } - - processing_requests_[id] = ctx; - } - - request_scheduler_->schedule_request(ctx, shared_from_this()); - } - - void execute_request( - const std::shared_ptr& req) - { - try - { - for (;;) - { - if (req->request.addition.has_value()) - { - try - { - ReplyType reply{}; - reply.addition = calculator_base::detail::Adder_addition_Result{}; - reply.addition->result = calculator_base::detail::Adder_addition_Out{}; - reply.addition->result->return_ = implementation_->addition( - *req, - req->request.addition->value1, - req->request.addition->value2); - replier_->send_reply(&reply, req->info); - } - catch (const calculator_base::OverflowException& ex) - { - ReplyType reply{}; - reply.addition = calculator_base::detail::Adder_addition_Result{}; - reply.addition->calculator_base_OverflowException_ex = ex; - replier_->send_reply(&reply, req->info); - } - break; - } - - if (req->request.subtraction.has_value()) - { - try - { - ReplyType reply{}; - reply.subtraction = calculator_base::detail::Subtractor_subtraction_Result{}; - reply.subtraction->result = calculator_base::detail::Subtractor_subtraction_Out{}; - reply.subtraction->result->return_ = implementation_->subtraction( - *req, - req->request.subtraction->value1, - req->request.subtraction->value2); - replier_->send_reply(&reply, req->info); - } - catch (const calculator_base::OverflowException& ex) - { - ReplyType reply{}; - reply.subtraction = calculator_base::detail::Subtractor_subtraction_Result{}; - reply.subtraction->calculator_base_OverflowException_ex = ex; - replier_->send_reply(&reply, req->info); - } - break; - } - - if (req->request.representation_limits.has_value()) - { - { - ReplyType reply{}; - reply.representation_limits = detail::Calculator_representation_limits_Result{}; - reply.representation_limits->result = implementation_->representation_limits( - *req); - replier_->send_reply(&reply, req->info); - } - break; - } - - req->send_exception(frpc::RemoteExceptionCode_t::REMOTE_EX_UNSUPPORTED, replier_); - break; - } - } - catch (const frpc::RpcRemoteException& ex) - { - req->send_exception(ex.code(), replier_); - } - catch (...) - { - req->send_exception(frpc::RemoteExceptionCode_t::REMOTE_EX_UNKNOWN_EXCEPTION, replier_); - } - - { - std::lock_guard _(mtx_); - processing_requests_.erase(req->info.related_sample_identity); - } - } - - fdds::DomainParticipant& participant_; - frpc::Service* service_ = nullptr; - frpc::Replier* replier_ = nullptr; - fdds::GuardCondition finish_condition_; - std::mutex mtx_; - std::map> processing_requests_; - std::shared_ptr request_scheduler_; - std::shared_ptr implementation_; - -}; - -struct CalculatorServerProxy - : public frpc::RpcServer -{ - CalculatorServerProxy( - std::shared_ptr impl) - : impl_(std::move(impl)) - { - } - - ~CalculatorServerProxy() override - { - if (impl_) - { - impl_->stop(); - } - } - - void run() override - { - impl_->run(); - } - - void stop() override - { - impl_->stop(); - } - - void execute_request( - const std::shared_ptr& request) override - { - impl_->execute_request(request); - } - -private: - - std::shared_ptr impl_; -}; - -} // namespace detail - -std::shared_ptr create_CalculatorServer( - eprosima::fastdds::dds::DomainParticipant& part, - const char* service_name, - const eprosima::fastdds::dds::ReplierQos& qos, - size_t thread_pool_size, - std::shared_ptr implementation) -{ - auto ptr = std::make_shared( - part, service_name, qos, thread_pool_size, implementation); - return std::make_shared(ptr); -} - -std::shared_ptr create_CalculatorServer( - eprosima::fastdds::dds::DomainParticipant& part, - const char* service_name, - const eprosima::fastdds::dds::ReplierQos& qos, - std::shared_ptr scheduler, - std::shared_ptr implementation) -{ - auto ptr = std::make_shared( - part, service_name, qos, scheduler, implementation); - return std::make_shared(ptr); -} - -//} interface Calculator - diff --git a/fastdds_python_examples/RPCExample/generated_code/calculatorServer.hpp b/fastdds_python_examples/RPCExample/generated_code/calculatorServer.hpp deleted file mode 100644 index 0bebd560..00000000 --- a/fastdds_python_examples/RPCExample/generated_code/calculatorServer.hpp +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/*! - * @file calculatorServer.hpp - * Server implementation for interfaces - * - * This file was generated by the tool fastddsgen (version: 4.2.0). - */ - -#ifndef FAST_DDS_GENERATED__CALCULATOR_SERVER_HPP -#define FAST_DDS_GENERATED__CALCULATOR_SERVER_HPP - -#include - -#include -#include -#include -#include -#include -#include - -#include "calculator.hpp" - -namespace calculator_base { - - -} // namespace calculator_base - -struct CalculatorServer_IServerImplementation -{ - virtual ~CalculatorServer_IServerImplementation() = default; - - virtual int32_t addition( - const eprosima::fastdds::dds::rpc::RpcRequest& info, - /*in*/ int32_t value1, - /*in*/ int32_t value2) = 0; - - - - virtual int32_t subtraction( - const eprosima::fastdds::dds::rpc::RpcRequest& info, - /*in*/ int32_t value1, - /*in*/ int32_t value2) = 0; - - - - virtual detail::Calculator_representation_limits_Out representation_limits( - const eprosima::fastdds::dds::rpc::RpcRequest& info) = 0; - -}; - -/** - * @brief Create a Calculator server instance. - * - * @param part The DomainParticipant to use for the server. - * @param service_name The name of the service. - * @param qos The QoS settings for the server. - * @param thread_pool_size The size of the thread pool to use for processing requests. - * When set to 0, a pool with a single thread will be created. - * @param implementation The implementation of the server interface. - */ -extern eProsima_user_DllExport std::shared_ptr create_CalculatorServer( - eprosima::fastdds::dds::DomainParticipant& part, - const char* service_name, - const eprosima::fastdds::dds::ReplierQos& qos, - size_t thread_pool_size, - std::shared_ptr implementation); - -/** - * @brief Create a Calculator server instance. - * - * @param part The DomainParticipant to use for the server. - * @param service_name The name of the service. - * @param qos The QoS settings for the server. - * @param scheduler The request scheduling strategy to use for the server. - * @param implementation The implementation of the server interface. - */ -extern eProsima_user_DllExport std::shared_ptr create_CalculatorServer( - eprosima::fastdds::dds::DomainParticipant& part, - const char* service_name, - const eprosima::fastdds::dds::ReplierQos& qos, - std::shared_ptr scheduler, - std::shared_ptr implementation); - - -#endif // FAST_DDS_GENERATED__CALCULATOR_CLIENT_HPP diff --git a/fastdds_python_examples/RPCExample/generated_code/calculatorServerImpl.hpp b/fastdds_python_examples/RPCExample/generated_code/calculatorServerImpl.hpp deleted file mode 100644 index 45e4c5fe..00000000 --- a/fastdds_python_examples/RPCExample/generated_code/calculatorServerImpl.hpp +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/*! - * @file calculatorServerImpl.hpp - * Server implementation for interfaces - * - * This file was generated by the tool fastddsgen (version: 4.2.0). - */ - -#ifndef FAST_DDS_GENERATED__CALCULATOR_SERVERIMPL_HPP -#define FAST_DDS_GENERATED__CALCULATOR_SERVERIMPL_HPP - -#include "calculator.hpp" -#include "calculatorServer.hpp" - -namespace calculator_base { - - -} // namespace calculator_base - -//{ interface Calculator - -struct CalculatorServerImplementation : - public CalculatorServer_IServerImplementation -{ - - int32_t addition( - const eprosima::fastdds::dds::rpc::RpcRequest& info, - /*in*/ int32_t value1, - /*in*/ int32_t value2) override - { - static_cast(info); - static_cast(value1); - static_cast(value2); - throw eprosima::fastdds::dds::rpc::RemoteUnsupportedError("Operation 'addition' is not implemented"); - } - - int32_t subtraction( - const eprosima::fastdds::dds::rpc::RpcRequest& info, - /*in*/ int32_t value1, - /*in*/ int32_t value2) override - { - static_cast(info); - static_cast(value1); - static_cast(value2); - throw eprosima::fastdds::dds::rpc::RemoteUnsupportedError("Operation 'subtraction' is not implemented"); - } - - detail::Calculator_representation_limits_Out representation_limits( - const eprosima::fastdds::dds::rpc::RpcRequest& info) override - { - static_cast(info); - throw eprosima::fastdds::dds::rpc::RemoteUnsupportedError("Operation 'representation_limits' is not implemented"); - } - -}; - -//} interface Calculator - - -#endif // FAST_DDS_GENERATED__CALCULATOR_SERVERIMPL_HPP diff --git a/fastdds_python_examples/RPCExample/generated_code/calculatorTypeObjectSupport.cxx b/fastdds_python_examples/RPCExample/generated_code/calculatorTypeObjectSupport.cxx deleted file mode 100644 index 45aa1135..00000000 --- a/fastdds_python_examples/RPCExample/generated_code/calculatorTypeObjectSupport.cxx +++ /dev/null @@ -1,1213 +0,0 @@ -// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/*! - * @file calculatorTypeObjectSupport.cxx - * Source file containing the implementation to register the TypeObject representation of the described types in the IDL file - * - * This file was generated by the tool fastddsgen (version: 4.2.0). - */ - -#include "calculatorTypeObjectSupport.hpp" - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "calculator.hpp" - - -using namespace eprosima::fastdds::dds::xtypes; - -namespace calculator_base { -// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method -void register_OverflowException_type_identifier( - TypeIdentifierPair& type_ids_OverflowException) -{ - - ReturnCode_t return_code_OverflowException {eprosima::fastdds::dds::RETCODE_OK}; - return_code_OverflowException = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "calculator_base::OverflowException", type_ids_OverflowException); - if (eprosima::fastdds::dds::RETCODE_OK != return_code_OverflowException) - { - StructTypeFlag struct_flags_OverflowException = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::FINAL, - false, false); - return_code_OverflowException = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "eprosima::fastdds::dds::rpc::RpcOperationError", type_ids_OverflowException); - - if (return_code_OverflowException != eprosima::fastdds::dds::RETCODE_OK) - { - ::eprosima::fastdds::dds::rpc::register_RpcOperationError_type_identifier(type_ids_OverflowException); - } - QualifiedTypeName type_name_OverflowException = "calculator_base::OverflowException"; - eprosima::fastcdr::optional type_ann_builtin_OverflowException; - eprosima::fastcdr::optional ann_custom_OverflowException; - CompleteTypeDetail detail_OverflowException = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_OverflowException, ann_custom_OverflowException, type_name_OverflowException.to_string()); - CompleteStructHeader header_OverflowException; - if (EK_COMPLETE == type_ids_OverflowException.type_identifier1()._d()) - { - header_OverflowException = TypeObjectUtils::build_complete_struct_header(type_ids_OverflowException.type_identifier1(), detail_OverflowException); - } - else if (EK_COMPLETE == type_ids_OverflowException.type_identifier2()._d()) - { - header_OverflowException = TypeObjectUtils::build_complete_struct_header(type_ids_OverflowException.type_identifier2(), detail_OverflowException); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "calculator_base::OverflowException Structure: base_type TypeIdentifier registered in TypeObjectRegistry is inconsistent."); - return; - } - CompleteStructMemberSeq member_seq_OverflowException; - CompleteStructType struct_type_OverflowException = TypeObjectUtils::build_complete_struct_type(struct_flags_OverflowException, header_OverflowException, member_seq_OverflowException); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_OverflowException, type_name_OverflowException.to_string(), type_ids_OverflowException)) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "calculator_base::OverflowException already registered in TypeObjectRegistry for a different type."); - } - } -} - -namespace detail { - -//{ addition -// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method -void register_Adder_addition_In_type_identifier( - TypeIdentifierPair& type_ids_Adder_addition_In) -{ - - ReturnCode_t return_code_Adder_addition_In {eprosima::fastdds::dds::RETCODE_OK}; - return_code_Adder_addition_In = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "calculator_base::detail::Adder_addition_In", type_ids_Adder_addition_In); - if (eprosima::fastdds::dds::RETCODE_OK != return_code_Adder_addition_In) - { - StructTypeFlag struct_flags_Adder_addition_In = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::FINAL, - false, false); - QualifiedTypeName type_name_Adder_addition_In = "calculator_base::detail::Adder_addition_In"; - eprosima::fastcdr::optional type_ann_builtin_Adder_addition_In; - eprosima::fastcdr::optional ann_custom_Adder_addition_In; - CompleteTypeDetail detail_Adder_addition_In = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_Adder_addition_In, ann_custom_Adder_addition_In, type_name_Adder_addition_In.to_string()); - CompleteStructHeader header_Adder_addition_In; - header_Adder_addition_In = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_Adder_addition_In); - CompleteStructMemberSeq member_seq_Adder_addition_In; - { - TypeIdentifierPair type_ids_value1; - ReturnCode_t return_code_value1 {eprosima::fastdds::dds::RETCODE_OK}; - return_code_value1 = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_int32_t", type_ids_value1); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_value1) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "value1 Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_value1 = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - false, false, false, false); - MemberId member_id_value1 = 0x00000000; - bool common_value1_ec {false}; - CommonStructMember common_value1 {TypeObjectUtils::build_common_struct_member(member_id_value1, member_flags_value1, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_value1, common_value1_ec))}; - if (!common_value1_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure value1 member TypeIdentifier inconsistent."); - return; - } - MemberName name_value1 = "value1"; - eprosima::fastcdr::optional member_ann_builtin_value1; - ann_custom_Adder_addition_In.reset(); - CompleteMemberDetail detail_value1 = TypeObjectUtils::build_complete_member_detail(name_value1, member_ann_builtin_value1, ann_custom_Adder_addition_In); - CompleteStructMember member_value1 = TypeObjectUtils::build_complete_struct_member(common_value1, detail_value1); - TypeObjectUtils::add_complete_struct_member(member_seq_Adder_addition_In, member_value1); - } - { - TypeIdentifierPair type_ids_value2; - ReturnCode_t return_code_value2 {eprosima::fastdds::dds::RETCODE_OK}; - return_code_value2 = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_int32_t", type_ids_value2); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_value2) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "value2 Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_value2 = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - false, false, false, false); - MemberId member_id_value2 = 0x00000001; - bool common_value2_ec {false}; - CommonStructMember common_value2 {TypeObjectUtils::build_common_struct_member(member_id_value2, member_flags_value2, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_value2, common_value2_ec))}; - if (!common_value2_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure value2 member TypeIdentifier inconsistent."); - return; - } - MemberName name_value2 = "value2"; - eprosima::fastcdr::optional member_ann_builtin_value2; - ann_custom_Adder_addition_In.reset(); - CompleteMemberDetail detail_value2 = TypeObjectUtils::build_complete_member_detail(name_value2, member_ann_builtin_value2, ann_custom_Adder_addition_In); - CompleteStructMember member_value2 = TypeObjectUtils::build_complete_struct_member(common_value2, detail_value2); - TypeObjectUtils::add_complete_struct_member(member_seq_Adder_addition_In, member_value2); - } - CompleteStructType struct_type_Adder_addition_In = TypeObjectUtils::build_complete_struct_type(struct_flags_Adder_addition_In, header_Adder_addition_In, member_seq_Adder_addition_In); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_Adder_addition_In, type_name_Adder_addition_In.to_string(), type_ids_Adder_addition_In)) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "calculator_base::detail::Adder_addition_In already registered in TypeObjectRegistry for a different type."); - } - } -} - - - -// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method -void register_Adder_addition_Out_type_identifier( - TypeIdentifierPair& type_ids_Adder_addition_Out) -{ - - ReturnCode_t return_code_Adder_addition_Out {eprosima::fastdds::dds::RETCODE_OK}; - return_code_Adder_addition_Out = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "calculator_base::detail::Adder_addition_Out", type_ids_Adder_addition_Out); - if (eprosima::fastdds::dds::RETCODE_OK != return_code_Adder_addition_Out) - { - StructTypeFlag struct_flags_Adder_addition_Out = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::FINAL, - false, false); - QualifiedTypeName type_name_Adder_addition_Out = "calculator_base::detail::Adder_addition_Out"; - eprosima::fastcdr::optional type_ann_builtin_Adder_addition_Out; - eprosima::fastcdr::optional ann_custom_Adder_addition_Out; - CompleteTypeDetail detail_Adder_addition_Out = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_Adder_addition_Out, ann_custom_Adder_addition_Out, type_name_Adder_addition_Out.to_string()); - CompleteStructHeader header_Adder_addition_Out; - header_Adder_addition_Out = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_Adder_addition_Out); - CompleteStructMemberSeq member_seq_Adder_addition_Out; - { - TypeIdentifierPair type_ids_return_; - ReturnCode_t return_code_return_ {eprosima::fastdds::dds::RETCODE_OK}; - return_code_return_ = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_int32_t", type_ids_return_); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_return_) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "return_ Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_return_ = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - false, false, false, false); - MemberId member_id_return_ = 0x00000000; - bool common_return__ec {false}; - CommonStructMember common_return_ {TypeObjectUtils::build_common_struct_member(member_id_return_, member_flags_return_, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_return_, common_return__ec))}; - if (!common_return__ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure return_ member TypeIdentifier inconsistent."); - return; - } - MemberName name_return_ = "return_"; - eprosima::fastcdr::optional member_ann_builtin_return_; - ann_custom_Adder_addition_Out.reset(); - CompleteMemberDetail detail_return_ = TypeObjectUtils::build_complete_member_detail(name_return_, member_ann_builtin_return_, ann_custom_Adder_addition_Out); - CompleteStructMember member_return_ = TypeObjectUtils::build_complete_struct_member(common_return_, detail_return_); - TypeObjectUtils::add_complete_struct_member(member_seq_Adder_addition_Out, member_return_); - } - CompleteStructType struct_type_Adder_addition_Out = TypeObjectUtils::build_complete_struct_type(struct_flags_Adder_addition_Out, header_Adder_addition_Out, member_seq_Adder_addition_Out); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_Adder_addition_Out, type_name_Adder_addition_Out.to_string(), type_ids_Adder_addition_Out)) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "calculator_base::detail::Adder_addition_Out already registered in TypeObjectRegistry for a different type."); - } - } -} - -// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method -void register_Adder_addition_Result_type_identifier( - TypeIdentifierPair& type_ids_Adder_addition_Result) -{ - - ReturnCode_t return_code_Adder_addition_Result {eprosima::fastdds::dds::RETCODE_OK}; - return_code_Adder_addition_Result = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "calculator_base::detail::Adder_addition_Result", type_ids_Adder_addition_Result); - if (eprosima::fastdds::dds::RETCODE_OK != return_code_Adder_addition_Result) - { - StructTypeFlag struct_flags_Adder_addition_Result = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::MUTABLE, - false, false); - QualifiedTypeName type_name_Adder_addition_Result = "calculator_base::detail::Adder_addition_Result"; - eprosima::fastcdr::optional type_ann_builtin_Adder_addition_Result; - eprosima::fastcdr::optional ann_custom_Adder_addition_Result; - CompleteTypeDetail detail_Adder_addition_Result = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_Adder_addition_Result, ann_custom_Adder_addition_Result, type_name_Adder_addition_Result.to_string()); - CompleteStructHeader header_Adder_addition_Result; - header_Adder_addition_Result = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_Adder_addition_Result); - CompleteStructMemberSeq member_seq_Adder_addition_Result; - { - TypeIdentifierPair type_ids_result; - ReturnCode_t return_code_result {eprosima::fastdds::dds::RETCODE_OK}; - return_code_result = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "calculator_base::detail::Adder_addition_Out", type_ids_result); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_result) - { - ::calculator_base::detail::register_Adder_addition_Out_type_identifier(type_ids_result); - } - StructMemberFlag member_flags_result = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - true, false, false, false); - MemberId member_id_result = 0x0784a8b4; - bool common_result_ec {false}; - CommonStructMember common_result {TypeObjectUtils::build_common_struct_member(member_id_result, member_flags_result, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_result, common_result_ec))}; - if (!common_result_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure result member TypeIdentifier inconsistent."); - return; - } - MemberName name_result = "result"; - eprosima::fastcdr::optional member_ann_builtin_result; - ann_custom_Adder_addition_Result.reset(); - AppliedAnnotationSeq tmp_ann_custom_result; - eprosima::fastcdr::optional unit_result; - eprosima::fastcdr::optional min_result; - eprosima::fastcdr::optional max_result; - eprosima::fastcdr::optional hash_id_result; - hash_id_result = ""; - - if (unit_result.has_value() || min_result.has_value() || max_result.has_value() || hash_id_result.has_value()) - { - member_ann_builtin_result = TypeObjectUtils::build_applied_builtin_member_annotations(unit_result, min_result, max_result, hash_id_result); - } - if (!tmp_ann_custom_result.empty()) - { - ann_custom_Adder_addition_Result = tmp_ann_custom_result; - } - CompleteMemberDetail detail_result = TypeObjectUtils::build_complete_member_detail(name_result, member_ann_builtin_result, ann_custom_Adder_addition_Result); - CompleteStructMember member_result = TypeObjectUtils::build_complete_struct_member(common_result, detail_result); - TypeObjectUtils::add_complete_struct_member(member_seq_Adder_addition_Result, member_result); - } - { - TypeIdentifierPair type_ids_calculator_base_OverflowException_ex; - ReturnCode_t return_code_calculator_base_OverflowException_ex {eprosima::fastdds::dds::RETCODE_OK}; - return_code_calculator_base_OverflowException_ex = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "calculator_base::OverflowException", type_ids_calculator_base_OverflowException_ex); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_calculator_base_OverflowException_ex) - { - ::calculator_base::register_OverflowException_type_identifier(type_ids_calculator_base_OverflowException_ex); - } - StructMemberFlag member_flags_calculator_base_OverflowException_ex = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - true, false, false, false); - MemberId member_id_calculator_base_OverflowException_ex = 0x0254c1f7; - bool common_calculator_base_OverflowException_ex_ec {false}; - CommonStructMember common_calculator_base_OverflowException_ex {TypeObjectUtils::build_common_struct_member(member_id_calculator_base_OverflowException_ex, member_flags_calculator_base_OverflowException_ex, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_calculator_base_OverflowException_ex, common_calculator_base_OverflowException_ex_ec))}; - if (!common_calculator_base_OverflowException_ex_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure calculator_base_OverflowException_ex member TypeIdentifier inconsistent."); - return; - } - MemberName name_calculator_base_OverflowException_ex = "calculator_base_OverflowException_ex"; - eprosima::fastcdr::optional member_ann_builtin_calculator_base_OverflowException_ex; - ann_custom_Adder_addition_Result.reset(); - AppliedAnnotationSeq tmp_ann_custom_calculator_base_OverflowException_ex; - eprosima::fastcdr::optional unit_calculator_base_OverflowException_ex; - eprosima::fastcdr::optional min_calculator_base_OverflowException_ex; - eprosima::fastcdr::optional max_calculator_base_OverflowException_ex; - eprosima::fastcdr::optional hash_id_calculator_base_OverflowException_ex; - hash_id_calculator_base_OverflowException_ex = ""; - - if (unit_calculator_base_OverflowException_ex.has_value() || min_calculator_base_OverflowException_ex.has_value() || max_calculator_base_OverflowException_ex.has_value() || hash_id_calculator_base_OverflowException_ex.has_value()) - { - member_ann_builtin_calculator_base_OverflowException_ex = TypeObjectUtils::build_applied_builtin_member_annotations(unit_calculator_base_OverflowException_ex, min_calculator_base_OverflowException_ex, max_calculator_base_OverflowException_ex, hash_id_calculator_base_OverflowException_ex); - } - if (!tmp_ann_custom_calculator_base_OverflowException_ex.empty()) - { - ann_custom_Adder_addition_Result = tmp_ann_custom_calculator_base_OverflowException_ex; - } - CompleteMemberDetail detail_calculator_base_OverflowException_ex = TypeObjectUtils::build_complete_member_detail(name_calculator_base_OverflowException_ex, member_ann_builtin_calculator_base_OverflowException_ex, ann_custom_Adder_addition_Result); - CompleteStructMember member_calculator_base_OverflowException_ex = TypeObjectUtils::build_complete_struct_member(common_calculator_base_OverflowException_ex, detail_calculator_base_OverflowException_ex); - TypeObjectUtils::add_complete_struct_member(member_seq_Adder_addition_Result, member_calculator_base_OverflowException_ex); - } - CompleteStructType struct_type_Adder_addition_Result = TypeObjectUtils::build_complete_struct_type(struct_flags_Adder_addition_Result, header_Adder_addition_Result, member_seq_Adder_addition_Result); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_Adder_addition_Result, type_name_Adder_addition_Result.to_string(), type_ids_Adder_addition_Result)) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "calculator_base::detail::Adder_addition_Result already registered in TypeObjectRegistry for a different type."); - } - } -} - -//} // addition - - -} // namespace detail - - - -namespace detail { - -//{ subtraction -// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method -void register_Subtractor_subtraction_In_type_identifier( - TypeIdentifierPair& type_ids_Subtractor_subtraction_In) -{ - - ReturnCode_t return_code_Subtractor_subtraction_In {eprosima::fastdds::dds::RETCODE_OK}; - return_code_Subtractor_subtraction_In = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "calculator_base::detail::Subtractor_subtraction_In", type_ids_Subtractor_subtraction_In); - if (eprosima::fastdds::dds::RETCODE_OK != return_code_Subtractor_subtraction_In) - { - StructTypeFlag struct_flags_Subtractor_subtraction_In = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::FINAL, - false, false); - QualifiedTypeName type_name_Subtractor_subtraction_In = "calculator_base::detail::Subtractor_subtraction_In"; - eprosima::fastcdr::optional type_ann_builtin_Subtractor_subtraction_In; - eprosima::fastcdr::optional ann_custom_Subtractor_subtraction_In; - CompleteTypeDetail detail_Subtractor_subtraction_In = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_Subtractor_subtraction_In, ann_custom_Subtractor_subtraction_In, type_name_Subtractor_subtraction_In.to_string()); - CompleteStructHeader header_Subtractor_subtraction_In; - header_Subtractor_subtraction_In = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_Subtractor_subtraction_In); - CompleteStructMemberSeq member_seq_Subtractor_subtraction_In; - { - TypeIdentifierPair type_ids_value1; - ReturnCode_t return_code_value1 {eprosima::fastdds::dds::RETCODE_OK}; - return_code_value1 = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_int32_t", type_ids_value1); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_value1) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "value1 Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_value1 = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - false, false, false, false); - MemberId member_id_value1 = 0x00000000; - bool common_value1_ec {false}; - CommonStructMember common_value1 {TypeObjectUtils::build_common_struct_member(member_id_value1, member_flags_value1, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_value1, common_value1_ec))}; - if (!common_value1_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure value1 member TypeIdentifier inconsistent."); - return; - } - MemberName name_value1 = "value1"; - eprosima::fastcdr::optional member_ann_builtin_value1; - ann_custom_Subtractor_subtraction_In.reset(); - CompleteMemberDetail detail_value1 = TypeObjectUtils::build_complete_member_detail(name_value1, member_ann_builtin_value1, ann_custom_Subtractor_subtraction_In); - CompleteStructMember member_value1 = TypeObjectUtils::build_complete_struct_member(common_value1, detail_value1); - TypeObjectUtils::add_complete_struct_member(member_seq_Subtractor_subtraction_In, member_value1); - } - { - TypeIdentifierPair type_ids_value2; - ReturnCode_t return_code_value2 {eprosima::fastdds::dds::RETCODE_OK}; - return_code_value2 = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_int32_t", type_ids_value2); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_value2) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "value2 Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_value2 = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - false, false, false, false); - MemberId member_id_value2 = 0x00000001; - bool common_value2_ec {false}; - CommonStructMember common_value2 {TypeObjectUtils::build_common_struct_member(member_id_value2, member_flags_value2, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_value2, common_value2_ec))}; - if (!common_value2_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure value2 member TypeIdentifier inconsistent."); - return; - } - MemberName name_value2 = "value2"; - eprosima::fastcdr::optional member_ann_builtin_value2; - ann_custom_Subtractor_subtraction_In.reset(); - CompleteMemberDetail detail_value2 = TypeObjectUtils::build_complete_member_detail(name_value2, member_ann_builtin_value2, ann_custom_Subtractor_subtraction_In); - CompleteStructMember member_value2 = TypeObjectUtils::build_complete_struct_member(common_value2, detail_value2); - TypeObjectUtils::add_complete_struct_member(member_seq_Subtractor_subtraction_In, member_value2); - } - CompleteStructType struct_type_Subtractor_subtraction_In = TypeObjectUtils::build_complete_struct_type(struct_flags_Subtractor_subtraction_In, header_Subtractor_subtraction_In, member_seq_Subtractor_subtraction_In); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_Subtractor_subtraction_In, type_name_Subtractor_subtraction_In.to_string(), type_ids_Subtractor_subtraction_In)) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "calculator_base::detail::Subtractor_subtraction_In already registered in TypeObjectRegistry for a different type."); - } - } -} - - - -// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method -void register_Subtractor_subtraction_Out_type_identifier( - TypeIdentifierPair& type_ids_Subtractor_subtraction_Out) -{ - - ReturnCode_t return_code_Subtractor_subtraction_Out {eprosima::fastdds::dds::RETCODE_OK}; - return_code_Subtractor_subtraction_Out = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "calculator_base::detail::Subtractor_subtraction_Out", type_ids_Subtractor_subtraction_Out); - if (eprosima::fastdds::dds::RETCODE_OK != return_code_Subtractor_subtraction_Out) - { - StructTypeFlag struct_flags_Subtractor_subtraction_Out = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::FINAL, - false, false); - QualifiedTypeName type_name_Subtractor_subtraction_Out = "calculator_base::detail::Subtractor_subtraction_Out"; - eprosima::fastcdr::optional type_ann_builtin_Subtractor_subtraction_Out; - eprosima::fastcdr::optional ann_custom_Subtractor_subtraction_Out; - CompleteTypeDetail detail_Subtractor_subtraction_Out = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_Subtractor_subtraction_Out, ann_custom_Subtractor_subtraction_Out, type_name_Subtractor_subtraction_Out.to_string()); - CompleteStructHeader header_Subtractor_subtraction_Out; - header_Subtractor_subtraction_Out = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_Subtractor_subtraction_Out); - CompleteStructMemberSeq member_seq_Subtractor_subtraction_Out; - { - TypeIdentifierPair type_ids_return_; - ReturnCode_t return_code_return_ {eprosima::fastdds::dds::RETCODE_OK}; - return_code_return_ = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_int32_t", type_ids_return_); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_return_) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "return_ Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_return_ = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - false, false, false, false); - MemberId member_id_return_ = 0x00000000; - bool common_return__ec {false}; - CommonStructMember common_return_ {TypeObjectUtils::build_common_struct_member(member_id_return_, member_flags_return_, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_return_, common_return__ec))}; - if (!common_return__ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure return_ member TypeIdentifier inconsistent."); - return; - } - MemberName name_return_ = "return_"; - eprosima::fastcdr::optional member_ann_builtin_return_; - ann_custom_Subtractor_subtraction_Out.reset(); - CompleteMemberDetail detail_return_ = TypeObjectUtils::build_complete_member_detail(name_return_, member_ann_builtin_return_, ann_custom_Subtractor_subtraction_Out); - CompleteStructMember member_return_ = TypeObjectUtils::build_complete_struct_member(common_return_, detail_return_); - TypeObjectUtils::add_complete_struct_member(member_seq_Subtractor_subtraction_Out, member_return_); - } - CompleteStructType struct_type_Subtractor_subtraction_Out = TypeObjectUtils::build_complete_struct_type(struct_flags_Subtractor_subtraction_Out, header_Subtractor_subtraction_Out, member_seq_Subtractor_subtraction_Out); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_Subtractor_subtraction_Out, type_name_Subtractor_subtraction_Out.to_string(), type_ids_Subtractor_subtraction_Out)) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "calculator_base::detail::Subtractor_subtraction_Out already registered in TypeObjectRegistry for a different type."); - } - } -} - -// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method -void register_Subtractor_subtraction_Result_type_identifier( - TypeIdentifierPair& type_ids_Subtractor_subtraction_Result) -{ - - ReturnCode_t return_code_Subtractor_subtraction_Result {eprosima::fastdds::dds::RETCODE_OK}; - return_code_Subtractor_subtraction_Result = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "calculator_base::detail::Subtractor_subtraction_Result", type_ids_Subtractor_subtraction_Result); - if (eprosima::fastdds::dds::RETCODE_OK != return_code_Subtractor_subtraction_Result) - { - StructTypeFlag struct_flags_Subtractor_subtraction_Result = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::MUTABLE, - false, false); - QualifiedTypeName type_name_Subtractor_subtraction_Result = "calculator_base::detail::Subtractor_subtraction_Result"; - eprosima::fastcdr::optional type_ann_builtin_Subtractor_subtraction_Result; - eprosima::fastcdr::optional ann_custom_Subtractor_subtraction_Result; - CompleteTypeDetail detail_Subtractor_subtraction_Result = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_Subtractor_subtraction_Result, ann_custom_Subtractor_subtraction_Result, type_name_Subtractor_subtraction_Result.to_string()); - CompleteStructHeader header_Subtractor_subtraction_Result; - header_Subtractor_subtraction_Result = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_Subtractor_subtraction_Result); - CompleteStructMemberSeq member_seq_Subtractor_subtraction_Result; - { - TypeIdentifierPair type_ids_result; - ReturnCode_t return_code_result {eprosima::fastdds::dds::RETCODE_OK}; - return_code_result = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "calculator_base::detail::Subtractor_subtraction_Out", type_ids_result); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_result) - { - ::calculator_base::detail::register_Subtractor_subtraction_Out_type_identifier(type_ids_result); - } - StructMemberFlag member_flags_result = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - true, false, false, false); - MemberId member_id_result = 0x0784a8b4; - bool common_result_ec {false}; - CommonStructMember common_result {TypeObjectUtils::build_common_struct_member(member_id_result, member_flags_result, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_result, common_result_ec))}; - if (!common_result_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure result member TypeIdentifier inconsistent."); - return; - } - MemberName name_result = "result"; - eprosima::fastcdr::optional member_ann_builtin_result; - ann_custom_Subtractor_subtraction_Result.reset(); - AppliedAnnotationSeq tmp_ann_custom_result; - eprosima::fastcdr::optional unit_result; - eprosima::fastcdr::optional min_result; - eprosima::fastcdr::optional max_result; - eprosima::fastcdr::optional hash_id_result; - hash_id_result = ""; - - if (unit_result.has_value() || min_result.has_value() || max_result.has_value() || hash_id_result.has_value()) - { - member_ann_builtin_result = TypeObjectUtils::build_applied_builtin_member_annotations(unit_result, min_result, max_result, hash_id_result); - } - if (!tmp_ann_custom_result.empty()) - { - ann_custom_Subtractor_subtraction_Result = tmp_ann_custom_result; - } - CompleteMemberDetail detail_result = TypeObjectUtils::build_complete_member_detail(name_result, member_ann_builtin_result, ann_custom_Subtractor_subtraction_Result); - CompleteStructMember member_result = TypeObjectUtils::build_complete_struct_member(common_result, detail_result); - TypeObjectUtils::add_complete_struct_member(member_seq_Subtractor_subtraction_Result, member_result); - } - { - TypeIdentifierPair type_ids_calculator_base_OverflowException_ex; - ReturnCode_t return_code_calculator_base_OverflowException_ex {eprosima::fastdds::dds::RETCODE_OK}; - return_code_calculator_base_OverflowException_ex = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "calculator_base::OverflowException", type_ids_calculator_base_OverflowException_ex); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_calculator_base_OverflowException_ex) - { - ::calculator_base::register_OverflowException_type_identifier(type_ids_calculator_base_OverflowException_ex); - } - StructMemberFlag member_flags_calculator_base_OverflowException_ex = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - true, false, false, false); - MemberId member_id_calculator_base_OverflowException_ex = 0x0254c1f7; - bool common_calculator_base_OverflowException_ex_ec {false}; - CommonStructMember common_calculator_base_OverflowException_ex {TypeObjectUtils::build_common_struct_member(member_id_calculator_base_OverflowException_ex, member_flags_calculator_base_OverflowException_ex, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_calculator_base_OverflowException_ex, common_calculator_base_OverflowException_ex_ec))}; - if (!common_calculator_base_OverflowException_ex_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure calculator_base_OverflowException_ex member TypeIdentifier inconsistent."); - return; - } - MemberName name_calculator_base_OverflowException_ex = "calculator_base_OverflowException_ex"; - eprosima::fastcdr::optional member_ann_builtin_calculator_base_OverflowException_ex; - ann_custom_Subtractor_subtraction_Result.reset(); - AppliedAnnotationSeq tmp_ann_custom_calculator_base_OverflowException_ex; - eprosima::fastcdr::optional unit_calculator_base_OverflowException_ex; - eprosima::fastcdr::optional min_calculator_base_OverflowException_ex; - eprosima::fastcdr::optional max_calculator_base_OverflowException_ex; - eprosima::fastcdr::optional hash_id_calculator_base_OverflowException_ex; - hash_id_calculator_base_OverflowException_ex = ""; - - if (unit_calculator_base_OverflowException_ex.has_value() || min_calculator_base_OverflowException_ex.has_value() || max_calculator_base_OverflowException_ex.has_value() || hash_id_calculator_base_OverflowException_ex.has_value()) - { - member_ann_builtin_calculator_base_OverflowException_ex = TypeObjectUtils::build_applied_builtin_member_annotations(unit_calculator_base_OverflowException_ex, min_calculator_base_OverflowException_ex, max_calculator_base_OverflowException_ex, hash_id_calculator_base_OverflowException_ex); - } - if (!tmp_ann_custom_calculator_base_OverflowException_ex.empty()) - { - ann_custom_Subtractor_subtraction_Result = tmp_ann_custom_calculator_base_OverflowException_ex; - } - CompleteMemberDetail detail_calculator_base_OverflowException_ex = TypeObjectUtils::build_complete_member_detail(name_calculator_base_OverflowException_ex, member_ann_builtin_calculator_base_OverflowException_ex, ann_custom_Subtractor_subtraction_Result); - CompleteStructMember member_calculator_base_OverflowException_ex = TypeObjectUtils::build_complete_struct_member(common_calculator_base_OverflowException_ex, detail_calculator_base_OverflowException_ex); - TypeObjectUtils::add_complete_struct_member(member_seq_Subtractor_subtraction_Result, member_calculator_base_OverflowException_ex); - } - CompleteStructType struct_type_Subtractor_subtraction_Result = TypeObjectUtils::build_complete_struct_type(struct_flags_Subtractor_subtraction_Result, header_Subtractor_subtraction_Result, member_seq_Subtractor_subtraction_Result); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_Subtractor_subtraction_Result, type_name_Subtractor_subtraction_Result.to_string(), type_ids_Subtractor_subtraction_Result)) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "calculator_base::detail::Subtractor_subtraction_Result already registered in TypeObjectRegistry for a different type."); - } - } -} - -//} // subtraction - - -} // namespace detail - - -} // namespace calculator_base - - -namespace detail { - -//{ representation_limits -// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method -void register_Calculator_representation_limits_In_type_identifier( - TypeIdentifierPair& type_ids_Calculator_representation_limits_In) -{ - - ReturnCode_t return_code_Calculator_representation_limits_In {eprosima::fastdds::dds::RETCODE_OK}; - return_code_Calculator_representation_limits_In = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "detail::Calculator_representation_limits_In", type_ids_Calculator_representation_limits_In); - if (eprosima::fastdds::dds::RETCODE_OK != return_code_Calculator_representation_limits_In) - { - StructTypeFlag struct_flags_Calculator_representation_limits_In = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::FINAL, - false, false); - QualifiedTypeName type_name_Calculator_representation_limits_In = "detail::Calculator_representation_limits_In"; - eprosima::fastcdr::optional type_ann_builtin_Calculator_representation_limits_In; - eprosima::fastcdr::optional ann_custom_Calculator_representation_limits_In; - CompleteTypeDetail detail_Calculator_representation_limits_In = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_Calculator_representation_limits_In, ann_custom_Calculator_representation_limits_In, type_name_Calculator_representation_limits_In.to_string()); - CompleteStructHeader header_Calculator_representation_limits_In; - header_Calculator_representation_limits_In = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_Calculator_representation_limits_In); - CompleteStructMemberSeq member_seq_Calculator_representation_limits_In; - CompleteStructType struct_type_Calculator_representation_limits_In = TypeObjectUtils::build_complete_struct_type(struct_flags_Calculator_representation_limits_In, header_Calculator_representation_limits_In, member_seq_Calculator_representation_limits_In); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_Calculator_representation_limits_In, type_name_Calculator_representation_limits_In.to_string(), type_ids_Calculator_representation_limits_In)) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "detail::Calculator_representation_limits_In already registered in TypeObjectRegistry for a different type."); - } - } -} - - -// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method -void register_Calculator_representation_limits_Out_type_identifier( - TypeIdentifierPair& type_ids_Calculator_representation_limits_Out) -{ - - ReturnCode_t return_code_Calculator_representation_limits_Out {eprosima::fastdds::dds::RETCODE_OK}; - return_code_Calculator_representation_limits_Out = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "detail::Calculator_representation_limits_Out", type_ids_Calculator_representation_limits_Out); - if (eprosima::fastdds::dds::RETCODE_OK != return_code_Calculator_representation_limits_Out) - { - StructTypeFlag struct_flags_Calculator_representation_limits_Out = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::FINAL, - false, false); - QualifiedTypeName type_name_Calculator_representation_limits_Out = "detail::Calculator_representation_limits_Out"; - eprosima::fastcdr::optional type_ann_builtin_Calculator_representation_limits_Out; - eprosima::fastcdr::optional ann_custom_Calculator_representation_limits_Out; - CompleteTypeDetail detail_Calculator_representation_limits_Out = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_Calculator_representation_limits_Out, ann_custom_Calculator_representation_limits_Out, type_name_Calculator_representation_limits_Out.to_string()); - CompleteStructHeader header_Calculator_representation_limits_Out; - header_Calculator_representation_limits_Out = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_Calculator_representation_limits_Out); - CompleteStructMemberSeq member_seq_Calculator_representation_limits_Out; - { - TypeIdentifierPair type_ids_min_value; - ReturnCode_t return_code_min_value {eprosima::fastdds::dds::RETCODE_OK}; - return_code_min_value = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_int32_t", type_ids_min_value); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_min_value) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "min_value Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_min_value = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - false, false, false, false); - MemberId member_id_min_value = 0x00000000; - bool common_min_value_ec {false}; - CommonStructMember common_min_value {TypeObjectUtils::build_common_struct_member(member_id_min_value, member_flags_min_value, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_min_value, common_min_value_ec))}; - if (!common_min_value_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure min_value member TypeIdentifier inconsistent."); - return; - } - MemberName name_min_value = "min_value"; - eprosima::fastcdr::optional member_ann_builtin_min_value; - ann_custom_Calculator_representation_limits_Out.reset(); - CompleteMemberDetail detail_min_value = TypeObjectUtils::build_complete_member_detail(name_min_value, member_ann_builtin_min_value, ann_custom_Calculator_representation_limits_Out); - CompleteStructMember member_min_value = TypeObjectUtils::build_complete_struct_member(common_min_value, detail_min_value); - TypeObjectUtils::add_complete_struct_member(member_seq_Calculator_representation_limits_Out, member_min_value); - } - { - TypeIdentifierPair type_ids_max_value; - ReturnCode_t return_code_max_value {eprosima::fastdds::dds::RETCODE_OK}; - return_code_max_value = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_int32_t", type_ids_max_value); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_max_value) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "max_value Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_max_value = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - false, false, false, false); - MemberId member_id_max_value = 0x00000001; - bool common_max_value_ec {false}; - CommonStructMember common_max_value {TypeObjectUtils::build_common_struct_member(member_id_max_value, member_flags_max_value, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_max_value, common_max_value_ec))}; - if (!common_max_value_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure max_value member TypeIdentifier inconsistent."); - return; - } - MemberName name_max_value = "max_value"; - eprosima::fastcdr::optional member_ann_builtin_max_value; - ann_custom_Calculator_representation_limits_Out.reset(); - CompleteMemberDetail detail_max_value = TypeObjectUtils::build_complete_member_detail(name_max_value, member_ann_builtin_max_value, ann_custom_Calculator_representation_limits_Out); - CompleteStructMember member_max_value = TypeObjectUtils::build_complete_struct_member(common_max_value, detail_max_value); - TypeObjectUtils::add_complete_struct_member(member_seq_Calculator_representation_limits_Out, member_max_value); - } - CompleteStructType struct_type_Calculator_representation_limits_Out = TypeObjectUtils::build_complete_struct_type(struct_flags_Calculator_representation_limits_Out, header_Calculator_representation_limits_Out, member_seq_Calculator_representation_limits_Out); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_Calculator_representation_limits_Out, type_name_Calculator_representation_limits_Out.to_string(), type_ids_Calculator_representation_limits_Out)) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "detail::Calculator_representation_limits_Out already registered in TypeObjectRegistry for a different type."); - } - } -} - -// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method -void register_Calculator_representation_limits_Result_type_identifier( - TypeIdentifierPair& type_ids_Calculator_representation_limits_Result) -{ - - ReturnCode_t return_code_Calculator_representation_limits_Result {eprosima::fastdds::dds::RETCODE_OK}; - return_code_Calculator_representation_limits_Result = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "detail::Calculator_representation_limits_Result", type_ids_Calculator_representation_limits_Result); - if (eprosima::fastdds::dds::RETCODE_OK != return_code_Calculator_representation_limits_Result) - { - StructTypeFlag struct_flags_Calculator_representation_limits_Result = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::MUTABLE, - false, false); - QualifiedTypeName type_name_Calculator_representation_limits_Result = "detail::Calculator_representation_limits_Result"; - eprosima::fastcdr::optional type_ann_builtin_Calculator_representation_limits_Result; - eprosima::fastcdr::optional ann_custom_Calculator_representation_limits_Result; - CompleteTypeDetail detail_Calculator_representation_limits_Result = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_Calculator_representation_limits_Result, ann_custom_Calculator_representation_limits_Result, type_name_Calculator_representation_limits_Result.to_string()); - CompleteStructHeader header_Calculator_representation_limits_Result; - header_Calculator_representation_limits_Result = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_Calculator_representation_limits_Result); - CompleteStructMemberSeq member_seq_Calculator_representation_limits_Result; - { - TypeIdentifierPair type_ids_result; - ReturnCode_t return_code_result {eprosima::fastdds::dds::RETCODE_OK}; - return_code_result = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "detail::Calculator_representation_limits_Out", type_ids_result); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_result) - { - ::detail::register_Calculator_representation_limits_Out_type_identifier(type_ids_result); - } - StructMemberFlag member_flags_result = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - true, false, false, false); - MemberId member_id_result = 0x0784a8b4; - bool common_result_ec {false}; - CommonStructMember common_result {TypeObjectUtils::build_common_struct_member(member_id_result, member_flags_result, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_result, common_result_ec))}; - if (!common_result_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure result member TypeIdentifier inconsistent."); - return; - } - MemberName name_result = "result"; - eprosima::fastcdr::optional member_ann_builtin_result; - ann_custom_Calculator_representation_limits_Result.reset(); - AppliedAnnotationSeq tmp_ann_custom_result; - eprosima::fastcdr::optional unit_result; - eprosima::fastcdr::optional min_result; - eprosima::fastcdr::optional max_result; - eprosima::fastcdr::optional hash_id_result; - hash_id_result = ""; - - if (unit_result.has_value() || min_result.has_value() || max_result.has_value() || hash_id_result.has_value()) - { - member_ann_builtin_result = TypeObjectUtils::build_applied_builtin_member_annotations(unit_result, min_result, max_result, hash_id_result); - } - if (!tmp_ann_custom_result.empty()) - { - ann_custom_Calculator_representation_limits_Result = tmp_ann_custom_result; - } - CompleteMemberDetail detail_result = TypeObjectUtils::build_complete_member_detail(name_result, member_ann_builtin_result, ann_custom_Calculator_representation_limits_Result); - CompleteStructMember member_result = TypeObjectUtils::build_complete_struct_member(common_result, detail_result); - TypeObjectUtils::add_complete_struct_member(member_seq_Calculator_representation_limits_Result, member_result); - } - CompleteStructType struct_type_Calculator_representation_limits_Result = TypeObjectUtils::build_complete_struct_type(struct_flags_Calculator_representation_limits_Result, header_Calculator_representation_limits_Result, member_seq_Calculator_representation_limits_Result); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_Calculator_representation_limits_Result, type_name_Calculator_representation_limits_Result.to_string(), type_ids_Calculator_representation_limits_Result)) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "detail::Calculator_representation_limits_Result already registered in TypeObjectRegistry for a different type."); - } - } -} - -//} // representation_limits - - -} // namespace detail - -// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method -void register_Calculator_Request_type_identifier( - TypeIdentifierPair& type_ids_Calculator_Request) -{ - - ReturnCode_t return_code_Calculator_Request {eprosima::fastdds::dds::RETCODE_OK}; - return_code_Calculator_Request = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "detail::Calculator_Request", type_ids_Calculator_Request); - if (eprosima::fastdds::dds::RETCODE_OK != return_code_Calculator_Request) - { - StructTypeFlag struct_flags_Calculator_Request = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::MUTABLE, - false, false); - QualifiedTypeName type_name_Calculator_Request = "detail::Calculator_Request"; - eprosima::fastcdr::optional type_ann_builtin_Calculator_Request; - eprosima::fastcdr::optional ann_custom_Calculator_Request; - CompleteTypeDetail detail_Calculator_Request = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_Calculator_Request, ann_custom_Calculator_Request, type_name_Calculator_Request.to_string()); - CompleteStructHeader header_Calculator_Request; - header_Calculator_Request = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_Calculator_Request); - CompleteStructMemberSeq member_seq_Calculator_Request; - { - TypeIdentifierPair type_ids_addition; - ReturnCode_t return_code_addition {eprosima::fastdds::dds::RETCODE_OK}; - return_code_addition = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "calculator_base::detail::Adder_addition_In", type_ids_addition); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_addition) - { - ::calculator_base::detail::register_Adder_addition_In_type_identifier(type_ids_addition); - } - StructMemberFlag member_flags_addition = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - true, false, false, false); - MemberId member_id_addition = 0x04e82a2b; - bool common_addition_ec {false}; - CommonStructMember common_addition {TypeObjectUtils::build_common_struct_member(member_id_addition, member_flags_addition, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_addition, common_addition_ec))}; - if (!common_addition_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure addition member TypeIdentifier inconsistent."); - return; - } - MemberName name_addition = "addition"; - eprosima::fastcdr::optional member_ann_builtin_addition; - ann_custom_Calculator_Request.reset(); - AppliedAnnotationSeq tmp_ann_custom_addition; - eprosima::fastcdr::optional unit_addition; - eprosima::fastcdr::optional min_addition; - eprosima::fastcdr::optional max_addition; - eprosima::fastcdr::optional hash_id_addition; - hash_id_addition = ""; - - if (unit_addition.has_value() || min_addition.has_value() || max_addition.has_value() || hash_id_addition.has_value()) - { - member_ann_builtin_addition = TypeObjectUtils::build_applied_builtin_member_annotations(unit_addition, min_addition, max_addition, hash_id_addition); - } - if (!tmp_ann_custom_addition.empty()) - { - ann_custom_Calculator_Request = tmp_ann_custom_addition; - } - CompleteMemberDetail detail_addition = TypeObjectUtils::build_complete_member_detail(name_addition, member_ann_builtin_addition, ann_custom_Calculator_Request); - CompleteStructMember member_addition = TypeObjectUtils::build_complete_struct_member(common_addition, detail_addition); - TypeObjectUtils::add_complete_struct_member(member_seq_Calculator_Request, member_addition); - } - { - TypeIdentifierPair type_ids_subtraction; - ReturnCode_t return_code_subtraction {eprosima::fastdds::dds::RETCODE_OK}; - return_code_subtraction = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "calculator_base::detail::Subtractor_subtraction_In", type_ids_subtraction); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_subtraction) - { - ::calculator_base::detail::register_Subtractor_subtraction_In_type_identifier(type_ids_subtraction); - } - StructMemberFlag member_flags_subtraction = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - true, false, false, false); - MemberId member_id_subtraction = 0x096bbc8d; - bool common_subtraction_ec {false}; - CommonStructMember common_subtraction {TypeObjectUtils::build_common_struct_member(member_id_subtraction, member_flags_subtraction, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_subtraction, common_subtraction_ec))}; - if (!common_subtraction_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure subtraction member TypeIdentifier inconsistent."); - return; - } - MemberName name_subtraction = "subtraction"; - eprosima::fastcdr::optional member_ann_builtin_subtraction; - ann_custom_Calculator_Request.reset(); - AppliedAnnotationSeq tmp_ann_custom_subtraction; - eprosima::fastcdr::optional unit_subtraction; - eprosima::fastcdr::optional min_subtraction; - eprosima::fastcdr::optional max_subtraction; - eprosima::fastcdr::optional hash_id_subtraction; - hash_id_subtraction = ""; - - if (unit_subtraction.has_value() || min_subtraction.has_value() || max_subtraction.has_value() || hash_id_subtraction.has_value()) - { - member_ann_builtin_subtraction = TypeObjectUtils::build_applied_builtin_member_annotations(unit_subtraction, min_subtraction, max_subtraction, hash_id_subtraction); - } - if (!tmp_ann_custom_subtraction.empty()) - { - ann_custom_Calculator_Request = tmp_ann_custom_subtraction; - } - CompleteMemberDetail detail_subtraction = TypeObjectUtils::build_complete_member_detail(name_subtraction, member_ann_builtin_subtraction, ann_custom_Calculator_Request); - CompleteStructMember member_subtraction = TypeObjectUtils::build_complete_struct_member(common_subtraction, detail_subtraction); - TypeObjectUtils::add_complete_struct_member(member_seq_Calculator_Request, member_subtraction); - } - { - TypeIdentifierPair type_ids_representation_limits; - ReturnCode_t return_code_representation_limits {eprosima::fastdds::dds::RETCODE_OK}; - return_code_representation_limits = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "detail::Calculator_representation_limits_In", type_ids_representation_limits); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_representation_limits) - { - ::detail::register_Calculator_representation_limits_In_type_identifier(type_ids_representation_limits); - } - StructMemberFlag member_flags_representation_limits = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - true, false, false, false); - MemberId member_id_representation_limits = 0x0e205a8d; - bool common_representation_limits_ec {false}; - CommonStructMember common_representation_limits {TypeObjectUtils::build_common_struct_member(member_id_representation_limits, member_flags_representation_limits, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_representation_limits, common_representation_limits_ec))}; - if (!common_representation_limits_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure representation_limits member TypeIdentifier inconsistent."); - return; - } - MemberName name_representation_limits = "representation_limits"; - eprosima::fastcdr::optional member_ann_builtin_representation_limits; - ann_custom_Calculator_Request.reset(); - AppliedAnnotationSeq tmp_ann_custom_representation_limits; - eprosima::fastcdr::optional unit_representation_limits; - eprosima::fastcdr::optional min_representation_limits; - eprosima::fastcdr::optional max_representation_limits; - eprosima::fastcdr::optional hash_id_representation_limits; - hash_id_representation_limits = ""; - - if (unit_representation_limits.has_value() || min_representation_limits.has_value() || max_representation_limits.has_value() || hash_id_representation_limits.has_value()) - { - member_ann_builtin_representation_limits = TypeObjectUtils::build_applied_builtin_member_annotations(unit_representation_limits, min_representation_limits, max_representation_limits, hash_id_representation_limits); - } - if (!tmp_ann_custom_representation_limits.empty()) - { - ann_custom_Calculator_Request = tmp_ann_custom_representation_limits; - } - CompleteMemberDetail detail_representation_limits = TypeObjectUtils::build_complete_member_detail(name_representation_limits, member_ann_builtin_representation_limits, ann_custom_Calculator_Request); - CompleteStructMember member_representation_limits = TypeObjectUtils::build_complete_struct_member(common_representation_limits, detail_representation_limits); - TypeObjectUtils::add_complete_struct_member(member_seq_Calculator_Request, member_representation_limits); - } - CompleteStructType struct_type_Calculator_Request = TypeObjectUtils::build_complete_struct_type(struct_flags_Calculator_Request, header_Calculator_Request, member_seq_Calculator_Request); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_Calculator_Request, type_name_Calculator_Request.to_string(), type_ids_Calculator_Request)) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "detail::Calculator_Request already registered in TypeObjectRegistry for a different type."); - } - } -} -// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method -void register_Calculator_Reply_type_identifier( - TypeIdentifierPair& type_ids_Calculator_Reply) -{ - - ReturnCode_t return_code_Calculator_Reply {eprosima::fastdds::dds::RETCODE_OK}; - return_code_Calculator_Reply = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "detail::Calculator_Reply", type_ids_Calculator_Reply); - if (eprosima::fastdds::dds::RETCODE_OK != return_code_Calculator_Reply) - { - StructTypeFlag struct_flags_Calculator_Reply = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::MUTABLE, - false, false); - QualifiedTypeName type_name_Calculator_Reply = "detail::Calculator_Reply"; - eprosima::fastcdr::optional type_ann_builtin_Calculator_Reply; - eprosima::fastcdr::optional ann_custom_Calculator_Reply; - CompleteTypeDetail detail_Calculator_Reply = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_Calculator_Reply, ann_custom_Calculator_Reply, type_name_Calculator_Reply.to_string()); - CompleteStructHeader header_Calculator_Reply; - header_Calculator_Reply = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_Calculator_Reply); - CompleteStructMemberSeq member_seq_Calculator_Reply; - { - TypeIdentifierPair type_ids_addition; - ReturnCode_t return_code_addition {eprosima::fastdds::dds::RETCODE_OK}; - return_code_addition = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "calculator_base::detail::Adder_addition_Result", type_ids_addition); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_addition) - { - ::calculator_base::detail::register_Adder_addition_Result_type_identifier(type_ids_addition); - } - StructMemberFlag member_flags_addition = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - true, false, false, false); - MemberId member_id_addition = 0x04e82a2b; - bool common_addition_ec {false}; - CommonStructMember common_addition {TypeObjectUtils::build_common_struct_member(member_id_addition, member_flags_addition, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_addition, common_addition_ec))}; - if (!common_addition_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure addition member TypeIdentifier inconsistent."); - return; - } - MemberName name_addition = "addition"; - eprosima::fastcdr::optional member_ann_builtin_addition; - ann_custom_Calculator_Reply.reset(); - AppliedAnnotationSeq tmp_ann_custom_addition; - eprosima::fastcdr::optional unit_addition; - eprosima::fastcdr::optional min_addition; - eprosima::fastcdr::optional max_addition; - eprosima::fastcdr::optional hash_id_addition; - hash_id_addition = ""; - - if (unit_addition.has_value() || min_addition.has_value() || max_addition.has_value() || hash_id_addition.has_value()) - { - member_ann_builtin_addition = TypeObjectUtils::build_applied_builtin_member_annotations(unit_addition, min_addition, max_addition, hash_id_addition); - } - if (!tmp_ann_custom_addition.empty()) - { - ann_custom_Calculator_Reply = tmp_ann_custom_addition; - } - CompleteMemberDetail detail_addition = TypeObjectUtils::build_complete_member_detail(name_addition, member_ann_builtin_addition, ann_custom_Calculator_Reply); - CompleteStructMember member_addition = TypeObjectUtils::build_complete_struct_member(common_addition, detail_addition); - TypeObjectUtils::add_complete_struct_member(member_seq_Calculator_Reply, member_addition); - } - { - TypeIdentifierPair type_ids_subtraction; - ReturnCode_t return_code_subtraction {eprosima::fastdds::dds::RETCODE_OK}; - return_code_subtraction = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "calculator_base::detail::Subtractor_subtraction_Result", type_ids_subtraction); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_subtraction) - { - ::calculator_base::detail::register_Subtractor_subtraction_Result_type_identifier(type_ids_subtraction); - } - StructMemberFlag member_flags_subtraction = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - true, false, false, false); - MemberId member_id_subtraction = 0x096bbc8d; - bool common_subtraction_ec {false}; - CommonStructMember common_subtraction {TypeObjectUtils::build_common_struct_member(member_id_subtraction, member_flags_subtraction, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_subtraction, common_subtraction_ec))}; - if (!common_subtraction_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure subtraction member TypeIdentifier inconsistent."); - return; - } - MemberName name_subtraction = "subtraction"; - eprosima::fastcdr::optional member_ann_builtin_subtraction; - ann_custom_Calculator_Reply.reset(); - AppliedAnnotationSeq tmp_ann_custom_subtraction; - eprosima::fastcdr::optional unit_subtraction; - eprosima::fastcdr::optional min_subtraction; - eprosima::fastcdr::optional max_subtraction; - eprosima::fastcdr::optional hash_id_subtraction; - hash_id_subtraction = ""; - - if (unit_subtraction.has_value() || min_subtraction.has_value() || max_subtraction.has_value() || hash_id_subtraction.has_value()) - { - member_ann_builtin_subtraction = TypeObjectUtils::build_applied_builtin_member_annotations(unit_subtraction, min_subtraction, max_subtraction, hash_id_subtraction); - } - if (!tmp_ann_custom_subtraction.empty()) - { - ann_custom_Calculator_Reply = tmp_ann_custom_subtraction; - } - CompleteMemberDetail detail_subtraction = TypeObjectUtils::build_complete_member_detail(name_subtraction, member_ann_builtin_subtraction, ann_custom_Calculator_Reply); - CompleteStructMember member_subtraction = TypeObjectUtils::build_complete_struct_member(common_subtraction, detail_subtraction); - TypeObjectUtils::add_complete_struct_member(member_seq_Calculator_Reply, member_subtraction); - } - { - TypeIdentifierPair type_ids_representation_limits; - ReturnCode_t return_code_representation_limits {eprosima::fastdds::dds::RETCODE_OK}; - return_code_representation_limits = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "detail::Calculator_representation_limits_Result", type_ids_representation_limits); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_representation_limits) - { - ::detail::register_Calculator_representation_limits_Result_type_identifier(type_ids_representation_limits); - } - StructMemberFlag member_flags_representation_limits = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - true, false, false, false); - MemberId member_id_representation_limits = 0x0e205a8d; - bool common_representation_limits_ec {false}; - CommonStructMember common_representation_limits {TypeObjectUtils::build_common_struct_member(member_id_representation_limits, member_flags_representation_limits, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_representation_limits, common_representation_limits_ec))}; - if (!common_representation_limits_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure representation_limits member TypeIdentifier inconsistent."); - return; - } - MemberName name_representation_limits = "representation_limits"; - eprosima::fastcdr::optional member_ann_builtin_representation_limits; - ann_custom_Calculator_Reply.reset(); - AppliedAnnotationSeq tmp_ann_custom_representation_limits; - eprosima::fastcdr::optional unit_representation_limits; - eprosima::fastcdr::optional min_representation_limits; - eprosima::fastcdr::optional max_representation_limits; - eprosima::fastcdr::optional hash_id_representation_limits; - hash_id_representation_limits = ""; - - if (unit_representation_limits.has_value() || min_representation_limits.has_value() || max_representation_limits.has_value() || hash_id_representation_limits.has_value()) - { - member_ann_builtin_representation_limits = TypeObjectUtils::build_applied_builtin_member_annotations(unit_representation_limits, min_representation_limits, max_representation_limits, hash_id_representation_limits); - } - if (!tmp_ann_custom_representation_limits.empty()) - { - ann_custom_Calculator_Reply = tmp_ann_custom_representation_limits; - } - CompleteMemberDetail detail_representation_limits = TypeObjectUtils::build_complete_member_detail(name_representation_limits, member_ann_builtin_representation_limits, ann_custom_Calculator_Reply); - CompleteStructMember member_representation_limits = TypeObjectUtils::build_complete_struct_member(common_representation_limits, detail_representation_limits); - TypeObjectUtils::add_complete_struct_member(member_seq_Calculator_Reply, member_representation_limits); - } - { - TypeIdentifierPair type_ids_remoteEx; - ReturnCode_t return_code_remoteEx {eprosima::fastdds::dds::RETCODE_OK}; - return_code_remoteEx = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "eprosima::fastdds::dds::rpc::RemoteExceptionCode_t", type_ids_remoteEx); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_remoteEx) - { - ::eprosima::fastdds::dds::rpc::register_RemoteExceptionCode_t_type_identifier(type_ids_remoteEx); - } - StructMemberFlag member_flags_remoteEx = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - true, false, false, false); - MemberId member_id_remoteEx = 0x0f8e48f0; - bool common_remoteEx_ec {false}; - CommonStructMember common_remoteEx {TypeObjectUtils::build_common_struct_member(member_id_remoteEx, member_flags_remoteEx, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_remoteEx, common_remoteEx_ec))}; - if (!common_remoteEx_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure remoteEx member TypeIdentifier inconsistent."); - return; - } - MemberName name_remoteEx = "remoteEx"; - eprosima::fastcdr::optional member_ann_builtin_remoteEx; - ann_custom_Calculator_Reply.reset(); - AppliedAnnotationSeq tmp_ann_custom_remoteEx; - eprosima::fastcdr::optional unit_remoteEx; - eprosima::fastcdr::optional min_remoteEx; - eprosima::fastcdr::optional max_remoteEx; - eprosima::fastcdr::optional hash_id_remoteEx; - hash_id_remoteEx = ""; - - if (unit_remoteEx.has_value() || min_remoteEx.has_value() || max_remoteEx.has_value() || hash_id_remoteEx.has_value()) - { - member_ann_builtin_remoteEx = TypeObjectUtils::build_applied_builtin_member_annotations(unit_remoteEx, min_remoteEx, max_remoteEx, hash_id_remoteEx); - } - if (!tmp_ann_custom_remoteEx.empty()) - { - ann_custom_Calculator_Reply = tmp_ann_custom_remoteEx; - } - CompleteMemberDetail detail_remoteEx = TypeObjectUtils::build_complete_member_detail(name_remoteEx, member_ann_builtin_remoteEx, ann_custom_Calculator_Reply); - CompleteStructMember member_remoteEx = TypeObjectUtils::build_complete_struct_member(common_remoteEx, detail_remoteEx); - TypeObjectUtils::add_complete_struct_member(member_seq_Calculator_Reply, member_remoteEx); - } - CompleteStructType struct_type_Calculator_Reply = TypeObjectUtils::build_complete_struct_type(struct_flags_Calculator_Reply, header_Calculator_Reply, member_seq_Calculator_Reply); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_Calculator_Reply, type_name_Calculator_Reply.to_string(), type_ids_Calculator_Reply)) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "detail::Calculator_Reply already registered in TypeObjectRegistry for a different type."); - } - } -} - diff --git a/fastdds_python_examples/RPCExample/generated_code/calculatorTypeObjectSupport.hpp b/fastdds_python_examples/RPCExample/generated_code/calculatorTypeObjectSupport.hpp deleted file mode 100644 index 13f75565..00000000 --- a/fastdds_python_examples/RPCExample/generated_code/calculatorTypeObjectSupport.hpp +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/*! - * @file calculatorTypeObjectSupport.hpp - * Header file containing the API required to register the TypeObject representation of the described types in the IDL file - * - * This file was generated by the tool fastddsgen (version: 4.2.0). - */ - -#ifndef FAST_DDS_GENERATED__CALCULATOR_TYPE_OBJECT_SUPPORT_HPP -#define FAST_DDS_GENERATED__CALCULATOR_TYPE_OBJECT_SUPPORT_HPP - -#include - - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define eProsima_user_DllExport -#endif // _WIN32 - -#ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC - -namespace calculator_base { -} // namespace calculator_base -/** - * @brief Register Calculator_Request related TypeIdentifier. - * Fully-descriptive TypeIdentifiers are directly registered. - * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is - * indirectly registered as well. - * - * @param[out] type_ids TypeIdentifier of the registered type. - * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. - * Invalid TypeIdentifier is returned in case of error. - */ -eProsima_user_DllExport void register_Calculator_Request_type_identifier( - eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); - -/** - * @brief Register Calculator_Reply related TypeIdentifier. - * Fully-descriptive TypeIdentifiers are directly registered. - * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is - * indirectly registered as well. - * - * @param[out] type_ids TypeIdentifier of the registered type. - * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. - * Invalid TypeIdentifier is returned in case of error. - */ -eProsima_user_DllExport void register_Calculator_Reply_type_identifier( - eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); - - - -#endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC - -#endif // FAST_DDS_GENERATED__CALCULATOR_TYPE_OBJECT_SUPPORT_HPP diff --git a/fastdds_python_examples/RPCExample/generated_code/calculator_details.hpp b/fastdds_python_examples/RPCExample/generated_code/calculator_details.hpp deleted file mode 100644 index ed49f644..00000000 --- a/fastdds_python_examples/RPCExample/generated_code/calculator_details.hpp +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/*! - * @file calculator_details.hpp - * This header file contains support data structures for RPC communication. - * - * This file was generated by the tool fastddsgen (version: 4.2.0). - */ - -#ifndef FAST_DDS_GENERATED__CALCULATOR_DETAILS_HPP -#define FAST_DDS_GENERATED__CALCULATOR_DETAILS_HPP - -#include -#include -#include - -#include "calculator.hpp" - -namespace calculator_base { - namespace detail { - - //{ Adder interface - - //{ addition - struct Adder_addition_In - { - int32_t value1; - int32_t value2; - }; - - - - struct Adder_addition_Out - { - int32_t return_; - }; - - struct Adder_addition_Result - { - eprosima::fastcdr::optional result; - eprosima::fastcdr::optional calculator_base_OverflowException_ex; - }; - - //} // addition - - - //} // Adder interface - - } // namespace detail - namespace detail { - - //{ Subtractor interface - - //{ subtraction - struct Subtractor_subtraction_In - { - int32_t value1; - int32_t value2; - }; - - - - struct Subtractor_subtraction_Out - { - int32_t return_; - }; - - struct Subtractor_subtraction_Result - { - eprosima::fastcdr::optional result; - eprosima::fastcdr::optional calculator_base_OverflowException_ex; - }; - - //} // subtraction - - - //} // Subtractor interface - - } // namespace detail -} // namespace calculator_base -namespace detail { - -//{ Calculator interface - -//{ representation_limits -struct Calculator_representation_limits_In -{ -}; - - - -struct Calculator_representation_limits_Result -{ - eprosima::fastcdr::optional result; -}; - -//} // representation_limits - - -//{ top level - -struct Calculator_Request -{ - eprosima::fastcdr::optional addition; - eprosima::fastcdr::optional subtraction; - eprosima::fastcdr::optional representation_limits; -}; - -struct Calculator_Reply -{ - eprosima::fastcdr::optional addition; - eprosima::fastcdr::optional subtraction; - eprosima::fastcdr::optional representation_limits; - eprosima::fastcdr::optional remoteEx; -}; - -//} // top level - -//} // Calculator interface - -} // namespace detail - -#endif //FAST_DDS_GENERATED__CALCULATOR_DETAILS_HPP \ No newline at end of file diff --git a/utils/scripts/update_generated_code_from_idl.sh b/utils/scripts/update_generated_code_from_idl.sh index 108f3939..8586552f 100755 --- a/utils/scripts/update_generated_code_from_idl.sh +++ b/utils/scripts/update_generated_code_from_idl.sh @@ -40,14 +40,6 @@ if [[ $? != 0 ]]; then fi cd - -if [[ $ret_value != -1 ]]; then - cd "./fastdds_python_examples/RPCExample" - -echo -e "Processing ${yellow}calculator.idl${textreset}" - echo "Running: fastddsgen -replace -python calculator.idl" - fastddsgen -replace -python -d generated_code calculator.idl -fi - if [[ $? != 0 ]]; then ret_value=-1 fi