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')\n if __package__ or '.' in __name__:\n from . import _calculatorWrapper\n else:\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')\n if __package__ or '.' in __name__:\n from . import _calculatorWrapper\n else:\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 %{
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"
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