SurgSim::Physics::ConstraintImplementationFactory Class Reference

This class manages ConstraintImplementations, and can be used to look up the correct implementation by representation and constraint type. More...

`#include <SurgSim/Physics/ConstraintImplementationFactory.h>`

## Public Member Functions

| ConstraintImplementationFactory ()
| Constructor. More...
| ~ConstraintImplementationFactory ()
| Destructor. More...
std::shared_ptr< ConstraintImplementation > | getImplementation (std::type_index representationType, ConstraintType constraintType)
| Get the instance of a ConstraintImplementation for a specific representation and constraint type. More...
void | addImplementation (std::type_index typeIndex, std::shared_ptr< ConstraintImplementation > implementation)
| Add an implementation to the internal directory. More...

## Private Attributes

std::unordered_map< std::type_index, std::array< std::shared_ptr< ConstraintImplementation >, NUM_CONSTRAINT_TYPES > > | m_implementations
| Lookup table for constraint implementations. More...

## Detailed Description

This class manages ConstraintImplementations, and can be used to look up the correct implementation by representation and constraint type.

The only maintenance that needs to be done right now when a new ConstraintImplementation is added is to add a call into the constructor.

## Constructor & Destructor Documentation

## ConstraintImplementationFactory()

SurgSim::Physics::ConstraintImplementationFactory::ConstraintImplementationFactory | ( |  | ) |

Constructor.

## ~ConstraintImplementationFactory()

SurgSim::Physics::ConstraintImplementationFactory::~ConstraintImplementationFactory | ( |  | ) |

Destructor.

## Member Function Documentation

## addImplementation()

void SurgSim::Physics::ConstraintImplementationFactory::addImplementation | ( | std::type_index | typeIndex,
|  | std::shared_ptr< ConstraintImplementation > | implementation
| ) |  |

Add an implementation to the internal directory.

Parameters

  typeIndex | The type of representation associated with the implementation.
  implementation | The ConstraintImplementation to add.

## getImplementation()

std::shared_ptr< ConstraintImplementation > SurgSim::Physics::ConstraintImplementationFactory::getImplementation | ( | std::type_index | representationType,
|  | ConstraintType | constraintType
| ) |  |

Get the instance of a ConstraintImplementation for a specific representation and constraint type.

Parameters

  representationType | Type index of the representation.
  constraintType | Type of the constraint.

Returns
  a pointer to an implementation if the implementation can be found, nullptr otherwise.

## Member Data Documentation

## m_implementations

std::unordered_map<std::type_index, std::array<std::shared_ptr<ConstraintImplementation>, NUM_CONSTRAINT_TYPES> > SurgSim::Physics::ConstraintImplementationFactory::m_implementations

private

Lookup table for constraint implementations.

The documentation for this class was generated from the following files:

- SurgSim/Physics/ConstraintImplementationFactory.h
- SurgSim/Physics/ConstraintImplementationFactory.cpp