This file declares the base class AbstractMeasure for all derived Measure handle classes, and the handle classes for built-in Measures.
More...
This file declares the base class AbstractMeasure for all derived Measure handle classes, and the handle classes for built-in Measures.
Measure handles provide the end user API, while the implementations of Measures derive from the abstract Measure::Implementation class defined in MeasureImplementation.h. Measure Implementation classes provide the Measure developer's API.
#define SimTK_MEASURE_HANDLE_PREAMBLE_BASE |
( |
| MH, |
|
|
| PH ) |
Value: class Implementation; \
explicit MH(Implementation* imp) : PH(imp) {} \
: PH(sub,imp,sh) {} \
MH& operator=(const MH& src) {PH::operator=(src); return *this;}\
MH& shallowAssign(const MH& src) {PH::shallowAssign(src); return *this;}\
MH& deepAssign(const MH& src) {PH::deepAssign(src); return *this;}
An object of this type is used as a dummy argument to make sure the automatically-generated handle co...
Definition Measure.h:156
A Subsystem is expected to be part of a larger System and to have interdependencies with other subsys...
Definition Subsystem.h:55
Every concrete measure handle class "MH" derived from a parent handle "PH" that derives directly or indirectly from the AbstractMeasure handle class should include the macro SimTK_MEASURE_HANDLE_PREAMBLE(MH,PH) at the beginning of the public section of its declaration.
It performs the following declarations:
MH::Implementation the handle's local implementation class
MH::MH() default constructor creates an empty handle
MH::MH(Implementation*) create a handle referencing an existing object
MH::MH(Subsystem&, Implementation*)
create a handle referencing an existing but
unowned object, then installs that in the
given Subsystem which becomes the owner
MH::Implementation must be defined elsewhere as a class derived from Measure::Implementation.
#define SimTK_MEASURE_HANDLE_POSTSCRIPT |
( |
| MH, |
|
|
| PH ) |
Value:
{ return dynamic_cast<const Implementation*>(&m.getImpl()) != 0; } \
{ assert(isA(m)); return static_cast<const MH&>(m); } \
{ assert(isA(m)); return static_cast<MH&>(m); } \
const Implementation& getImpl() const \
Implementation& updImpl() \
#define SimTK_DYNAMIC_CAST_DEBUG
Use this macro to generate a cast that is dynamic_cast in Debug builds but static_cast in Release bui...
Definition SimTKcommon/include/SimTKcommon/internal/common.h:559
This is the base class for all Measure handle classes.
Definition Measure.h:151
Implementation & updImpl()
Definition Measure.h:243
const Implementation & getImpl() const
Definition Measure.h:242
Every measure handle class "MH" derived directly or indirectly from the abstract measure handle class "Measure" should include this macro at the end of the "public" section of its declaration.
The macro expects there to be a local class, MH::Implementation, already declared. (MH::Implementation is the type of MH's implementation object to be derived from Measure::Implementation and defined elsewhere.) Then the following type-safe downcast methods will be added to MH's definition:
MH::getAs(const AbstractMeasure&) generic handle to const MH (static)
MH::updAs(AbstractMeasure&) generic handle to writable MH (static)
MH::isA(AbstractMeasure&) test if generic handle is of type MH
getImpl() generic implementation to const MH::Implementation
updImpl() generic implementation to writable MH::Implementation
Type checking for the handle class conversions is done only in Debug builds.