Simbody
Classes | Public Member Functions | Protected Member Functions

SimTK::MobilizedBody::Custom Class Reference

The handle class MobilizedBody::Custom (dataless) and its companion class MobilizedBody::Custom::Implementation can be used together to define new MobilizedBody types with arbitrary properties. More...

#include <MobilizedBody.h>

Inheritance diagram for SimTK::MobilizedBody::Custom:

List of all members.

Classes

class  Implementation

Public Member Functions

 Custom (MobilizedBody &parent, Implementation *implementation, const Body &body, Direction direction=Forward)
 Custom (MobilizedBody &parent, Implementation *implementation, const Transform &inbFrame, const Body &body, const Transform &outbFrame, Direction direction=Forward)
 SimTK_INSERT_DERIVED_HANDLE_DECLARATIONS (Custom, CustomImpl, MobilizedBody)

Protected Member Functions

const ImplementationgetImplementation () const
ImplementationupdImplementation ()
 Custom ()

Detailed Description

The handle class MobilizedBody::Custom (dataless) and its companion class MobilizedBody::Custom::Implementation can be used together to define new MobilizedBody types with arbitrary properties.

To use it, create a class that extends MobilizedBody::Custom::Implementation. You can then create an instance of it and pass it to the MobilizedBody::Custom constructor:

 MobilizedBody::Custom myMobilizedBody(new MyMobilizedBodyImplementation(args));
 

Alternatively, you can also create a new Handle class which is a subclass of MobilizedBody::Custom and which creates the Implementation itself in its constructors.

 class MyMobilizedBody : public MobilizedBody::Custom {
 public:
   MyMobilizedBody(args) : MobilizedBody::Custom(new MyForceImplementation(args)) {
   }
 }
 

This allows an end user to simply write

 MyMobilizedBody(args);
 

and not worry about implementation classes or creating objects on the heap. If you do this, your MobilizedBody::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.


Constructor & Destructor Documentation

SimTK::MobilizedBody::Custom::Custom ( MobilizedBody parent,
Implementation implementation,
const Body body,
Direction  direction = Forward 
)
SimTK::MobilizedBody::Custom::Custom ( MobilizedBody parent,
Implementation implementation,
const Transform inbFrame,
const Body body,
const Transform outbFrame,
Direction  direction = Forward 
)
SimTK::MobilizedBody::Custom::Custom ( ) [inline, protected]

Member Function Documentation

SimTK::MobilizedBody::Custom::SimTK_INSERT_DERIVED_HANDLE_DECLARATIONS ( Custom  ,
CustomImpl  ,
MobilizedBody   
)
const Implementation& SimTK::MobilizedBody::Custom::getImplementation ( ) const [protected]
Implementation& SimTK::MobilizedBody::Custom::updImplementation ( ) [protected]

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines