Gazebo Physics

API Reference

2.6.2
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 namespace ignition
26 {
27  namespace physics
28  {
29  namespace detail
30  {
31  // Forward declarations
32  template <typename...> struct CombineLists;
33  template <bool, typename...> struct SelfConflict;
34  template <typename> struct IterateTuple;
35  }
36 
50  template <typename... FeaturesT>
51  struct FeatureList : detail::IterateTuple<std::tuple<FeaturesT...>>
52  {
57  public: using Features =
58  typename detail::CombineLists<FeaturesT...>::Result;
59 
60  public: using FeatureTuple = std::tuple<FeaturesT...>;
61 
67  public: template <typename F>
68  static constexpr bool HasFeature();
69 
83  public: template <typename SomeFeatureList,
84  bool AssertNoConflict = false>
85  static constexpr bool ConflictsWith();
86 
89  public: using RequiredFeatures = void;
90 
91  // Check that this FeatureList does not contain any self-conflicts.
92  static_assert(!detail::SelfConflict<true, FeaturesT...>::value,
93  "FeatureList ERROR: YOUR LIST CONTAINS CONFLICTING FEATURES!");
94  };
95 
100  template <typename... ConflictingFeatures>
102 
107  template <typename... RequiredFeatures>
109  }
110 }
111 
112 #include <gz/physics/detail/FeatureList.hh>
113 
114 #endif
If your feature is known to require any other features, then you should have your feature class inher...
Definition: gz/physics/FeatureList.hh:108
void RequiredFeatures
All the features required by this FeatureList will be included in CombineLists.
Definition: gz/physics/FeatureList.hh:89
static constexpr bool ConflictsWith()
A static constexpr function which indicates whether any features in SomeFeatureList conflict with any...
Use a FeatureList to aggregate a list of Features.
Definition: gz/physics/FeatureList.hh:51
static constexpr bool HasFeature()
A static constexpr function which indicates whether a given Feature, F, is contained in this list.
If your feature is known to conflict with any other feature, then you should have your feature class ...
Definition: gz/physics/FeatureList.hh:101
typename detail::CombineLists< FeaturesT... >::Result Features
Definition: gz/physics/FeatureList.hh:58