-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathfastdds.i
More file actions
255 lines (228 loc) · 9.78 KB
/
fastdds.i
File metadata and controls
255 lines (228 loc) · 9.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
// Copyright 2022 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(directors="1", threads="1", moduleimport="if __import__('os').name == 'nt': import win32api; win32api.LoadLibrary('$<TARGET_FILE_NAME:fastdds>')\nif __package__ or '.' in __name__:\n from . import _fastdds_python\nelse:\n import _fastdds_python") fastdds
// Handle exceptions on python callbacks and send them back to C++ so that they can be catched
// Also, add some meaningful description of the error
%feature("director:except") {
if ($error != NULL) {
PyObject *exc, *val, *tb;
PyErr_Fetch(&exc, &val, &tb);
PyErr_NormalizeException(&exc, &val, &tb);
std::string err_msg("In method '$symname': ");
PyObject* exc_str = PyObject_GetAttrString(exc, "__name__");
PyObject* unicode = PyUnicode_AsUTF8String (exc_str);
err_msg += PyBytes_AsString(unicode);
Py_XDECREF(unicode);
Py_XDECREF(exc_str);
if (val != NULL)
{
PyObject* val_str = PyObject_Str(val);
PyObject* unicode2 = PyUnicode_AsUTF8String (val_str);
err_msg += ": ";
err_msg += PyBytes_AsString(unicode);
Py_XDECREF(unicode2);
Py_XDECREF(val_str);
}
Py_XDECREF(exc);
Py_XDECREF(val);
Py_XDECREF(tb);
Swig::DirectorMethodException::raise(err_msg.c_str());
}
}
// If using windows in debug, it would try to use python_d, which would not be found.
%begin %{
#ifdef _MSC_VER
#define SWIG_PYTHON_INTERPRETER_NO_DEBUG
#endif
#include <exception>
%}
%exception {
try { $action }
catch (Swig::DirectorException &e) { SWIG_fail; }
}
// SWIG helper modules
%include "stdint.i"
%include "std_list.i"
%include "std_string.i"
%include "std_shared_ptr.i"
%include "std_vector.i"
%include "typemaps.i"
%{
#include "fastdds/config.hpp"
bool has_statistics()
{
#ifdef FASTDDS_STATISTICS
return true;
#else
return false;
#endif
}
%}
bool has_statistics();
// Some operators are ignored, as there is no such thing in Python.
// Trying to export them issues a warning
%ignore *::operator=;
%ignore *::operator++;
%ignore *::operator!;
// This ensures that the returned string references can be used with the string API
// Otherwise, they will be wrapped objects without API
%typemap(out) std::string& {
$result = SWIG_From_std_string(*$1);
}
// Keywords that are not fully supported in SWIG
// and make not difference in python anyways
#define final
// Macro delcarations
// Any macro used on the Fast DDS header files will give an error if it is not redefined here
#define eProsima_user_DllExport
#define FASTDDS_EXPORTED_API
#define FASTDDS_DEPRECATED_UNTIL(major, entity_name, msg)
#define FASTDDS_TODO_BEFORE(major, minor, msg)
// Defined template for some vector containers.
%template(StringVector) std::vector<std::string>;
%template(uint8_t_vector) std::vector<uint8_t>;
%template(uint16_t_vector) std::vector<uint16_t>;
%template(int32_t_vector) std::vector<int32_t>;
%template(uint32_t_vector) std::vector<uint32_t>;
%template(uint64_t_vector) std::vector<uint64_t>;
// Predeclaration of namespaces and/or classes not exported to the target language,
// but that are part of the Fast DDS public API
// SWIG will make an empty wrapper around these, but still needs to know they exists
// or the wrapper will fail compilation
namespace eprosima {
namespace fastdds {
namespace dds{
namespace builtin {
// Just declaring the namespace
} // namespace builtin
namespace xtypes {
// Just declaring the namespace
} // namespace xtypes
} // namespace dds
} // namespace fastdds
} // namespace eprosima
// Definition of the API exported to the binding.
// The order of appearance in this list matters.
// For example, base classes **MUST** be included before its derived classes.
// Failing to do so will issue a warning, but will not stop the compilation.
// However, the resulting derived class will **not** be considered as inheriting from the base class
#ifndef FASTDDS_DOCS_BUILD
%include <fastcdr/config.h>
%include "fastcdr/xcdr/optional.i"
%include "fastcdr/cdr/fixed_size_string.i"
#endif
%include "fastdds/LibrarySettings.i"
%include "fastdds/rtps/common/VendorId_t.i"
%include "fastdds/rtps/common/Types.i"
%include "fastdds/rtps/common/Time_t.i"
%include "fastdds/rtps/common/Locator.i"
%include "fastdds/rtps/common/LocatorList.i"
%include "fastdds/rtps/common/BinaryProperty.i"
%include "fastdds/rtps/common/Property.i"
%include "fastdds/rtps/common/EntityId_t.i"
%include "fastdds/rtps/common/GuidPrefix_t.i"
%include "fastdds/rtps/common/Guid.i"
%include "fastdds/rtps/common/PortParameters.i"
%include "fastdds/rtps/common/InstanceHandle.i"
%include "fastdds/utils/collections/ResourceLimitedContainerConfig.i"
%include "fastdds/utils/collections/ResourceLimitedVector.i"
%include "fastdds/rtps/attributes/ResourceManagement.i"
%include "fastdds/rtps/attributes/RTPSParticipantAllocationAttributes.i"
%include "fastdds/rtps/attributes/ThreadSettings.i"
%include "fastdds/rtps/flowcontrol/FlowControllerSchedulerPolicy.i"
%include "fastdds/rtps/flowcontrol/FlowControllerDescriptor.i"
%include "fastdds/rtps/attributes/PropertyPolicy.i"
%include "fastdds/rtps/attributes/RTPSParticipantAttributes.i"
%include "fastdds/rtps/attributes/ReaderAttributes.i"
%include "fastdds/rtps/attributes/WriterAttributes.i"
%include "fastdds/rtps/common/RemoteLocators.i"
%include "fastdds/rtps/common/SequenceNumber.i"
%include "fastdds/rtps/common/SampleIdentity.i"
%include "fastdds/rtps/common/OriginalWriterInfo.i"
%include "fastdds/rtps/common/WriteParams.i"
%include "fastdds/rtps/builtin/data/ContentFilterProperty.i"
%include "fastdds/rtps/reader/ReaderDiscoveryInfo.i"
%include "fastdds/rtps/writer/WriterDiscoveryInfo.i"
%include "fastdds/rtps/participant/ParticipantDiscoveryInfo.i"
%include "fastdds/dds/common/InstanceHandle.i"
%include "fastdds/dds/core/ReturnCode.i"
%include "fastdds/dds/core/status/StatusMask.i"
%include "fastdds/dds/core/policy/ParameterTypes.i"
%include "fastdds/dds/core/policy/QosPolicies.i"
%include "fastdds/dds/core/Time_t.i"
%include "fastdds/dds/topic/IContentFilter.i"
%include "fastdds/dds/topic/TopicDataType.i"
%include "fastdds/dds/topic/IContentFilterFactory.i"
%include "fastdds/dds/topic/TypeSupport.i"
%include "fastdds/dds/builtin/topic/BuiltinTopicKey.i"
%include "fastdds/dds/builtin/topic/ParticipantBuiltinTopicData.i"
%include "fastdds/dds/builtin/topic/SubscriptionBuiltinTopicData.i"
%include "fastdds/dds/builtin/topic/PublicationBuiltinTopicData.i"
%include "fastdds/dds/core/condition/Condition.i"
%include "fastdds/dds/core/Entity.i"
%include "fastdds/dds/core/condition/WaitSet.i"
%include "fastdds/dds/core/LoanableTypedCollection.i"
%include "fastdds/dds/core/StackAllocatedSequence.i"
%include "fastdds/dds/core/LoanableCollection.i"
%include "fastdds/dds/core/UserAllocatedSequence.i"
%include "fastdds/dds/core/LoanableSequence.i"
%include "fastdds/dds/core/LoanableArray.i"
%include "fastdds/dds/core/Types.i"
%include "fastdds/dds/core/policy/ReaderDataLifecycleQosPolicy.i"
%include "fastdds/dds/core/policy/ReaderResourceLimitsQos.i"
%include "fastdds/dds/core/policy/RTPSReliableReaderQos.i"
%include "fastdds/dds/core/policy/RTPSReliableWriterQos.i"
%include "fastdds/dds/core/policy/WriterDataLifecycleQosPolicy.i"
%include "fastdds/dds/core/status/LivelinessChangedStatus.i"
%include "fastdds/dds/core/status/MatchedStatus.i"
%include "fastdds/dds/core/status/SubscriptionMatchedStatus.i"
%include "fastdds/dds/core/status/BaseStatus.i"
%include "fastdds/dds/core/status/IncompatibleQosStatus.i"
%include "fastdds/dds/core/status/DeadlineMissedStatus.i"
%include "fastdds/dds/core/status/SampleRejectedStatus.i"
%include "fastdds/dds/core/status/PublicationMatchedStatus.i"
%include "fastdds/dds/topic/qos/TopicQos.i"
%include "fastdds/dds/topic/TopicDescription.i"
%include "fastdds/dds/topic/Topic.i"
%include "fastdds/dds/topic/ContentFilteredTopic.i"
%include "fastdds/dds/topic/TopicListener.i"
%include "fastdds/dds/subscriber/qos/ReaderQos.i"
%include "fastdds/dds/subscriber/qos/SubscriberQos.i"
%include "fastdds/dds/subscriber/qos/DataReaderQos.i"
%include "fastdds/dds/subscriber/DataReaderListener.i"
%include "fastdds/dds/subscriber/SubscriberListener.i"
%include "fastdds/dds/subscriber/ViewState.i"
%include "fastdds/dds/subscriber/SampleState.i"
%include "fastdds/dds/subscriber/InstanceState.i"
%include "fastdds/dds/subscriber/SampleInfo.i"
%include "fastdds/dds/subscriber/DataReader.i"
%include "fastdds/dds/subscriber/Subscriber.i"
%include "fastdds/dds/publisher/qos/PublisherQos.i"
%include "fastdds/dds/publisher/qos/WriterQos.i"
%include "fastdds/dds/publisher/qos/DataWriterQos.i"
%include "fastdds/dds/publisher/DataWriterListener.i"
%include "fastdds/dds/publisher/PublisherListener.i"
%include "fastdds/dds/publisher/DataWriter.i"
%include "fastdds/dds/publisher/Publisher.i"
%include "fastdds/dds/domain/DomainParticipantListener.i"
%include "fastdds/dds/domain/qos/DomainParticipantFactoryQos.i"
%include "fastdds/dds/domain/qos/DomainParticipantQos.i"
%include "fastdds/dds/domain/qos/DomainParticipantExtendedQos.i"
%include "fastdds/dds/domain/qos/ReplierQos.i"
%include "fastdds/dds/domain/qos/RequesterQos.i"
%include "fastdds/dds/domain/DomainParticipant.i"
%include "fastdds/dds/domain/DomainParticipantFactory.i"
%include "fastdds/dds/xtypes/type_representation/TypeObject.i"
%include "fastdds/dds/rpc/interfaces.i"
%include "fastdds/dds/rpc/exceptions.i"