Skip to content

Commit b70d9c4

Browse files
committed
Fix conflicts.
Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
1 parent ae21735 commit b70d9c4

11 files changed

Lines changed: 146 additions & 3412 deletions

fastdds_python_examples/RPCExample/generated_code/CMakeLists.txt

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,4 @@
11

2-
# Copyright 2025 Proyectos y Sistemas de Mantenimiento SL (eProsima).
3-
#
4-
# Licensed under the Apache License, Version 2.0 (the "License");
5-
# you may not use this file except in compliance with the License.
6-
# You may obtain a copy of the License at
7-
#
8-
# http://www.apache.org/licenses/LICENSE-2.0
9-
#
10-
# Unless required by applicable law or agreed to in writing, software
11-
# distributed under the License is distributed on an "AS IS" BASIS,
12-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
# See the License for the specific language governing permissions and
14-
# limitations under the License.
15-
162
cmake_minimum_required(VERSION 3.20)
173

184
# SWIG: use standard target name.
@@ -44,9 +30,6 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
4430
#Create library for C++ types
4531
add_library(${PROJECT_NAME} SHARED
4632
calculatorTypeObjectSupport.cxx
47-
calculatorPubSubTypes.cxx
48-
calculatorClient.cxx
49-
calculatorServer.cxx
5033
)
5134
if(WIN32)
5235
target_compile_definitions(${PROJECT_NAME} PRIVATE EPROSIMA_USER_DLL_EXPORT)

fastdds_python_examples/RPCExample/generated_code/calculator.hpp

Lines changed: 4 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,14 @@
1616
* @file calculator.hpp
1717
* This header file contains the declaration of the described types in the IDL file.
1818
*
19-
* This file was generated by the tool fastddsgen (version: 4.1.0).
19+
* This file was generated by the tool fastddsgen (version: 4.0.4).
2020
*/
2121

2222
#ifndef FAST_DDS_GENERATED__CALCULATOR_HPP
2323
#define FAST_DDS_GENERATED__CALCULATOR_HPP
2424

2525
#include <cstdint>
26-
#include <string>
2726
#include <utility>
28-
#include <fastcdr/cdr/fixed_size_string.hpp>
29-
#include <fastcdr/xcdr/optional.hpp>
30-
#include <fastdds/dds/rpc/exceptions/RpcOperationError.hpp>
31-
#include <fastdds/dds/rpc/interfaces/RpcFuture.hpp>
32-
3327

3428
#if defined(_WIN32)
3529
#if defined(EPROSIMA_USER_DLL_EXPORT)
@@ -57,136 +51,36 @@
5751

5852
namespace calculator_base {
5953

60-
/*!
61-
* @brief This class implements the user exception calculator_base::OverflowException
62-
* @ingroup calculator
63-
*/
64-
class eProsima_user_DllExport OverflowException : public eprosima::fastdds::dds::rpc::RpcOperationError
65-
{
66-
public:
67-
68-
/**
69-
* Default constructor.
70-
*/
71-
OverflowException()
72-
: OverflowException("OverflowException")
73-
{
74-
}
75-
76-
/**
77-
* Constructor.
78-
*/
79-
OverflowException(
80-
const std::string& message)
81-
: eprosima::fastdds::dds::rpc::RpcOperationError(message)
82-
{
83-
}
84-
85-
/**
86-
* Constructor.
87-
*/
88-
OverflowException(
89-
const char* message)
90-
: eprosima::fastdds::dds::rpc::RpcOperationError(message)
91-
{
92-
}
93-
94-
/**
95-
* Copy constructor.
96-
*/
97-
OverflowException(
98-
const OverflowException& other) noexcept = default;
99-
100-
/**
101-
* Copy assignment.
102-
*/
103-
OverflowException& operator =(
104-
const OverflowException& other) noexcept = default;
105-
106-
/**
107-
* Destructor.
108-
*/
109-
virtual ~OverflowException() noexcept = default;
110-
111-
112-
113-
private:
114-
115-
116-
};
117-
118-
11954
/*!
12055
* @brief This class represents the interface Adder defined by the user in the IDL file.
12156
* @ingroup calculator
12257
*/
123-
class eProsima_user_DllExport Adder
58+
class CALCULATOR_DllAPI Adder
12459
{
12560
public:
126-
virtual ~Adder() = default;
127-
128-
129-
virtual eprosima::fastdds::dds::rpc::RpcFuture<int32_t> addition(
130-
/*in*/ int32_t value1,
131-
/*in*/ int32_t value2) = 0;
13261

13362
};
134-
135-
136-
13763
/*!
13864
* @brief This class represents the interface Subtractor defined by the user in the IDL file.
13965
* @ingroup calculator
14066
*/
141-
class eProsima_user_DllExport Subtractor
67+
class CALCULATOR_DllAPI Subtractor
14268
{
14369
public:
144-
virtual ~Subtractor() = default;
145-
146-
147-
virtual eprosima::fastdds::dds::rpc::RpcFuture<int32_t> subtraction(
148-
/*in*/ int32_t value1,
149-
/*in*/ int32_t value2) = 0;
15070

15171
};
15272

153-
154-
15573
} // namespace calculator_base
156-
157-
namespace detail {
158-
159-
struct Calculator_representation_limits_Out;
160-
161-
} // namespace detail
162-
16374
/*!
16475
* @brief This class represents the interface Calculator defined by the user in the IDL file.
16576
* @ingroup calculator
16677
*/
167-
class eProsima_user_DllExport Calculator : public calculator_base::Adder, public calculator_base::Subtractor
78+
class CALCULATOR_DllAPI Calculator : public calculator_base::Adder, public calculator_base::Subtractor
16879
{
16980
public:
170-
virtual ~Calculator() = default;
171-
172-
173-
virtual eprosima::fastdds::dds::rpc::RpcFuture<detail::Calculator_representation_limits_Out> representation_limits(
174-
) = 0;
175-
176-
};
17781

