Skip to content

Commit bff8ee8

Browse files
iox-#1391 Move functional interface files
Signed-off-by: Marika Lehmann <[email protected]>
1 parent e816c36 commit bff8ee8

19 files changed

+121
-64
lines changed

doc/website/release-notes/iceoryx-unreleased.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@
220220
via a pointer to `FunctionalInterface`
221221

222222
```cpp
223-
iox::cxx::FunctionalInterface<iox::optional<MyClass>, MyClass, void>* soSmart =
223+
iox::FunctionalInterface<iox::optional<MyClass>, MyClass, void>* soSmart =
224224
new iox::optional<MyClass>{};
225225

226226
delete soSmart; // <- not possible anymore

iceoryx_hoofs/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ cc_library(
3434
"vocabulary/source/**/*.cpp",
3535
"source/**/*.hpp",
3636
"memory/source/*.cpp",
37+
"design/source/*.cpp",
3738
]),
3839
hdrs = glob(["include/**"]) + glob(["legacy/**"]) + glob(["memory/**"]) + glob(["container/**"]) + glob(["vocabulary/**"]) + glob(["utility/**"]) + glob(["primitives/**"]) + glob(["design/**"]) + [
3940
":iceoryx_hoofs_deployment_hpp",

iceoryx_hoofs/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ iox_add_library(
6969
source/cxx/adaptive_wait.cpp
7070
source/cxx/deadline_timer.cpp
7171
source/cxx/filesystem.cpp
72-
source/cxx/functional_interface.cpp
7372
source/cxx/requires.cpp
7473
source/cxx/type_traits.cpp
7574
source/cxx/unique_id.cpp
@@ -97,6 +96,7 @@ iox_add_library(
9796
source/units/duration.cpp
9897
memory/source/bump_allocator.cpp
9998
memory/source/memory.cpp
99+
design/source/functional_interface.cpp
100100
)
101101

102102
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/iceoryx_hoofs_deployment.hpp.in"

iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/functional_interface.inl renamed to iceoryx_hoofs/design/include/iox/detail/functional_interface.inl

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,14 @@
1414
//
1515
// SPDX-License-Identifier: Apache-2.0
1616

17-
#ifndef IOX_HOOFS_CXX_FUNCTIONAL_INTERFACE_INL
18-
#define IOX_HOOFS_CXX_FUNCTIONAL_INTERFACE_INL
17+
#ifndef IOX_HOOFS_DESIGN_FUNCTIONAL_INTERFACE_INL
18+
#define IOX_HOOFS_DESIGN_FUNCTIONAL_INTERFACE_INL
1919

20-
#include "iceoryx_hoofs/cxx/functional_interface.hpp"
2120
#include "iox/detail/string_type_traits.hpp"
21+
#include "iox/functional_interface.hpp"
2222

2323
namespace iox
2424
{
25-
namespace cxx
26-
{
2725
namespace internal
2826
{
2927
///////////////
@@ -33,31 +31,31 @@ template <typename Derived>
3331
template <typename StringType>
3432
inline void Expect<Derived>::expect(const StringType& msg) const noexcept
3533
{
36-
static_assert(is_char_array<StringType>::value || is_cxx_string<StringType>::value,
34+
static_assert(cxx::is_char_array<StringType>::value || is_cxx_string<StringType>::value,
3735
"Only char arrays and iox::strings are allowed as message type.");
3836

3937
const auto& derivedThis = *static_cast<const Derived*>(this);
4038

4139
if (!derivedThis)
4240
{
4341
print_expect_message(&msg[0]);
44-
Ensures(false);
42+
cxx::Ensures(false);
4543
}
4644
}
4745

4846
template <typename Derived, typename ValueType>
4947
template <typename StringType>
5048
inline ValueType& ExpectWithValue<Derived, ValueType>::expect(const StringType& msg) & noexcept
5149
{
52-
static_assert(is_char_array<StringType>::value || is_cxx_string<StringType>::value,
50+
static_assert(cxx::is_char_array<StringType>::value || is_cxx_string<StringType>::value,
5351
"Only char arrays and iox::strings are allowed as message type.");
5452

5553
auto& derivedThis = *static_cast<Derived*>(this);
5654

5755
if (!derivedThis)
5856
{
5957
print_expect_message(&msg[0]);
60-
Ensures(false);
58+
cxx::Ensures(false);
6159
}
6260

6361
return derivedThis.value();
@@ -312,6 +310,5 @@ inline const Derived&& OrElse<Derived>::or_else(const or_else_callback_t& callab
312310

313311

314312
} // namespace internal
315-
} // namespace cxx
316313
} // namespace iox
317314
#endif

iceoryx_hoofs/include/iceoryx_hoofs/cxx/functional_interface.hpp renamed to iceoryx_hoofs/design/include/iox/functional_interface.hpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
// limitations under the License.
1414
//
1515
// SPDX-License-Identifier: Apache-2.0
16-
#ifndef IOX_HOOFS_CXX_FUNCTIONAL_POLICY_HPP
17-
#define IOX_HOOFS_CXX_FUNCTIONAL_POLICY_HPP
16+
#ifndef IOX_HOOFS_DESIGN_FUNCTIONAL_INTERFACE_HPP
17+
#define IOX_HOOFS_DESIGN_FUNCTIONAL_INTERFACE_HPP
1818

1919
#include "iceoryx_hoofs/cxx/function_ref.hpp"
2020
#include "iceoryx_hoofs/cxx/type_traits.hpp"
@@ -24,8 +24,6 @@
2424

2525
namespace iox
2626
{
27-
namespace cxx
28-
{
2927
namespace internal
3028
{
3129
template <typename Derived, class = void>
@@ -434,9 +432,8 @@ struct FunctionalInterfaceImpl<Derived, void, ErrorType>
434432
template <typename Derived, typename ValueType, typename ErrorType>
435433
using FunctionalInterface = internal::FunctionalInterfaceImpl<Derived, ValueType, ErrorType>;
436434

437-
} // namespace cxx
438435
} // namespace iox
439436

440-
#include "iceoryx_hoofs/internal/cxx/functional_interface.inl"
437+
#include "iox/detail/functional_interface.inl"
441438

442439
#endif

iceoryx_hoofs/source/cxx/functional_interface.cpp renamed to iceoryx_hoofs/design/source/functional_interface.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,11 @@
1414
//
1515
// SPDX-License-Identifier: Apache-2.0
1616

17-
#include "iceoryx_hoofs/cxx/functional_interface.hpp"
17+
#include "iox/functional_interface.hpp"
1818
#include "iceoryx_hoofs/log/logging.hpp"
1919

2020
namespace iox
2121
{
22-
namespace cxx
23-
{
2422
namespace internal
2523
{
2624
// AXIVION Next Construct AutosarC++19_03-A3.9.1 : See rational in header
@@ -31,5 +29,4 @@ void print_expect_message(const char* message) noexcept
3129
IOX_LOG(FATAL) << message;
3230
}
3331
} // namespace internal
34-
} // namespace cxx
3532
} // namespace iox
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
// Copyright (c) 2023 by Apex.AI Inc. All rights reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
//
15+
// SPDX-License-Identifier: Apache-2.0
16+
#ifndef IOX_HOOFS_CXX_FUNCTIONAL_INTERFACE_HPP
17+
#define IOX_HOOFS_CXX_FUNCTIONAL_INTERFACE_HPP
18+
19+
#include "iox/functional_interface.hpp"
20+
21+
namespace iox
22+
{
23+
/// @todo iox-#1593 Deprecate include
24+
/// [[deprecated("Deprecated in 3.0, removed in 4.0, please include 'iox/functional_interface.hpp' instead")]]
25+
namespace cxx
26+
{
27+
namespace internal
28+
{
29+
/// @deprecated use `iox::internal::HasValueMethod` instead of `iox::cxx::internal::HasValueMethod`
30+
using iox::internal::HasValueMethod;
31+
32+
/// @deprecated use `iox::internal::HasGetErrorMethod` instead of `iox::cxx::internal::HasGetErrorMethod`
33+
using iox::internal::HasGetErrorMethod;
34+
35+
/// @deprecated use `iox::internal::Expect` instead of `iox::cxx::internal::Expect`
36+
using iox::internal::Expect;
37+
38+
/// @deprecated use `iox::internal::ExpectWithValue` instead of `iox::cxx::internal::ExpectWithValue`
39+
using iox::internal::ExpectWithValue;
40+
41+
/// @deprecated use `iox::internal::ValueOr` instead of `iox::cxx::internal::ValueOr`
42+
using iox::internal::ValueOr;
43+
44+
/// @deprecated use `iox::internal::AndThenWithValue` instead of `iox::cxx::internal::AndThenWithValue`
45+
using iox::internal::AndThenWithValue;
46+
47+
/// @deprecated use `iox::internal::AndThen` instead of `iox::cxx::internal::AndThen`
48+
using iox::internal::AndThen;
49+
50+
/// @deprecated use `iox::internal::OrElseWithValue` instead of `iox::cxx::internal::OrElseWithValue`
51+
using iox::internal::OrElseWithValue;
52+
53+
/// @deprecated use `iox::internal::OrElse` instead of `iox::cxx::internal::OrElse`
54+
using iox::internal::OrElse;
55+
56+
/// @deprecated use `iox::internal::FunctionalInterfaceImpl` instead of `iox::cxx::internal::FunctionalInterfaceImpl`
57+
using iox::internal::FunctionalInterfaceImpl;
58+
} // namespace internal
59+
60+
/// @deprecated use `iox::FunctionalInterface` instead of `iox::cxx::FunctionalInterface`
61+
using iox::FunctionalInterface;
62+
63+
} // namespace cxx
64+
} // namespace iox
65+
66+
#endif

iceoryx_hoofs/legacy/include/iceoryx_hoofs/design_pattern/builder.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,3 @@
2222
/// [[deprecated("Deprecated in 3.0, removed in 4.0, please include 'iox/builder.hpp' instead")]]
2323

2424
#endif
25-

iceoryx_hoofs/test/moduletests/test_cxx_functional_interface_and_then.cpp renamed to iceoryx_hoofs/test/moduletests/test_design_functional_interface_and_then.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@
1414
//
1515
// SPDX-License-Identifier: Apache-2.0
1616
#include "iceoryx_hoofs/testing/expect_no_death.hpp"
17-
#include "test_cxx_functional_interface_types.hpp"
17+
#include "test_design_functional_interface_types.hpp"
1818

1919
namespace
2020
{
21-
using namespace test_cxx_functional_interface;
21+
using namespace test_design_functional_interface;
2222
using namespace ::testing;
2323

2424
TYPED_TEST(FunctionalInterface_test, AndThenHasCorrectSignature)
2525
{
2626
::testing::Test::RecordProperty("TEST_ID", "7636fda5-090f-4dd6-b3a0-3d71bdbca787");
2727
using Factory = typename TestFixture::TestFactoryType;
28-
constexpr bool DOES_AND_THEN_HAVE_A_VALUE = iox::cxx::internal::HasValueMethod<typename Factory::Type>::value;
28+
constexpr bool DOES_AND_THEN_HAVE_A_VALUE = iox::internal::HasValueMethod<typename Factory::Type>::value;
2929

3030
EXPECT_THAT(DOES_AND_THEN_HAVE_A_VALUE, Eq(Factory::EXPECT_AND_THEN_WITH_VALUE));
3131
}
@@ -36,7 +36,7 @@ TYPED_TEST(FunctionalInterface_test, AndThenHasCorrectSignature)
3636
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
3737
#define IOX_TEST_FUNCTIONAL_INTERFACE(TestName, variationPoint) \
3838
using SutType = typename TestFixture::TestFactoryType::Type; \
39-
constexpr bool HAS_VALUE_METHOD = iox::cxx::internal::HasValueMethod<SutType>::value; \
39+
constexpr bool HAS_VALUE_METHOD = iox::internal::HasValueMethod<SutType>::value; \
4040
/* NOLINTNEXTLINE(bugprone-macro-parentheses) prevents clang-tidy parsing failures */ \
4141
TestName<HAS_VALUE_METHOD>::template performTest<typename TestFixture::TestFactoryType>( \
4242
[](auto& sut, auto callback) { (variationPoint).and_then(callback); })

iceoryx_hoofs/test/moduletests/test_cxx_functional_interface_common.cpp renamed to iceoryx_hoofs/test/moduletests/test_design_functional_interface_common.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
//
1515
// SPDX-License-Identifier: Apache-2.0
1616

17-
#include "test_cxx_functional_interface_common.hpp"
17+
#include "test_design_functional_interface_common.hpp"
1818

19-
namespace test_cxx_functional_interface
19+
namespace test_design_functional_interface
2020
{
2121
// NOLINTNEXTLINE(bugprone-easily-swappable-parameters) only for testing purposes
2222
GenericValueError::GenericValueError(const value_t value, const error_t error) noexcept
@@ -95,4 +95,4 @@ GenericPlain::operator bool() const noexcept
9595
}
9696

9797

98-
} // namespace test_cxx_functional_interface
98+
} // namespace test_design_functional_interface

0 commit comments

Comments
 (0)