Gazebo Physics

API Reference

5.3.2
gz/physics/TemplateHelpers.hh File Reference
#include <type_traits>

Go to the source code of this file.

Classes

struct  ConstCompatible< To, From >
 Contains a static constexpr field named value which will be true if the type From has a const-quality less than or equal to the type To. More...
 
struct  ConstCompatible< To, const From >
 
struct  Empty
 Useful as a blank placeholder in template metaprogramming. More...
 
struct  type< T >
 This can be used to turn a type into a function argument, which is useful for template metaprogramming. More...
 

Namespaces

 ignition
 
 ignition::physics
 

Macros

#define IGN_PHYSICS_CREATE_SELECTOR(X)
 Use this macro to create an API "selector" for a custom class. More...
 

Typedefs

template<typename... >
using void_t = void
 

Macro Definition Documentation

◆ IGN_PHYSICS_CREATE_SELECTOR

#define IGN_PHYSICS_CREATE_SELECTOR (   X)
Value:
template<typename InFeature> \
struct Select ## X \
{ \
template<typename F, typename PolicyT, typename FeaturesT, \
struct Implementation \
{ \
}; \
\
template<typename F, typename PolicyT, typename FeaturesT> \
struct Implementation<F, PolicyT, FeaturesT, \
typename F::template X <PolicyT, FeaturesT>>> \
{ \
using type = typename F::template X <PolicyT, FeaturesT>; \
}; \
\
template <typename PolicyT, typename FeaturesT> \
using type = typename Implementation<InFeature, PolicyT, FeaturesT>::type; \
};

Use this macro to create an API "selector" for a custom class.

Features may define APIs for class types that are not anticipated ahead of time by the ign-physics library. When aggregating the API for that class from a set of features, the Aggregator must be given a Selector that can ignore features that don't mention the class (or else a compilation failure would occur).

This macro creates a class that uses SFINAE (https://en.wikipedia.org/wiki/Substitution_failure_is_not_an_error) to ignore features that don't define an API for the class of interest (X). When using this macro, pass in the name of the class that you want the selector to look for. If the class name is X, then this will create a selector named SelectX. E.g. IGN_PHYSICS_CREATE_SELECTOR(RevoluteJoint) will create a class named SelectRevoluteJoint which can be passed to an Aggregator to extract the RevoluteJoint API from a list of features.

Useful as a blank placeholder in template metaprogramming.
Definition: gz/physics/TemplateHelpers.hh:28
void void_t
Definition: gz/physics/TemplateHelpers.hh:37