178-
namespace detail {
179-
180-
struct Calculator_representation_limits_Out
181-
{
182-
int32_t min_value;
183-
int32_t max_value;
18482
};
18583

186-
187-
} // namespace detail
188-
189-
19084
#endif // _FAST_DDS_GENERATED_CALCULATOR_HPP_
19185

19286

fastdds_python_examples/RPCExample/generated_code/calculator.i

Lines changed: 2 additions & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,10 @@
1616
* @file calculator.i
1717
* This header file contains the SWIG interface of the described types in the IDL file.
1818
*
19-
* This file was generated by the tool fastddsgen (version: 4.1.0).
19+
* This file was generated by the tool fastddsgen (version: 4.0.4).
2020
*/
2121

22-
%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
23-
24-
// We have enabled threads because the RPC server directors will call the target language environment
25-
// from the C++ server threads, but we don't want the calls from the target language to release their
26-
// locks (e.g. Python GIL) when calling the C++ methods.
27-
// See a very nice explanation at https://github.com/swig/swig/issues/927#issuecomment-289279243
28-
%feature("nothreadallow");
22+
%module(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
2923

3024
// If using windows in debug, it would try to use python_d, which would not be found.
3125
%begin %{
@@ -36,12 +30,9 @@
3630
%}
3731

3832
// SWIG helper modules
39-
%include "exception.i"
4033
%include "stdint.i"
4134
%include "std_array.i"
4235
%include "std_map.i"
43-
%include "std_pair.i"
44-
%include "std_shared_ptr.i"
4536
%include "std_string.i"
4637
%include "std_vector.i"
4738
%include "typemaps.i"
@@ -58,90 +49,15 @@
5849

5950
%{
6051
#include "calculator.hpp"
61-
#include "calculatorClient.hpp"
62-
#include "calculatorServer.hpp"
63-
#include "calculatorServerImpl.hpp"
6452

6553
#include <fastdds/dds/core/LoanableSequence.hpp>
6654
%}
6755

6856
%include <fastcdr/config.h>
69-
%import(module="fastdds") "fastcdr/xcdr/optional.hpp"
70-
%import(module="fastdds") "fastcdr/cdr/fixed_size_string.hpp"
7157
%import(module="fastdds") "fastdds/dds/core/LoanableCollection.hpp"
7258
%import(module="fastdds") "fastdds/dds/core/LoanableTypedCollection.hpp"
7359
%import(module="fastdds") "fastdds/dds/core/LoanableSequence.hpp"
7460

75-
%import(module="fastdds") "fastdds/dds/rpc/exceptions/RpcException.hpp"
76-
%import(module="fastdds") "fastdds/dds/rpc/exceptions/RpcOperationError.hpp"
77-
78-
%exception {
79-
try
80-
{
81-
$action
82-
}
83-
catch (const eprosima::fastdds::dds::rpc::RpcException& ex)
84-
{
85-
SWIG_exception(SWIG_RuntimeError, ex.what());
86-
}
87-
catch (const std::exception& ex)
88-
{
89-
SWIG_exception(SWIG_RuntimeError, ex.what());
90-
}
91-
catch (...)
92-
{
93-
SWIG_exception(SWIG_RuntimeError,"Unknown exception");
94-
}
95-
}
96-
97-
// Code for std::future taken from https://github.com/swig/swig/issues/1828#issuecomment-648449092
98-
namespace eprosima::fastdds::dds::rpc
99-
{
100-
template <class R>
101-
class RpcFuture {
102-
public:
103-
RpcFuture() noexcept;
104-
RpcFuture(RpcFuture &&) noexcept;
105-
RpcFuture(const RpcFuture& rhs) = delete;
106-
~RpcFuture();
107-
RpcFuture& operator=(const RpcFuture& rhs) = delete;
108-
RpcFuture& operator=(RpcFuture&&) noexcept;
109-
110-
// retrieving the value
111-
R get();
112-
113-
// functions to check state
114-
bool valid() const noexcept;
115-
void wait() const;
116-
117-
/*
118-
template <class Rep, class Period>
119-
future_status wait_for(const chrono::duration<Rep, Period>& rel_time) const;
120-
template <class Clock, class Duration>
121-
future_status wait_until(const chrono::time_point<Clock, Duration>& abs_time) const;
122-
*/
123-
};
124-
125-
}
126-
127-
%shared_ptr(eprosima::fastdds::dds::rpc::RpcFuture<detail::Calculator_representation_limits_Out>);
128-
%template(detail_Calculator_representation_limits_Out_rpc_future) eprosima::fastdds::dds::rpc::RpcFuture<detail::Calculator_representation_limits_Out>;
129-
130-
%typemap(out, optimal="1") eprosima::fastdds::dds::rpc::RpcFuture<detail::Calculator_representation_limits_Out> {
131-
std::shared_ptr<$1_ltype> *smartresult = new std::shared_ptr<$1_ltype>(new $1_ltype($1));
132-
$result = SWIG_NewPointerObj(SWIG_as_voidptr(smartresult), $descriptor(std::shared_ptr< eprosima::fastdds::dds::rpc::RpcFuture<detail::Calculator_representation_limits_Out>> *), SWIG_POINTER_OWN);
133-
}
134-
135-
%shared_ptr(eprosima::fastdds::dds::rpc::RpcFuture<int32_t>);
136-
%template(int32_t_rpc_future) eprosima::fastdds::dds::rpc::RpcFuture<int32_t>;
137-
138-
%typemap(out, optimal="1") eprosima::fastdds::dds::rpc::RpcFuture<int32_t> {
139-
std::shared_ptr<$1_ltype> *smartresult = new std::shared_ptr<$1_ltype>(new $1_ltype($1));
140-
$result = SWIG_NewPointerObj(SWIG_as_voidptr(smartresult), $descriptor(std::shared_ptr< eprosima::fastdds::dds::rpc::RpcFuture<int32_t>> *), SWIG_POINTER_OWN);
141-
}
142-
143-
%exception;
144-
14561
%define %traits_penumn(Type...)
14662
%fragment(SWIG_Traits_frag(Type),"header",
14763
fragment="StdTraits") {
@@ -155,58 +71,8 @@ namespace swig {
15571
%enddef
15672

15773

158-
159-
%shared_ptr(calculator_base::Adder);
160-
161-
162-
163-
%shared_ptr(calculator_base::Subtractor);
164-
165-
166-
167-
<<<<<<< HEAD
168-
%shared_ptr(calculator_base::BasicCalculator);
169-
%shared_ptr(calculator_base::BasicCalculatorServer);
170-
%extend calculator_base::BasicCalculatorServer
171-
{
172-
void run()
173-
{
174-
Py_BEGIN_ALLOW_THREADS
175-
self->run();
176-
Py_END_ALLOW_THREADS
177-
}
178-
}
179-
180-
%shared_ptr(calculator_base::BasicCalculatorServer_IServerImplementation);
181-
%shared_ptr(calculator_base::BasicCalculatorServerImplementation);
182-
%feature("director") calculator_base::BasicCalculatorServerImplementation;
183-
184-
185-
186-
=======
187-
>>>>>>> e143c3b (Remove `@feed` operations from example (#256))
188-
%shared_ptr(Calculator);
189-
%shared_ptr(CalculatorServer);
190-
%extend CalculatorServer
191-
{
192-
void run()
193-
{
194-
Py_BEGIN_ALLOW_THREADS
195-
self->run();
196-
Py_END_ALLOW_THREADS
197-
}
198-
}
199-
200-
%shared_ptr(CalculatorServer_IServerImplementation);
201-
%shared_ptr(CalculatorServerImplementation);
202-
%feature("director") CalculatorServerImplementation;
203-
204-
20574
// Include the class interfaces
20675
%include "calculator.hpp"
207-
%include "calculatorClient.hpp"
208-
%include "calculatorServer.hpp"
209-
%include "calculatorServerImpl.hpp"
21076

21177
// Include the corresponding TopicDataType
21278
%include "calculatorPubSubTypes.i"

0 commit comments

Comments
 (0)