Gazebo Physics

API Reference

6.5.1
gz/physics/FeatureList.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 
18 #ifndef GZ_PHYSICS_FEATURELIST_HH_
19 #define GZ_PHYSICS_FEATURELIST_HH_
20 
21 #include <tuple>
22 
23 #include <gz/physics/Feature.hh>
24 
25 #if defined(_MSC_VER)
26 #pragma warning(push)
27 #pragma warning(disable: 4584)
33 #endif // defined(_MSC_VER)
34 
35 namespace gz
36 {
37  namespace physics
38  {
39  namespace detail
40  {
41  // Forward declarations
42  template <typename...> struct CombineLists;
43  template <bool, typename...> struct SelfConflict;
44  template <typename> struct IterateTuple;
45  }
46 
60  template <typename... FeaturesT>
61  struct FeatureList : detail::IterateTuple<std::tuple<FeaturesT...>>
62  {
67  public: using Features =
68  typename detail::CombineLists<FeaturesT...>::Result;
69 
70  public: using FeatureTuple = std::tuple<FeaturesT...>;
71 
77  public: template <typename F>
78  static constexpr bool HasFeature();
79 
93  public: template <typename SomeFeatureList,
94  bool AssertNoConflict = false>
95  static constexpr bool ConflictsWith();
96 
99  public: using RequiredFeatures = void;
100 
101  // Check that this FeatureList does not contain any self-conflicts.
102  static_assert(!detail::SelfConflict<true, FeaturesT...>::value,
103  "FeatureList ERROR: YOUR LIST CONTAINS CONFLICTING FEATURES!");
104  };
105 
110  template <typename... ConflictingFeatures>
112 
117  template <typename... RequiredFeatures>
119  }
120 }
121 
122 #include <gz/physics/detail/FeatureList.hh>
123 
124 #if defined(_MSC_VER)
125 #pragma warning(pop)
126 #endif // defined(_MSC_VER)
127 #endif // GZ_PHYSICS_FEATURELIST_HH_