iceoryx_doc  1.0.1
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 
22 namespace iox
23 {
24 namespace helper
25 {
26 template <typename... ConfigParts>
27 struct SetDefaults;
28 
29 template <typename FirstArg, typename... RemainderArgs>
30 struct SetDefaults<FirstArg, RemainderArgs...>
31 {
32  template <typename BaseType>
33  static void apply(BaseType* me) noexcept
34  {
37  }
38 };
39 
40 template <typename FinalArg>
41 struct SetDefaults<FinalArg>
42 {
43  template <typename BaseType>
44  static void apply(BaseType* me) noexcept
45  {
46  static_cast<FinalArg*>(me)->setDefaults();
47  }
48 };
49 
50 template <typename... ConfigParts>
51 struct Optimize;
52 
53 template <typename FirstArg, typename... RemainderArgs>
54 struct Optimize<FirstArg, RemainderArgs...>
55 {
56  template <typename BaseType>
57  static void apply(BaseType* me) noexcept
58  {
61  }
62 };
63 
64 template <typename FinalArg>
65 struct 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 
75 template <typename... ConfigParts>
76 struct 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: service_description.hpp:29
Definition: iceoryx_posh_config.hpp:77
Definition: iceoryx_posh_config.hpp:51
Definition: iceoryx_posh_config.hpp:27