Skip to content

Commit 92cfb97

Browse files
iox-#1391 Move stack to buffer module
Signed-off-by: Marika Lehmann <[email protected]>
1 parent 57d7918 commit 92cfb97

File tree

10 files changed

+66
-37
lines changed

10 files changed

+66
-37
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
- Add check in `RelativePointer::get` to avoid `nullptr` dereferencing [\#1596](https://github.com/eclipse-iceoryx/iceoryx/issues/1596)
5757
- iceoryx_posh_testing cannot find iceoryx_hoofs_testing in CMake [\#1602](https://github.com/eclipse-iceoryx/iceoryx/issues/1602)
5858
- locking_policy.cpp calls error handler without log message [\#1609](https://github.com/eclipse-iceoryx/iceoryx/issues/1609)
59-
- Implement destructor, copy and move operations in `cxx::stack` [\#1469](https://github.com/eclipse-iceoryx/iceoryx/issues/1469)
59+
- Implement destructor, copy and move operations in `iox::stack` [\#1469](https://github.com/eclipse-iceoryx/iceoryx/issues/1469)
6060
- `gw::GatewayGeneric` sometimes terminates discovery and forward threads immediately [\#1666](https://github.com/eclipse-iceoryx/iceoryx/issues/1666)
6161
- `m_originId` in `mepoo::ChunkHeader` sometimes not set [\#1668](https://github.com/eclipse-iceoryx/iceoryx/issues/1668)
6262
- Remove `cxx::unique_ptr::reset` [\#1655](https://github.com/eclipse-iceoryx/iceoryx/issues/1655)

iceoryx_examples/complexdata/topic_data.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919

2020
#include "iceoryx_dust/cxx/forward_list.hpp"
2121
#include "iceoryx_hoofs/cxx/list.hpp"
22-
#include "iceoryx_hoofs/cxx/stack.hpp"
2322
#include "iox/optional.hpp"
23+
#include "iox/stack.hpp"
2424
#include "iox/string.hpp"
2525
#include "iox/variant.hpp"
2626
#include "iox/vector.hpp"

iceoryx_hoofs/BUILD.bazel

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@ cc_library(
3737
"design/source/*.cpp",
3838
"posix/time/source/*.cpp",
3939
]),
40-
hdrs = glob(["include/**"]) + glob(["legacy/**"]) + glob(["memory/**"]) + glob(["container/**"]) + glob(["vocabulary/**"]) + glob(["time/**"]) + glob(["utility/**"]) + glob(["primitives/**"]) + glob(["posix/**"]) + glob(["design/**"]) + [
40+
hdrs = glob(["include/**"]) + glob(["legacy/**"]) + glob(["memory/**"]) + glob(["container/**"]) + glob(["vocabulary/**"]) + glob(["time/**"]) + glob(["utility/**"]) + glob(["primitives/**"]) + glob(["posix/**"]) + glob(["design/**"]) + glob(["buffer/**"]) + [
4141
":iceoryx_hoofs_deployment_hpp",
4242
],
4343
includes = [
44+
"buffer/include/",
4445
"container/include/",
4546
"design/include",
4647
"include/",

iceoryx_hoofs/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ iox_add_library(
5656
${PROJECT_SOURCE_DIR}/design/include
5757
${PROJECT_SOURCE_DIR}/time/include
5858
${PROJECT_SOURCE_DIR}/posix/time/include
59+
${PROJECT_SOURCE_DIR}/buffer/include
5960
${CMAKE_BINARY_DIR}/generated/iceoryx_hoofs/include
6061
INSTALL_INTERFACE include/${PREFIX}
6162
EXPORT_INCLUDE_DIRS include/
@@ -68,6 +69,7 @@ iox_add_library(
6869
design/include/
6970
time/include/
7071
posix/time/include/
72+
buffer/include/
7173
FILES
7274
source/concurrent/loffli.cpp
7375
posix/time/source/adaptive_wait.cpp

iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/stack.inl renamed to iceoryx_hoofs/buffer/include/iox/detail/stack.inl

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,13 @@
1313
// limitations under the License.
1414
//
1515
// SPDX-License-Identifier: Apache-2.0
16-
#ifndef IOX_HOOFS_CXX_STACK_INL
17-
#define IOX_HOOFS_CXX_STACK_INL
16+
#ifndef IOX_HOOFS_BUFFER_STACK_INL
17+
#define IOX_HOOFS_BUFFER_STACK_INL
1818

19-
#include "iceoryx_hoofs/cxx/stack.hpp"
19+
#include "iox/stack.hpp"
2020

2121
namespace iox
2222
{
23-
namespace cxx
24-
{
2523
template <typename T, uint64_t Capacity>
2624
inline stack<T, Capacity>& stack<T, Capacity>::copy(const stack& rhs) noexcept
2725
{
@@ -196,7 +194,6 @@ inline constexpr uint64_t stack<T, Capacity>::capacity() noexcept
196194
}
197195

198196

199-
} // namespace cxx
200197
} // namespace iox
201198

202-
#endif // IOX_HOOFS_CXX_STACK_INL
199+
#endif // IOX_HOOFS_BUFFER_STACK_INL

iceoryx_hoofs/include/iceoryx_hoofs/cxx/stack.hpp renamed to iceoryx_hoofs/buffer/include/iox/stack.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_STACK_HPP
17-
#define IOX_HOOFS_CXX_STACK_HPP
16+
#ifndef IOX_HOOFS_BUFFER_STACK_HPP
17+
#define IOX_HOOFS_BUFFER_STACK_HPP
1818

1919
#include "iceoryx_hoofs/cxx/algorithm.hpp"
2020
#include "iox/optional.hpp"
@@ -24,8 +24,6 @@
2424

2525
namespace iox
2626
{
27-
namespace cxx
28-
{
2927
// AXIVION Next Construct AutosarC++19_03-A12.1.1 : it is guaranteed that the array elements are initialized before read
3028
// access
3129
// AXIVION Next Construct AutosarC++19_03-A9.6.1 : false positive since no bit-fields are involved
@@ -75,9 +73,8 @@ class stack final // NOLINT(cppcoreguidelines-pro-type-member-init, hicpp-member
7573
UninitializedArray<T, Capacity> m_data;
7674
uint64_t m_size{0U};
7775
};
78-
} // namespace cxx
7976
} // namespace iox
8077

81-
#include "iceoryx_hoofs/internal/cxx/stack.inl"
78+
#include "iox/detail/stack.inl"
8279

8380
#endif
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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_STACK_HPP
17+
#define IOX_HOOFS_CXX_STACK_HPP
18+
19+
#include "iox/stack.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/stack.hpp' instead")]]
25+
namespace cxx
26+
{
27+
/// @deprecated use `iox::stack` instead of `iox::cxx::stack`
28+
using iox::stack;
29+
} // namespace cxx
30+
} // namespace iox
31+
32+
#endif

iceoryx_hoofs/test/moduletests/test_cxx_stack.cpp renamed to iceoryx_hoofs/test/moduletests/test_buffer_stack.cpp

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

17-
#include "iceoryx_hoofs/cxx/stack.hpp"
17+
#include "iox/stack.hpp"
1818
#include "test.hpp"
1919

2020
#include <vector>
@@ -127,7 +127,7 @@ class stack_test : public Test
127127
{
128128
public:
129129
static constexpr uint32_t STACK_SIZE = 10U;
130-
cxx::stack<TestClass, STACK_SIZE> m_sut;
130+
stack<TestClass, STACK_SIZE> m_sut;
131131

132132
void pushElements(const uint32_t numberOfElements)
133133
{
@@ -216,7 +216,7 @@ TEST_F(stack_test, TestClassDTorIsCalledWhenStackGoesOutOfScope)
216216
{
217217
::testing::Test::RecordProperty("TEST_ID", "3c496cb7-898b-4a65-a405-c42cbd7f0d7b");
218218
{
219-
cxx::stack<TestClass, STACK_SIZE> sut;
219+
stack<TestClass, STACK_SIZE> sut;
220220
sut.push();
221221
sut.push(1U, 2U, 3U);
222222
EXPECT_THAT(TestClass::dTor, Eq(0));
@@ -228,7 +228,7 @@ TEST_F(stack_test, StackDestroysElementsInReverseOrder)
228228
{
229229
::testing::Test::RecordProperty("TEST_ID", "fb38b063-4921-46ae-bdf2-922f49a9ab41");
230230
{
231-
cxx::stack<TestClass, STACK_SIZE> sut;
231+
stack<TestClass, STACK_SIZE> sut;
232232
for (uint32_t i{0}; i < STACK_SIZE; ++i)
233233
{
234234
sut.push(i + 3, i + 1, i + 2);
@@ -248,7 +248,7 @@ TEST_F(stack_test, CopyConstructorWorksAndCallsTestClassCopyConstructor)
248248
constexpr uint32_t ELEMENT{13};
249249
m_sut.push(ELEMENT, ELEMENT, ELEMENT);
250250

251-
cxx::stack<TestClass, STACK_SIZE> testStack(m_sut);
251+
stack<TestClass, STACK_SIZE> testStack(m_sut);
252252
EXPECT_THAT(TestClass::copyCTor, Eq(1));
253253
ASSERT_THAT(testStack.size(), Eq(1));
254254
EXPECT_THAT(testStack.pop().value(), Eq(TestClass(ELEMENT, ELEMENT, ELEMENT)));
@@ -257,7 +257,7 @@ TEST_F(stack_test, CopyConstructorWorksAndCallsTestClassCopyConstructor)
257257
TEST_F(stack_test, CopyConstructorWithEmptyStackWorks)
258258
{
259259
::testing::Test::RecordProperty("TEST_ID", "08bfe7d9-233e-47cc-a7ca-5520eb6b99df");
260-
cxx::stack<TestClass, STACK_SIZE> testStack(m_sut);
260+
stack<TestClass, STACK_SIZE> testStack(m_sut);
261261
EXPECT_THAT(TestClass::copyCTor, Eq(0));
262262
EXPECT_THAT(testStack.size(), Eq(0));
263263
}
@@ -267,7 +267,7 @@ TEST_F(stack_test, CopyConstructorWithFullStackWorks)
267267
::testing::Test::RecordProperty("TEST_ID", "f5ff8a1c-8bd4-40a9-9b10-7e90f232d78a");
268268
pushElements(STACK_SIZE);
269269

270-
cxx::stack<TestClass, STACK_SIZE> testStack(m_sut);
270+
stack<TestClass, STACK_SIZE> testStack(m_sut);
271271
EXPECT_THAT(TestClass::copyCTor, Eq(STACK_SIZE));
272272
EXPECT_THAT(testStack.size(), Eq(STACK_SIZE));
273273

@@ -283,7 +283,7 @@ TEST_F(stack_test, CopyAssignmentWithEmptySourceWorks)
283283
{
284284
::testing::Test::RecordProperty("TEST_ID", "0b563f12-e565-49d8-ba62-7d9a2323afdb");
285285
pushElements(STACK_SIZE);
286-
cxx::stack<TestClass, STACK_SIZE> testStack;
286+
stack<TestClass, STACK_SIZE> testStack;
287287

288288
m_sut = testStack;
289289

@@ -297,7 +297,7 @@ TEST_F(stack_test, CopyAssignmentWithEmptyDestinationWorks)
297297
{
298298
::testing::Test::RecordProperty("TEST_ID", "81ea12ea-14ad-474c-bfd7-72433c780ceb");
299299
pushElements(STACK_SIZE);
300-
cxx::stack<TestClass, STACK_SIZE> testStack;
300+
stack<TestClass, STACK_SIZE> testStack;
301301

302302
testStack = m_sut;
303303

@@ -318,7 +318,7 @@ TEST_F(stack_test, CopyAssignmentWithLargerDestinationWorks)
318318
{
319319
::testing::Test::RecordProperty("TEST_ID", "2f07ec25-fd62-414f-bb41-9284ce9f69b2");
320320
pushElements(STACK_SIZE);
321-
cxx::stack<TestClass, STACK_SIZE> testStack;
321+
stack<TestClass, STACK_SIZE> testStack;
322322
testStack.push(9U, 11U, 13U);
323323
const auto srcSize = testStack.size();
324324

@@ -335,7 +335,7 @@ TEST_F(stack_test, CopyAssignmentWithLargerSourceWorks)
335335
{
336336
::testing::Test::RecordProperty("TEST_ID", "1a001c09-abc2-4518-a47a-30d41aca3be4");
337337
pushElements(STACK_SIZE);
338-
cxx::stack<TestClass, STACK_SIZE> testStack;
338+
stack<TestClass, STACK_SIZE> testStack;
339339
testStack.push(17U, 19U, 23U);
340340
const auto destSize = testStack.size();
341341

@@ -358,7 +358,7 @@ TEST_F(stack_test, MoveConstructorWorksAndCallsTestClassMoveConstructor)
358358
::testing::Test::RecordProperty("TEST_ID", "e3ad8e37-a95a-4f35-bee0-c83961c626a7");
359359
constexpr uint32_t ELEMENT{46};
360360
m_sut.push(ELEMENT, ELEMENT, ELEMENT);
361-
cxx::stack<TestClass, STACK_SIZE> testStack(std::move(m_sut));
361+
stack<TestClass, STACK_SIZE> testStack(std::move(m_sut));
362362

363363
EXPECT_THAT(TestClass::moveCTor, Eq(1));
364364
ASSERT_THAT(testStack.size(), Eq(1));
@@ -369,7 +369,7 @@ TEST_F(stack_test, MoveConstructorWorksAndCallsTestClassMoveConstructor)
369369
TEST_F(stack_test, MoveConstructorWithEmptyStackWorks)
370370
{
371371
::testing::Test::RecordProperty("TEST_ID", "2cb3bfc8-ef86-4648-90e0-c0d4375834cc");
372-
cxx::stack<TestClass, STACK_SIZE> testStack(std::move(m_sut));
372+
stack<TestClass, STACK_SIZE> testStack(std::move(m_sut));
373373
EXPECT_THAT(TestClass::moveCTor, Eq(0));
374374
EXPECT_THAT(testStack.size(), Eq(0));
375375
EXPECT_THAT(m_sut.size(), Eq(0));
@@ -379,7 +379,7 @@ TEST_F(stack_test, MoveConstructorWithFullStackWorks)
379379
{
380380
::testing::Test::RecordProperty("TEST_ID", "08661d3d-89d7-4ada-ba78-757e92eeb8d4");
381381
pushElements(STACK_SIZE);
382-
cxx::stack<TestClass, STACK_SIZE> testStack(std::move(m_sut));
382+
stack<TestClass, STACK_SIZE> testStack(std::move(m_sut));
383383

384384
EXPECT_THAT(TestClass::moveCTor, Eq(STACK_SIZE));
385385
EXPECT_THAT(testStack.size(), Eq(STACK_SIZE));
@@ -397,7 +397,7 @@ TEST_F(stack_test, MoveAssignmentWithEmptySourceWorks)
397397
{
398398
::testing::Test::RecordProperty("TEST_ID", "a06a3f8e-a886-43e2-b119-adc66c2af799");
399399
pushElements(STACK_SIZE);
400-
cxx::stack<TestClass, STACK_SIZE> testStack;
400+
stack<TestClass, STACK_SIZE> testStack;
401401

402402
m_sut = std::move(testStack);
403403

@@ -414,7 +414,7 @@ TEST_F(stack_test, MoveAssignmentWithEmptyDestinationWorks)
414414
{
415415
::testing::Test::RecordProperty("TEST_ID", "b67825b9-2053-453d-a2b7-5fe544f7b16d");
416416
pushElements(STACK_SIZE);
417-
cxx::stack<TestClass, STACK_SIZE> testStack;
417+
stack<TestClass, STACK_SIZE> testStack;
418418

419419
testStack = std::move(m_sut);
420420

@@ -436,7 +436,7 @@ TEST_F(stack_test, MoveAssignmentWithLargerDestinationWorks)
436436
{
437437
::testing::Test::RecordProperty("TEST_ID", "de0b02d2-762e-41e7-a179-bd3f57da5dc6");
438438
pushElements(STACK_SIZE);
439-
cxx::stack<TestClass, STACK_SIZE> testStack;
439+
stack<TestClass, STACK_SIZE> testStack;
440440
testStack.push(9U, 11U, 13U);
441441
const auto srcSize = testStack.size();
442442

@@ -456,7 +456,7 @@ TEST_F(stack_test, MoveAssignmentWithLargerSourceWorks)
456456
{
457457
::testing::Test::RecordProperty("TEST_ID", "7ff5a53d-18f7-447d-8bc8-04d2f9e38caa");
458458
pushElements(STACK_SIZE);
459-
cxx::stack<TestClass, STACK_SIZE> testStack;
459+
stack<TestClass, STACK_SIZE> testStack;
460460
testStack.push(17U, 19U, 23U);
461461
const auto destSize = testStack.size();
462462

iceoryx_posh/include/iceoryx_posh/popo/wait_set.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include "iceoryx_hoofs/cxx/algorithm.hpp"
2121
#include "iceoryx_hoofs/cxx/function.hpp"
2222
#include "iceoryx_hoofs/cxx/function_ref.hpp"
23-
#include "iceoryx_hoofs/cxx/stack.hpp"
2423
#include "iceoryx_posh/iceoryx_posh_types.hpp"
2524
#include "iceoryx_posh/internal/popo/building_blocks/condition_listener.hpp"
2625
#include "iceoryx_posh/internal/popo/building_blocks/condition_variable_data.hpp"
@@ -31,6 +30,7 @@
3130
#include "iceoryx_posh/popo/trigger.hpp"
3231
#include "iceoryx_posh/popo/trigger_handle.hpp"
3332
#include "iceoryx_posh/runtime/posh_runtime.hpp"
33+
#include "iox/stack.hpp"
3434
#include "iox/vector.hpp"
3535

3636
namespace iox
@@ -238,7 +238,7 @@ class WaitSet
238238
ConditionVariableData* m_conditionVariableDataPtr{nullptr};
239239
ConditionListener m_conditionListener;
240240

241-
cxx::stack<uint64_t, Capacity> m_indexRepository;
241+
stack<uint64_t, Capacity> m_indexRepository;
242242
ConditionListener::NotificationVector_t m_activeNotifications;
243243
};
244244

iceoryx_posh/test/integrationtests/test_publisher_subscriber_communication.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717

1818
#include "iceoryx_dust/cxx/forward_list.hpp"
1919
#include "iceoryx_hoofs/cxx/list.hpp"
20-
#include "iceoryx_hoofs/cxx/stack.hpp"
2120
#include "iceoryx_hoofs/testing/barrier.hpp"
2221
#include "iceoryx_hoofs/testing/watch_dog.hpp"
2322
#include "iceoryx_posh/popo/publisher.hpp"
2423
#include "iceoryx_posh/popo/subscriber.hpp"
2524
#include "iceoryx_posh/runtime/posh_runtime.hpp"
2625
#include "iceoryx_posh/testing/roudi_gtest.hpp"
2726
#include "iox/optional.hpp"
27+
#include "iox/stack.hpp"
2828
#include "iox/string.hpp"
2929
#include "iox/variant.hpp"
3030
#include "iox/vector.hpp"

0 commit comments

Comments
 (0)