Skip to content

Commit

Permalink
Support of optional members (#66)
Browse files Browse the repository at this point in the history
* Refs #19659. Support of optionals.

Also support of collections of enumerations

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #19659. Regenerated example idl

Signed-off-by: Ricardo González Moreno <[email protected]>

---------

Signed-off-by: Ricardo González Moreno <[email protected]>
  • Loading branch information
richiware authored Oct 24, 2023
1 parent 2308102 commit ffaeea7
Show file tree
Hide file tree
Showing 21 changed files with 10,300 additions and 3,402 deletions.
19 changes: 19 additions & 0 deletions fastdds_python/src/swig/fastcdr/xcdr/optional.i
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright 2023 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/xcdr/optional.hpp"
%}

%include "fastcdr/xcdr/optional.hpp"
4 changes: 2 additions & 2 deletions fastdds_python/src/swig/fastdds.i
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ namespace builtin {
// 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

%include "fastcdr/xcdr/optional.i"

%include "fastdds/rtps/common/VendorId_t.i"
%include "fastdds/rtps/common/Types.i"
%include "fastdds/rtps/common/Time_t.i"
Expand Down Expand Up @@ -492,5 +494,3 @@ namespace builtin {
%include "fastdds/dds/log/StdoutConsumer.i"
%include "fastdds/dds/log/Colors.i"
*/


527 changes: 511 additions & 16 deletions fastdds_python/test/api/test_datareader.py

Large diffs are not rendered by default.

53 changes: 31 additions & 22 deletions fastdds_python/test/types/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,22 @@ set(${PROJECT_NAME}_FILES
test_included_modulesPubSubTypes.cxx
)

include_directories()

set(CMAKE_POSITION_INDEPENDENT_CODE ON)

#Create library for C++ types
add_library(${PROJECT_NAME} SHARED ${${PROJECT_NAME}_FILES})
if(WIN32)
target_compile_definitions(${PROJECT_NAME} PRIVATE EPROSIMA_USER_DLL_EXPORT)
endif(WIN32)
target_link_libraries(${PROJECT_NAME} PUBLIC fastcdr fastrtps)
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11)
target_include_directories(${PROJECT_NAME} PUBLIC
${PROJECT_SOURCE_DIR}
)
target_link_libraries(${PROJECT_NAME}
PUBLIC
fastcdr
fastrtps
)

###############################################################################
# Python bindings for type
Expand Down Expand Up @@ -70,17 +76,14 @@ SET_SOURCE_FILES_PROPERTIES(
USE_TARGET_INCLUDE_DIRECTORIES TRUE
)

include_directories(
${PROJECT_SOURCE_DIR}
)

set_property(SOURCE ${PROJECT_NAME}.i PROPERTY OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/eprosima/test2")

SWIG_ADD_LIBRARY(${${PROJECT_NAME}_MODULE}
TYPE SHARED
LANGUAGE python
SOURCES ${${PROJECT_NAME}_MODULE_FILES})

set_property(TARGET ${${PROJECT_NAME}_MODULE} PROPERTY CXX_STANDARD 11)
if(UNIX AND CMAKE_SIZEOF_VOID_P EQUAL 8)
set_property(TARGET ${${PROJECT_NAME}_MODULE} PROPERTY SWIG_COMPILE_DEFINITIONS SWIGWORDSIZE64)
endif()
Expand Down Expand Up @@ -138,16 +141,22 @@ set(${PROJECT_NAME}_FILES
test_modulesPubSubTypes.cxx
)

include_directories()

set(CMAKE_POSITION_INDEPENDENT_CODE ON)

#Create library for C++ types
add_library(${PROJECT_NAME} SHARED ${${PROJECT_NAME}_FILES})
if(WIN32)
target_compile_definitions(${PROJECT_NAME} PRIVATE EPROSIMA_USER_DLL_EXPORT)
endif(WIN32)
target_link_libraries(${PROJECT_NAME} PUBLIC fastcdr fastrtps)
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11)
target_include_directories(${PROJECT_NAME} PUBLIC
${PROJECT_SOURCE_DIR}
)
target_link_libraries(${PROJECT_NAME}
PUBLIC
fastcdr
fastrtps
)

###############################################################################
# Python bindings for type
Expand Down Expand Up @@ -177,17 +186,14 @@ SET_SOURCE_FILES_PROPERTIES(
USE_TARGET_INCLUDE_DIRECTORIES TRUE
)

include_directories(
${PROJECT_SOURCE_DIR}
)

set_property(SOURCE ${PROJECT_NAME}.i PROPERTY OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/eprosima/test")

SWIG_ADD_LIBRARY(${${PROJECT_NAME}_MODULE}
TYPE SHARED
LANGUAGE python
SOURCES ${${PROJECT_NAME}_MODULE_FILES})

set_property(TARGET ${${PROJECT_NAME}_MODULE} PROPERTY CXX_STANDARD 11)
if(UNIX AND CMAKE_SIZEOF_VOID_P EQUAL 8)
set_property(TARGET ${${PROJECT_NAME}_MODULE} PROPERTY SWIG_COMPILE_DEFINITIONS SWIGWORDSIZE64)
endif()
Expand Down Expand Up @@ -245,16 +251,23 @@ set(${PROJECT_NAME}_FILES
test_completePubSubTypes.cxx
)

include_directories()

set(CMAKE_POSITION_INDEPENDENT_CODE ON)

#Create library for C++ types
add_library(${PROJECT_NAME} SHARED ${${PROJECT_NAME}_FILES})
if(WIN32)
target_compile_definitions(${PROJECT_NAME} PRIVATE EPROSIMA_USER_DLL_EXPORT)
endif(WIN32)
target_link_libraries(${PROJECT_NAME} PUBLIC fastcdr fastrtps test_included_modules)
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11)
target_include_directories(${PROJECT_NAME} PUBLIC
${PROJECT_SOURCE_DIR}
)
target_link_libraries(${PROJECT_NAME}
PUBLIC
fastcdr
fastrtps
test_included_modules
)

###############################################################################
# Python bindings for type
Expand Down Expand Up @@ -284,17 +297,14 @@ SET_SOURCE_FILES_PROPERTIES(
USE_TARGET_INCLUDE_DIRECTORIES TRUE
)

include_directories(
${PROJECT_SOURCE_DIR}
)

set_property(SOURCE ${PROJECT_NAME}.i PROPERTY OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/")

SWIG_ADD_LIBRARY(${${PROJECT_NAME}_MODULE}
TYPE SHARED
LANGUAGE python
SOURCES ${${PROJECT_NAME}_MODULE_FILES})

set_property(TARGET ${${PROJECT_NAME}_MODULE} PROPERTY CXX_STANDARD 11)
if(UNIX AND CMAKE_SIZEOF_VOID_P EQUAL 8)
set_property(TARGET ${${PROJECT_NAME}_MODULE} PROPERTY SWIG_COMPILE_DEFINITIONS SWIGWORDSIZE64)
endif()
Expand All @@ -303,7 +313,6 @@ target_link_libraries(${${PROJECT_NAME}_MODULE}
Python3::Module
fastrtps
${PROJECT_NAME}
test_included_modules
)

set_target_properties(${${PROJECT_NAME}_MODULE}
Expand Down
Loading

0 comments on commit ffaeea7

Please sign in to comment.