From 26952cd173ca508311cbbdfa11488e4852b7dcb1 Mon Sep 17 00:00:00 2001 From: Raul Sanchez-Mateos Lizano Date: Fri, 21 Mar 2025 11:11:28 +0100 Subject: [PATCH] Add support for `string_255` type and fix discovery status memory leaks (#215) * Support using string_225 template instance in python Signed-off-by: Raul Sanchez-Mateos * Fix DiscoveryStatus memory leak warnings Signed-off-by: Raul Sanchez-Mateos --------- Signed-off-by: Raul Sanchez-Mateos (cherry picked from commit 23156aa26de6306fc4e72b560602320b6e2c35d2) # Conflicts: # fastdds_python/src/swig/fastcdr/cdr/fixed_size_string.i --- .../src/swig/fastcdr/cdr/fixed_size_string.i | 25 +++++++++++++++++++ fastdds_python/src/swig/fastdds.i | 3 +++ 2 files changed, 28 insertions(+) create mode 100644 fastdds_python/src/swig/fastcdr/cdr/fixed_size_string.i diff --git a/fastdds_python/src/swig/fastcdr/cdr/fixed_size_string.i b/fastdds_python/src/swig/fastcdr/cdr/fixed_size_string.i new file mode 100644 index 00000000..0101ff10 --- /dev/null +++ b/fastdds_python/src/swig/fastcdr/cdr/fixed_size_string.i @@ -0,0 +1,25 @@ +// 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. + +%{ +#include "fastcdr/cdr/fixed_size_string.hpp" +%} + +// Ignore method that causes warnings on SWIG +%ignore eprosima::fastcdr::fixed_string::operator const char*() const; + +%include "fastcdr/cdr/fixed_size_string.hpp" + +// Define string_255 as a fixed_string<255> +%template(string_255) eprosima::fastcdr::fixed_string<255>; diff --git a/fastdds_python/src/swig/fastdds.i b/fastdds_python/src/swig/fastdds.i index fc66930c..8b66ad8f 100644 --- a/fastdds_python/src/swig/fastdds.i +++ b/fastdds_python/src/swig/fastdds.i @@ -167,6 +167,9 @@ namespace xtypes { %include "fastdds/rtps/common/SampleIdentity.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"