Simbody
|
This file declares the base class AbstractMeasure for all derived Measure handle classes, and the handle classes for built-in Measures. More...
#include "SimTKcommon/basics.h"
#include "SimTKcommon/Simmatrix.h"
#include <cassert>
Go to the source code of this file.
Classes | |
class | SimTK::AbstractMeasure |
This is the base class for all Measure handle classes. More... | |
class | SimTK::AbstractMeasure::SetHandle |
class | SimTK::Measure_< T > |
This is the base handle class for all Measures whose value type is known. More... | |
class | SimTK::Measure_< T >::Constant |
This creates a Measure whose value is a Topology-stage constant of any type T. More... | |
class | SimTK::Measure_< T >::Zero |
This creates a Measure::Constant whose value is always T(0) and can't be changed. More... | |
class | SimTK::Measure_< T >::One |
This creates a Measure::Constant whose value is always T(1) and can't be changed. More... | |
class | SimTK::Measure_< T >::Time |
This creates a Measure::Time whose value is always T(time). More... | |
class | SimTK::Measure_< T >::Variable |
This creates a Measure whose value is a discrete State variable of any type T. More... | |
class | SimTK::Measure_< T >::Result |
This Measure holds the result of some externally-determined computation, and helps to coordinate the validity of that computation with respect to the state variables. More... | |
class | SimTK::Measure_< T >::Sinusoid |
This measure produces a sinusoidal function of time: More... | |
class | SimTK::Measure_< T >::Plus |
This Measure is the sum of two Measures of the same type T. More... | |
class | SimTK::Measure_< T >::Minus |
This Measure is the difference of two Measures of the same type T. More... | |
class | SimTK::Measure_< T >::Scale |
This Measure multiplies some other Measure by a Real scale factor. More... | |
class | SimTK::Measure_< T >::Integrate |
class | SimTK::Measure_< T >::Differentiate |
This Measure operator returns the time derivative of its operand measure, or a numerical approximation of the time derivative if an analytic one is not available. More... | |
class | SimTK::Measure_< T >::Minimum |
This Measure tracks the minimum value attained by its source operand since the last initialize() call. More... | |
class | SimTK::Measure_< T >::SampleAndHold |
This is a Measure operator which, upon occurrence of a designated event, samples its source Measure and then holds its value in a discrete state variable until the next occurrence of the event. More... | |
Namespaces | |
namespace | SimTK |
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with other symbols. | |
Defines | |
#define | SimTK_MEASURE_HANDLE_PREAMBLE_BASE(MH, PH) |
Every measure handle class "MH" derived directly or indirectly from the AbstractMeasure handle class should include this macro at the beginning of the "public" section of its declaration. | |
#define | SimTK_MEASURE_HANDLE_PREAMBLE(MH, PH) |
#define | SimTK_MEASURE_HANDLE_PREAMBLE_ABSTRACT(MH, PH) |
#define | SimTK_MEASURE_HANDLE_POSTSCRIPT(MH, PH) |
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. | |
Typedefs | |
typedef Measure_< Real > | SimTK::Measure |
A convenient abbreviation for the most common kind of Measure -- one which returns a single Real result. | |
Functions | |
SimTK::SimTK_DEFINE_UNIQUE_INDEX_TYPE (MeasureIndex) | |
Define a unique integral type for safe indexing of Measures. |
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 | |||
) |
class Implementation; \ explicit MH(Implementation* imp) : PH(imp) {} \ MH(Subsystem& sub, Implementation* imp, const SetHandle& sh) \ : 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;}
Every measure handle class "MH" derived directly or indirectly from the AbstractMeasure handle class should include this macro 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_PREAMBLE | ( | MH, | |
PH | |||
) |
SimTK_MEASURE_HANDLE_PREAMBLE_BASE(MH,PH) \ MH() : PH(new Implementation()) {} \ explicit MH(Subsystem& sub) \ : PH(sub,new Implementation(), SetHandle()) {}
#define SimTK_MEASURE_HANDLE_PREAMBLE_ABSTRACT | ( | MH, | |
PH | |||
) |
SimTK_MEASURE_HANDLE_PREAMBLE_BASE(MH,PH) \ MH() : PH() {} \ explicit MH(Subsystem& sub) : PH(sub) {}
#define SimTK_MEASURE_HANDLE_POSTSCRIPT | ( | MH, | |
PH | |||
) |
static bool isA(const AbstractMeasure& m) \ { return dynamic_cast<const Implementation*>(&m.getImpl()) != 0; } \ static const MH& getAs(const AbstractMeasure& m) \ { assert(isA(m)); return static_cast<const MH&>(m); } \ static MH& updAs(AbstractMeasure& m) \ { assert(isA(m)); return static_cast<MH&>(m); } \ const Implementation& getImpl() const \ { return dynamic_cast<const Implementation&> \ (AbstractMeasure::getImpl());} \ Implementation& updImpl() \ { return dynamic_cast<Implementation&>(AbstractMeasure::updImpl());}
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(const AbstractMeasure::Implementation&) generic implementation to const MH::Implementation updImpl(AbstractMeasure::Implementation&) generic implementation to writable MH::Implementation
Type checking for the handle class conversions is done only in Debug builds.