|
Simbody
3.4 (development)
|
The handle class Constraint::Custom (dataless) and its companion class Constraint::Custom::Implementation can be used together to define new Constraint types with arbitrary properties. More...
#include <Constraint.h>
Inheritance diagram for SimTK::Constraint::Custom:Classes | |
| class | Implementation |
| This is the abstract base class for the implementation of custom constraints. See Constraint::Custom for more information. More... | |
Public Member Functions | |
| Custom (Implementation *implementation) | |
| Create a Custom Constraint. | |
| Custom () | |
| Default constructor creates an empty handle. | |
| SimTK_INSERT_DERIVED_HANDLE_DECLARATIONS (Custom, CustomImpl, Constraint) | |
Protected Member Functions | |
| const Implementation & | getImplementation () const |
| Implementation & | updImplementation () |
The handle class Constraint::Custom (dataless) and its companion class Constraint::Custom::Implementation can be used together to define new Constraint types with arbitrary properties.
To use it, create a class that extends Constraint::Custom::Implementation. You can then create an instance of it and pass it to the Constraint::Custom constructor:
Constraint::Custom myConstraint(new MyConstraintImplementation( args ));
Alternatively, you can also create a new Handle class which is a subclass of Constraint::Custom and which creates the Implementation itself in its constructors.
class MyConstraint : public Constraint::Custom { public: MyConstraint( args ) : Constraint::Custom(new MyForceImplementation( args )) { } }
This allows an end user to simply write
MyConstraint( args );
and not worry about implementation classes or creating objects on the heap. If you do this, your Constraint::Custom subclass must not have any data members or virtual methods. If it does, it will not work correctly. Instead, store all data in the Implementation subclass.
| SimTK::Constraint::Custom::Custom | ( | Implementation * | implementation | ) | [explicit] |
Create a Custom Constraint.
| implementation | The object which implements the custom constraint. The Constraint::Custom takes over ownership of the implementation object, and deletes it when the Constraint itself is deleted. |
| SimTK::Constraint::Custom::Custom | ( | ) | [inline] |
Default constructor creates an empty handle.
| SimTK::Constraint::Custom::SimTK_INSERT_DERIVED_HANDLE_DECLARATIONS | ( | Custom | , |
| CustomImpl | , | ||
| Constraint | |||
| ) |
| const Implementation& SimTK::Constraint::Custom::getImplementation | ( | ) | const [protected] |
| Implementation& SimTK::Constraint::Custom::updImplementation | ( | ) | [protected] |