Custom Class Reference

This class can be used to define new motions. More...

#include <Motion.h>

Inheritance diagram for Custom:
Motion PIMPLHandle< Motion, MotionImpl, true >

List of all members.

Classes

class  Implementation
 This is the abstract base class for Custom Motion implementations. More...

Public Member Functions

 Custom (MobilizedBody &mobod, Implementation *implementation)
 Create a Custom motion.
 SimTK_INSERT_DERIVED_HANDLE_DECLARATIONS (Custom, CustomImpl, Motion)

Protected Member Functions

const ImplementationgetImplementation () const
ImplementationupdImplementation ()

Detailed Description

This class can be used to define new motions.

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

 Motion::Custom myMotion(mobod, new MyMotionImplementation());
 

Alternatively, you can create a subclass of Motion::Custom which creates the Implementation itself:

 class MyMotion : public Motion::Custom {
 public:
   MyMotion(MobilizedBody& mobod) 
     : Motion::Custom(mobod, new MyMotionImplementation()) {}
 };
 

This allows a user to simply write

 MyMotion(mobod);
 

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

Custom ( MobilizedBody mobod,
Implementation implementation 
)

Create a Custom motion.

Parameters:
mobod the MobilizedBody to which this Motion should be added
implementation the object which implements the custom Motion. The Motion::Custom takes over ownership of the implementation object, and deletes it when the Motion itself is deleted.

Member Function Documentation

const Implementation& getImplementation (  )  const [protected]
SimTK_INSERT_DERIVED_HANDLE_DECLARATIONS ( Custom  ,
CustomImpl  ,
Motion   
)
Implementation& updImplementation (  )  [protected]

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

Generated on Thu Aug 12 16:38:01 2010 for SimTKcore by  doxygen 1.6.1