iceoryx2
C++ Language Bindings
Loading...
Searching...
No Matches
builder.hpp
Go to the documentation of this file.
1
// Copyright (c) 2024 Contributors to the Eclipse Foundation
2
//
3
// See the NOTICE file(s) distributed with this work for additional
4
// information regarding copyright ownership.
5
//
6
// This program and the accompanying materials are made available under the
7
// terms of the Apache Software License 2.0 which is available at
8
// https://www.apache.org/licenses/LICENSE-2.0, or the MIT license
9
// which is available at https://opensource.org/licenses/MIT.
10
//
11
// SPDX-License-Identifier: Apache-2.0 OR MIT
12
13
#ifndef IOX2_BB_DETAIL_BUILDER_HPP
14
#define IOX2_BB_DETAIL_BUILDER_HPP
15
16
#include "
iox2/bb/optional.hpp
"
17
18
// NOLINTBEGIN(cppcoreguidelines-macro-usage)
19
// NOLINTBEGIN(bugprone-macro-parentheses)
20
#define IOX2_BUILDER_SWITCH(name) \
21
public: \
22
auto name()&& noexcept -> decltype(auto) { \
23
m_##name = true; \
24
return std::move(*this); \
25
} \
26
\
27
private: \
28
bool m_##name { false };
29
30
#define IOX2_BUILDER_PARAMETER(type, name, defaultValue) \
31
public: \
32
auto name(type const& value)&& noexcept -> decltype(auto) { \
33
m_##name = value; \
34
return std::move(*this); \
35
} \
36
\
37
auto name(type&& value)&& noexcept -> decltype(auto) { \
38
m_##name = std::move(value); \
39
return std::move(*this); \
40
} \
41
\
42
private: \
43
type m_##name { \
44
defaultValue \
45
}
46
47
#define IOX2_BUILDER_OPTIONAL(type, name) \
48
public: \
49
auto name(type const& value)&& -> decltype(auto) { \
50
m_##name = iox2::bb::Optional<type>(value); \
51
return std::move(*this); \
52
} \
53
\
54
auto name(type&& value)&& -> decltype(auto) { \
55
m_##name = iox2::bb::Optional<type>(std::move(value)); \
56
return std::move(*this); \
57
} \
58
\
59
private: \
60
iox2::bb::Optional<type> m_##name
61
// NOLINTEND(bugprone-macro-parentheses)
62
// NOLINTEND(cppcoreguidelines-macro-usage)
63
64
#endif
// IOX2_BB_DETAIL_BUILDER_HPP
optional.hpp
iox2
bb
detail
builder.hpp
Generated by
1.9.8