Skip to content

Commit 3ecb67a

Browse files
committed
Refs #23701. Remove feed operations from example.
Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
1 parent 28ba0e1 commit 3ecb67a

12 files changed

Lines changed: 2 additions & 3993 deletions

fastdds_python_examples/RPCExample/CalculatorExample.py

Lines changed: 0 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -50,38 +50,6 @@ def representation_limits(self, info):
5050
ret_val.max_value = 2147483647
5151
return ret_val
5252

53-
def fibonacci_seq(self, info, n_results, result_writer):
54-
self.operation_call_print(info, "fibonacci_seq")
55-
a = 1
56-
b = 1
57-
c = 0
58-
59-
while n_results > 0:
60-
n_results = n_results - 1
61-
62-
result_writer.write(a)
63-
c = a + b
64-
a = b
65-
b = c
66-
67-
def sum_all(self, info, value):
68-
self.operation_call_print(info, "sum_all")
69-
ret = 0
70-
has_value, n = value.read()
71-
while has_value:
72-
ret = ret + n
73-
has_value, n = value.read()
74-
return ret
75-
76-
def accumulator(self, info, value, result_writer):
77-
self.operation_call_print(info, "accumulator")
78-
ret = 0
79-
has_value, n = value.read()
80-
while has_value:
81-
ret = ret + n
82-
result_writer.write(ret)
83-
has_value, n = value.read()
84-
8553
### Server application ###
8654

8755
def run_server(server):
@@ -134,9 +102,6 @@ def run(self):
134102
self.perform_addition()
135103
self.perform_subtraction()
136104
self.perform_representation_limits()
137-
self.perform_fibonacci_seq()
138-
self.perform_sum_all()
139-
self.perform_accumulator()
140105

141106
def perform_addition(self):
142107
try:
@@ -180,51 +145,6 @@ def perform_representation_limits(self):
180145
print("Exception: {}".format(type(e).__name__))
181146
print("Exception message: {}".format(e))
182147

