diff --git a/iceoryx_dust/CMakeLists.txt b/iceoryx_dust/CMakeLists.txt new file mode 100644 index 0000000000..9b1f148e0b --- /dev/null +++ b/iceoryx_dust/CMakeLists.txt @@ -0,0 +1,60 @@ +# Copyright (c) 2022 by Apex.AI Inc. All rights reserved. +# +# 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. +# +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.16) + +set(IOX_VERSION_STRING "2.90.0") + +project(iceoryx_dust VERSION ${IOX_VERSION_STRING}) + +find_package(iceoryx_hoofs REQUIRED) + +include(IceoryxPackageHelper) +include(IceoryxPlatform) + +if(CMAKE_SYSTEM_NAME MATCHES Linux OR CMAKE_SYSTEM_NAME MATCHES Darwin) + option(BUILD_SHARED_LIBS "Create shared libraries by default" ON) +endif() + +# +########## build iceoryx dust lib ########## +# + +iox_add_library( + TARGET iceoryx_dust + NAMESPACE iceoryx_dust + PROJECT_PREFIX ${PREFIX} + PRIVATE_LIBS ${ICEORYX_SANITIZER_FLAGS} + PRIVATE_LIBS_LINUX ${CODE_COVERAGE_LIBS} + PUBLIC_LIBS iceoryx_hoofs::iceoryx_hoofs + BUILD_INTERFACE ${PROJECT_SOURCE_DIR}/include + INSTALL_INTERFACE include/${PREFIX} + FILES + source/cxx/file_reader.cpp + source/posix_wrapper/named_pipe.cpp + source/posix_wrapper/signal_watcher.cpp + source/posix_wrapper/message_queue.cpp +) + +# +########## dust testing ########## +# + +# Finding gtest and adding the subdirectories is split to support the use case of +# building the testing lib without the tests by providing gtest externally +if(NOT GTest_FOUND AND BUILD_TEST) + find_package(GTest CONFIG REQUIRED) +endif() diff --git a/iceoryx_dust/cmake/Config.cmake.in b/iceoryx_dust/cmake/Config.cmake.in new file mode 100644 index 0000000000..849e4af78b --- /dev/null +++ b/iceoryx_dust/cmake/Config.cmake.in @@ -0,0 +1,23 @@ +# Copyright (c) 2020 by Robert Bosch GmbH All rights reserved. +# +# 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. +# +# SPDX-License-Identifier: Apache-2.0 + +@PACKAGE_INIT@ + +include(CMakeFindDependencyMacro) + +include("${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake") +list(APPEND CMAKE_MODULE_PATH "@DESTINATION_CONFIGDIR@") +check_required_components("@PROJECT_NAME@") diff --git a/iceoryx_dust/cmake/iceoryx_dustConfig.cmake b/iceoryx_dust/cmake/iceoryx_dustConfig.cmake new file mode 100644 index 0000000000..7b83c1707d --- /dev/null +++ b/iceoryx_dust/cmake/iceoryx_dustConfig.cmake @@ -0,0 +1,25 @@ +# Copyright (c) 2020 by Robert Bosch GmbH. All rights reserved. +# +# 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. +# +# SPDX-License-Identifier: Apache-2.0 + +# +########## dummyConfig.cmake to be able to use find_package with the source tree ########## +# + +if(NOT ${CMAKE_FIND_PACKAGE_NAME}_FOUND_PRINTED) + message(STATUS "The package '${CMAKE_FIND_PACKAGE_NAME}' is used in source code version.") + set(${CMAKE_FIND_PACKAGE_NAME}_FOUND_PRINTED true CACHE INTERNAL "") +endif() + list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) diff --git a/iceoryx_dust/cmake/iceoryx_dust_testingConfig.cmake b/iceoryx_dust/cmake/iceoryx_dust_testingConfig.cmake new file mode 100644 index 0000000000..f347a114d0 --- /dev/null +++ b/iceoryx_dust/cmake/iceoryx_dust_testingConfig.cmake @@ -0,0 +1,24 @@ +# Copyright (c) 2020 by Robert Bosch GmbH. All rights reserved. +# +# 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. +# +# SPDX-License-Identifier: Apache-2.0 + +# +########## dummyConfig.cmake to be able to use find_package with the source tree ########## +# + +if(NOT ${CMAKE_FIND_PACKAGE_NAME}_FOUND_PRINTED) + message(STATUS "The package '${CMAKE_FIND_PACKAGE_NAME}' is used in source code version.") + set(${CMAKE_FIND_PACKAGE_NAME}_FOUND_PRINTED true CACHE INTERNAL "") +endif() diff --git a/iceoryx_hoofs/include/iceoryx_hoofs/internal/file_reader/file_reader.hpp b/iceoryx_dust/include/iceoryx_dust/cxx/file_reader.hpp similarity index 100% rename from iceoryx_hoofs/include/iceoryx_hoofs/internal/file_reader/file_reader.hpp rename to iceoryx_dust/include/iceoryx_dust/cxx/file_reader.hpp diff --git a/iceoryx_hoofs/include/iceoryx_hoofs/cxx/forward_list.hpp b/iceoryx_dust/include/iceoryx_dust/cxx/forward_list.hpp similarity index 99% rename from iceoryx_hoofs/include/iceoryx_hoofs/cxx/forward_list.hpp rename to iceoryx_dust/include/iceoryx_dust/cxx/forward_list.hpp index 7185eb9d77..c8ac6dc25e 100644 --- a/iceoryx_hoofs/include/iceoryx_hoofs/cxx/forward_list.hpp +++ b/iceoryx_dust/include/iceoryx_dust/cxx/forward_list.hpp @@ -15,8 +15,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_HOOFS_CXX_FORWARD_LIST_HPP -#define IOX_HOOFS_CXX_FORWARD_LIST_HPP +#ifndef IOX_DUST_CXX_FORWARD_LIST_HPP +#define IOX_DUST_CXX_FORWARD_LIST_HPP #include "iceoryx_hoofs/cxx/helplets.hpp" @@ -368,6 +368,6 @@ class forward_list } // namespace cxx } // namespace iox -#include "iceoryx_hoofs/internal/cxx/forward_list.inl" +#include "iceoryx_dust/internal/cxx/forward_list.inl" -#endif // IOX_HOOFS_CXX_FORWARD_LIST_HPP +#endif // IOX_DUST_CXX_FORWARD_LIST_HPP diff --git a/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/forward_list.inl b/iceoryx_dust/include/iceoryx_dust/internal/cxx/forward_list.inl similarity index 99% rename from iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/forward_list.inl rename to iceoryx_dust/include/iceoryx_dust/internal/cxx/forward_list.inl index 50c6dbaed3..28211f4612 100644 --- a/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/forward_list.inl +++ b/iceoryx_dust/include/iceoryx_dust/internal/cxx/forward_list.inl @@ -15,11 +15,11 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_HOOFS_CXX_FORWARD_LIST_INL -#define IOX_HOOFS_CXX_FORWARD_LIST_INL +#ifndef IOX_DUST_CXX_FORWARD_LIST_INL +#define IOX_DUST_CXX_FORWARD_LIST_INL -#include "iceoryx_hoofs/cxx/forward_list.hpp" +#include "iceoryx_dust/cxx/forward_list.hpp" namespace iox @@ -619,4 +619,4 @@ inline void forward_list::errorMessage(const char* source, const ch } // namespace cxx } // namespace iox -#endif // IOX_HOOFS_CXX_FORWARD_LIST_INL +#endif // IOX_DUST_CXX_FORWARD_LIST_INL diff --git a/iceoryx_hoofs/include/iceoryx_hoofs/internal/objectpool/objectpool.hpp b/iceoryx_dust/include/iceoryx_dust/objectpool/objectpool.hpp similarity index 98% rename from iceoryx_hoofs/include/iceoryx_hoofs/internal/objectpool/objectpool.hpp rename to iceoryx_dust/include/iceoryx_dust/objectpool/objectpool.hpp index b57b3ef09d..da604d8a8f 100644 --- a/iceoryx_hoofs/include/iceoryx_hoofs/internal/objectpool/objectpool.hpp +++ b/iceoryx_dust/include/iceoryx_dust/objectpool/objectpool.hpp @@ -14,8 +14,8 @@ // limitations under the License. // // SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_HOOFS_OBJECTPOOL_OBJECTPOOL_HPP -#define IOX_HOOFS_OBJECTPOOL_OBJECTPOOL_HPP +#ifndef IOX_DUST_OBJECTPOOL_OBJECTPOOL_HPP +#define IOX_DUST_OBJECTPOOL_OBJECTPOOL_HPP #include //for size_t #include @@ -451,4 +451,4 @@ class ObjectPool } // namespace cxx } // namespace iox -#endif // IOX_HOOFS_OBJECTPOOL_OBJECTPOOL_HPP +#endif // IOX_DUST_OBJECTPOOL_OBJECTPOOL_HPP diff --git a/iceoryx_hoofs/include/iceoryx_hoofs/internal/posix_wrapper/message_queue.hpp b/iceoryx_dust/include/iceoryx_dust/posix_wrapper/message_queue.hpp similarity index 97% rename from iceoryx_hoofs/include/iceoryx_hoofs/internal/posix_wrapper/message_queue.hpp rename to iceoryx_dust/include/iceoryx_dust/posix_wrapper/message_queue.hpp index 947f71b9fc..18a6230a9e 100644 --- a/iceoryx_hoofs/include/iceoryx_hoofs/internal/posix_wrapper/message_queue.hpp +++ b/iceoryx_dust/include/iceoryx_dust/posix_wrapper/message_queue.hpp @@ -14,8 +14,8 @@ // limitations under the License. // // SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_HOOFS_POSIX_WRAPPER_MESSAGE_QUEUE_HPP -#define IOX_HOOFS_POSIX_WRAPPER_MESSAGE_QUEUE_HPP +#ifndef IOX_DUST_POSIX_WRAPPER_MESSAGE_QUEUE_HPP +#define IOX_DUST_POSIX_WRAPPER_MESSAGE_QUEUE_HPP #include "iceoryx_hoofs/cxx/optional.hpp" #include "iceoryx_hoofs/design_pattern/creation.hpp" @@ -128,4 +128,4 @@ class MessageQueue : public DesignPattern::Creation #include @@ -144,6 +144,6 @@ bool operator!=(const relocatable_ptr& lhs, const relocatable_ptr& rhs) no } // namespace rp } // namespace iox -#include "iceoryx_hoofs/internal/relocatable_pointer/relocatable_ptr.inl" +#include "iceoryx_dust/relocatable_pointer/relocatable_ptr.inl" -#endif // IOX_HOOFS_RELOCATABLE_POINTER_RELOCATABLE_PTR_HPP \ No newline at end of file +#endif // IOX_DUST_RELOCATABLE_POINTER_RELOCATABLE_PTR_HPP \ No newline at end of file diff --git a/iceoryx_hoofs/include/iceoryx_hoofs/internal/relocatable_pointer/relocatable_ptr.inl b/iceoryx_dust/include/iceoryx_dust/relocatable_pointer/relocatable_ptr.inl similarity index 94% rename from iceoryx_hoofs/include/iceoryx_hoofs/internal/relocatable_pointer/relocatable_ptr.inl rename to iceoryx_dust/include/iceoryx_dust/relocatable_pointer/relocatable_ptr.inl index de3ed0a78d..655d4d6fa0 100644 --- a/iceoryx_hoofs/include/iceoryx_hoofs/internal/relocatable_pointer/relocatable_ptr.inl +++ b/iceoryx_dust/include/iceoryx_dust/relocatable_pointer/relocatable_ptr.inl @@ -14,10 +14,10 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_HOOFS_RELOCATABLE_POINTER_RELOCATABLE_PTR_INL -#define IOX_HOOFS_RELOCATABLE_POINTER_RELOCATABLE_PTR_INL +#ifndef IOX_DUST_RELOCATABLE_POINTER_RELOCATABLE_PTR_INL +#define IOX_DUST_RELOCATABLE_POINTER_RELOCATABLE_PTR_INL -#include "iceoryx_hoofs/internal/relocatable_pointer/relocatable_ptr.hpp" +#include "iceoryx_dust/relocatable_pointer/relocatable_ptr.hpp" namespace iox { @@ -161,4 +161,4 @@ inline bool operator!=(const relocatable_ptr& lhs, const relocatable_ptr& } // namespace rp } // namespace iox -#endif // IOX_HOOFS_RELOCATABLE_POINTER_RELOCATABLE_PTR_INL +#endif // IOX_DUST_RELOCATABLE_POINTER_RELOCATABLE_PTR_INL diff --git a/iceoryx_hoofs/source/file_reader/file_reader.cpp b/iceoryx_dust/source/cxx/file_reader.cpp similarity index 97% rename from iceoryx_hoofs/source/file_reader/file_reader.cpp rename to iceoryx_dust/source/cxx/file_reader.cpp index e1280e01db..8e0253c293 100644 --- a/iceoryx_hoofs/source/file_reader/file_reader.cpp +++ b/iceoryx_dust/source/cxx/file_reader.cpp @@ -15,7 +15,7 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "iceoryx_hoofs/internal/file_reader/file_reader.hpp" +#include "iceoryx_dust/cxx/file_reader.hpp" #include "iceoryx_hoofs/cxx/helplets.hpp" #include diff --git a/iceoryx_hoofs/source/posix_wrapper/message_queue.cpp b/iceoryx_dust/source/posix_wrapper/message_queue.cpp similarity index 99% rename from iceoryx_hoofs/source/posix_wrapper/message_queue.cpp rename to iceoryx_dust/source/posix_wrapper/message_queue.cpp index a4f4cfe323..e978be713b 100644 --- a/iceoryx_hoofs/source/posix_wrapper/message_queue.cpp +++ b/iceoryx_dust/source/posix_wrapper/message_queue.cpp @@ -15,7 +15,7 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "iceoryx_hoofs/internal/posix_wrapper/message_queue.hpp" +#include "iceoryx_dust/posix_wrapper/message_queue.hpp" #include "iceoryx_hoofs/platform/fcntl.hpp" #include "iceoryx_hoofs/platform/platform_correction.hpp" #include "iceoryx_hoofs/posix_wrapper/posix_call.hpp" diff --git a/iceoryx_hoofs/source/posix_wrapper/named_pipe.cpp b/iceoryx_dust/source/posix_wrapper/named_pipe.cpp similarity index 99% rename from iceoryx_hoofs/source/posix_wrapper/named_pipe.cpp rename to iceoryx_dust/source/posix_wrapper/named_pipe.cpp index 527868627f..1569f684e9 100644 --- a/iceoryx_hoofs/source/posix_wrapper/named_pipe.cpp +++ b/iceoryx_dust/source/posix_wrapper/named_pipe.cpp @@ -14,7 +14,7 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "iceoryx_hoofs/posix_wrapper/named_pipe.hpp" +#include "iceoryx_dust/posix_wrapper/named_pipe.hpp" #include "iceoryx_hoofs/cxx/deadline_timer.hpp" #include "iceoryx_hoofs/cxx/helplets.hpp" #include "iceoryx_hoofs/posix_wrapper/posix_call.hpp" diff --git a/iceoryx_hoofs/source/posix_wrapper/signal_watcher.cpp b/iceoryx_dust/source/posix_wrapper/signal_watcher.cpp similarity index 98% rename from iceoryx_hoofs/source/posix_wrapper/signal_watcher.cpp rename to iceoryx_dust/source/posix_wrapper/signal_watcher.cpp index de998516a5..77cabd46f5 100644 --- a/iceoryx_hoofs/source/posix_wrapper/signal_watcher.cpp +++ b/iceoryx_dust/source/posix_wrapper/signal_watcher.cpp @@ -13,7 +13,7 @@ // limitations under the License. // // SPDX-License-Identifier: Apache-2.0 -#include "iceoryx_hoofs/posix_wrapper/signal_watcher.hpp" +#include "iceoryx_dust/posix_wrapper/signal_watcher.hpp" #include "iceoryx_hoofs/cxx/helplets.hpp" #include "iceoryx_hoofs/internal/log/hoofs_logging.hpp" #include "iceoryx_hoofs/platform/unistd.hpp" diff --git a/iceoryx_dust/test/CMakeLists.txt b/iceoryx_dust/test/CMakeLists.txt new file mode 100644 index 0000000000..7199df4a46 --- /dev/null +++ b/iceoryx_dust/test/CMakeLists.txt @@ -0,0 +1,46 @@ +# Copyright (c) 2019 - 2020 by Robert Bosch GmbH. All rights reserved. +# Copyright (c) 2020 - 2022 by Apex.AI Inc. All rights reserved. +# +# 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. +# +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.16) +set(test_iceoryx_dust_VERSION 0) +project(test_iceoryx_dust VERSION ${test_iceoryx_hoofs_VERSION}) + +find_package(Threads REQUIRED) +find_package(iceoryx_hoofs_testing REQUIRED) + +set(PROJECT_PREFIX "dust") + +file(GLOB_RECURSE MODULETESTS_SRC "${CMAKE_CURRENT_SOURCE_DIR}/moduletests/*.cpp") + +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${PROJECT_PREFIX}/test) + +set(TEST_LINK_LIBS + ${CODE_COVERAGE_LIBS} + GTest::gtest + GTest::gmock + iceoryx_hoofs::iceoryx_hoofs + iceoryx_hoofs_testing::iceoryx_hoofs_testing +) + +iox_add_executable( TARGET ${PROJECT_PREFIX}_moduletests + INCLUDE_DIRECTORIES . + LIBS ${TEST_LINK_LIBS} + LIBS_LINUX acl dl pthread rt + FILES ${MODULETESTS_SRC} +) + +target_compile_options(${PROJECT_PREFIX}_moduletests PRIVATE ${TEST_CXX_FLAGS}) diff --git a/iceoryx_hoofs/test/moduletests/test_cxx_forward_list.cpp b/iceoryx_dust/test/moduletests/test_cxx_forward_list.cpp similarity index 99% rename from iceoryx_hoofs/test/moduletests/test_cxx_forward_list.cpp rename to iceoryx_dust/test/moduletests/test_cxx_forward_list.cpp index 7795420460..6c64c02b81 100644 --- a/iceoryx_hoofs/test/moduletests/test_cxx_forward_list.cpp +++ b/iceoryx_dust/test/moduletests/test_cxx_forward_list.cpp @@ -15,7 +15,7 @@ // SPDX-License-Identifier: Apache-2.0 #include "iceoryx_hoofs/cxx/attributes.hpp" -#include "iceoryx_hoofs/cxx/forward_list.hpp" +#include "iceoryx_dust/cxx/forward_list.hpp" #include "test.hpp" namespace diff --git a/iceoryx_hoofs/test/moduletests/test_directed_graph.cpp b/iceoryx_dust/test/moduletests/test_directed_graph.cpp similarity index 100% rename from iceoryx_hoofs/test/moduletests/test_directed_graph.cpp rename to iceoryx_dust/test/moduletests/test_directed_graph.cpp diff --git a/iceoryx_hoofs/test/moduletests/test_file_reader.cpp b/iceoryx_dust/test/moduletests/test_file_reader.cpp similarity index 98% rename from iceoryx_hoofs/test/moduletests/test_file_reader.cpp rename to iceoryx_dust/test/moduletests/test_file_reader.cpp index 6c1ca2bc29..9c86dc9c2b 100644 --- a/iceoryx_hoofs/test/moduletests/test_file_reader.cpp +++ b/iceoryx_dust/test/moduletests/test_file_reader.cpp @@ -15,7 +15,7 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "iceoryx_hoofs/internal/file_reader/file_reader.hpp" +#include "iceoryx_dust/cxx/file_reader.hpp" #include "test.hpp" diff --git a/iceoryx_hoofs/test/moduletests/test_ipc_channel.cpp b/iceoryx_dust/test/moduletests/test_ipc_channel.cpp similarity index 100% rename from iceoryx_hoofs/test/moduletests/test_ipc_channel.cpp rename to iceoryx_dust/test/moduletests/test_ipc_channel.cpp diff --git a/iceoryx_hoofs/test/moduletests/test_objectpool.cpp b/iceoryx_dust/test/moduletests/test_objectpool.cpp similarity index 99% rename from iceoryx_hoofs/test/moduletests/test_objectpool.cpp rename to iceoryx_dust/test/moduletests/test_objectpool.cpp index f6bd5918ab..526227fceb 100644 --- a/iceoryx_hoofs/test/moduletests/test_objectpool.cpp +++ b/iceoryx_dust/test/moduletests/test_objectpool.cpp @@ -15,7 +15,7 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "iceoryx_hoofs/internal/objectpool/objectpool.hpp" +#include "iceoryx_dust/objectpool/objectpool.hpp" #include diff --git a/iceoryx_hoofs/test/moduletests/test_posix_signal_watcher.cpp b/iceoryx_dust/test/moduletests/test_posix_signal_watcher.cpp similarity index 98% rename from iceoryx_hoofs/test/moduletests/test_posix_signal_watcher.cpp rename to iceoryx_dust/test/moduletests/test_posix_signal_watcher.cpp index f3da2a6625..89ea8d3eb2 100644 --- a/iceoryx_hoofs/test/moduletests/test_posix_signal_watcher.cpp +++ b/iceoryx_dust/test/moduletests/test_posix_signal_watcher.cpp @@ -14,7 +14,7 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "iceoryx_hoofs/posix_wrapper/signal_watcher.hpp" +#include "iceoryx_dust/posix_wrapper/signal_watcher.hpp" #include "iceoryx_hoofs/testing/barrier.hpp" #include "iceoryx_hoofs/testing/watch_dog.hpp" #include "test.hpp" diff --git a/iceoryx_hoofs/test/moduletests/test_relocatable_ptr.cpp b/iceoryx_dust/test/moduletests/test_relocatable_ptr.cpp similarity index 99% rename from iceoryx_hoofs/test/moduletests/test_relocatable_ptr.cpp rename to iceoryx_dust/test/moduletests/test_relocatable_ptr.cpp index 5aafb98de9..05ad4f66e9 100644 --- a/iceoryx_hoofs/test/moduletests/test_relocatable_ptr.cpp +++ b/iceoryx_dust/test/moduletests/test_relocatable_ptr.cpp @@ -14,7 +14,7 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "iceoryx_hoofs/internal/relocatable_pointer/relocatable_ptr.hpp" +#include "iceoryx_dust/relocatable_pointer/relocatable_ptr.hpp" #include "test.hpp" diff --git a/iceoryx_examples/callbacks/ice_callbacks_listener_as_class_member.cpp b/iceoryx_examples/callbacks/ice_callbacks_listener_as_class_member.cpp index 5d85c8612d..7103a0b150 100644 --- a/iceoryx_examples/callbacks/ice_callbacks_listener_as_class_member.cpp +++ b/iceoryx_examples/callbacks/ice_callbacks_listener_as_class_member.cpp @@ -15,7 +15,7 @@ // SPDX-License-Identifier: Apache-2.0 #include "iceoryx_hoofs/cxx/optional.hpp" -#include "iceoryx_hoofs/posix_wrapper/signal_watcher.hpp" +#include "iceoryx_dust/posix_wrapper/signal_watcher.hpp" #include "iceoryx_posh/popo/listener.hpp" #include "iceoryx_posh/popo/subscriber.hpp" #include "iceoryx_posh/popo/user_trigger.hpp" diff --git a/iceoryx_examples/callbacks/ice_callbacks_publisher.cpp b/iceoryx_examples/callbacks/ice_callbacks_publisher.cpp index 7e9bc64dd4..8034ef6df9 100644 --- a/iceoryx_examples/callbacks/ice_callbacks_publisher.cpp +++ b/iceoryx_examples/callbacks/ice_callbacks_publisher.cpp @@ -14,7 +14,7 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "iceoryx_hoofs/posix_wrapper/signal_watcher.hpp" +#include "iceoryx_dust/posix_wrapper/signal_watcher.hpp" #include "iceoryx_posh/popo/publisher.hpp" #include "iceoryx_posh/runtime/posh_runtime.hpp" #include "topic_data.hpp" diff --git a/iceoryx_examples/callbacks/ice_callbacks_subscriber.cpp b/iceoryx_examples/callbacks/ice_callbacks_subscriber.cpp index a969f34a08..c4d28aeffb 100644 --- a/iceoryx_examples/callbacks/ice_callbacks_subscriber.cpp +++ b/iceoryx_examples/callbacks/ice_callbacks_subscriber.cpp @@ -15,7 +15,7 @@ // SPDX-License-Identifier: Apache-2.0 #include "iceoryx_hoofs/cxx/optional.hpp" -#include "iceoryx_hoofs/posix_wrapper/signal_watcher.hpp" +#include "iceoryx_dust/posix_wrapper/signal_watcher.hpp" #include "iceoryx_posh/popo/listener.hpp" #include "iceoryx_posh/popo/subscriber.hpp" #include "iceoryx_posh/popo/user_trigger.hpp" diff --git a/iceoryx_examples/complexdata/CMakeLists.txt b/iceoryx_examples/complexdata/CMakeLists.txt index 4122070d11..d002bc7a2d 100644 --- a/iceoryx_examples/complexdata/CMakeLists.txt +++ b/iceoryx_examples/complexdata/CMakeLists.txt @@ -20,6 +20,7 @@ project(example_complexdata) include(GNUInstallDirs) +find_package(iceoryx_dust CONFIG REQUIRED) find_package(iceoryx_posh CONFIG REQUIRED) find_package(iceoryx_hoofs CONFIG REQUIRED) @@ -44,6 +45,7 @@ iox_add_executable( TARGET iox-cpp-publisher-complexdata FILES ./iox_publisher_complexdata.cpp LIBS iceoryx_posh::iceoryx_posh + iceoryx_posh::iceoryx_posh ) iox_add_executable( diff --git a/iceoryx_examples/complexdata/iox_publisher_complexdata.cpp b/iceoryx_examples/complexdata/iox_publisher_complexdata.cpp index c3d5b311d5..5f1d25ab64 100644 --- a/iceoryx_examples/complexdata/iox_publisher_complexdata.cpp +++ b/iceoryx_examples/complexdata/iox_publisher_complexdata.cpp @@ -16,7 +16,7 @@ #include "topic_data.hpp" -#include "iceoryx_hoofs/posix_wrapper/signal_watcher.hpp" +#include "iceoryx_dust/posix_wrapper/signal_watcher.hpp" #include "iceoryx_posh/popo/publisher.hpp" #include "iceoryx_posh/runtime/posh_runtime.hpp" diff --git a/iceoryx_examples/complexdata/iox_publisher_vector.cpp b/iceoryx_examples/complexdata/iox_publisher_vector.cpp index a37470e7f0..fc87732f2f 100644 --- a/iceoryx_examples/complexdata/iox_publisher_vector.cpp +++ b/iceoryx_examples/complexdata/iox_publisher_vector.cpp @@ -16,7 +16,7 @@ #include "iceoryx_hoofs/cxx/vector.hpp" -#include "iceoryx_hoofs/posix_wrapper/signal_watcher.hpp" +#include "iceoryx_dust/posix_wrapper/signal_watcher.hpp" #include "iceoryx_posh/popo/publisher.hpp" #include "iceoryx_posh/runtime/posh_runtime.hpp" diff --git a/iceoryx_examples/complexdata/iox_subscriber_complexdata.cpp b/iceoryx_examples/complexdata/iox_subscriber_complexdata.cpp index 102ff85400..7776e92a82 100644 --- a/iceoryx_examples/complexdata/iox_subscriber_complexdata.cpp +++ b/iceoryx_examples/complexdata/iox_subscriber_complexdata.cpp @@ -17,7 +17,7 @@ #include "topic_data.hpp" #include "iceoryx_hoofs/cxx/string.hpp" -#include "iceoryx_hoofs/posix_wrapper/signal_watcher.hpp" +#include "iceoryx_dust/posix_wrapper/signal_watcher.hpp" #include "iceoryx_posh/popo/subscriber.hpp" #include "iceoryx_posh/runtime/posh_runtime.hpp" diff --git a/iceoryx_examples/complexdata/iox_subscriber_vector.cpp b/iceoryx_examples/complexdata/iox_subscriber_vector.cpp index 76fc43eed3..b4422ff0d8 100644 --- a/iceoryx_examples/complexdata/iox_subscriber_vector.cpp +++ b/iceoryx_examples/complexdata/iox_subscriber_vector.cpp @@ -17,7 +17,7 @@ #include "iceoryx_hoofs/cxx/vector.hpp" #include "iceoryx_hoofs/cxx/string.hpp" -#include "iceoryx_hoofs/posix_wrapper/signal_watcher.hpp" +#include "iceoryx_dust/posix_wrapper/signal_watcher.hpp" #include "iceoryx_posh/popo/subscriber.hpp" #include "iceoryx_posh/runtime/posh_runtime.hpp" diff --git a/iceoryx_examples/complexdata/topic_data.hpp b/iceoryx_examples/complexdata/topic_data.hpp index 2bf0ebf61f..7e95aa1481 100644 --- a/iceoryx_examples/complexdata/topic_data.hpp +++ b/iceoryx_examples/complexdata/topic_data.hpp @@ -17,7 +17,7 @@ #ifndef IOX_EXAMPLES_COMPLEXDATA_TOPIC_DATA_HPP #define IOX_EXAMPLES_COMPLEXDATA_TOPIC_DATA_HPP -#include "iceoryx_hoofs/cxx/forward_list.hpp" +#include "iceoryx_dust/cxx/forward_list.hpp" #include "iceoryx_hoofs/cxx/list.hpp" #include "iceoryx_hoofs/cxx/optional.hpp" #include "iceoryx_hoofs/cxx/stack.hpp" diff --git a/iceoryx_examples/ice_access_control/iox_display_app.cpp b/iceoryx_examples/ice_access_control/iox_display_app.cpp index 3fd5828cd7..9fab77e7a6 100644 --- a/iceoryx_examples/ice_access_control/iox_display_app.cpp +++ b/iceoryx_examples/ice_access_control/iox_display_app.cpp @@ -16,7 +16,7 @@ #include "topic_data.hpp" -#include "iceoryx_hoofs/posix_wrapper/signal_watcher.hpp" +#include "iceoryx_dust/posix_wrapper/signal_watcher.hpp" #include "iceoryx_posh/popo/publisher.hpp" #include "iceoryx_posh/popo/subscriber.hpp" #include "iceoryx_posh/runtime/posh_runtime.hpp" diff --git a/iceoryx_examples/ice_access_control/iox_radar_app.cpp b/iceoryx_examples/ice_access_control/iox_radar_app.cpp index 169b324fc8..31f0421706 100644 --- a/iceoryx_examples/ice_access_control/iox_radar_app.cpp +++ b/iceoryx_examples/ice_access_control/iox_radar_app.cpp @@ -16,7 +16,7 @@ #include "topic_data.hpp" -#include "iceoryx_hoofs/posix_wrapper/signal_watcher.hpp" +#include "iceoryx_dust/posix_wrapper/signal_watcher.hpp" #include "iceoryx_posh/popo/publisher.hpp" #include "iceoryx_posh/runtime/posh_runtime.hpp" diff --git a/iceoryx_examples/icedelivery/README.md b/iceoryx_examples/icedelivery/README.md index 67168db30b..f919a1902f 100644 --- a/iceoryx_examples/icedelivery/README.md +++ b/iceoryx_examples/icedelivery/README.md @@ -23,7 +23,7 @@ First off, let's include the publisher, the runtime and the signal handler: ```cpp -#include "iceoryx_hoofs/posix_wrapper/signal_watcher.hpp" +#include "iceoryx_dust/posix_wrapper/signal_watcher.hpp" #include "iceoryx_posh/popo/untyped_publisher.hpp" #include "iceoryx_posh/runtime/posh_runtime.hpp" ``` @@ -130,7 +130,7 @@ Similar to the publisher, we include the topic data, the subscriber, the runtime ```cpp #include "topic_data.hpp" -#include "iceoryx_hoofs/posix_wrapper/signal_watcher.hpp" +#include "iceoryx_dust/posix_wrapper/signal_watcher.hpp" #include "iceoryx_posh/popo/untyped_subscriber.hpp" #include "iceoryx_posh/runtime/posh_runtime.hpp" ``` diff --git a/iceoryx_examples/icedelivery/iox_publisher.cpp b/iceoryx_examples/icedelivery/iox_publisher.cpp index 0b1877aa48..6d32a94a2d 100644 --- a/iceoryx_examples/icedelivery/iox_publisher.cpp +++ b/iceoryx_examples/icedelivery/iox_publisher.cpp @@ -20,7 +20,7 @@ //! [include publisher] #include "iceoryx_posh/popo/publisher.hpp" //! [include publisher] -#include "iceoryx_hoofs/posix_wrapper/signal_watcher.hpp" +#include "iceoryx_dust/posix_wrapper/signal_watcher.hpp" #include "iceoryx_posh/runtime/posh_runtime.hpp" #include diff --git a/iceoryx_examples/icedelivery/iox_publisher_untyped.cpp b/iceoryx_examples/icedelivery/iox_publisher_untyped.cpp index 6ca689f782..735da37808 100644 --- a/iceoryx_examples/icedelivery/iox_publisher_untyped.cpp +++ b/iceoryx_examples/icedelivery/iox_publisher_untyped.cpp @@ -20,7 +20,7 @@ //! [include topic data] //! [includes] -#include "iceoryx_hoofs/posix_wrapper/signal_watcher.hpp" +#include "iceoryx_dust/posix_wrapper/signal_watcher.hpp" #include "iceoryx_posh/popo/untyped_publisher.hpp" #include "iceoryx_posh/runtime/posh_runtime.hpp" //! [includes] diff --git a/iceoryx_examples/icedelivery/iox_subscriber.cpp b/iceoryx_examples/icedelivery/iox_subscriber.cpp index 02828df2c1..8c79034f53 100644 --- a/iceoryx_examples/icedelivery/iox_subscriber.cpp +++ b/iceoryx_examples/icedelivery/iox_subscriber.cpp @@ -20,7 +20,7 @@ //! [include subscriber] #include "iceoryx_posh/popo/subscriber.hpp" //! [include subscriber] -#include "iceoryx_hoofs/posix_wrapper/signal_watcher.hpp" +#include "iceoryx_dust/posix_wrapper/signal_watcher.hpp" #include "iceoryx_posh/runtime/posh_runtime.hpp" #include diff --git a/iceoryx_examples/icedelivery/iox_subscriber_untyped.cpp b/iceoryx_examples/icedelivery/iox_subscriber_untyped.cpp index 190fa62d93..b667027406 100644 --- a/iceoryx_examples/icedelivery/iox_subscriber_untyped.cpp +++ b/iceoryx_examples/icedelivery/iox_subscriber_untyped.cpp @@ -18,7 +18,7 @@ //! [includes] #include "topic_data.hpp" -#include "iceoryx_hoofs/posix_wrapper/signal_watcher.hpp" +#include "iceoryx_dust/posix_wrapper/signal_watcher.hpp" #include "iceoryx_posh/popo/untyped_subscriber.hpp" #include "iceoryx_posh/runtime/posh_runtime.hpp" //! [includes] diff --git a/iceoryx_examples/icediscovery/iox_discovery_monitor.cpp b/iceoryx_examples/icediscovery/iox_discovery_monitor.cpp index 2f2cbcdbe0..abc9437610 100644 --- a/iceoryx_examples/icediscovery/iox_discovery_monitor.cpp +++ b/iceoryx_examples/icediscovery/iox_discovery_monitor.cpp @@ -18,7 +18,7 @@ #include "discovery_monitor.hpp" //! [include custom discovery] -#include "iceoryx_hoofs/posix_wrapper/signal_watcher.hpp" +#include "iceoryx_dust/posix_wrapper/signal_watcher.hpp" #include "iceoryx_posh/runtime/posh_runtime.hpp" #include diff --git a/iceoryx_examples/icediscovery/iox_find_service.cpp b/iceoryx_examples/icediscovery/iox_find_service.cpp index 398d812625..dea81f9550 100644 --- a/iceoryx_examples/icediscovery/iox_find_service.cpp +++ b/iceoryx_examples/icediscovery/iox_find_service.cpp @@ -14,7 +14,7 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "iceoryx_hoofs/posix_wrapper/signal_watcher.hpp" +#include "iceoryx_dust/posix_wrapper/signal_watcher.hpp" #include "iceoryx_posh/runtime/posh_runtime.hpp" //! [include ServiceDiscovery] #include "iceoryx_posh/runtime/service_discovery.hpp" diff --git a/iceoryx_examples/icediscovery/iox_offer_service.cpp b/iceoryx_examples/icediscovery/iox_offer_service.cpp index 32b529bfac..5dc2a65f4a 100644 --- a/iceoryx_examples/icediscovery/iox_offer_service.cpp +++ b/iceoryx_examples/icediscovery/iox_offer_service.cpp @@ -14,7 +14,7 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "iceoryx_hoofs/posix_wrapper/signal_watcher.hpp" +#include "iceoryx_dust/posix_wrapper/signal_watcher.hpp" #include "iceoryx_posh/popo/publisher.hpp" #include "iceoryx_posh/runtime/posh_runtime.hpp" diff --git a/iceoryx_examples/icediscovery/iox_wait_for_service.cpp b/iceoryx_examples/icediscovery/iox_wait_for_service.cpp index 20a3b45cc2..b3a77681e2 100644 --- a/iceoryx_examples/icediscovery/iox_wait_for_service.cpp +++ b/iceoryx_examples/icediscovery/iox_wait_for_service.cpp @@ -18,7 +18,7 @@ #include "discovery_blocking.hpp" //! [include custom discovery] -#include "iceoryx_hoofs/posix_wrapper/signal_watcher.hpp" +#include "iceoryx_dust/posix_wrapper/signal_watcher.hpp" #include "iceoryx_posh/runtime/posh_runtime.hpp" #include diff --git a/iceoryx_examples/icehello/README.md b/iceoryx_examples/icehello/README.md index 269023f32d..3e65b6d0ee 100644 --- a/iceoryx_examples/icehello/README.md +++ b/iceoryx_examples/icehello/README.md @@ -65,7 +65,7 @@ In iceoryx, a publisher and a subscriber are connected only if all three IDs mat For exiting on Ctrl+C, we use the `SignalWatcher` ```cpp -#include "iceoryx_hoofs/posix_wrapper/signal_watcher.hpp" +#include "iceoryx_dust/posix_wrapper/signal_watcher.hpp" ``` and loop in our `while` loop until it states that `SIGINT` or `SIGTERM` was sent via @@ -125,7 +125,7 @@ The subscriber needs to have similar includes, but unlike the publisher `subscri ```cpp #include "topic_data.hpp" -#include "iceoryx_hoofs/posix_wrapper/signal_watcher.hpp" +#include "iceoryx_dust/posix_wrapper/signal_watcher.hpp" #include "iceoryx_posh/popo/subscriber.hpp" #include "iceoryx_posh/runtime/posh_runtime.hpp" ``` diff --git a/iceoryx_examples/icehello/iox_publisher_helloworld.cpp b/iceoryx_examples/icehello/iox_publisher_helloworld.cpp index 44ed498533..20dd474b5d 100644 --- a/iceoryx_examples/icehello/iox_publisher_helloworld.cpp +++ b/iceoryx_examples/icehello/iox_publisher_helloworld.cpp @@ -19,7 +19,7 @@ //! [include topic] //! [include sig watcher] -#include "iceoryx_hoofs/posix_wrapper/signal_watcher.hpp" +#include "iceoryx_dust/posix_wrapper/signal_watcher.hpp" //! [include sig watcher] //! [include] diff --git a/iceoryx_examples/icehello/iox_subscriber_helloworld.cpp b/iceoryx_examples/icehello/iox_subscriber_helloworld.cpp index 80d216c319..99f505a99c 100644 --- a/iceoryx_examples/icehello/iox_subscriber_helloworld.cpp +++ b/iceoryx_examples/icehello/iox_subscriber_helloworld.cpp @@ -17,7 +17,7 @@ //! [include] #include "topic_data.hpp" -#include "iceoryx_hoofs/posix_wrapper/signal_watcher.hpp" +#include "iceoryx_dust/posix_wrapper/signal_watcher.hpp" #include "iceoryx_posh/popo/subscriber.hpp" #include "iceoryx_posh/runtime/posh_runtime.hpp" //! [include] diff --git a/iceoryx_examples/iceoptions/iox_publisher_with_options.cpp b/iceoryx_examples/iceoptions/iox_publisher_with_options.cpp index ce59852506..357f7692ee 100644 --- a/iceoryx_examples/iceoptions/iox_publisher_with_options.cpp +++ b/iceoryx_examples/iceoptions/iox_publisher_with_options.cpp @@ -16,7 +16,7 @@ #include "topic_data.hpp" -#include "iceoryx_hoofs/posix_wrapper/signal_watcher.hpp" +#include "iceoryx_dust/posix_wrapper/signal_watcher.hpp" #include "iceoryx_posh/popo/publisher.hpp" #include "iceoryx_posh/runtime/posh_runtime.hpp" diff --git a/iceoryx_examples/iceoptions/iox_subscriber_with_options.cpp b/iceoryx_examples/iceoptions/iox_subscriber_with_options.cpp index 780dc8fd47..f33931b915 100644 --- a/iceoryx_examples/iceoptions/iox_subscriber_with_options.cpp +++ b/iceoryx_examples/iceoptions/iox_subscriber_with_options.cpp @@ -16,7 +16,7 @@ #include "topic_data.hpp" -#include "iceoryx_hoofs/posix_wrapper/signal_watcher.hpp" +#include "iceoryx_dust/posix_wrapper/signal_watcher.hpp" #include "iceoryx_posh/popo/subscriber.hpp" #include "iceoryx_posh/runtime/posh_runtime.hpp" diff --git a/iceoryx_examples/iceperf/CMakeLists.txt b/iceoryx_examples/iceperf/CMakeLists.txt index 5f7425ca3e..a83414e522 100644 --- a/iceoryx_examples/iceperf/CMakeLists.txt +++ b/iceoryx_examples/iceperf/CMakeLists.txt @@ -24,6 +24,7 @@ option(TOML_CONFIG "TOML support for RouDi with dynamic configuration" ON) find_package(iceoryx_posh CONFIG REQUIRED) find_package(iceoryx_binding_c CONFIG REQUIRED) find_package(iceoryx_hoofs CONFIG REQUIRED) +find_package(iceoryx_dust CONFIG REQUIRED) get_target_property(ICEORYX_CXX_STANDARD iceoryx_posh::iceoryx_posh CXX_STANDARD) diff --git a/iceoryx_examples/iceperf/mq.cpp b/iceoryx_examples/iceperf/mq.cpp index f10ee4cd1f..362862bd2a 100644 --- a/iceoryx_examples/iceperf/mq.cpp +++ b/iceoryx_examples/iceperf/mq.cpp @@ -16,7 +16,7 @@ // SPDX-License-Identifier: Apache-2.0 #include "mq.hpp" -#include "iceoryx_hoofs/internal/posix_wrapper/message_queue.hpp" +#include "iceoryx_dust/posix_wrapper/message_queue.hpp" #include "iceoryx_hoofs/platform/fcntl.hpp" #include "iceoryx_hoofs/platform/platform_correction.hpp" #include "iceoryx_hoofs/posix_wrapper/posix_call.hpp" diff --git a/iceoryx_examples/request_response/README.md b/iceoryx_examples/request_response/README.md index 9927e0f30c..4269305596 100644 --- a/iceoryx_examples/request_response/README.md +++ b/iceoryx_examples/request_response/README.md @@ -36,7 +36,7 @@ At first, the includes for the client port, request-response types, WaitSet, and #include "request_and_response_types.hpp" #include "iceoryx_hoofs/posix_wrapper/signal_handler.hpp" -#include "iceoryx_hoofs/posix_wrapper/signal_watcher.hpp" +#include "iceoryx_dust/posix_wrapper/signal_watcher.hpp" #include "iceoryx_posh/popo/client.hpp" #include "iceoryx_posh/popo/wait_set.hpp" #include "iceoryx_posh/runtime/posh_runtime.hpp" @@ -176,7 +176,7 @@ At first, the includes for the server port, Listener, request-response types and ```cpp #include "request_and_response_types.hpp" -#include "iceoryx_hoofs/posix_wrapper/signal_watcher.hpp" +#include "iceoryx_dust/posix_wrapper/signal_watcher.hpp" #include "iceoryx_posh/popo/listener.hpp" #include "iceoryx_posh/popo/server.hpp" #include "iceoryx_posh/runtime/posh_runtime.hpp" diff --git a/iceoryx_examples/request_response/client_cxx_basic.cpp b/iceoryx_examples/request_response/client_cxx_basic.cpp index a110e3dcf5..7cbbfb2ff3 100644 --- a/iceoryx_examples/request_response/client_cxx_basic.cpp +++ b/iceoryx_examples/request_response/client_cxx_basic.cpp @@ -17,7 +17,7 @@ //! [iceoryx includes] #include "request_and_response_types.hpp" -#include "iceoryx_hoofs/posix_wrapper/signal_watcher.hpp" +#include "iceoryx_dust/posix_wrapper/signal_watcher.hpp" #include "iceoryx_posh/popo/client.hpp" #include "iceoryx_posh/runtime/posh_runtime.hpp" //! [iceoryx includes] diff --git a/iceoryx_examples/request_response/client_cxx_untyped.cpp b/iceoryx_examples/request_response/client_cxx_untyped.cpp index 1bcf2bd051..811d376d70 100644 --- a/iceoryx_examples/request_response/client_cxx_untyped.cpp +++ b/iceoryx_examples/request_response/client_cxx_untyped.cpp @@ -17,7 +17,7 @@ //! [iceoryx includes] #include "request_and_response_types.hpp" -#include "iceoryx_hoofs/posix_wrapper/signal_watcher.hpp" +#include "iceoryx_dust/posix_wrapper/signal_watcher.hpp" #include "iceoryx_posh/popo/untyped_client.hpp" #include "iceoryx_posh/runtime/posh_runtime.hpp" //! [iceoryx includes] diff --git a/iceoryx_examples/request_response/client_cxx_waitset.cpp b/iceoryx_examples/request_response/client_cxx_waitset.cpp index 0d5cfb2d38..4bdd766d6b 100644 --- a/iceoryx_examples/request_response/client_cxx_waitset.cpp +++ b/iceoryx_examples/request_response/client_cxx_waitset.cpp @@ -18,7 +18,7 @@ #include "request_and_response_types.hpp" #include "iceoryx_hoofs/posix_wrapper/signal_handler.hpp" -#include "iceoryx_hoofs/posix_wrapper/signal_watcher.hpp" +#include "iceoryx_dust/posix_wrapper/signal_watcher.hpp" #include "iceoryx_posh/popo/client.hpp" #include "iceoryx_posh/popo/wait_set.hpp" #include "iceoryx_posh/runtime/posh_runtime.hpp" diff --git a/iceoryx_examples/request_response/server_cxx_basic.cpp b/iceoryx_examples/request_response/server_cxx_basic.cpp index 3478fc1d3a..02c5e600a6 100644 --- a/iceoryx_examples/request_response/server_cxx_basic.cpp +++ b/iceoryx_examples/request_response/server_cxx_basic.cpp @@ -17,7 +17,7 @@ //! [iceoryx includes] #include "request_and_response_types.hpp" -#include "iceoryx_hoofs/posix_wrapper/signal_watcher.hpp" +#include "iceoryx_dust/posix_wrapper/signal_watcher.hpp" #include "iceoryx_posh/popo/server.hpp" #include "iceoryx_posh/runtime/posh_runtime.hpp" //! [iceoryx includes] diff --git a/iceoryx_examples/request_response/server_cxx_listener.cpp b/iceoryx_examples/request_response/server_cxx_listener.cpp index b6ca1e1851..45842cba3e 100644 --- a/iceoryx_examples/request_response/server_cxx_listener.cpp +++ b/iceoryx_examples/request_response/server_cxx_listener.cpp @@ -17,7 +17,7 @@ //! [iceoryx includes] #include "request_and_response_types.hpp" -#include "iceoryx_hoofs/posix_wrapper/signal_watcher.hpp" +#include "iceoryx_dust/posix_wrapper/signal_watcher.hpp" #include "iceoryx_posh/popo/listener.hpp" #include "iceoryx_posh/popo/server.hpp" #include "iceoryx_posh/runtime/posh_runtime.hpp" diff --git a/iceoryx_examples/request_response/server_cxx_untyped.cpp b/iceoryx_examples/request_response/server_cxx_untyped.cpp index e895f1b746..3fd6a6debb 100644 --- a/iceoryx_examples/request_response/server_cxx_untyped.cpp +++ b/iceoryx_examples/request_response/server_cxx_untyped.cpp @@ -17,7 +17,7 @@ //! [iceoryx includes] #include "request_and_response_types.hpp" -#include "iceoryx_hoofs/posix_wrapper/signal_watcher.hpp" +#include "iceoryx_dust/posix_wrapper/signal_watcher.hpp" #include "iceoryx_posh/popo/untyped_server.hpp" #include "iceoryx_posh/runtime/posh_runtime.hpp" //! [iceoryx includes] diff --git a/iceoryx_examples/singleprocess/single_process.cpp b/iceoryx_examples/singleprocess/single_process.cpp index b940d282e5..3c7e087f02 100644 --- a/iceoryx_examples/singleprocess/single_process.cpp +++ b/iceoryx_examples/singleprocess/single_process.cpp @@ -17,7 +17,7 @@ #include "iceoryx_hoofs/cxx/convert.hpp" #include "iceoryx_hoofs/log/logmanager.hpp" -#include "iceoryx_hoofs/posix_wrapper/signal_watcher.hpp" +#include "iceoryx_dust/posix_wrapper/signal_watcher.hpp" #include "iceoryx_posh/iceoryx_posh_config.hpp" #include "iceoryx_posh/iceoryx_posh_types.hpp" #include "iceoryx_posh/internal/roudi/roudi.hpp" diff --git a/iceoryx_examples/user_header/README.md b/iceoryx_examples/user_header/README.md index fc4bff6558..aa781a0012 100644 --- a/iceoryx_examples/user_header/README.md +++ b/iceoryx_examples/user_header/README.md @@ -58,7 +58,7 @@ and the iceoryx includes for publisher and runtime. ```cpp #include "user_header_and_payload_types.hpp" -#include "iceoryx_hoofs/posix_wrapper/signal_watcher.hpp" +#include "iceoryx_dust/posix_wrapper/signal_watcher.hpp" #include "iceoryx_posh/popo/publisher.hpp" #include "iceoryx_posh/runtime/posh_runtime.hpp" ``` diff --git a/iceoryx_examples/user_header/publisher_cxx_api.cpp b/iceoryx_examples/user_header/publisher_cxx_api.cpp index 1b1e754546..e3dfb7b728 100644 --- a/iceoryx_examples/user_header/publisher_cxx_api.cpp +++ b/iceoryx_examples/user_header/publisher_cxx_api.cpp @@ -17,7 +17,7 @@ //! [iceoryx includes] #include "user_header_and_payload_types.hpp" -#include "iceoryx_hoofs/posix_wrapper/signal_watcher.hpp" +#include "iceoryx_dust/posix_wrapper/signal_watcher.hpp" #include "iceoryx_posh/popo/publisher.hpp" #include "iceoryx_posh/runtime/posh_runtime.hpp" //! [iceoryx includes] diff --git a/iceoryx_examples/user_header/publisher_untyped_cxx_api.cpp b/iceoryx_examples/user_header/publisher_untyped_cxx_api.cpp index c9fd18bc7d..c52d7cc3a7 100644 --- a/iceoryx_examples/user_header/publisher_untyped_cxx_api.cpp +++ b/iceoryx_examples/user_header/publisher_untyped_cxx_api.cpp @@ -17,7 +17,7 @@ //! [iceoryx includes] #include "user_header_and_payload_types.hpp" -#include "iceoryx_hoofs/posix_wrapper/signal_watcher.hpp" +#include "iceoryx_dust/posix_wrapper/signal_watcher.hpp" //! [include differs from typed C++ API] #include "iceoryx_posh/popo/untyped_publisher.hpp" //! [include differs from typed C++ API] diff --git a/iceoryx_examples/user_header/subscriber_cxx_api.cpp b/iceoryx_examples/user_header/subscriber_cxx_api.cpp index 080d7be6e6..4737620610 100644 --- a/iceoryx_examples/user_header/subscriber_cxx_api.cpp +++ b/iceoryx_examples/user_header/subscriber_cxx_api.cpp @@ -17,7 +17,7 @@ //! [iceoryx includes] #include "user_header_and_payload_types.hpp" -#include "iceoryx_hoofs/posix_wrapper/signal_watcher.hpp" +#include "iceoryx_dust/posix_wrapper/signal_watcher.hpp" #include "iceoryx_posh/popo/subscriber.hpp" #include "iceoryx_posh/runtime/posh_runtime.hpp" //! [iceoryx includes] diff --git a/iceoryx_examples/user_header/subscriber_untyped_cxx_api.cpp b/iceoryx_examples/user_header/subscriber_untyped_cxx_api.cpp index 199d562724..ee176ce48a 100644 --- a/iceoryx_examples/user_header/subscriber_untyped_cxx_api.cpp +++ b/iceoryx_examples/user_header/subscriber_untyped_cxx_api.cpp @@ -17,7 +17,7 @@ //! [iceoryx includes] #include "user_header_and_payload_types.hpp" -#include "iceoryx_hoofs/posix_wrapper/signal_watcher.hpp" +#include "iceoryx_dust/posix_wrapper/signal_watcher.hpp" #include "iceoryx_posh/popo/untyped_subscriber.hpp" #include "iceoryx_posh/runtime/posh_runtime.hpp" //! [iceoryx includes] diff --git a/iceoryx_examples/waitset/ice_waitset_publisher.cpp b/iceoryx_examples/waitset/ice_waitset_publisher.cpp index 25510d38cc..9a692d41db 100644 --- a/iceoryx_examples/waitset/ice_waitset_publisher.cpp +++ b/iceoryx_examples/waitset/ice_waitset_publisher.cpp @@ -14,7 +14,7 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "iceoryx_hoofs/posix_wrapper/signal_watcher.hpp" +#include "iceoryx_dust/posix_wrapper/signal_watcher.hpp" #include "iceoryx_posh/popo/publisher.hpp" #include "iceoryx_posh/runtime/posh_runtime.hpp" #include "topic_data.hpp" diff --git a/iceoryx_hoofs/CMakeLists.txt b/iceoryx_hoofs/CMakeLists.txt index 745dfbc46f..8332d5321a 100644 --- a/iceoryx_hoofs/CMakeLists.txt +++ b/iceoryx_hoofs/CMakeLists.txt @@ -46,7 +46,6 @@ iox_add_library( BUILD_INTERFACE ${PROJECT_SOURCE_DIR}/include INSTALL_INTERFACE include/${PREFIX} FILES - source/concurrent/active_object.cpp source/concurrent/loffli.cpp source/cxx/adaptive_wait.cpp source/cxx/deadline_timer.cpp @@ -57,7 +56,6 @@ iox_add_library( source/cxx/unique_id.cpp source/error_handling/error_handler.cpp source/error_handling/error_handling.cpp - source/file_reader/file_reader.cpp source/log/hoofs_logging.cpp source/log/logcommon.cpp source/log/logger.cpp @@ -67,9 +65,7 @@ iox_add_library( source/log/logstream.cpp source/posix_wrapper/access_control.cpp source/posix_wrapper/file_lock.cpp - source/posix_wrapper/message_queue.cpp source/posix_wrapper/mutex.cpp - source/posix_wrapper/named_pipe.cpp source/posix_wrapper/named_semaphore.cpp source/posix_wrapper/posix_access_rights.cpp source/posix_wrapper/semaphore_interface.cpp @@ -78,7 +74,6 @@ iox_add_library( source/posix_wrapper/shared_memory_object/memory_map.cpp source/posix_wrapper/shared_memory_object/shared_memory.cpp source/posix_wrapper/signal_handler.cpp - source/posix_wrapper/signal_watcher.cpp source/posix_wrapper/system_configuration.cpp source/posix_wrapper/thread.cpp source/posix_wrapper/types.cpp diff --git a/iceoryx_hoofs/README.md b/iceoryx_hoofs/README.md index a15d363d77..2b81335792 100644 --- a/iceoryx_hoofs/README.md +++ b/iceoryx_hoofs/README.md @@ -7,16 +7,16 @@ grouped together in categories or namespace, depending on where or how they are ## Categories -| Namespace | Short Description | -|:---------------:|:------------------| -| [cxx](#cxx) | Since we are not allowed to use C++17 as well as the heap or exceptions we implemented constructs like `optional`, `expected` or `variant` so that we can be as modern as possible. Furthermore, you can find here constructs which are mentioned in the [C++ Core Guidelines](https://github.com/isocpp/CppCoreGuidelines) as well as STL re-implementations of container like `vector` which are relocatable an can be placed into the shared memory. | -| [concurrent](#concurrent) | You should never use concurrent constructs like `mutex`, `semaphores`, `atomic`, etc. directly in our codebase. At the moment we still have some exceptions to this guideline but the idea is that all classes which are using them are stored under concurrent and have to undergo more tests then the usual non concurrent class. For instance we try to provide stress tests for them. This module provides classes like `fifo`, `smart_lock`, `sofi`, `trigger_queue` and much more. | +| Namespace | Short Description | +|:---------------------------------:|:------------------| +| [cxx](#cxx) | Since we are not allowed to use C++17 as well as the heap or exceptions we implemented constructs like `optional`, `expected` or `variant` so that we can be as modern as possible. Furthermore, you can find here constructs which are mentioned in the [C++ Core Guidelines](https://github.com/isocpp/CppCoreGuidelines) as well as STL re-implementations of container like `vector` which are relocatable an can be placed into the shared memory. | +| [concurrent](#concurrent) | You should never use concurrent constructs like `mutex`, `semaphores`, `atomic`, etc. directly in our codebase. At the moment we still have some exceptions to this guideline but the idea is that all classes which are using them are stored under concurrent and have to undergo more tests then the usual non concurrent class. For instance we try to provide stress tests for them. This module provides classes like `fifo`, `smart_lock`, `sofi`, `trigger_queue` and much more. | | [design_pattern](#design-pattern) | Certain code patterns which are repeating themselves all over the code are abstracted and stored in here. At the moment we only have the creation pattern which will be removed in a future release. | | [error-handling](#error-handling) | The central error handler in iceoryx for cases when no sane further execution is possible, e.g. `nullptr` access. | -| [log](#log) | The logger used by iceoryx. | -| [posix_wrapper](#posix-wrapper) | Posix constructs like shared memory, threads or semaphores are not used directly in our code base. We abstracted them so that they are following the [RAII (Resource Acquisition Is Initialization)](https://en.wikipedia.org/wiki/Resource_acquisition_is_initialization) idiom and other good practices from the C++ community. | -| [units](#units) | Time units for duration and string literals. | -| other | There are even more namespaces inside the iceoryx hoofs but they will either become obsolete in the future, will be integrated into existing names or are established as another namespace and documented here. We are unsure where they will end up in the future. | +| [log](#log) | The logger used by iceoryx. | +| [posix_wrapper](#posix-wrapper) | Posix constructs like shared memory, threads or semaphores are not used directly in our code base. We abstracted them so that they are following the [RAII (Resource Acquisition Is Initialization)](https://en.wikipedia.org/wiki/Resource_acquisition_is_initialization) idiom and other good practices from the C++ community. | +| [units](#units) | Time units for duration and string literals. | +| other | There are even more namespaces inside the iceoryx hoofs but they will either become obsolete in the future, will be integrated into existing names or are established as another namespace and documented here. We are unsure where they will end up in the future. | ## Structure @@ -39,79 +39,70 @@ and we do not use dynamic memory. In these cases we adjusted the API to our use Most of the headers are providing some example code on how the class should be used. -| class/file | internal | maybe obsolete | description | -|:-------------------:|:--------:|:--------------:|:------------| -|`algorithm` | | | Implements `min` and `max` for an arbitrary number of values of the same type. For instance `min(1,2,3,4,5);` | -|`attributes` | | | C++17 and C++20 attributes are sometimes available through compiler extensions. The attribute macros defined in here (like `IOX_FALLTHROUGH`, `IOX_MAYBE_UNUSED` ... ) make sure that we are able to use them if the compiler supports it. | -|`convert` | | | Converting a number into a string is easy, converting it back can be hard. You can use functions like `strtoll` but you still have to handle errors like under- and overflow, or converting invalid strings into number. Here we abstract all the error handling so that you can convert strings into numbers safely. | -|`DeadlineTimer` | | | Polling based timer to check for an elapsed deadline. | -|`expected` | | | Our base class used in error handling. Every function which can fail should return an expected. With this the user knows that this function can fail and that they have to do some kind of error handling. We got inspired by the [C++ expected proposal]( http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0323r7.html) and by the [rust error handling concept](https://doc.rust-lang.org/std/result/enum.Result.html). | -|`filesystem` | | | Implementation of C++17 filesystem features for instance `cxx::perms` to abstract file permissions | -|`forward_list` | | | Heap and exception free, relocatable implementation of `std::forward_list` | -|`function` | | | A stack-based `std::function` replacement based on `storable_function` | -|`function_ref` | | | C++11 implementation of the next-gen C++ feature `std::function_ref` see [function_ref proposal](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0792r2.html). It behaves like `std::function` but does not own the callable. | -|`functional_interface` | | | Constructs to easily add functional interfaces like `and_then` to object container. | -|`GenericRAII` | | | This is an abstraction of the C++ RAII idiom. Sometimes you have constructs where you would like to perform a certain task on creation and then again when they are getting out of scope, this is where `GenericRAII` comes in. It is like a `std::lock_guard` or a `std::shared_ptr` but more generic. | -|`helplets` | | | Implementations of [C++ Core Guideline](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines) concepts like `not_null` are contained here. Additionally, we are providing some types to verify preconditions at compile time. Think of an int which has to be always greater 5, here we provide types like `greater_or_equal`.| -|`list` | | | Heap and exception free, relocatable implementation of `std::list` | -|`NewType`| | | C++11 implementation of [Haskells NewType-pattern](https://wiki.haskell.org/Newtype). | -|`optional` | | | C++11 implementation of the C++17 feature `std::optional` | -|`pair` | i | X | Simplistic re-implementation of an `std::pair`. | -|`poor_mans_heap` | | | Acquires memory on the stack for placement new instantiations. All classes must inherit from a base class which has to be known at compile time but the class itself does not have to be known - only the size. | -|`ReferenceCounter` | i | | Basic building block for classes which are needing some kind of reference counting like a `std::shared_ptr` | -|`requires` | | | Base for `Expects`/`Ensures` from the C++ Core Guideline | -|`scoped_static` | | | Helper function to limit lifetime of static or global variables to a scope | -|`serialization` | | X | Implements a simple serialization concept for classes based on the idea presented here [ISOCPP serialization](https://isocpp.org/wiki/faq/serialization#serialize-text-format). | -|`set` | i | X | Templated helper functions to create a fake `std::set` from a vector. | -|`spinator` | i | | Building block to realize busy waiting loops with low cpu load. | -|`stack` | | | Stack implementation with simple push/pop interface. | -|`static_storage` | i | | Untyped aligned static storage. | -|`storable_function` | i | | A `std::function` alternative with configurable backend for memory storage. | -|`string` | | | Heap and exception free implementation of `std::string`. Attention, since the string is stack based, std::string or char array which are assigned to this string will be truncated and zero-terminated if they exceed the string capacity. | -|`type_traits` | | | Extended support for evaluating types on compile-time. | -|`types` | | | Declares essential building block types like `byte_t`. | -|`UniqueId` | i | | Monotonic increasing IDs within a process. | -|`unique_ptr` | | | Provides a heap-less unique ptr implementation, unlike the STL | -|`variant` | | | C++11 implementation of the C++17 feature `std::variant` | -|`variant_queue` | | | A queue which wraps multiple variants of Queues (FiFo, SoFi, ResizeableLockFreeQueue) | -|`vector` | | | Heap and exception free implementation of `std::vector` | +| class/file | internal | description | +|:---------------------:|:--------:|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +|`algorithm` | | Implements `min` and `max` for an arbitrary number of values of the same type. For instance `min(1,2,3,4,5);` | +|`attributes` | | C++17 and C++20 attributes are sometimes available through compiler extensions. The attribute macros defined in here (like `IOX_FALLTHROUGH`, `IOX_MAYBE_UNUSED` ... ) make sure that we are able to use them if the compiler supports it. | +|`convert` | | Converting a number into a string is easy, converting it back can be hard. You can use functions like `strtoll` but you still have to handle errors like under- and overflow, or converting invalid strings into number. Here we abstract all the error handling so that you can convert strings into numbers safely. | +|`DeadlineTimer` | | Polling based timer to check for an elapsed deadline. | +|`expected` | | Our base class used in error handling. Every function which can fail should return an expected. With this the user knows that this function can fail and that they have to do some kind of error handling. We got inspired by the [C++ expected proposal]( http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0323r7.html) and by the [rust error handling concept](https://doc.rust-lang.org/std/result/enum.Result.html). | +|`filesystem` | | Implementation of C++17 filesystem features for instance `cxx::perms` to abstract file permissions | +|`function` | | A stack-based `std::function` replacement based on `storable_function` | +|`function_ref` | | C++11 implementation of the next-gen C++ feature `std::function_ref` see [function_ref proposal](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0792r2.html). It behaves like `std::function` but does not own the callable.| +|`functional_interface` | | Constructs to easily add functional interfaces like `and_then` to object container. | +|`GenericRAII` | | This is an abstraction of the C++ RAII idiom. Sometimes you have constructs where you would like to perform a certain task on creation and then again when they are getting out of scope, this is where `GenericRAII` comes in. It is like a `std::lock_guard` or a `std::shared_ptr` but more generic. | +|`helplets` | | Implementations of [C++ Core Guideline](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines) concepts like `not_null` are contained here. Additionally, we are providing some types to verify preconditions at compile time. Think of an int which has to be always greater 5, here we provide types like `greater_or_equal`.| +|`list` | | Heap and exception free, relocatable implementation of `std::list` | +|`NewType` | | C++11 implementation of [Haskells NewType-pattern](https://wiki.haskell.org/Newtype). | +|`optional` | | C++11 implementation of the C++17 feature `std::optional` | +|`requires` | | Base for `Expects`/`Ensures` from the C++ Core Guideline | +|`scoped_static` | | Helper function to limit lifetime of static or global variables to a scope | +|`serialization` | | Implements a simple serialization concept for classes based on the idea presented here [ISOCPP serialization](https://isocpp.org/wiki/faq/serialization#serialize-text-format). | +|`spinator` | i | Building block to realize busy waiting loops with low cpu load. | +|`stack` | | Stack implementation with simple push/pop interface. | +|`static_storage` | i | Untyped aligned static storage. | +|`storable_function` | i | A `std::function` alternative with configurable backend for memory storage. | +|`string` | | Heap and exception free implementation of `std::string`. Attention, since the string is stack based, std::string or char array which are assigned to this string will be truncated and zero-terminated if they exceed the string capacity. | +|`type_traits` | | Extended support for evaluating types on compile-time. | +|`types` | | Declares essential building block types like `byte_t`. | +|`UniqueId` | i | Monotonic increasing IDs within a process. | +|`unique_ptr` | | Provides a heap-less unique ptr implementation, unlike the STL | +|`variant` | | C++11 implementation of the C++17 feature `std::variant` | +|`variant_queue` | | A queue which wraps multiple variants of Queues (FiFo, SoFi, ResizeableLockFreeQueue) | +|`vector` | | Heap and exception free implementation of `std::vector` | ### Concurrent If you have to write concurrent code, never use concurrency constructs like `mutex`, `atomic`, `thread`, `semaphore`, etc. directly. Most of the use cases can be solved by using an `ActiveObject` which uses as building block our `FiFo` or a queue which is thread-safe when combined with `smart_lock`. To learn more about active objects see [Prefer Using Active Objects Instead Of Naked Threads](https://www.drdobbs.com/parallel/prefer-using-active-objects-instead-of-n/225700095). -| class | internal | maybe obsolete | description | -|:-------------------:|:--------:|:--------------:|:------------| -|`ActiveObject` | i | X | Active object base skeleton implementation inspired by [Prefer Using Active Objects Instead Of Naked Threads](https://www.drdobbs.com/parallel/prefer-using-active-objects-instead-of-n/225700095) | -|`FiFo` | i | | Single producer, single consumer lock-free FiFo | -|`LockfreeQueue` | | | Multi producer, multi consumer lock-free FiFo with ringbuffer like overflow handling | -|`LoFFLi` | i | | Lock-free LIFO based index manager (lock-free free list). One building block of our memory manager. After construction it contains the indices {0 ... n} which you can acquire and release. | -|`PeriodicTask` | i | | Periodically executes a callable specified by the template parameter in a configurable time interval. | -|`ResizeableLockFreeQueue` | | | Resizeable variant of the `LockfreeQueue` | -|`smart_lock` | i | | Creates arbitrary thread safe constructs which then can be used like smart pointers. If some STL type should be thread safe use the smart_lock to create the thread safe version in one line. Based on some ideas presented in [Wrapping C++ Member Function Calls](https://stroustrup.com/wrapper.pdf) | -|`SoFi` | i | | Single producer, single consumer lock-free safely overflowing FiFo (SoFi). | -|`TACO` | i | | Thread Aware exChange Ownership (TACO). Solution if you would like to use `std::atomic` with data types larger than 64 bit. Wait free data synchronization mechanism between threads.| -|`TriggerQueue` | i | X | Queue with a `push` - `pop` interface where `pop` is blocking as long as the queue is empty. Can be used as a building block for active objects. | +| class | internal | description | +|:------------------------:|:--------:|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +|`FiFo` | i | Single producer, single consumer lock-free FiFo | +|`LockfreeQueue` | | Multi producer, multi consumer lock-free FiFo with ringbuffer like overflow handling | +|`LoFFLi` | i | Lock-free LIFO based index manager (lock-free free list). One building block of our memory manager. After construction it contains the indices {0 ... n} which you can acquire and release. | +|`PeriodicTask` | i | Periodically executes a callable specified by the template parameter in a configurable time interval. | +|`ResizeableLockFreeQueue` | | Resizeable variant of the `LockfreeQueue` | +|`smart_lock` | i | Creates arbitrary thread safe constructs which then can be used like smart pointers. If some STL type should be thread safe use the smart_lock to create the thread safe version in one line. Based on some ideas presented in [Wrapping C++ Member Function Calls](https://stroustrup.com/wrapper.pdf) | +|`SoFi` | i | Single producer, single consumer lock-free safely overflowing FiFo (SoFi). | +|`TACO` | i | Thread Aware exChange Ownership (TACO). Solution if you would like to use `std::atomic` with data types larger than 64 bit. Wait free data synchronization mechanism between threads. | attribute overview of the available Queues: -| Data Structure | Shared Memory usable | Thread-Safe | Lock-Free | Concurrent Producers : Consumers | Bounded Capacity | Data Type Restriction |Use Case | -|----------------|-----------------------|-------------|-----------|----------------------------------|------------------|---|-----------------------| -|`FiFo` | Yes | Yes | Yes | 1:1 | Yes | Copyable | FIFO Data transfer | -|`LockfreeQueue` | Yes | Yes | Yes | n:m | Yes | Copyable or Movable | lock-free transfer of arbitrary data between multiple contexts in FIFO order with overflow handling (ringbuffer) | -|`LoFFLi` | Yes | Yes | Yes | n:m | Yes | int32 | manage memory access, LIFO order | -|`smart_lock` | Yes | Yes | No | n/a | n/a | None | Wrapper to make classes thread-safe (by using a lock)| -|`SoFi` | Yes | Yes | Yes | 1:1 | Yes | Trivially Copyable | lock-free transfer of small data (e.g. pointers) between two contexts in FIFO order with overflow handling (ringbuffer) | -|`ResizeableLockFreeQueue` | Yes | Yes | Yes | n:m | Yes | Copyable or Movable | Resizeable variant of the `LockfreeQueue`| -|`TACO` | Yes | Yes | Yes | n:m | Yes | Copyable or Movable | fast lock-free exchange data between threads| -|`TriggerQueue` | No | Yes | No | n:m | Yes | Copyable | Process events in a blocking way| +| Data Structure | Shared Memory usable | Thread-Safe | Lock-Free | Concurrent Producers : Consumers | Bounded Capacity | Data Type Restriction | Use Case | +|--------------------------|-----------------------|-------------|-----------|----------------------------------|------------------|-----------------------|-------------------------------------------------------------------------------------------------------------------------| +|`FiFo` | Yes | Yes | Yes | 1:1 | Yes | Copyable | FIFO Data transfer | +|`LockfreeQueue` | Yes | Yes | Yes | n:m | Yes | Copyable or Movable | lock-free transfer of arbitrary data between multiple contexts in FIFO order with overflow handling (ringbuffer) | +|`LoFFLi` | Yes | Yes | Yes | n:m | Yes | int32 | manage memory access, LIFO order | +|`smart_lock` | Yes | Yes | No | n/a | n/a | None | Wrapper to make classes thread-safe (by using a lock) | +|`SoFi` | Yes | Yes | Yes | 1:1 | Yes | Trivially Copyable | lock-free transfer of small data (e.g. pointers) between two contexts in FIFO order with overflow handling (ringbuffer) | +|`ResizeableLockFreeQueue` | Yes | Yes | Yes | n:m | Yes | Copyable or Movable | Resizeable variant of the `LockfreeQueue` | ### Design pattern -| class | internal | maybe obsolete | description | -|:-------------------:|:--------:|:--------------:|:------------| -|`Creation` | | X | When implementing resource handling classes which follow the RAII idiom we may have to throw exceptions inside the constructor. As an alternative to exceptions we have the creation pattern, a specialized factory which returns the object inside of an `expected`. | +| class | internal | description | +|:-------------------:|:--------:|:--------------------------------------------------------------------| +|`Builder` | | Macro which generates a setter method useful for a builder pattern. | ### Error handling @@ -126,35 +117,35 @@ The error handler is a central instance for collecting all errors and react to t For information about how to use the logger API see [error-handling.md](../doc/design/error-handling.md) -| class | internal | maybe obsolete | description | -|:-----------------------:|:--------:|:--------------:|:------------| -|`logger` | | | | +| class | internal | description | +|:-----------------------:|:--------:|:------------| +|`logger` | | | ### POSIX wrapper We abstract POSIX resources following the RAII idiom and by using our [Creation](#design-pattern) pattern. Try to exclusively use these abstractions or add a new one when using POSIX resources like semaphores, shared memory, etc. -| class | internal | maybe obsolete | description | -|:-------------------:|:--------:|:--------------:|:------------| -|`AccessController` | i | | Interface for Access Control Lists (ACL). | -|`FileLock` | | | File lock C++ wrapping class. | -|`NamedPipe` | | | Shared memory based ipc channel. Mainly a `UnixDomainSocket` replacement on Windows. | -|`IpcChannel` | i | | Helper types used by the `MessageQueue`and the `UnixDomainSocket`. | -|`MessageQueue` | i | | Interface for Message Queues, see [ManPage mq_overview](https://www.man7.org/linux/man-pages/man7/mq_overview.7.html). | -|`mutex` | i | | Mutex interface, see [ManPage pthread_mutex_lock](https://man7.org/linux/man-pages/man3/pthread_mutex_lock.3p.html). | -|`posix_access_rights` | | | Rights and user management interface. | -|`posixCall` | | | Wrapper around C and POSIX function calls which performs a full error handling. Additionally, this wrapper makes sure that `EINTR` handling is performed correctly by repeating the system call. | -|`SignalGuard` | | | Helper class for signal handler registration. | -|`SignalWatcher` | | | Batteries included signal handling with polling and optional blocking wait for `SIGINT` and `SIGTERM`. | -|`Semaphore` | | | Semaphore interface, see [ManPage sem_overview](https://man7.org/linux/man-pages/man7/sem_overview.7.html) | -|`shared_memory_object/Allocator` | i | | Helper class for the `SharedMemoryObject`. | -|`shared_memory_object/MemoryMap` | i | | Abstraction of `mmap`, `munmap` and helper class for the `SharedMemoryObject`.| -|`shared_memory_object/SharedMemory` | i | | Abstraction of shared memory, see [ManPage shm_overview](https://www.man7.org/linux/man-pages/man7/shm_overview.7.html) and helper class for the `SharedMemoryObject`. | -|`SharedMemoryObject` | i | | Creates and maps existing shared memory into the application. | -|`system_configuration` | i | | Collection of free functions which acquire system information like the page-size. | -|`thread` | | | Wrapper for pthread functions like `pthread_setname_np`. | -|`UnixDomainSocket` | i | | Interface for unix domain sockets. | +| class | internal | description | +|:----------------------------------:|:--------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +|`AccessController` | i | Interface for Access Control Lists (ACL). | +|`FileLock` | | File lock C++ wrapping class. | +|`NamedPipe` | | Shared memory based ipc channel. Mainly a `UnixDomainSocket` replacement on Windows. | +|`IpcChannel` | i | Helper types used by the `MessageQueue`and the `UnixDomainSocket`. | +|`MessageQueue` | i | Interface for Message Queues, see [ManPage mq_overview](https://www.man7.org/linux/man-pages/man7/mq_overview.7.html). | +|`mutex` | i | Mutex interface, see [ManPage pthread_mutex_lock](https://man7.org/linux/man-pages/man3/pthread_mutex_lock.3p.html). | +|`posix_access_rights` | | Rights and user management interface. | +|`posixCall` | | Wrapper around C and POSIX function calls which performs a full error handling. Additionally, this wrapper makes sure that `EINTR` handling is performed correctly by repeating the system call. | +|`SignalGuard` | | Helper class for signal handler registration. | +|`SignalWatcher` | | Batteries included signal handling with polling and optional blocking wait for `SIGINT` and `SIGTERM`. | +|`Semaphore` | | Semaphore interface, see [ManPage sem_overview](https://man7.org/linux/man-pages/man7/sem_overview.7.html) | +|`shared_memory_object/Allocator` | i | Helper class for the `SharedMemoryObject`. | +|`shared_memory_object/MemoryMap` | i | Abstraction of `mmap`, `munmap` and helper class for the `SharedMemoryObject`. | +|`shared_memory_object/SharedMemory` | i | Abstraction of shared memory, see [ManPage shm_overview](https://www.man7.org/linux/man-pages/man7/shm_overview.7.html) and helper class for the `SharedMemoryObject`. | +|`SharedMemoryObject` | i | Creates and maps existing shared memory into the application. | +|`system_configuration` | i | Collection of free functions which acquire system information like the page-size. | +|`thread` | | Wrapper for pthread functions like `pthread_setname_np`. | +|`UnixDomainSocket` | i | Interface for unix domain sockets. | ### Units @@ -162,23 +153,21 @@ Never use physical properties like speed or time directly as integer or float in Otherwise you encounter problems like this function `void setTimeout(int timeout)`. What is the unit of the argument, seconds? minutes? If you use `Duration` you see it directly in the code. ```cpp - void setTimeout(const Duration & timeout); setTimeout(11_s); // 11 seconds setTimeout(5_ms); // 5 milliseconds - ``` -| class | internal | maybe obsolete | description | -|:-------------------:|:--------:|:--------------:|:------------| -|`Duration` | i | | Represents the unit time, is convertible to `timespec` and `timeval`. User defined literals are available for convenience and readability. | +| class | internal | description | +|:-------------------:|:--------:|:--------------------------------------------------------------------------------------------------------------------------------------------| +|`Duration` | i | Represents the unit time, is convertible to `timespec` and `timeval`. User defined literals are available for convenience and readability. | ### objectpool -| class | internal | maybe obsolete | description | -|:---------------------:|:--------:|:--------------:|:------------| -|`ObjectPool` | i | | Container which stores raw objects without calling the ctor of the objects. | +| class | internal | description | +|:---------------------:|:--------:|:---------------------------------------------------------| +|`ObjectPool` | i | | Container which stores raw objects without calling the ctor of the objects. | ### graphs diff --git a/iceoryx_hoofs/include/iceoryx_hoofs/cxx/poor_mans_heap.hpp b/iceoryx_hoofs/include/iceoryx_hoofs/cxx/poor_mans_heap.hpp deleted file mode 100644 index 202cea6d4a..0000000000 --- a/iceoryx_hoofs/include/iceoryx_hoofs/cxx/poor_mans_heap.hpp +++ /dev/null @@ -1,170 +0,0 @@ -// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved. -// Copyright (c) 2021 by Apex.AI Inc. All rights reserved. -// -// 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. -// -// SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_HOOFS_CXX_POOR_MANS_HEAP_HPP -#define IOX_HOOFS_CXX_POOR_MANS_HEAP_HPP - -#include -#include -#include - -namespace iox -{ -namespace cxx -{ -/// This is a proxy which must be used for the non default PoorMansHeap ctor -template -class PoorMansHeapType -{ -}; - -constexpr uint64_t POOR_MANS_HEAP_DEFAULT_ALIGNMENT{8}; - -/// @brief Reserves space on stack for placement new instatiation -/// @param Interface base type of all classes which should be stored in here -/// @param TypeSize maximum size of a child of Interface -/// @param TypeAlignment alignment which is required for the types -/// -/// @code -/// #include "iceoryx_hoofs/cxx/poor_mans_heap.hpp" -/// -/// #include "iceoryx_hoofs/cxx/helplets.hpp" -/// -/// #include -/// -/// class Base -/// { -/// public: -/// virtual ~Base() = default; -/// virtual void doStuff() = 0; -/// }; -/// -/// class Foo : public Base -/// { -/// public: -/// Foo(int stuff) -/// : m_stuff(stuff) -/// { -/// } -/// -/// void doStuff() override -/// { -/// std::cout << __PRETTY_FUNCTION__ << ": " << m_stuff << std::endl; -/// } -/// -/// private: -/// int m_stuff; -/// }; -/// -/// class Bar : public Base -/// { -/// public: -/// void doStuff() override -/// { -/// std::cout << __PRETTY_FUNCTION__ << std::endl; -/// } -/// }; -/// -/// int main() -/// { -/// constexpr auto MaxSize = cxx::maxSize(); -/// constexpr auto MaxAlignment = cxx::maxAlignment(); -/// -/// using FooBar = cxx::PoorMansHeap; -/// -/// FooBar fooBar1{cxx::PoorMansHeapType(), 42}; -/// fooBar1->doStuff(); -/// -/// fooBar1.newInstance(); -/// fooBar1->doStuff(); -/// -/// fooBar1.newInstance(13); -/// fooBar1->doStuff(); -/// -/// FooBar fooBar2; -/// if (!fooBar2.hasInstance()) -/// { -/// std::cout << "There is no instance!" << std::endl; -/// } -/// -/// fooBar2.newInstance(); -/// fooBar2->doStuff(); -/// -/// fooBar2.deleteInstance(); -/// if (!fooBar2.hasInstance()) -/// { -/// std::cout << "There is again no instance!" << std::endl; -/// } -/// -/// return 0; -/// } -/// @endcode -/// @NOLINTJUSTIFICATION it is guaranteed that the memory is initialized on access -template -class PoorMansHeap // NOLINT (cppcoreguidelines-pro-type-member-init,hicpp-member-init) -{ - public: - PoorMansHeap() = default; - ~PoorMansHeap() noexcept; - - /// Constructor for immediate construction of an instance - /// @param [in] Type the type to instantiate, wrapped in PoorMansHeapType - /// @param [in] ctorArgs ctor arguments for the type to instantiate - template - // 'PoorMansHeapType' is a compile time variable to recognize the used type - // NOLINTNEXTLINE(hicpp-named-parameter, readability-named-parameter) - explicit PoorMansHeap(PoorMansHeapType, CTorArgs&&... ctorArgs) noexcept; - - PoorMansHeap(PoorMansHeap&& other) = delete; - PoorMansHeap& operator=(PoorMansHeap&& rhs) = delete; - - PoorMansHeap(const PoorMansHeap&) = delete; - PoorMansHeap& operator=(const PoorMansHeap&) = delete; - - /// Create a new instance of the Type - /// @param [in] Type the type to instantiate, wrapped in PoorMansHeapType - /// @param [in] ctorArgs ctor arguments for the type to instantiate - template - void newInstance(CTorArgs&&... ctorArgs) noexcept; - - /// Calls the destructor if there is a valid instance, otherwise nothing happens - void deleteInstance() noexcept; - - /// Checks is there is a valid instance - /// @return true if there is a valid instance - bool hasInstance() const noexcept; - - /// Returns a pointer to the underlying instance - /// @return pointer to the underlying instance or nullptr if there is no valid instance - Interface* operator->() const noexcept; - - /// Returns a reference to the underlying instance. If there is no valid instance, the behaviour is undefined - /// @return reference to the underlying instance - Interface& operator*() const noexcept; - - private: - Interface* m_instance{nullptr}; - // safe access is guaranteed since the array is wrapped inside the PoorMansHeap - // NOLINTNEXTLINE(hicpp-avoid-c-arrays, cppcoreguidelines-avoid-c-arrays) - alignas(TypeAlignment) uint8_t m_heap[TypeSize]; -}; - -} // namespace cxx -} // namespace iox - -#include "iceoryx_hoofs/internal/cxx/poor_mans_heap.inl" - -#endif // IOX_HOOFS_CXX_POOR_MANS_HEAP_HPP diff --git a/iceoryx_hoofs/include/iceoryx_hoofs/internal/concurrent/active_object.hpp b/iceoryx_hoofs/include/iceoryx_hoofs/internal/concurrent/active_object.hpp deleted file mode 100644 index 6c864cb3e3..0000000000 --- a/iceoryx_hoofs/include/iceoryx_hoofs/internal/concurrent/active_object.hpp +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved. -// Copyright (c) 2021 by Apex.AI Inc. All rights reserved. -// -// 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. -// -// SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_HOOFS_CONCURRENT_ACTIVE_OBJECT_HPP -#define IOX_HOOFS_CONCURRENT_ACTIVE_OBJECT_HPP - -#include - -#include "iceoryx_hoofs/cxx/function.hpp" -#include "iceoryx_hoofs/internal/concurrent/fifo.hpp" -#include "iceoryx_hoofs/internal/concurrent/trigger_queue.hpp" - -namespace iox -{ -namespace concurrent -{ -class ActiveObject -{ - protected: - ActiveObject() noexcept; - virtual ~ActiveObject() noexcept; - void addTask(const cxx::function& f) noexcept; - void mainLoop() noexcept; - void stopRunning() noexcept; - - friend class cxx::optional; - - private: - static constexpr uint32_t taskQueueSize = 128; - using taskQueue_t = concurrent::TriggerQueue, taskQueueSize, concurrent::FiFo>; - - taskQueue_t m_tasks; - - bool m_keepRunning{true}; - std::thread m_mainLoopThread; -}; -} // namespace concurrent -} // namespace iox - -#endif // IOX_HOOFS_CONCURRENT_ACTIVE_OBJECT_HPP diff --git a/iceoryx_hoofs/include/iceoryx_hoofs/internal/concurrent/taco.hpp b/iceoryx_hoofs/include/iceoryx_hoofs/internal/concurrent/taco.hpp deleted file mode 100644 index 2b043b6dff..0000000000 --- a/iceoryx_hoofs/include/iceoryx_hoofs/internal/concurrent/taco.hpp +++ /dev/null @@ -1,181 +0,0 @@ -// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved. -// Copyright (c) 2021 by Apex.AI Inc. All rights reserved. -// -// 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. -// -// SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_HOOFS_CONCURRENT_TACO_HPP -#define IOX_HOOFS_CONCURRENT_TACO_HPP - -#include "iceoryx_hoofs/cxx/helplets.hpp" -#include "iceoryx_hoofs/cxx/optional.hpp" - -#include -#include - -namespace iox -{ -namespace concurrent -{ -/// Defines how the TACO works with data reads from the same context -enum class TACOMode -{ - /// Accept data reads from the same context as data write - AccecptDataFromSameContext, - /// Deny data reads from the same context as data write - DenyDataFromSameContext -}; - -constexpr uint32_t DEFAULT_MAX_NUMBER_OF_CONTEXT = 500; - -/// @brief -/// TACO is an acronym for Thread Aware exChange Ownership. -/// Exchanging data between thread needs some synchonization mechanism. -/// This can be done with a mutex or atomics. If the data structure is larger -/// than 64 bit or if more than one value need to be accessed in a synchronized -/// manner, a mutex would be the only option. -/// The TACO is a wait-free alternative to the mutex. Data can be exchanged -/// between threads. The TACO is like a SoFi with one element, but with the -/// possibility to read/write from multiple threads. -/// -/// @param T DataType to be stored -/// @param Context Enum class with all the thread context that access the TACO. -/// The enum must start with 0, must have ascending values and -/// the last value must be called END_OF_LIST. -/// -/// @code -/// #include "iceoryx_hoofs/internal/concurrent/taco.hpp" -/// -/// #include -/// #include -/// #include -/// -/// constexpr std::uint64_t TotalCount{1000000}; -/// struct SyncedData -/// { -/// std::uint64_t decrementCounter{TotalCount}; -/// std::uint64_t incrementCounter{0}; -/// }; -/// -/// enum class ThreadContext : uint32_t -/// { -/// Hardy, -/// Laurel, -/// END_OF_LIST -/// }; -/// -/// int main() -/// { -/// concurrent::TACO taco(concurrent::TACOMode::DenyDataFromSameContext); -/// constexpr auto producerContext {ThreadContext::Hardy}; -/// constexpr auto consumerContext {ThreadContext::Laurel}; -/// -/// auto producer = std::thread([&] { -/// SyncedData data; -/// while (data.decrementCounter != 0) -/// { -/// data.decrementCounter--; -/// data.incrementCounter++; -/// taco.store(data, producerContext); -/// } -/// }); -/// auto consumer = std::thread([&] { -/// SyncedData data; -/// do -/// { -/// auto retVal = taco.take(consumerContext); -/// if (retVal.has_value()) -/// { -/// data = *retVal; -/// if(data.decrementCounter + data.incrementCounter != TotalCount) -/// { -/// std::cout << "Error! Counter not synchronized!" << std::endl; -/// } -/// } -/// -/// } while (data.decrementCounter != 0); -/// }); -/// -/// producer.join(); -/// consumer.join(); -/// -/// std::cout << "Finished!" << std::endl; -/// -/// return 0; -/// } -/// @endcode -template -class TACO -{ - public: - /// Create a TACO instance with the specified mode - /// @param [in] mode the TACO operates - explicit TACO(TACOMode mode) noexcept; - - TACO(const TACO&) = delete; - TACO(TACO&&) = delete; - TACO& operator=(const TACO&) = delete; - TACO& operator=(TACO&&) = delete; - - ~TACO() noexcept = default; - - /// Takes the data from the TACO and supplies new data - /// @param [in] data to supply for consumption, it's copied into a local cache in the TACO - /// @param [in] context of the thread which performs the exchange - /// @return the data a previous operation supplied for consumption or nullopt_t if there was either no data or the - /// data was supplied from the same context and the mode disallows data from the same context - cxx::optional exchange(const T& data, Context context) noexcept; - - /// Takes the data which is ready for consumption. The data isn't available for other access anymore. - /// @param [in] context of the thread which takes the data - /// @return the data a previous operation supplied for consumption or nullopt_t if there was either no data or the - /// data was supplied from the same context and the mode disallows data from the same context - cxx::optional take(const Context context) noexcept; - - /// Supplies data for consumption - /// @param [in] data to supply for consumption, it's copied into a local cache in the TACO - /// @param [in] context of the thread which performs the exchange - void store(const T& data, const Context context) noexcept; - - private: - cxx::optional exchange(const Context context) noexcept; - - private: - struct Transaction - { - Context context{Context::END_OF_LIST}; - cxx::optional data; - }; - - TACOMode m_mode{TACOMode::DenyDataFromSameContext}; - // this is the index of the transaction currently available for consumption - std::atomic m_pendingTransaction; - - static constexpr uint32_t NumberOfContext = static_cast(Context::END_OF_LIST); - - // NOLINTBEGIN(hicpp-avoid-c-arrays, cppcoreguidelines-avoid-c-arrays) - // the corresponding transaction indices for the thread context; - // the value of m_indices[Context] contains the index of the m_transactions array which is owned by the context - // so it's save to access m_transactions[m_indices[Context]] - uint32_t m_indices[NumberOfContext]{0}; - // this is a local buffer for the transaction, one for each thread that might access the TACO - // and there needs to be one more element which is the one ready for consumption - Transaction m_transactions[NumberOfContext + 1]; - // NOLINTEND(hicpp-avoid-c-arrays, cppcoreguidelines-avoid-c-arrays) -}; -} // namespace concurrent -} // namespace iox - -#include "iceoryx_hoofs/internal/concurrent/taco.inl" - -#endif // IOX_HOOFS_CONCURRENT_TACO_HPP diff --git a/iceoryx_hoofs/include/iceoryx_hoofs/internal/concurrent/taco.inl b/iceoryx_hoofs/include/iceoryx_hoofs/internal/concurrent/taco.inl deleted file mode 100644 index 82b60f1328..0000000000 --- a/iceoryx_hoofs/include/iceoryx_hoofs/internal/concurrent/taco.inl +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved. -// Copyright (c) 2021 by Apex.AI Inc. All rights reserved. -// -// 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. -// -// SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_HOOFS_CONCURRENT_TACO_INL -#define IOX_HOOFS_CONCURRENT_TACO_INL - -#include "iceoryx_hoofs/internal/concurrent/taco.hpp" - -namespace iox -{ -namespace concurrent -{ -template -inline TACO::TACO(TACOMode mode) noexcept - : m_mode(mode) - , m_pendingTransaction(NumberOfContext) -{ - static_assert(std::is_enum::value, "TACO Context must be an enum class!"); - static_assert(!std::is_convertible::value, - "TACO Context must be an enum class, not just an enum!"); - static_assert(std::is_same::type>::value, - "TACO Context underlying type must be uint32_t!"); - static_assert(static_cast(Context::END_OF_LIST) < MaxNumberOfContext, - "TACO exceeded max number of contexts!"); - - // initially assign the indices to the corresponding contexts - uint32_t i = 0; - for (auto& index : m_indices) - { - index = i; - i++; - } -} - -template -inline cxx::optional TACO::exchange(const T& data, Context context) noexcept -{ - cxx::Expects(context < Context::END_OF_LIST); - m_transactions[m_indices[static_cast(context)]].data.emplace(data); - return exchange(context); -} - -template -inline cxx::optional TACO::take(const Context context) noexcept -{ - cxx::Expects(context < Context::END_OF_LIST); - // there is no need to set the transaction for the corresponding context to nullopt_t, the exchange function - // either moves the data, which leaves a nullopt_t or resets the data, which also results in a nullopt_t - return exchange(context); -} - -template -inline void TACO::store(const T& data, const Context context) noexcept -{ - cxx::Expects(context < Context::END_OF_LIST); - exchange(data, context); -} - -template -inline cxx::optional TACO::exchange(const Context context) noexcept -{ - auto contextIndex = static_cast(context); - auto transactionIndexOld = m_indices[contextIndex]; - m_transactions[transactionIndexOld].context = context; - - m_indices[contextIndex] = m_pendingTransaction.exchange(transactionIndexOld, std::memory_order_acq_rel); - auto transactionIndexNew = m_indices[contextIndex]; - - if (m_mode == TACOMode::AccecptDataFromSameContext || m_transactions[transactionIndexNew].context != context) - { - return std::move(m_transactions[transactionIndexNew].data); - } - - m_transactions[transactionIndexNew].data.reset(); - return cxx::nullopt_t(); -} -} // namespace concurrent -} // namespace iox - -#endif // IOX_HOOFS_CONCURRENT_TACO_INL diff --git a/iceoryx_hoofs/include/iceoryx_hoofs/internal/concurrent/trigger_queue.hpp b/iceoryx_hoofs/include/iceoryx_hoofs/internal/concurrent/trigger_queue.hpp deleted file mode 100644 index e8e4daf0d1..0000000000 --- a/iceoryx_hoofs/include/iceoryx_hoofs/internal/concurrent/trigger_queue.hpp +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved. -// Copyright (c) 2021 by Apex.AI Inc. All rights reserved. -// -// 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. -// -// SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_HOOFS_CONCURRENT_TRIGGER_QUEUE_HPP -#define IOX_HOOFS_CONCURRENT_TRIGGER_QUEUE_HPP - -#include "iceoryx_hoofs/cxx/optional.hpp" - -#include -#include -#include - -namespace iox -{ -namespace concurrent -{ -template -class LockFreeQueue; -template -class ResizeableLockFreeQueue; - -template class Queue> -struct QueueAdapter -{ - static bool push(Queue& queue, const T& in) noexcept; -}; - -template -struct QueueAdapter -{ - static bool push(LockFreeQueue& queue, const T& in) noexcept; -}; - -template -struct QueueAdapter -{ - static bool push(ResizeableLockFreeQueue& queue, const T& in) noexcept; -}; - - -/// @brief TriggerQueue is behaves exactly like a normal queue (fifo) except that -/// this queue is threadsafe and offers a blocking push which blocks the -/// the caller until the queue has space for at least one element which can -/// be pushed -template class QueueType> -class TriggerQueue -{ - public: - using ValueType = T; - static constexpr uint64_t CAPACITY = Capacity; - - /// @brief Pushs an element into the trigger queue. - /// If the queue is full it blocks until there is space again. - /// If in the meantime destroy() was called the block is released and - /// push returns false. - bool push(const T& in) noexcept; - - /// @brief If the queue already contains an element it writes the contents - /// of that element in out and returns true, otherwise false. - /// @return if an element could be removed the optional contains it, otherwise when the queue is empty - /// the optional is empty - cxx::optional pop() noexcept; - - /// @brief Returns true if the queue is empty, otherwise false. - bool empty() const noexcept; - - /// @brief Returns the number of elements which are currently in the queue. - uint64_t size() const noexcept; - - /// @brief Returns the capacity of the trigger queue. - static constexpr uint64_t capacity() noexcept; - - /// @brief when someone is waiting in push since the queue is full it - /// unblocks push. after that call it is impossible to push - /// elements. - void destroy() noexcept; - - /// @brief resizes the queue. - /// @return true if resize was successful otherwise false - bool setCapacity(const uint64_t capacity) noexcept; - - private: - QueueType m_queue; - std::atomic_bool m_toBeDestroyed{false}; -}; -} // namespace concurrent -} // namespace iox - -#include "iceoryx_hoofs/internal/concurrent/trigger_queue.inl" - -#endif // IOX_HOOFS_CONCURRENT_TRIGGER_QUEUE_HPP diff --git a/iceoryx_hoofs/include/iceoryx_hoofs/internal/concurrent/trigger_queue.inl b/iceoryx_hoofs/include/iceoryx_hoofs/internal/concurrent/trigger_queue.inl deleted file mode 100644 index bb47e61531..0000000000 --- a/iceoryx_hoofs/include/iceoryx_hoofs/internal/concurrent/trigger_queue.inl +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved. -// Copyright (c) 2021 by Apex.AI Inc. All rights reserved. -// -// 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. -// -// SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_HOOFS_CONCURRENT_TRIGGER_QUEUE_INL -#define IOX_HOOFS_CONCURRENT_TRIGGER_QUEUE_INL - -#include "iceoryx_hoofs/internal/concurrent/trigger_queue.hpp" - -namespace iox -{ -namespace concurrent -{ -template class Queue> -inline bool QueueAdapter::push(Queue& queue, const T& in) noexcept -{ - return queue.push(in); -} - -template -inline bool QueueAdapter::push(LockFreeQueue& queue, const T& in) noexcept -{ - return queue.tryPush(in); -} - -template -inline bool QueueAdapter::push(ResizeableLockFreeQueue& queue, - const T& in) noexcept -{ - return queue.tryPush(in); -} - -template class QueueType> -inline bool TriggerQueue::push(const T& in) noexcept -{ - while (!m_toBeDestroyed.load(std::memory_order_relaxed) && !QueueAdapter::push(m_queue, in)) - { - std::this_thread::yield(); - } - - return !m_toBeDestroyed.load(std::memory_order_relaxed); -} - -template class QueueType> -inline cxx::optional TriggerQueue::pop() noexcept -{ - return m_queue.pop(); -} - -template class QueueType> -inline bool TriggerQueue::empty() const noexcept -{ - return m_queue.empty(); -} - -template class QueueType> -inline uint64_t TriggerQueue::size() const noexcept -{ - return m_queue.size(); -} - -template class QueueType> -inline constexpr uint64_t TriggerQueue::capacity() noexcept -{ - return Capacity; -} - -template class QueueType> -inline void TriggerQueue::destroy() noexcept -{ - m_toBeDestroyed.store(true, std::memory_order_relaxed); -} - -template class QueueType> -inline bool TriggerQueue::setCapacity(const uint64_t capacity) noexcept -{ - return m_queue.setCapacity(capacity); -} - - -} // namespace concurrent -} // namespace iox - -#endif // IOX_HOOFS_CONCURRENT_TRIGGER_QUEUE_INL diff --git a/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/pair.hpp b/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/pair.hpp deleted file mode 100644 index 500cf8eb06..0000000000 --- a/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/pair.hpp +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved. -// Copyright (c) 2021 by Apex.AI Inc. All rights reserved. -// -// 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. -// -// SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_HOOFS_CXX_PAIR_HPP -#define IOX_HOOFS_CXX_PAIR_HPP - -namespace iox -{ -namespace cxx -{ -template -struct pair -{ - using first_type = FirstType; - using second_type = SecondType; - first_type first; - second_type second; -}; -} // namespace cxx -} // namespace iox - -#endif // IOX_HOOFS_CXX_PAIR_HPP diff --git a/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/poor_mans_heap.inl b/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/poor_mans_heap.inl deleted file mode 100644 index de4ecfcb31..0000000000 --- a/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/poor_mans_heap.inl +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved. -// Copyright (c) 2021 by Apex.AI Inc. All rights reserved. -// -// 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. -// -// SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_HOOFS_CXX_POOR_MANS_HEAP_INL -#define IOX_HOOFS_CXX_POOR_MANS_HEAP_INL - -#include "iceoryx_hoofs/cxx/poor_mans_heap.hpp" - -#include -#include -#include - -namespace iox -{ -namespace cxx -{ -template -PoorMansHeap::~PoorMansHeap() noexcept -{ - deleteInstance(); -} - -// NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init,hicpp-member-init) justification in header -template -template -// NOLINTNEXTLINE(hicpp-named-parameter, readability-named-parameter) justification in header -PoorMansHeap::PoorMansHeap(PoorMansHeapType, CTorArgs&&... ctorArgs) noexcept -{ - newInstance(std::forward(ctorArgs)...); -} - -template -template -void PoorMansHeap::newInstance(CTorArgs&&... ctorArgs) noexcept -{ - static_assert(TypeAlignment >= alignof(Type), "Alignment missmatch! No safe instantiation of Type possible!"); - static_assert(TypeSize >= sizeof(Type), "Size missmatch! Not enough space to instantiate Type!"); - - deleteInstance(); - - // the PoorMansHeap acts as a fancy pointer and takes the memory ownership - // NOLINTNEXTLINE(cppcoreguidelines-owning-memory) - m_instance = new (m_heap) Type(std::forward(ctorArgs)...); -} - -template -void PoorMansHeap::deleteInstance() noexcept -{ - if (m_instance != nullptr) - { - m_instance->~Interface(); - m_instance = nullptr; - } -} - -template -bool PoorMansHeap::hasInstance() const noexcept -{ - return m_instance != nullptr; -} - -template -Interface* PoorMansHeap::operator->() const noexcept -{ - return m_instance; -} - -template -Interface& PoorMansHeap::operator*() const noexcept -{ - return *m_instance; -} - -} // namespace cxx -} // namespace iox - -#endif // IOX_HOOFS_CXX_POOR_MANS_HEAP_INL diff --git a/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/reference_counter.hpp b/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/reference_counter.hpp deleted file mode 100644 index 9edda5968a..0000000000 --- a/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/reference_counter.hpp +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved. -// Copyright (c) 2021 by Apex.AI Inc. All rights reserved. -// -// 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. -// -// SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_HOOFS_CXX_REFERENCE_COUNTER_HPP -#define IOX_HOOFS_CXX_REFERENCE_COUNTER_HPP - -namespace iox -{ -namespace cxx -{ -/// @brief reference counter abstraction for the usage in constructs like a -/// shared_ptr. A pointer to a memory position where the reference -/// counter is stored is put into the constructor and then this object -/// performs reference counting on it. -template -class ReferenceCounter -{ - public: - /// @brief increments f_referenceCounter if f_referenceCounter != nullptr - /// @param[in] referenceCounter pointer to the underlying number where the reference count is stored - explicit ReferenceCounter(T* const referenceCounter) noexcept; - - /// @brief copy constructor, increments the rhs managed reference counter if it is != nullptr - ReferenceCounter(const ReferenceCounter& rhs) noexcept; - - /// @brief move constructor, takes over the f_rhs managed reference counter - ReferenceCounter(ReferenceCounter&& f_rhs) noexcept; - - /// @brief decrements f_referenceCounter if f_referenceCounter != nullptr - ~ReferenceCounter() noexcept; - - /// @brief copy assignment, increments the rhs managed reference counter if it is != nullptr - ReferenceCounter& operator=(const ReferenceCounter& rhs) noexcept; - - /// @brief move assignment - ReferenceCounter& operator=(ReferenceCounter&& rhs) noexcept; - - /// @brief returns the current value of the reference counter - T getValue() const noexcept; - - private: - void incrementReferenceCounter() noexcept; - void decrementReferenceCounter() noexcept; - - private: - T* m_referenceCounter; -}; -} // namespace cxx -} // namespace iox - -#include "iceoryx_hoofs/internal/cxx/reference_counter.inl" - -#endif // IOX_HOOFS_CXX_REFERENCE_COUNTER_HPP diff --git a/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/reference_counter.inl b/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/reference_counter.inl deleted file mode 100644 index fde3286b71..0000000000 --- a/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/reference_counter.inl +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved. -// Copyright (c) 2021 by Apex.AI Inc. All rights reserved. -// -// 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. -// -// SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_HOOFS_CXX_REFERENCE_COUNTER_INL -#define IOX_HOOFS_CXX_REFERENCE_COUNTER_INL - -#include "iceoryx_hoofs/internal/cxx/reference_counter.hpp" - -namespace iox -{ -namespace cxx -{ -template -inline ReferenceCounter::ReferenceCounter(T* const referenceCounter) noexcept - : m_referenceCounter(referenceCounter) -{ - incrementReferenceCounter(); -} - -template -inline ReferenceCounter::ReferenceCounter(const ReferenceCounter& rhs) noexcept - : m_referenceCounter(rhs.m_referenceCounter) -{ - incrementReferenceCounter(); -} - -template -inline ReferenceCounter::ReferenceCounter(ReferenceCounter&& rhs) noexcept - : m_referenceCounter(rhs.m_referenceCounter) -{ - rhs.m_referenceCounter = nullptr; -} - -template -inline ReferenceCounter::~ReferenceCounter() noexcept -{ - decrementReferenceCounter(); -} - -template -inline ReferenceCounter& ReferenceCounter::operator=(const ReferenceCounter& rhs) noexcept -{ - if (this != &rhs) - { - decrementReferenceCounter(); - m_referenceCounter = rhs.m_referenceCounter; - incrementReferenceCounter(); - } - return *this; -} - -template -inline ReferenceCounter& ReferenceCounter::operator=(ReferenceCounter&& rhs) noexcept -{ - if (this != &rhs) - { - decrementReferenceCounter(); - m_referenceCounter = rhs.m_referenceCounter; - rhs.m_referenceCounter = nullptr; - } - return *this; -} - -template -inline T ReferenceCounter::getValue() const noexcept -{ - return *m_referenceCounter; -} - -template -inline void ReferenceCounter::incrementReferenceCounter() noexcept -{ - if (m_referenceCounter != nullptr) - { - (*m_referenceCounter)++; - } -} - -template -inline void ReferenceCounter::decrementReferenceCounter() noexcept -{ - if (m_referenceCounter != nullptr) - { - (*m_referenceCounter)--; - } -} -} // namespace cxx -} // namespace iox - -#endif // IOX_HOOFS_CXX_REFERENCE_COUNTER_INL diff --git a/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/set.hpp b/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/set.hpp deleted file mode 100644 index 14879325d3..0000000000 --- a/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/set.hpp +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved. -// Copyright (c) 2021 by Apex.AI Inc. All rights reserved. -// -// 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. -// -// SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_HOOFS_CXX_SET_HPP -#define IOX_HOOFS_CXX_SET_HPP - -#include - -namespace iox -{ -namespace cxx -{ -namespace set -{ -/// Adds entry to a container with set semantics. The entry type must provide operator==. -/// If the entry already exists it is not added. -/// @param [in] container container to be added to -/// @param [in] entry element to be added -template -void add(Container& container, const Type& entry) noexcept -{ - auto iter = std::find(container.begin(), container.end(), entry); - if (iter == container.end()) - { - container.push_back(entry); - } -} - -/// Removes entry from a container if it exists. The entry type must provide operator==. -/// @param [in] container container to be removed from -/// @param [in] entry element to be removed -template -void remove(Container& container, const Type& entry) noexcept -{ - auto iter = std::find(container.begin(), container.end(), entry); - if (iter != container.end()) - { - container.erase(iter); - } -} - -/// Checks whether a container contains some specified entry. The entry type must provide operator==. -/// @param [in] container container to check -/// @param [in] entry element whose existence is checked -/// @return true if the container contains entry, false otherwise -template -bool hasElement(Container& container, const Type& entry) noexcept -{ - auto iter = std::find(container.begin(), container.end(), entry); - return iter != container.end(); -} - -/// union of set1 and set2, set1 is the union after the operation and returned as result -/// @param [in] set1 first set operand for union operation, also holds the union result after operation -/// @param [in] set2 second set operand for union operation -/// @return reference to the union of both sets stored in set1 -template -Container& unify(Container& set1, const Container& set2) noexcept -{ - for (auto& element : set2) - { - add(set1, element); - } - return set1; -} - -} // namespace set -} // namespace cxx -} // namespace iox - -#endif // IOX_HOOFS_CXX_SET_HPP diff --git a/iceoryx_hoofs/include/iceoryx_hoofs/internal/graphs/directed_acyclic_graph.hpp b/iceoryx_hoofs/include/iceoryx_hoofs/internal/graphs/directed_acyclic_graph.hpp deleted file mode 100644 index 5a710db526..0000000000 --- a/iceoryx_hoofs/include/iceoryx_hoofs/internal/graphs/directed_acyclic_graph.hpp +++ /dev/null @@ -1,145 +0,0 @@ -// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved. -// Copyright (c) 2021 by Apex.AI Inc. All rights reserved. -// -// 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. -// -// SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_HOOFS_GRAPHS_DIRECTED_ACYCLIC_GRAPH_HPP -#define IOX_HOOFS_GRAPHS_DIRECTED_ACYCLIC_GRAPH_HPP - -#include "iceoryx_hoofs/internal/cxx/set.hpp" -#include "iceoryx_hoofs/internal/graphs/directed_graph.hpp" -#include - -#include - -/// same functionality as its parent class DirectedGraph, except that adding edges that close a cycle -/// is impossible now (this incurs a checking overhead of course) -template -class DirectedAcyclicGraph : public DirectedGraph -{ - private: - using base_type = DirectedGraph; - - public: - using Index_t = typename base_type::Index_t; - - DirectedAcyclicGraph() - { - init(); - } - - /// add an edge between fromVertex and toVertex to the graph - /// @param [in] fromVertex - /// @param [in] toVertex - /// @return pointer true if the edge was added successfully, false otherwise - /// (e.g. it would create a cycle) - virtual bool addEdge(VertexType* fromVertex, VertexType* toVertex) - { - auto from = this->findVertex(fromVertex); - auto to = this->findVertex(toVertex); - if (from < 0 || to < 0 || from == to) - { - return false; // need to add vertices first or there would be a self loop - } - - if (createsCycle(from, to)) - { - return false; // new edge would create a cycle, do not add it - } - - if (base_type::addEdge(fromVertex, toVertex)) - { - updateConnectivity(from, to); - return true; - } - - return false; - } - - private: - ///@todo: static cast should only be a temporary solution, currently VERTEX_LIMIT has to - /// be unsigned for the tests and since it is a positive quantity this makes sense - /// TFixedVector cannot deal with this properly since its capacity is a signed type (which - /// is nonconforming with STL and makes no sense since a capacity is always nonnegative) - /// casting is no problem for the ranges we use, but for very large values (larger than - // max of int32) the cast will change the value - using IndexSet = iox::cxx::vector; - - // contains for each vertex index the indices of the vertices it can be reached from - iox::cxx::vector m_reachableFrom; - - // contains for each vertex index the indices of vertices that can be reached from it - iox::cxx::vector m_leadsTo; - - // check whether the graph where we add an edge between from and to would be cyclic - bool createsCycle(const Index_t from, const Index_t to) - { - // if there is already is a path from the to-vertex to the from-vertex - // adding an edge from the from-vertex to the to-vertex would create a cycle - if (iox::cxx::set::hasElement(m_leadsTo[to], from)) - { - return true; - } - return false; - } - - // update the connectivity data (m_reachableFrom and m_leadsTo) when we add an edge between from and to - // note that this is quite expensive for large graphs, but we do not expect large graphs - // also note that this cannot easily be avoided in general, e.g. depth first search would be - // even more costly - void updateConnectivity(const Index_t from, const Index_t to) - { - // update predecessors of to-vertex - // (due to the new edge it can now be reached by every vertex with a path to the from-vertex) - auto& inTo = m_reachableFrom[to]; - iox::cxx::set::add(inTo, from); - iox::cxx::set::unify(inTo, m_reachableFrom[from]); - - // update successors of from-vertex - // (due to the new edge we can now reach every vertex that can be reached by the from-vertex) - auto& outFrom = m_leadsTo[from]; - iox::cxx::set::add(outFrom, to); - iox::cxx::set::unify(outFrom, m_leadsTo[to]); - - // update every predecessor of from-vertex - //(from them we can reach every vertex that can be reached from the to-vertex ) - for (auto pred : m_reachableFrom[from]) - { - iox::cxx::set::unify(m_leadsTo[pred], outFrom); - } - - // update every successor of to-vertex - //(they can now be reached from every predecessor of from-vertex ) - auto& inFrom = m_reachableFrom[from]; - for (auto succ : m_leadsTo[to]) - { - iox::cxx::set::unify(m_reachableFrom[succ], inFrom); - } - } - - void init() - { - bool stat = true; - // as a small optimization we could defer the - // initialization to the time the vertex is actually added - for (decltype(VERTEX_LIMIT) i = 0; i < VERTEX_LIMIT; ++i) - { - stat &= m_reachableFrom.emplace_back(IndexSet()); - stat &= m_leadsTo.emplace_back(IndexSet()); - } - assert(stat); - } -}; - -#endif // IOX_HOOFS_GRAPHS_DIRECTED_ACYCLIC_GRAPH_HPP diff --git a/iceoryx_hoofs/include/iceoryx_hoofs/internal/graphs/directed_graph.hpp b/iceoryx_hoofs/include/iceoryx_hoofs/internal/graphs/directed_graph.hpp deleted file mode 100644 index d6b5918b12..0000000000 --- a/iceoryx_hoofs/include/iceoryx_hoofs/internal/graphs/directed_graph.hpp +++ /dev/null @@ -1,266 +0,0 @@ -// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved. -// Copyright (c) 2021 by Apex.AI Inc. All rights reserved. -// -// 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. -// -// SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_HOOFS_GRAPHS_DIRECTED_GRAPH_HPP -#define IOX_HOOFS_GRAPHS_DIRECTED_GRAPH_HPP - -#include "iceoryx_hoofs/cxx/vector.hpp" - -#include -#include - -// remark: only supports adding but no removal of vertices or edges -// and this graph is not necessarily acyclic -template -class DirectedGraph -{ - public: - using Index_t = uint32_t; - using AdjacencyList = iox::cxx::vector; - - static constexpr Index_t INVALID_INDEX = std::numeric_limits::max(); - - virtual ~DirectedGraph() = default; - - /// add a vertex to the graph - /// @param [in] vertex vertex to be added - /// @return pointer true if the vertex was added successfully, false otherwise - /// (e.g. capacity reached or vertex already exists) - bool addVertex(VertexType* vertex) - { - if (numberOfVertices() >= VERTEX_LIMIT) - { - return false; - } - - if (findVertex(vertex) != INVALID_INDEX) - { - return false; // already exists - } - - VertexData data(vertex); - m_vertices.emplace_back(std::move(data)); - return true; - } - - /// add an edge between fromVertex and toVertex to the graph - /// @param [in] fromVertex - /// @param [in] toVertex - /// @return pointer true if the edge was added successfully, false otherwise - /// (e.g. vertices do not exist) - virtual bool addEdge(VertexType* fromVertex, VertexType* toVertex) - { - auto from = findVertex(fromVertex); - auto to = findVertex(toVertex); - if (from < 0 || to < 0 || from == to) - { - return false; // need to add vertices first (could do this here as well) - } - VertexData& fromData = m_vertices[from]; - VertexData& toData = m_vertices[to]; - - if (static_cast(fromData.successorIndices.size()) >= DEGREE_LIMIT - || static_cast(toData.predecessorIndices.size()) >= DEGREE_LIMIT) - { - return false; // degree limit of at least one vertex would be exceeded - } - - // only store indices, value can be found at this index - fromData.successorIndices.emplace_back(to); - toData.predecessorIndices.emplace_back(from); - - // add to successor/predecessor lists to return on demand - fromData.successors.emplace_back(toVertex); - toData.predecessors.emplace_back(fromVertex); - - ++m_numEdges; - - return true; - } - - /// get the internal index of a given vertex - /// @param [in] vertex vertex of which the index is requested - /// @return internal index of vertex, -1 if vertex does not exist - Index_t getIndex(VertexType const* vertex) - { - return findVertex(vertex); - } - - /// get the direct successors of a given vertex in the graph - /// @param [in] vertex vertex of which the successors are requested - /// @return pointer to the list of successors, nullptr if vertex does not exist - const AdjacencyList* getSuccessors(VertexType const* vertex) - { - return getSuccessors(findVertex(vertex)); - } - - /// get the direct predecessors of a given vertex in the graph - /// @param [in] vertex vertex of which the predecessors are requested - /// @return pointer to the list of predecessors, nullptr if vertex does not exist - const AdjacencyList* getPredecessors(VertexType const* vertex) - { - return getPredecessors(findVertex(vertex)); - } - - /// get the direct successors of a given vertex index in the graph - /// @param [in] index index of vertex of which the successors are requested - /// @return pointer to the list of successors, nullptr if index does not exist in the graph - const AdjacencyList* getSuccessors(Index_t index) - { - if (index != INVALID_INDEX && index < static_cast(numberOfVertices())) - { - return &m_vertices[index].successors; - } - return nullptr; - } - - /// get the direct predecessors of a given vertex index in the graph - /// @param [in] index index of vertex of which the predecessors are requested - /// @return pointer to the list of predecessors, nullptr if index does not exist in the graph - const AdjacencyList* getPredecessors(Index_t index) - { - if (index != INVALID_INDEX && index < static_cast(numberOfVertices())) - { - return &m_vertices[index].predecessors; - } - return nullptr; - } - - - /// get the source vertices of the graph, i.e. vertices without incoming edges - /// @return vector filled with source vertices (might be empty if e.g. the graph is a cycle) - iox::cxx::vector getSources() - { - iox::cxx::vector result; - for (auto& vertexData : m_vertices) - { - if (vertexData.predecessors.size() == 0u) - { - result.emplace_back(vertexData.vertex); - } - } - return result; - } - - /// get the sink vertices of the graph, i.e. vertices without outgoing edges - /// @return vector filled with sink vertices (might be empty if e.g. the graph is a cycle) - iox::cxx::vector getSinks() - { - iox::cxx::vector result; - for (auto& vertexData : m_vertices) - { - if (vertexData.successors.size() == 0) - { - result.emplace_back(vertexData.vertex); - } - } - return result; - } - - /// check whether the given vertex is a source - /// @param [in] vertex to be checked - /// @return true iff the vertex is a source - bool isSource(VertexType const* vertex) - { - auto index = findVertex(vertex); - if (isValid(index)) - { - if (m_vertices[index].predecessors.size() == 0) - { - return true; - } - } - return false; - } - - /// check whether the given vertex is a sink - /// @param [in] vertex to be checked - /// @return true if the vertex is a sink - bool isSink(VertexType const* vertex) - { - auto index = findVertex(vertex); - if (isValid(index)) - { - if (m_vertices[index].successors.size() == 0) - { - return true; - } - } - return false; - } - - - /// get the number of vertices - /// @return number of vertices - size_t numberOfVertices() - { - return m_vertices.size(); - } - - /// get the number of edges - /// @return number of edges - size_t numberOfEdges() - { - return m_numEdges; - } - - protected: - using AdjacencyIndexList = iox::cxx::vector; - - struct VertexData - { - explicit VertexData(VertexType* vertex) - : vertex(vertex) - { - } - - VertexType* vertex; - - AdjacencyIndexList predecessorIndices; // indices to navigate the graph - AdjacencyIndexList successorIndices; - - AdjacencyList predecessors; // values to provide references externally - AdjacencyList successors; - }; - - iox::cxx::vector m_vertices; - size_t m_numEdges{0}; - - // static assert to check comparison operator? - // requires ==operator - Index_t findVertex(VertexType const* vertex) const - { - // linear search for now, could be improved using binary search if we store the vertices sorted - // (but would require insertion in the middle) - Index_t n = static_cast(m_vertices.size()); - for (Index_t i = 0; i < n; ++i) - { - const auto& compareVertex = m_vertices[i].vertex; - if (vertex == compareVertex) - { - return i; - } - } - return INVALID_INDEX; // not found - } - - bool isValid(Index_t index) - { - return index != INVALID_INDEX && index < static_cast(m_vertices.size()); - } -}; - -#endif // IOX_HOOFS_GRAPHS_DIRECTED_GRAPH_HPP diff --git a/iceoryx_hoofs/source/concurrent/active_object.cpp b/iceoryx_hoofs/source/concurrent/active_object.cpp deleted file mode 100644 index 6d49426762..0000000000 --- a/iceoryx_hoofs/source/concurrent/active_object.cpp +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved. -// Copyright (c) 2021 by Apex.AI Inc. All rights reserved. -// -// 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. -// -// SPDX-License-Identifier: Apache-2.0 - -#include "iceoryx_hoofs/internal/concurrent/active_object.hpp" - -namespace iox -{ -namespace concurrent -{ -ActiveObject::ActiveObject() noexcept - : m_mainLoopThread(&ActiveObject::mainLoop, this) -{ -} - -ActiveObject::~ActiveObject() noexcept -{ - stopRunning(); -} - -void ActiveObject::addTask(const cxx::function& f) noexcept -{ - m_tasks.push(f); -} - -void ActiveObject::mainLoop() noexcept -{ - while (m_keepRunning) - { - auto task = m_tasks.pop(); - if (task) - { - (*task)(); - } - } -} - -void ActiveObject::stopRunning() noexcept -{ - if (m_mainLoopThread.joinable()) - { - addTask([=] { this->m_keepRunning = false; }); - m_mainLoopThread.join(); - } -} -} // namespace concurrent -} // namespace iox diff --git a/iceoryx_hoofs/test/moduletests/test_concurrent_taco.cpp b/iceoryx_hoofs/test/moduletests/test_concurrent_taco.cpp deleted file mode 100644 index d58b96c3ea..0000000000 --- a/iceoryx_hoofs/test/moduletests/test_concurrent_taco.cpp +++ /dev/null @@ -1,283 +0,0 @@ -// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved. -// Copyright (c) 2021 by Apex.AI Inc. All rights reserved. -// -// 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. -// -// SPDX-License-Identifier: Apache-2.0 - -#include "iceoryx_hoofs/internal/concurrent/taco.hpp" -#include "test.hpp" - -#include - -namespace -{ -using namespace ::testing; - -struct TestData -{ - TestData() = default; - // NOLINTNEXTLINE(bugprone-easily-swappable-parameters) used only for test purposes - constexpr TestData(uint32_t f_index, uint32_t f_counter, uint64_t f_timestamp) - : index(f_index) - , counter(f_counter) - , timestamp(f_timestamp) - { - } - uint32_t index; - uint32_t counter; - uint64_t timestamp; - - bool operator==(const TestData& rhs) const - { - return index == rhs.index && counter == rhs.counter && timestamp == rhs.timestamp; - } -}; - -enum class Context : uint32_t -{ - Huey, - Dewey, - Louie, - END_OF_LIST -}; - -class TACO_test : public Test -{ - public: - void SetUp() override - { - } - - void TearDown() override - { - } - - using MyTACO = iox::concurrent::TACO; -}; - -TEST_F(TACO_test, Initialized_SameContextAllowed) -{ - ::testing::Test::RecordProperty("TEST_ID", "f8b7484d-2a98-4e2c-a994-4a4722f0c95f"); - // TACO must be empty when initialized - MyTACO taco(iox::concurrent::TACOMode::AccecptDataFromSameContext); - auto retVal = taco.take(Context::Huey); - EXPECT_THAT(retVal.has_value(), Eq(false)); -} - -TEST_F(TACO_test, Initialized_SameContextDenied) -{ - ::testing::Test::RecordProperty("TEST_ID", "e006901e-72d4-44ff-a0d9-f9f181e12d37"); - // TACO must be empty when initialized - MyTACO taco(iox::concurrent::TACOMode::DenyDataFromSameContext); - auto retVal = taco.take(Context::Huey); - EXPECT_THAT(retVal.has_value(), Eq(false)); -} - -TEST_F(TACO_test, StoreAndTake_FromSameContext_SameContextAllowed) -{ - ::testing::Test::RecordProperty("TEST_ID", "52a4be5a-ff7b-4a5e-8e1d-b8cd53a0a164"); - MyTACO taco(iox::concurrent::TACOMode::AccecptDataFromSameContext); - constexpr TestData ExpectedData{1, 42, 73}; - - taco.store(ExpectedData, Context::Huey); - auto retVal = taco.take(Context::Huey); - - ASSERT_THAT(retVal.has_value(), Eq(true)); - EXPECT_THAT(*retVal, Eq(ExpectedData)); -} - -TEST_F(TACO_test, StoreAndTake_FromDifferentContext_SameContextAllowed) -{ - ::testing::Test::RecordProperty("TEST_ID", "040f3ce7-8b5c-40c9-a3af-47c640af2e49"); - MyTACO taco(iox::concurrent::TACOMode::AccecptDataFromSameContext); - constexpr TestData ExpectedData{1, 42, 73}; - - taco.store(ExpectedData, Context::Huey); - auto retVal = taco.take(Context::Dewey); - - ASSERT_THAT(retVal.has_value(), Eq(true)); - EXPECT_THAT(*retVal, Eq(ExpectedData)); -} - -TEST_F(TACO_test, StoreAndTake_FromSameContext_SameContextDenied) -{ - ::testing::Test::RecordProperty("TEST_ID", "83da385c-2887-4c50-80c9-c7f888094d4a"); - MyTACO taco(iox::concurrent::TACOMode::DenyDataFromSameContext); - constexpr TestData ExpectedData{1, 42, 73}; - - taco.store(ExpectedData, Context::Huey); - auto retVal = taco.take(Context::Huey); - - EXPECT_THAT(retVal.has_value(), Eq(false)); -} - -TEST_F(TACO_test, StoreAndTake_FromDifferentContext_SameContextDenied) -{ - ::testing::Test::RecordProperty("TEST_ID", "5081f704-6f73-4185-8b8f-10ed9a1182ec"); - MyTACO taco(iox::concurrent::TACOMode::DenyDataFromSameContext); - constexpr TestData ExpectedData{1, 42, 73}; - - taco.store(ExpectedData, Context::Huey); - auto retVal = taco.take(Context::Dewey); - - ASSERT_THAT(retVal.has_value(), Eq(true)); - EXPECT_THAT(*retVal, Eq(ExpectedData)); -} - -TEST_F(TACO_test, MultipleStoresSingleTake_FromSameContext_SameContextAllowed) -{ - ::testing::Test::RecordProperty("TEST_ID", "599b3558-f9dc-4b50-b3d5-25f6cf2bf4b9"); - MyTACO taco(iox::concurrent::TACOMode::AccecptDataFromSameContext); - constexpr TestData ExpectedData_1{1, 42, 73}; - constexpr TestData ExpectedData_2{13, 111, 666}; - - taco.store(ExpectedData_1, Context::Huey); - taco.store(ExpectedData_2, Context::Huey); - auto retVal = taco.take(Context::Huey); - - ASSERT_THAT(retVal.has_value(), Eq(true)); - EXPECT_THAT(*retVal, Eq(ExpectedData_2)); -} - -TEST_F(TACO_test, MultipleStoresSingleTake_FromDifferentContext_SameContextAllowed) -{ - ::testing::Test::RecordProperty("TEST_ID", "b5e99d96-4071-4b6f-93ec-c52b5d1c5670"); - MyTACO taco(iox::concurrent::TACOMode::AccecptDataFromSameContext); - constexpr TestData ExpectedData_1{1, 42, 73}; - constexpr TestData ExpectedData_2{13, 111, 666}; - - taco.store(ExpectedData_1, Context::Huey); - taco.store(ExpectedData_2, Context::Dewey); - auto retVal = taco.take(Context::Louie); - - ASSERT_THAT(retVal.has_value(), Eq(true)); - EXPECT_THAT(*retVal, Eq(ExpectedData_2)); -} - -TEST_F(TACO_test, MultipleStoresSingleTake_FromSameContext_SameContextDenied) -{ - ::testing::Test::RecordProperty("TEST_ID", "71fe8d30-f4c9-4f4e-a6e3-70b8bffb48da"); - MyTACO taco(iox::concurrent::TACOMode::DenyDataFromSameContext); - constexpr TestData ExpectedData_1{1, 42, 73}; - constexpr TestData ExpectedData_2{13, 111, 666}; - - taco.store(ExpectedData_1, Context::Huey); - taco.store(ExpectedData_2, Context::Huey); - auto retVal = taco.take(Context::Huey); - - ASSERT_THAT(retVal.has_value(), Eq(false)); -} - -TEST_F(TACO_test, MultipleStoresSingleTake_FromDifferentContext_SameContextDenied) -{ - ::testing::Test::RecordProperty("TEST_ID", "145b09c0-3019-4dbb-9efb-814df294748a"); - MyTACO taco(iox::concurrent::TACOMode::DenyDataFromSameContext); - constexpr TestData ExpectedData_1{1, 42, 73}; - constexpr TestData ExpectedData_2{13, 111, 666}; - - taco.store(ExpectedData_1, Context::Huey); - taco.store(ExpectedData_2, Context::Dewey); - auto retVal = taco.take(Context::Louie); - - ASSERT_THAT(retVal.has_value(), Eq(true)); - EXPECT_THAT(*retVal, Eq(ExpectedData_2)); -} - -TEST_F(TACO_test, DoubleTake) -{ - ::testing::Test::RecordProperty("TEST_ID", "c5d3329e-ddf6-40f0-a9d7-af62b5826950"); - MyTACO taco(iox::concurrent::TACOMode::DenyDataFromSameContext); - constexpr TestData ExpectedData{1, 42, 73}; - - taco.store(ExpectedData, Context::Huey); - taco.take(Context::Dewey); - auto retVal = taco.take(Context::Louie); - - EXPECT_THAT(retVal.has_value(), Eq(false)); -} - -TEST_F(TACO_test, Exchange_FromSameContext_SameContextAllowed) -{ - ::testing::Test::RecordProperty("TEST_ID", "bcb9a21e-f5e1-4d82-8056-91c69ddedde1"); - MyTACO taco(iox::concurrent::TACOMode::AccecptDataFromSameContext); - constexpr TestData ExpectedData{1, 42, 73}; - constexpr TestData DummyData{37, 4242, 123456}; - - taco.store(ExpectedData, Context::Huey); - auto retVal = taco.exchange(DummyData, Context::Huey); - - ASSERT_THAT(retVal.has_value(), Eq(true)); - EXPECT_THAT(*retVal, Eq(ExpectedData)); -} - -TEST_F(TACO_test, Exchange_FromDifferentContext_SameContextAllowed) -{ - ::testing::Test::RecordProperty("TEST_ID", "3448ed3b-ff43-4e02-be73-335350b8df47"); - MyTACO taco(iox::concurrent::TACOMode::AccecptDataFromSameContext); - constexpr TestData ExpectedData{1, 42, 73}; - constexpr TestData DummyData{37, 4242, 123456}; - - taco.store(ExpectedData, Context::Huey); - auto retVal = taco.exchange(DummyData, Context::Dewey); - - ASSERT_THAT(retVal.has_value(), Eq(true)); - EXPECT_THAT(*retVal, Eq(ExpectedData)); -} - -TEST_F(TACO_test, Exchange_FromSameContext_SameContextDenied) -{ - ::testing::Test::RecordProperty("TEST_ID", "e930f8ef-12cc-4469-8394-b38d09e4a492"); - MyTACO taco(iox::concurrent::TACOMode::DenyDataFromSameContext); - constexpr TestData ExpectedData{1, 42, 73}; - constexpr TestData DummyData{37, 4242, 123456}; - - taco.store(ExpectedData, Context::Huey); - auto retVal = taco.exchange(DummyData, Context::Huey); - - ASSERT_THAT(retVal.has_value(), Eq(false)); -} - -TEST_F(TACO_test, Exchange_FromDifferentContext_SameContextDenied) -{ - ::testing::Test::RecordProperty("TEST_ID", "9f584a4e-a197-460b-b0ba-415c772339d6"); - MyTACO taco(iox::concurrent::TACOMode::DenyDataFromSameContext); - constexpr TestData ExpectedData{1, 42, 73}; - constexpr TestData DummyData{37, 4242, 123456}; - - taco.store(ExpectedData, Context::Huey); - auto retVal = taco.exchange(DummyData, Context::Dewey); - - ASSERT_THAT(retVal.has_value(), Eq(true)); - EXPECT_THAT(*retVal, Eq(ExpectedData)); -} - -TEST_F(TACO_test, DoubleExchange) -{ - ::testing::Test::RecordProperty("TEST_ID", "134a9f18-9a3c-47dc-9882-a18664501db5"); - MyTACO taco(iox::concurrent::TACOMode::DenyDataFromSameContext); - constexpr TestData ExpectedData_1{1, 42, 73}; - constexpr TestData ExpectedData_2{13, 111, 666}; - constexpr TestData DummyData{37, 4242, 123456}; - - taco.store(ExpectedData_1, Context::Huey); - auto retVal_1 = taco.exchange(ExpectedData_2, Context::Dewey); - auto retVal_2 = taco.exchange(DummyData, Context::Louie); - - ASSERT_THAT(retVal_1.has_value(), Eq(true)); - EXPECT_THAT(*retVal_1, Eq(ExpectedData_1)); - - ASSERT_THAT(retVal_2.has_value(), Eq(true)); - EXPECT_THAT(*retVal_2, Eq(ExpectedData_2)); -} -} // namespace diff --git a/iceoryx_hoofs/test/moduletests/test_concurrent_trigger_queue.cpp b/iceoryx_hoofs/test/moduletests/test_concurrent_trigger_queue.cpp deleted file mode 100644 index 50a7370ab6..0000000000 --- a/iceoryx_hoofs/test/moduletests/test_concurrent_trigger_queue.cpp +++ /dev/null @@ -1,188 +0,0 @@ -// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved. -// Copyright (c) 2021 by Apex.AI Inc. All rights reserved. -// -// 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. -// -// SPDX-License-Identifier: Apache-2.0 - -#include "iceoryx_hoofs/concurrent/lockfree_queue.hpp" -#include "iceoryx_hoofs/concurrent/resizeable_lockfree_queue.hpp" -#include "iceoryx_hoofs/internal/concurrent/fifo.hpp" -#include "iceoryx_hoofs/internal/concurrent/trigger_queue.hpp" -#include "iceoryx_hoofs/testing/watch_dog.hpp" -#include "test.hpp" - -namespace -{ -using namespace ::testing; - -using namespace iox; -using namespace iox::concurrent; - -template -class TriggerQueue_test : public Test -{ - public: - void SetUp() override - { - m_watchdog.watchAndActOnFailure([] { std::terminate(); }); - } - - void TearDown() override - { - } - - bool fillQueue(const uint64_t offset = 0U) - { - for (uint64_t i = 0U; i < this->m_sut.capacity(); ++i) - { - EXPECT_THAT(this->m_sut.push(i + offset), Eq(true)); - EXPECT_THAT(this->m_sut.empty(), Eq(false)); - EXPECT_THAT(this->m_sut.size(), Eq(i + 1U)); - } - return this->m_sut.size() == this->m_sut.capacity(); - } - - QueueType m_sut; - Watchdog m_watchdog{units::Duration::fromSeconds(2)}; -}; - -using TriggerQueueTestSubjects = Types, - TriggerQueue, - TriggerQueue, - TriggerQueue, - TriggerQueue, - TriggerQueue, - TriggerQueue, - TriggerQueue, - TriggerQueue>; - -#ifdef __clang__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" -#endif -TYPED_TEST_SUITE(TriggerQueue_test, TriggerQueueTestSubjects); -#ifdef __clang__ -#pragma GCC diagnostic pop -#endif - - -TYPED_TEST(TriggerQueue_test, EmptyOnConstruction) -{ - ::testing::Test::RecordProperty("TEST_ID", "e318311d-88fb-4014-8f4e-35fe539bd0e8"); - EXPECT_THAT(this->m_sut.empty(), Eq(true)); - EXPECT_THAT(this->m_sut.size(), Eq(0U)); -} - -TYPED_TEST(TriggerQueue_test, PushOneElement) -{ - ::testing::Test::RecordProperty("TEST_ID", "6c7f57fa-6656-479c-b7e2-dfe2d68b114a"); - EXPECT_THAT(this->m_sut.push(5U), Eq(true)); - EXPECT_THAT(this->m_sut.empty(), Eq(false)); - EXPECT_THAT(this->m_sut.size(), Eq(1U)); -} - -TYPED_TEST(TriggerQueue_test, PushTillFull) -{ - ::testing::Test::RecordProperty("TEST_ID", "25dfabda-d873-4681-89e8-8d0741c30ab4"); - EXPECT_TRUE(this->fillQueue()); -} - -TYPED_TEST(TriggerQueue_test, PopOnEmptyReturnsNullopt) -{ - ::testing::Test::RecordProperty("TEST_ID", "6e58cfb9-9271-4dbb-bf02-7177d55c8a26"); - EXPECT_THAT(this->m_sut.pop(), Eq(cxx::nullopt)); -} - -TYPED_TEST(TriggerQueue_test, PopOneElement) -{ - ::testing::Test::RecordProperty("TEST_ID", "49187773-f92d-4b11-9bbc-8e0ebf63a22a"); - this->m_sut.push(123U); - auto result = this->m_sut.pop(); - ASSERT_THAT(result.has_value(), Eq(true)); - EXPECT_THAT(*result, Eq(123U)); -} - -TYPED_TEST(TriggerQueue_test, PopFullQueue) -{ - ::testing::Test::RecordProperty("TEST_ID", "c7fd6ec6-c8fc-4143-aee6-653797265531"); - constexpr uint64_t OFFSET = 231; - this->fillQueue(OFFSET); - - for (uint64_t i = 0U; i < this->m_sut.capacity(); ++i) - { - auto result = this->m_sut.pop(); - ASSERT_THAT(result.has_value(), Eq(true)); - EXPECT_THAT(*result, Eq(i + OFFSET)); - } -} - -TYPED_TEST(TriggerQueue_test, PushBlocksUntilPopWhenFull) -{ - ::testing::Test::RecordProperty("TEST_ID", "519eaae3-b2da-4a7b-86a7-3bdf7523dc03"); - constexpr int64_t TIMEOUT_IN_MS = 100; - this->fillQueue(); - - std::atomic counter{0U}; - - std::thread t([&] { - this->m_sut.push(0U); - ++counter; - }); - - std::this_thread::sleep_for(std::chrono::milliseconds(TIMEOUT_IN_MS)); - EXPECT_THAT(counter.load(), Eq(0)); - - auto result = this->m_sut.pop(); - ASSERT_THAT(result.has_value(), Eq(true)); - EXPECT_THAT(*result, Eq(0U)); - std::this_thread::sleep_for(std::chrono::milliseconds(TIMEOUT_IN_MS)); - EXPECT_THAT(counter.load(), Eq(1)); - t.join(); -} - -TYPED_TEST(TriggerQueue_test, PushBlocksUntilDestroyWasCalled) -{ - ::testing::Test::RecordProperty("TEST_ID", "aaf70037-dd47-4a01-bc41-f948248bf05a"); - constexpr int64_t TIMEOUT_IN_MS = 100; - this->fillQueue(); - - std::atomic counter{0U}; - - std::thread t([&] { - this->m_sut.push(1U); - this->m_sut.push(2U); - this->m_sut.push(3U); - this->m_sut.push(4U); - ++counter; - }); - - std::this_thread::sleep_for(std::chrono::milliseconds(TIMEOUT_IN_MS)); - EXPECT_THAT(counter.load(), Eq(0)); - - this->m_sut.destroy(); - std::this_thread::sleep_for(std::chrono::milliseconds(TIMEOUT_IN_MS)); - EXPECT_THAT(counter.load(), Eq(1)); - t.join(); -} - -TYPED_TEST(TriggerQueue_test, AfterDestroyPushAddsNoElements) -{ - ::testing::Test::RecordProperty("TEST_ID", "79ea6a9c-c53a-49d0-8618-53b37718e8c8"); - this->m_sut.destroy(); - this->m_sut.push(123U); - - EXPECT_THAT(this->m_sut.size(), Eq(0U)); -} - -} // namespace diff --git a/iceoryx_hoofs/test/moduletests/test_cxx_poor_mans_heap.cpp b/iceoryx_hoofs/test/moduletests/test_cxx_poor_mans_heap.cpp deleted file mode 100644 index 4e9d45c59b..0000000000 --- a/iceoryx_hoofs/test/moduletests/test_cxx_poor_mans_heap.cpp +++ /dev/null @@ -1,210 +0,0 @@ -// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved. -// Copyright (c) 2021 by Apex.AI Inc. All rights reserved. -// -// 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. -// -// SPDX-License-Identifier: Apache-2.0 - -#include "iceoryx_hoofs/cxx/helplets.hpp" -#include "iceoryx_hoofs/cxx/poor_mans_heap.hpp" -#include "test.hpp" - -namespace -{ -using namespace ::testing; - -enum class Identity : uint32_t -{ - None, - Bar, - Foo -}; - -enum class LuckyNumber : uint32_t -{ - None, - Bar = 13, - Foo = 42 -}; - -std::vector g_destructionIdentities; - -class Interface -{ - public: - explicit Interface(Identity identity) - : m_identity(identity) - { - } - virtual ~Interface() - { - g_destructionIdentities.push_back(m_identity); - } - - Identity identity() const - { - return m_identity; - } - - virtual LuckyNumber luckyNumber() const = 0; - - private: - Identity m_identity{Identity::None}; -}; - -class Bar : public Interface -{ - public: - explicit Bar(LuckyNumber luckyNumber) - : Interface(Identity::Bar) - , m_luckyNumber(luckyNumber) - { - } - - LuckyNumber luckyNumber() const override - { - return m_luckyNumber; - } - - private: - LuckyNumber m_luckyNumber{LuckyNumber::None}; -}; - -class Foo : public Interface -{ - public: - explicit Foo() - : Interface(Identity::Foo) - { - } - - LuckyNumber luckyNumber() const override - { - return LuckyNumber::Foo; - } -}; - -class PoorMansHeap_test : public Test -{ - public: - void SetUp() override - { - } - - void TearDown() override - { - } - - static constexpr auto MaxSize = iox::cxx::maxSize(); - static constexpr auto MaxAlignment = iox::cxx::maxAlignment(); - - using SUT = iox::cxx::PoorMansHeap; - - SUT m_sut; -}; - -TEST_F(PoorMansHeap_test, SizeAndAlignment) -{ - ::testing::Test::RecordProperty("TEST_ID", "b1e7dc7e-4d0d-4eef-b3ce-45b222991e8b"); - constexpr uint32_t BookkeepingSize{MaxAlignment}; // offset of the aligned storage is the MaxAlignment value - EXPECT_THAT(sizeof(m_sut), Eq(MaxSize + BookkeepingSize)); - EXPECT_THAT(alignof(SUT), Eq(MaxAlignment)); -} - -TEST_F(PoorMansHeap_test, CTor_default) -{ - ::testing::Test::RecordProperty("TEST_ID", "a4db0afc-25d4-4754-bdf4-f966d3a5354f"); - EXPECT_THAT(m_sut.hasInstance(), Eq(false)); -} - -TEST_F(PoorMansHeap_test, CTorDTor_BaseClass) -{ - ::testing::Test::RecordProperty("TEST_ID", "3767015f-3ce2-4f44-b38f-70442ddc1d05"); - { - SUT sut{iox::cxx::PoorMansHeapType(), LuckyNumber::Bar}; - ASSERT_THAT(sut.hasInstance(), Eq(true)); - EXPECT_THAT(sut->identity(), Eq(Identity::Bar)); - EXPECT_THAT(sut->luckyNumber(), Eq(LuckyNumber::Bar)); - - g_destructionIdentities.clear(); - } - - ASSERT_THAT(g_destructionIdentities.size(), Eq(1U)); - EXPECT_THAT(g_destructionIdentities[0], Eq(Identity::Bar)); -} - -TEST_F(PoorMansHeap_test, CTorDTor_NonDerived) -{ - ::testing::Test::RecordProperty("TEST_ID", "1c214e68-b1a8-4178-8c8f-dab7b1b69b58"); - { - iox::cxx::PoorMansHeap sut{iox::cxx::PoorMansHeapType(), LuckyNumber::Bar}; - ASSERT_THAT(sut.hasInstance(), Eq(true)); - EXPECT_THAT(sut->identity(), Eq(Identity::Bar)); - EXPECT_THAT(sut->luckyNumber(), Eq(LuckyNumber::Bar)); - - g_destructionIdentities.clear(); - } - - ASSERT_THAT(g_destructionIdentities.size(), Eq(1U)); - EXPECT_THAT(g_destructionIdentities[0], Eq(Identity::Bar)); -} - -TEST_F(PoorMansHeap_test, newInstance) -{ - ::testing::Test::RecordProperty("TEST_ID", "e1f483bc-2cb7-475c-a73f-dc257e5d7240"); - m_sut.newInstance(); - - ASSERT_THAT(m_sut.hasInstance(), Eq(true)); - EXPECT_THAT(m_sut->identity(), Eq(Identity::Foo)); - EXPECT_THAT(m_sut->luckyNumber(), Eq(LuckyNumber::Foo)); -} - -TEST_F(PoorMansHeap_test, deleteInstance) -{ - ::testing::Test::RecordProperty("TEST_ID", "8a4f312c-b8a1-4582-9854-bcc26fe4a4cf"); - m_sut.newInstance(LuckyNumber::Bar); - - g_destructionIdentities.clear(); - m_sut.deleteInstance(); - ASSERT_THAT(g_destructionIdentities.size(), Eq(1U)); - EXPECT_THAT(g_destructionIdentities[0], Eq(Identity::Bar)); - EXPECT_THAT(m_sut.hasInstance(), Eq(false)); -} - -TEST_F(PoorMansHeap_test, overwriteInstance) -{ - ::testing::Test::RecordProperty("TEST_ID", "043782df-e105-4b70-b529-2317daee551a"); - m_sut.newInstance(LuckyNumber::Bar); - - g_destructionIdentities.clear(); - - m_sut.newInstance(); - - ASSERT_THAT(g_destructionIdentities.size(), Eq(1U)); - EXPECT_THAT(g_destructionIdentities[0], Eq(Identity::Bar)); - - ASSERT_THAT(m_sut.hasInstance(), Eq(true)); - EXPECT_THAT(m_sut->identity(), Eq(Identity::Foo)); - EXPECT_THAT(m_sut->luckyNumber(), Eq(LuckyNumber::Foo)); -} - -TEST_F(PoorMansHeap_test, instanceAccess) -{ - ::testing::Test::RecordProperty("TEST_ID", "6a3e882e-e73d-4a6e-8049-1fdd259d90de"); - m_sut.newInstance(LuckyNumber::Bar); - - ASSERT_THAT(m_sut.hasInstance(), Eq(true)); - EXPECT_THAT(m_sut->identity(), Eq(Identity::Bar)); - EXPECT_THAT((*m_sut).identity(), Eq(Identity::Bar)); -} -} // namespace diff --git a/iceoryx_hoofs/test/moduletests/test_cxx_reference_counter.cpp b/iceoryx_hoofs/test/moduletests/test_cxx_reference_counter.cpp deleted file mode 100644 index 47443bc4cf..0000000000 --- a/iceoryx_hoofs/test/moduletests/test_cxx_reference_counter.cpp +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved. -// Copyright (c) 2021 by Apex.AI Inc. All rights reserved. -// -// 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. -// -// SPDX-License-Identifier: Apache-2.0 - -#include "iceoryx_hoofs/internal/cxx/reference_counter.hpp" -#include "test.hpp" - -namespace -{ -using namespace ::testing; -using namespace iox::cxx; - -class ReferenceCounter_test : public Test -{ - public: - uint64_t var{0}; - ReferenceCounter sut{&var}; -}; - -TEST_F(ReferenceCounter_test, CTor) -{ - ::testing::Test::RecordProperty("TEST_ID", "b2fec1f5-7c59-40ef-9893-6b1f9aa2c56d"); - EXPECT_THAT(var, Eq(1)); -} - -TEST_F(ReferenceCounter_test, CopyCTor) -{ - ::testing::Test::RecordProperty("TEST_ID", "746fdfe6-80bb-4429-9bc2-2999a31d0891"); - ReferenceCounter sut2(sut); - EXPECT_THAT(var, Eq(2)); -} - -TEST_F(ReferenceCounter_test, MoveCTor) -{ - ::testing::Test::RecordProperty("TEST_ID", "d6146408-308a-44a2-bf52-3b807d36f6c4"); - ReferenceCounter sut2(std::move(sut)); - EXPECT_THAT(var, Eq(1)); -} - -TEST_F(ReferenceCounter_test, CopyAssignment) -{ - ::testing::Test::RecordProperty("TEST_ID", "a2117274-7550-4c7c-9f17-6bcf9d640acd"); - uint64_t var2{0}; - ReferenceCounter sut2(&var); - sut2 = sut; - - EXPECT_THAT(var, Eq(2)); - EXPECT_THAT(var2, Eq(0)); -} - -TEST_F(ReferenceCounter_test, MoveAssignment) -{ - ::testing::Test::RecordProperty("TEST_ID", "b728ba0f-bb26-4146-a7ec-076f90426711"); - uint64_t var2{0}; - ReferenceCounter sut2(&var); - sut2 = std::move(sut); - - EXPECT_THAT(var, Eq(1)); - EXPECT_THAT(var2, Eq(0)); -} - -TEST_F(ReferenceCounter_test, Destructor) -{ - ::testing::Test::RecordProperty("TEST_ID", "2eb96773-4543-4d73-9cfb-e4e456470d57"); - uint64_t var2{0}; - { - ReferenceCounter sut2(&var2); - } - EXPECT_THAT(var2, Eq(0)); -} - -TEST_F(ReferenceCounter_test, DestructorAfterCopyCTor) -{ - ::testing::Test::RecordProperty("TEST_ID", "6e0f8ecf-2380-4611-bd3a-29a881d38e87"); - uint64_t var2{0}; - { - ReferenceCounter sut2(&var2); - /// @NOLINTJUSTIFICATION unused variable is required to verify the decrementing side effect of the dtor - /// @NOLINTNEXTLINE(performance-unnecessary-copy-initialization) - ReferenceCounter sut3(sut2); - } - EXPECT_THAT(var2, Eq(0)); -} - -TEST_F(ReferenceCounter_test, DestructorAfterMoveCTor) -{ - ::testing::Test::RecordProperty("TEST_ID", "1972f5f0-43bb-45da-b843-82f10a62e84a"); - uint64_t var2{0}; - { - ReferenceCounter sut2(&var2); - ReferenceCounter sut3(std::move(sut2)); - } - EXPECT_THAT(var2, Eq(0)); -} - -TEST_F(ReferenceCounter_test, DestructorAfterCopyAssignment) -{ - ::testing::Test::RecordProperty("TEST_ID", "9d44de2b-44be-4a67-8d92-9249122d6df7"); - uint64_t var2{0}; - { - uint64_t var3{0}; - ReferenceCounter sut2(&var2); - { - ReferenceCounter sut3(&var3); - sut3 = sut2; - EXPECT_THAT(var2, Eq(2)); - } - EXPECT_THAT(var2, Eq(1)); - } - EXPECT_THAT(var2, Eq(0)); -} - -TEST_F(ReferenceCounter_test, DestructorAfterMoveAssignment) -{ - ::testing::Test::RecordProperty("TEST_ID", "197d9f84-0fb3-49d0-8041-3e02b307800e"); - uint64_t var2{0}; - { - uint64_t var3{0}; - ReferenceCounter sut2(&var2); - { - ReferenceCounter sut3(&var3); - sut3 = std::move(sut2); - EXPECT_THAT(var2, Eq(1)); - } - EXPECT_THAT(var2, Eq(0)); - } - EXPECT_THAT(var2, Eq(0)); -} - -TEST_F(ReferenceCounter_test, GetValue) -{ - ::testing::Test::RecordProperty("TEST_ID", "615a8d5d-39a5-4003-be32-d8e7d3c94baa"); - EXPECT_THAT(sut.getValue(), Eq(1)); -} -} // namespace diff --git a/iceoryx_hoofs/test/moduletests/test_cxx_set.cpp b/iceoryx_hoofs/test/moduletests/test_cxx_set.cpp deleted file mode 100644 index 2cfc5dc528..0000000000 --- a/iceoryx_hoofs/test/moduletests/test_cxx_set.cpp +++ /dev/null @@ -1,282 +0,0 @@ -// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved. -// Copyright (c) 2021 by Apex.AI Inc. All rights reserved. -// -// 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. -// -// SPDX-License-Identifier: Apache-2.0 - -#include "test.hpp" -using namespace ::testing; - -#include "iceoryx_hoofs/internal/cxx/set.hpp" - -#include - -namespace -{ -// non primitive type for container used with set semantics -class Foo -{ - public: - Foo() = default; - - explicit Foo(int data) - : m_data(data) - { - } - - ~Foo() = default; - - int m_data{0}; -}; - - -// operator needed for set semantics (internal check whether object exists) - -bool operator==(const Foo& a, const Foo& b) -{ - return a.m_data == b.m_data; -} - -using Type = Foo; -using Container = std::vector; /// @todo use fixed size container instead? -using namespace iox::cxx; - -class CxxSet_test : public Test -{ - public: - void SetUp() override - { - internal::CaptureStderr(); - } - void TearDown() override - { - std::string output = internal::GetCapturedStderr(); - if (Test::HasFailure()) - { - std::cout << output << std::endl; - } - } - - Container testContainer; -}; - - -TEST_F(CxxSet_test, add) -{ - ::testing::Test::RecordProperty("TEST_ID", "260f4df9-789e-4874-aab9-b07250ee3abe"); - EXPECT_THAT(testContainer.size(), Eq(0U)); - Foo foo(73); - set::add(testContainer, foo); - EXPECT_THAT(testContainer.size(), Eq(1U)); - - set::add(testContainer, foo); - EXPECT_THAT(testContainer.size(), Eq(1U)); - - for (auto& element : testContainer) - { - EXPECT_THAT(element, Eq(foo)); - } - - set::add(testContainer, Foo(37)); - EXPECT_THAT(testContainer.size(), Eq(2U)); - - set::add(testContainer, Foo(37)); - EXPECT_THAT(testContainer.size(), Eq(2U)); - - set::add(testContainer, Foo(73)); - EXPECT_THAT(testContainer.size(), Eq(2U)); - - // look for both elements in the set in any order (we cannot assume the vector/list behaviour of the container) - Foo otherFoo(37); - bool found{false}; - bool foundOther{false}; - for (auto& element : testContainer) - { - if (element == foo) - { - found = true; - } - else if (element == otherFoo) - { - foundOther = true; - } - } - - EXPECT_THAT(found, Eq(true)); - EXPECT_THAT(foundOther, Eq(true)); -} - - -TEST_F(CxxSet_test, remove) -{ - ::testing::Test::RecordProperty("TEST_ID", "a6e20947-8e7d-4c31-93ce-4b1b421ead08"); - EXPECT_THAT(testContainer.size(), Eq(0U)); - Foo foo(73); - Foo otherFoo(37); - - set::add(testContainer, foo); - set::add(testContainer, otherFoo); - - EXPECT_THAT(testContainer.size(), Eq(2U)); - - { - // look for both elements in the set in any order (we cannot assume the vector/list behaviour of the container) - bool found{false}; - bool foundOther{false}; - for (auto& element : testContainer) - { - if (element == foo) - { - found = true; - } - else if (element == otherFoo) - { - foundOther = true; - } - } - - EXPECT_THAT(found, Eq(true)); - EXPECT_THAT(foundOther, Eq(true)); - } - - // test removal of nonexisting element - { - set::remove(testContainer, Foo(42)); - EXPECT_THAT(testContainer.size(), Eq(2U)); - - // need to check that the container is unchanged - // look for both elements in the set in any order (we cannot assume the vector/list behaviour of the container) - bool found{false}; - bool foundOther{false}; - for (auto& element : testContainer) - { - if (element == foo) - { - found = true; - } - else if (element == otherFoo) - { - foundOther = true; - } - } - - EXPECT_THAT(found, Eq(true)); - EXPECT_THAT(foundOther, Eq(true)); - } - - // test removal of existing element - { - set::remove(testContainer, foo); - EXPECT_THAT(testContainer.size(), Eq(1U)); - - // need to check that the container is unchanged - // look for both elements in the set in any order (we cannot assume the vector/list behaviour of the container) - bool found{false}; - bool foundOther{false}; - for (auto& element : testContainer) - { - if (element == foo) - { - found = true; - } - else if (element == otherFoo) - { - foundOther = true; - } - } - - EXPECT_THAT(found, Eq(false)); - EXPECT_THAT(foundOther, Eq(true)); - } - - // test removal of last element - { - set::remove(testContainer, otherFoo); - EXPECT_THAT(testContainer.size(), Eq(0U)); - - // need to check that the container is unchanged - // look for both elements in the set in any order (we cannot assume the vector/list behaviour of the container) - bool found{false}; - bool foundOther{false}; - for (auto& element : testContainer) - { - if (element == foo) - { - found = true; - } - else if (element == otherFoo) - { - foundOther = true; - } - } - - EXPECT_THAT(found, Eq(false)); - EXPECT_THAT(foundOther, Eq(false)); - } - - // test removal from empty container - { - set::remove(testContainer, foo); - EXPECT_THAT(testContainer.size(), Eq(0U)); - } -} - - -TEST_F(CxxSet_test, hasElement) -{ - ::testing::Test::RecordProperty("TEST_ID", "103d87d2-901e-4255-b267-59cde9a803d7"); - EXPECT_THAT(testContainer.size(), Eq(0U)); - - Foo foo(73); - Foo otherFoo(37); - - bool found = set::hasElement(testContainer, foo); - EXPECT_THAT(found, Eq(false)); - found = set::hasElement(testContainer, otherFoo); - EXPECT_THAT(found, Eq(false)); - - set::add(testContainer, foo); - EXPECT_THAT(testContainer.size(), Eq(1U)); - - found = set::hasElement(testContainer, foo); - EXPECT_THAT(found, Eq(true)); - found = set::hasElement(testContainer, otherFoo); - EXPECT_THAT(found, Eq(false)); - - set::add(testContainer, otherFoo); - EXPECT_THAT(testContainer.size(), Eq(2U)); - - found = set::hasElement(testContainer, foo); - EXPECT_THAT(found, Eq(true)); - found = set::hasElement(testContainer, otherFoo); - EXPECT_THAT(found, Eq(true)); - - set::remove(testContainer, foo); - EXPECT_THAT(testContainer.size(), Eq(1U)); - - found = set::hasElement(testContainer, foo); - EXPECT_THAT(found, Eq(false)); - found = set::hasElement(testContainer, otherFoo); - EXPECT_THAT(found, Eq(true)); - - set::remove(testContainer, otherFoo); - - EXPECT_THAT(testContainer.size(), Eq(0U)); - - found = set::hasElement(testContainer, foo); - EXPECT_THAT(found, Eq(false)); - found = set::hasElement(testContainer, otherFoo); - EXPECT_THAT(found, Eq(false)); -} -} // namespace diff --git a/iceoryx_hoofs/test/moduletests/test_unix_domain_sockets.cpp b/iceoryx_hoofs/test/moduletests/test_unix_domain_sockets.cpp index 44a71706dc..8479d1e1c3 100644 --- a/iceoryx_hoofs/test/moduletests/test_unix_domain_sockets.cpp +++ b/iceoryx_hoofs/test/moduletests/test_unix_domain_sockets.cpp @@ -16,7 +16,6 @@ // SPDX-License-Identifier: Apache-2.0 #if !defined(_WIN32) -#include "iceoryx_hoofs/internal/posix_wrapper/message_queue.hpp" #include "iceoryx_hoofs/internal/posix_wrapper/unix_domain_socket.hpp" #include "iceoryx_hoofs/platform/socket.hpp" #include "iceoryx_hoofs/posix_wrapper/posix_call.hpp" diff --git a/iceoryx_posh/CMakeLists.txt b/iceoryx_posh/CMakeLists.txt index 06824937c4..92a0c71399 100644 --- a/iceoryx_posh/CMakeLists.txt +++ b/iceoryx_posh/CMakeLists.txt @@ -88,6 +88,7 @@ iox_add_library( source/version source/runtime PUBLIC_LIBS iceoryx_hoofs::iceoryx_hoofs + iceoryx_dust::iceoryx_dust PRIVATE_LIBS ${CMAKE_THREAD_LIBS_INIT} PRIVATE_LIBS_LINUX rt FILES diff --git a/iceoryx_posh/include/iceoryx_posh/gateway/channel.hpp b/iceoryx_posh/include/iceoryx_posh/gateway/channel.hpp index 834d1df097..3eb278a6bb 100644 --- a/iceoryx_posh/include/iceoryx_posh/gateway/channel.hpp +++ b/iceoryx_posh/include/iceoryx_posh/gateway/channel.hpp @@ -20,7 +20,7 @@ #include "iceoryx_hoofs/cxx/expected.hpp" #include "iceoryx_hoofs/cxx/optional.hpp" -#include "iceoryx_hoofs/internal/objectpool/objectpool.hpp" +#include "iceoryx_dust/objectpool/objectpool.hpp" #include "iceoryx_posh/capro/service_description.hpp" #include "iceoryx_posh/iceoryx_posh_types.hpp" diff --git a/iceoryx_posh/include/iceoryx_posh/internal/gateway/gateway_generic.inl b/iceoryx_posh/include/iceoryx_posh/internal/gateway/gateway_generic.inl index 2f712f55b2..b4b282c7e3 100644 --- a/iceoryx_posh/include/iceoryx_posh/internal/gateway/gateway_generic.inl +++ b/iceoryx_posh/include/iceoryx_posh/internal/gateway/gateway_generic.inl @@ -18,7 +18,7 @@ #ifndef IOX_POSH_GW_GATEWAY_GENERIC_INL #define IOX_POSH_GW_GATEWAY_GENERIC_INL -#include "iceoryx_hoofs/internal/file_reader/file_reader.hpp" +#include "iceoryx_dust/cxx/file_reader.hpp" #include "iceoryx_posh/gateway/gateway_generic.hpp" #include "iceoryx_posh/internal/log/posh_logging.hpp" diff --git a/iceoryx_posh/include/iceoryx_posh/internal/runtime/ipc_interface_base.hpp b/iceoryx_posh/include/iceoryx_posh/internal/runtime/ipc_interface_base.hpp index 48dcf4d27f..834f718f8f 100644 --- a/iceoryx_posh/include/iceoryx_posh/internal/runtime/ipc_interface_base.hpp +++ b/iceoryx_posh/include/iceoryx_posh/internal/runtime/ipc_interface_base.hpp @@ -29,7 +29,6 @@ #include "iceoryx_hoofs/platform/time.hpp" #include "iceoryx_hoofs/platform/types.hpp" #include "iceoryx_hoofs/platform/unistd.hpp" -#include "iceoryx_hoofs/posix_wrapper/named_pipe.hpp" #include "iceoryx_posh/iceoryx_posh_types.hpp" #include "iceoryx_posh/internal/runtime/ipc_message.hpp" diff --git a/iceoryx_posh/source/gateway/toml_gateway_config_parser.cpp b/iceoryx_posh/source/gateway/toml_gateway_config_parser.cpp index b93ca3beff..54a5dd92d4 100644 --- a/iceoryx_posh/source/gateway/toml_gateway_config_parser.cpp +++ b/iceoryx_posh/source/gateway/toml_gateway_config_parser.cpp @@ -15,7 +15,7 @@ // SPDX-License-Identifier: Apache-2.0 #include "iceoryx_posh/gateway/toml_gateway_config_parser.hpp" -#include "iceoryx_hoofs/internal/file_reader/file_reader.hpp" +#include "iceoryx_dust/cxx/file_reader.hpp" #include "iceoryx_posh/internal/log/posh_config_logging.hpp" #include diff --git a/iceoryx_posh/source/roudi/application/iceoryx_roudi_app.cpp b/iceoryx_posh/source/roudi/application/iceoryx_roudi_app.cpp index 718bf7697c..5289c7ac6a 100644 --- a/iceoryx_posh/source/roudi/application/iceoryx_roudi_app.cpp +++ b/iceoryx_posh/source/roudi/application/iceoryx_roudi_app.cpp @@ -17,9 +17,9 @@ #include "iceoryx_posh/roudi/iceoryx_roudi_app.hpp" +#include "iceoryx_dust/posix_wrapper/signal_watcher.hpp" #include "iceoryx_hoofs/cxx/optional.hpp" #include "iceoryx_hoofs/cxx/scoped_static.hpp" -#include "iceoryx_hoofs/posix_wrapper/signal_watcher.hpp" #include "iceoryx_posh/internal/roudi/roudi.hpp" #include "iceoryx_posh/roudi/iceoryx_roudi_components.hpp" diff --git a/iceoryx_posh/source/roudi/application/roudi_app.cpp b/iceoryx_posh/source/roudi/application/roudi_app.cpp index 2b04b12685..e9a237ede8 100644 --- a/iceoryx_posh/source/roudi/application/roudi_app.cpp +++ b/iceoryx_posh/source/roudi/application/roudi_app.cpp @@ -17,6 +17,7 @@ #include "iceoryx_posh/roudi/roudi_app.hpp" +#include "iceoryx_dust/posix_wrapper/signal_watcher.hpp" #include "iceoryx_hoofs/cxx/helplets.hpp" #include "iceoryx_hoofs/cxx/optional.hpp" #include "iceoryx_hoofs/internal/posix_wrapper/shared_memory_object/memory_map.hpp" @@ -27,7 +28,6 @@ #include "iceoryx_hoofs/platform/semaphore.hpp" #include "iceoryx_hoofs/platform/signal.hpp" #include "iceoryx_hoofs/posix_wrapper/posix_access_rights.hpp" -#include "iceoryx_hoofs/posix_wrapper/signal_watcher.hpp" #include "iceoryx_hoofs/posix_wrapper/thread.hpp" #include "iceoryx_posh/iceoryx_posh_types.hpp" #include "iceoryx_posh/internal/log/posh_logging.hpp" diff --git a/iceoryx_posh/source/roudi/roudi_config_toml_file_provider.cpp b/iceoryx_posh/source/roudi/roudi_config_toml_file_provider.cpp index 7c661f1d56..5a6d4f938c 100644 --- a/iceoryx_posh/source/roudi/roudi_config_toml_file_provider.cpp +++ b/iceoryx_posh/source/roudi/roudi_config_toml_file_provider.cpp @@ -15,9 +15,9 @@ // SPDX-License-Identifier: Apache-2.0 #include "iceoryx_posh/roudi/roudi_config_toml_file_provider.hpp" +#include "iceoryx_dust/cxx/file_reader.hpp" #include "iceoryx_hoofs/cxx/string.hpp" #include "iceoryx_hoofs/cxx/vector.hpp" -#include "iceoryx_hoofs/internal/file_reader/file_reader.hpp" #include "iceoryx_hoofs/platform/getopt.hpp" #include "iceoryx_hoofs/posix_wrapper/posix_access_rights.hpp" #include "iceoryx_posh/internal/log/posh_logging.hpp" diff --git a/iceoryx_posh/source/runtime/ipc_interface_base.cpp b/iceoryx_posh/source/runtime/ipc_interface_base.cpp index f644c2a8a4..94c2f2a582 100644 --- a/iceoryx_posh/source/runtime/ipc_interface_base.cpp +++ b/iceoryx_posh/source/runtime/ipc_interface_base.cpp @@ -17,7 +17,7 @@ #include "iceoryx_posh/internal/runtime/ipc_interface_base.hpp" #include "iceoryx_hoofs/cxx/convert.hpp" -#include "iceoryx_hoofs/internal/posix_wrapper/message_queue.hpp" +//#include "iceoryx_dust/posix_wrapper/message_queue.hpp" #include "iceoryx_posh/internal/log/posh_logging.hpp" #include "iceoryx_posh/internal/runtime/ipc_message.hpp" diff --git a/iceoryx_posh/test/integrationtests/test_mq_interface_startup_race.cpp b/iceoryx_posh/test/integrationtests/test_mq_interface_startup_race.cpp index c14f53f3c9..c32284e289 100644 --- a/iceoryx_posh/test/integrationtests/test_mq_interface_startup_race.cpp +++ b/iceoryx_posh/test/integrationtests/test_mq_interface_startup_race.cpp @@ -18,7 +18,7 @@ #include "iceoryx_posh/iceoryx_posh_types.hpp" #include "test.hpp" -#include "iceoryx_hoofs/internal/posix_wrapper/message_queue.hpp" +#include "iceoryx_dust/posix_wrapper/message_queue.hpp" #include "iceoryx_hoofs/internal/units/duration.hpp" #include "iceoryx_hoofs/posix_wrapper/posix_call.hpp" #include "iceoryx_posh/internal/runtime/ipc_message.hpp" diff --git a/iceoryx_posh/test/integrationtests/test_publisher_subscriber_communication.cpp b/iceoryx_posh/test/integrationtests/test_publisher_subscriber_communication.cpp index 1f96babdde..56afefb93f 100644 --- a/iceoryx_posh/test/integrationtests/test_publisher_subscriber_communication.cpp +++ b/iceoryx_posh/test/integrationtests/test_publisher_subscriber_communication.cpp @@ -14,7 +14,7 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "iceoryx_hoofs/cxx/forward_list.hpp" +#include "iceoryx_dust/cxx/forward_list.hpp" #include "iceoryx_hoofs/cxx/list.hpp" #include "iceoryx_hoofs/cxx/optional.hpp" #include "iceoryx_hoofs/cxx/stack.hpp"