Gazebo Physics

API Reference

5.3.2
FeaturePolicy< _Scalar, _Dim > Struct Template Reference

FeaturePolicy is a "policy class" used to provide metadata to features about what kind of simulation engine they are going to be used in. More...

#include <FeaturePolicy.hh>

Public Types

enum  { Dim = _Dim }
 
using Scalar = _Scalar
 

Detailed Description

template<typename _Scalar, std::size_t _Dim>
struct ignition::physics::FeaturePolicy< _Scalar, _Dim >

FeaturePolicy is a "policy class" used to provide metadata to features about what kind of simulation engine they are going to be used in.

Currently, the information provided by the native FeaturePolicy includes

- Scalar: double or float. Determines the numerical precision used
          by the simulation.

- Dim: 2 or 3. Determines whether the simulation is a 2D simulation
       or a 3D simulation.

Custom features may require additional metadata, which can be encoded into a custom FeaturePolicy. However, keep in mind that most features require at least the Scalar and Dim fields, so be sure to provide those in your feature policy or else you are likely to encounter compilation errors.

Feature policies are typically composable, but you must be careful about resolving ambiguously defined fields. If two parent policies are each defining a field with the same name, then the child policy must explicitly define that field itself. Preferably, the child would define the field based on one of its parent's definitions, e.g.:

struct Child : public Parent1, public Parent2
{
using AmbiguousField = typename Parent1::AmbiguousField;
};

This design pattern is known as "Policy-based design". For more information, see: https://en.wikipedia.org/wiki/Policy-based_design

Member Typedef Documentation

◆ Scalar

using Scalar = _Scalar

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
Dim 

The documentation for this struct was generated from the following file: