iceoryx_posh 2.0.3
iceoryx_posh_config.hpp
1// Copyright (c) 2019 by Robert Bosch GmbH. 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_POSH_ICEORYX_POSH_CONFIG_HPP
17#define IOX_POSH_ICEORYX_POSH_CONFIG_HPP
18
19#include "iceoryx_posh/mepoo/segment_config.hpp"
20#include "roudi/roudi_config.hpp"
21
22namespace iox
23{
24namespace helper
25{
26template <typename... ConfigParts>
28
29template <typename FirstArg, typename... RemainderArgs>
30struct SetDefaults<FirstArg, RemainderArgs...>
31{
32 template <typename BaseType>
33 static void apply(BaseType* me) noexcept
34 {
37 }
38};
39
40template <typename FinalArg>
41struct SetDefaults<FinalArg>
42{
43 template <typename BaseType>
44 static void apply(BaseType* me) noexcept
45 {
46 static_cast<FinalArg*>(me)->setDefaults();
47 }
48};
49
50template <typename... ConfigParts>
51struct Optimize;
52
53template <typename FirstArg, typename... RemainderArgs>
54struct Optimize<FirstArg, RemainderArgs...>
55{
56 template <typename BaseType>
57 static void apply(BaseType* me) noexcept
58 {
61 }
62};
63
64template <typename FinalArg>
65struct Optimize<FinalArg>
66{
67 template <typename BaseType>
68 static void apply(BaseType* me) noexcept
69 {
70 static_cast<FinalArg*>(me)->optimize();
71 }
72};
73} // namespace helper
74
75template <typename... ConfigParts>
76struct Config : public ConfigParts...
77{
78 Config& setDefaults() noexcept
79 {
81 return *this;
82 }
83
84 template <typename T>
85 Config& setModuleDefaults() noexcept
86 {
87 T::setDefaults();
88 return *this;
89 }
90
91 Config& optimize() noexcept
92 {
94 return *this;
95 }
96};
97
99} // namespace iox
100
101#endif // IOX_POSH_ICEORYX_POSH_CONFIG_HPP
Definition: iceoryx_posh_config.hpp:77
Definition: iceoryx_posh_config.hpp:51
Definition: iceoryx_posh_config.hpp:27