183-
def perform_fibonacci_seq(self):
184-
try:
185-
print("Performing fibonacci_seq(10)")
186-
result = self.client.fibonacci_seq(10)
187-
has_value, n = result.read()
188-
while has_value:
189-
print("Result: {}".format(n))
190-
has_value, n = result.read()
191-
except Exception as e:
192-
print("Exception: {}".format(type(e).__name__))
193-
print("Exception message: {}".format(e))
194-
195-
def perform_sum_all(self):
196-
try:
197-
print("Performing sum_all([1, 2, 3, 4, 5])")
198-
result, value = self.client.sum_all()
199-
value.write(1)
200-
value.write(2)
201-
value.write(3)
202-
value.write(4)
203-
value.write(5)
204-
value.finish()
205-
print("Result: {}".format(result.get()))
206-
except Exception as e:
207-
print("Exception: {}".format(type(e).__name__))
208-
print("Exception message: {}".format(e))
209-
210-
def perform_accumulator(self):
211-
try:
212-
print("Performing accumulator([1, 2, 3, 4, 5])")
213-
result, value = self.client.accumulator()
214-
value.write(1)
215-
value.write(2)
216-
value.write(3)
217-
value.write(4)
218-
value.write(5)
219-
value.finish()
220-
has_value, n = result.read()
221-
while has_value:
222-
print("Result: {}".format(n))
223-
has_value, n = result.read()
224-
except Exception as e:
225-
print("Exception: {}".format(type(e).__name__))
226-
print("Exception message: {}".format(e))
227-
228148
def parse_options():
229149
""""
230150
Parse arguments.

fastdds_python_examples/RPCExample/calculator.idl

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,4 @@ module calculator_base
4242

4343
interface Calculator : calculator_base::BasicCalculator
4444
{
45-
// Returns a feed of results with the n_results first elements of the Fibonacci sequence
46-
// E.g. for an input of 5, returns a feed with {1, 1, 2, 3, 5}
47-
@feed long fibonacci_seq(in unsigned long n_results) raises (calculator_base::OverflowException);
48-
49-
// Waits for an input feed to finish and returns the sum of all the received values
50-
// E.g. for an input of {1, 2, 3, 4, 5} returns 15
51-
long sum_all(@feed in long value) raises (calculator_base::OverflowException);
52-
53-
// Returns a feed of results with the sum of all received values
54-
// E.g. for an input of {1, 2, 3, 4, 5}, returns a feed with {1, 3, 6, 10, 15}
55-
@feed long accumulator(@feed in long value) raises (calculator_base::OverflowException);
5645
};

fastdds_python_examples/RPCExample/generated_code/calculator.hpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,11 @@
2323
#define FAST_DDS_GENERATED__CALCULATOR_HPP
2424

2525
#include <cstdint>
26-
#include <memory>
2726
#include <string>
2827
#include <utility>
2928
#include <fastcdr/cdr/fixed_size_string.hpp>
3029
#include <fastcdr/xcdr/optional.hpp>
3130
#include <fastdds/dds/rpc/exceptions/RpcOperationError.hpp>
32-
#include <fastdds/dds/rpc/interfaces/RpcClientReader.hpp>
33-
#include <fastdds/dds/rpc/interfaces/RpcClientWriter.hpp>
3431
#include <fastdds/dds/rpc/interfaces/RpcFuture.hpp>
3532

3633

@@ -199,18 +196,6 @@ class eProsima_user_DllExport Calculator : public calculator_base::BasicCalculat
199196
public:
200197
virtual ~Calculator() = default;
201198

202-
203-
virtual std::shared_ptr<eprosima::fastdds::dds::rpc::RpcClientReader<int32_t> > fibonacci_seq(
204-
/*in*/ uint32_t n_results) = 0;
205-
206-
207-
virtual eprosima::fastdds::dds::rpc::RpcFuture<int32_t> sum_all(
208-
/*in*/ std::shared_ptr<eprosima::fastdds::dds::rpc::RpcClientWriter<int32_t>>& value) = 0;
209-
210-
211-
virtual std::shared_ptr<eprosima::fastdds::dds::rpc::RpcClientReader<int32_t> > accumulator(
212-
/*in*/ std::shared_ptr<eprosima::fastdds::dds::rpc::RpcClientWriter<int32_t>>& value) = 0;
213-
214199
};
215200

216201

fastdds_python_examples/RPCExample/generated_code/calculator.i

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -102,33 +102,6 @@
102102
}
103103
}
104104

105-
%import(module="fastdds") "fastdds/dds/rpc/interfaces/RpcServerWriter.hpp"
106-
%ignore eprosima::fastdds::dds::rpc::RpcClientReader::read(T&);
107-
%ignore eprosima::fastdds::dds::rpc::RpcClientReader::read(T&,eprosima::fastdds::dds::Duration_t&);
108-
%import(module="fastdds") "fastdds/dds/rpc/interfaces/RpcClientReader.hpp"
109-
%extend eprosima::fastdds::dds::rpc::RpcClientReader {
110-
std::pair<bool, T> read(
111-
const eprosima::fastdds::dds::Duration_t& timeout = eprosima::fastdds::dds::c_TimeInfinite)
112-
{
113-
std::pair<bool, T> ret_val{};
114-
if (eprosima::fastdds::dds::c_TimeInfinite == timeout)
115-
{
116-
ret_val.first = self->read(ret_val.second);
117-
}
118-
else
119-
{
120-
ret_val.first = self->read(ret_val.second, timeout);
121-
}
122-
return ret_val;
123-
}
124-
}
125-
126-
%shared_ptr(eprosima::fastdds::dds::rpc::RpcClientReader<int32_t>);
127-
%template(int32_t_client_reader_result) std::pair<bool, int32_t>;
128-
%template(int32_t_client_reader) eprosima::fastdds::dds::rpc::RpcClientReader<int32_t>;
129-
130-
%template(int32_t_server_writer) eprosima::fastdds::dds::rpc::RpcServerWriter<int32_t>;
131-
132105
// Code for std::future taken from https://github.com/swig/swig/issues/1828#issuecomment-648449092
133106
namespace eprosima::fastdds::dds::rpc
134107
{
@@ -175,42 +148,6 @@ class RpcFuture {
175148
$result = SWIG_NewPointerObj(SWIG_as_voidptr(smartresult), $descriptor(std::shared_ptr< eprosima::fastdds::dds::rpc::RpcFuture<int32_t>> *), SWIG_POINTER_OWN);
176149
}
177150

178-
%import(module="fastdds") "fastdds/dds/rpc/interfaces/RpcClientWriter.hpp"
179-
%import(module="fastdds") "fastdds/dds/rpc/interfaces/RpcStatusCode.hpp"
180-
181-
%ignore eprosima::fastdds::dds::rpc::RpcServerReader::read(T&);
182-
%ignore eprosima::fastdds::dds::rpc::RpcServerReader::read(T&,eprosima::fastdds::dds::Duration_t&);
183-
%import(module="fastdds") "fastdds/dds/rpc/interfaces/RpcServerReader.hpp"
184-
%extend eprosima::fastdds::dds::rpc::RpcServerReader {
185-
std::pair<bool, T> read(
186-
const eprosima::fastdds::dds::Duration_t& timeout = eprosima::fastdds::dds::c_TimeInfinite)
187-
{
188-
std::pair<bool, T> ret_val{};
189-
if (eprosima::fastdds::dds::c_TimeInfinite == timeout)
190-
{
191-
ret_val.first = self->read(ret_val.second);
192-
}
193-
else
194-
{
195-
ret_val.first = self->read(ret_val.second, timeout);
196-
}
197-
return ret_val;
198-
}
199-
}
200-
201-
%template(int32_t_server_reader_result) std::pair<bool, int32_t>;
202-
%template(int32_t_server_reader) eprosima::fastdds::dds::rpc::RpcServerReader<int32_t>;
203-
204-
%shared_ptr(eprosima::fastdds::dds::rpc::RpcClientWriter<int32_t>);
205-
%template(int32_t_rpc_client_writer) eprosima::fastdds::dds::rpc::RpcClientWriter<int32_t>;
206-
%typemap(in,numinputs=0) std::shared_ptr<eprosima::fastdds::dds::rpc::RpcClientWriter<int32_t>>& %{
207-
$1 = new std::shared_ptr<eprosima::fastdds::dds::rpc::RpcClientWriter<int32_t>>();
208-
%}
209-
%typemap(argout) std::shared_ptr<eprosima::fastdds::dds::rpc::RpcClientWriter<int32_t>>& (PyObject* tmp) %{
210-
tmp = SWIG_NewPointerObj($1, $1_descriptor, SWIG_POINTER_OWN);
211-
$result = SWIG_Python_AppendOutput($result, tmp);
212-
%}
213-
214151
%exception;
215152

216153
%define %traits_penumn(Type...)

0 commit comments

Comments
 (0)