Simbody  3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Measure.h File Reference

This file declares the base class AbstractMeasure for all derived Measure handle classes, and the handle classes for built-in Measures. More...

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
 An object of this type is used as a dummy argument to make sure the automatically-generated handle constructor's signature doesn't conflict with an explicitly-defined one. More...
 
class  SimTK::Measure_< T >
 This is the base handle class for all Measures whose value type is known, including all the Simbody built-in Measure types. 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 >::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 >::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
 This measure yields the time integral of a given derivative measure, initializing with an initial condition measure of the same type T. More...
 
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 >::Extreme
 This Measure tracks extreme values attained by the elements of its source operand since the last initialize() call or explicit call to setValue(). More...
 
class  SimTK::Measure_< T >::Minimum
 Track the minimum value of the operand (signed). More...
 
class  SimTK::Measure_< T >::Maximum
 Track the maximum value of the operand (signed). More...
 
class  SimTK::Measure_< T >::MaxAbs
 Track the value of the operand that is of maximum absolute value. More...
 
class  SimTK::Measure_< T >::MinAbs
 Track the value of the operand that is of minimum absolute value (not very useful). More...
 
class  SimTK::Measure_< T >::Delay
 (CAUTION: still under development) This is a Measure whose value at time t is the value that its source operand had at time t-delay for a specified delay. More...
 
class  SimTK::Measure_< T >::SampleAndHold
 NOT IMPLEMENTED YET – 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

 SimTK
 This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with other symbols.
 

Macros

#define SimTK_MEASURE_HANDLE_PREAMBLE_BASE(MH, PH)
 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. More...
 
#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. More...
 

Typedefs

typedef Measure_< Real > SimTK::Measure
 This typedef is a convenient abbreviation for the most common kind of Measure – one that returns a single Real result; the underlying class is Measure_; look there for documentation. More...
 

Enumerations

enum  Operation
 

Functions

 SimTK::SimTK_DEFINE_UNIQUE_INDEX_TYPE (MeasureIndex)
 Define a unique integral type for safe indexing of Measures. More...
 

Detailed Description

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.

Macro Definition Documentation

#define SimTK_MEASURE_HANDLE_PREAMBLE_BASE (   MH,
  PH 
)
Value:
class Implementation; \
explicit MH(Implementation* imp) : PH(imp) {} \
MH(SimTK::Subsystem& sub, Implementation* 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;}
A Subsystem is expected to be part of a larger System and to have interdependencies with other subsys...
Definition: Subsystem.h:55
An object of this type is used as a dummy argument to make sure the automatically-generated handle co...
Definition: Measure.h:156

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_PREAMBLE (   MH,
  PH 
)
Value:
MH() : PH(new Implementation()) {} \
explicit MH(SimTK::Subsystem& sub) \
: PH(sub,new Implementation(), typename PH::SetHandle()) {}
A Subsystem is expected to be part of a larger System and to have interdependencies with other subsys...
Definition: Subsystem.h:55
#define SimTK_MEASURE_HANDLE_PREAMBLE_BASE(MH, PH)
Every concrete measure handle class "MH" derived from a parent handle "PH" that derives directly or i...
Definition: Measure.h:64
#define SimTK_MEASURE_HANDLE_PREAMBLE_ABSTRACT (   MH,
  PH 
)
Value:
MH() : PH() {}
#define SimTK_MEASURE_HANDLE_PREAMBLE_BASE(MH, PH)
Every concrete measure handle class "MH" derived from a parent handle "PH" that derives directly or i...
Definition: Measure.h:64
#define SimTK_MEASURE_HANDLE_POSTSCRIPT (   MH,
  PH 
)
Value:
static bool isA(const SimTK::AbstractMeasure& m) \
{ return dynamic_cast<const Implementation*>(&m.getImpl()) != 0; } \
static const MH& getAs(const SimTK::AbstractMeasure& m) \
{ assert(isA(m)); return static_cast<const MH&>(m); } \
static MH& updAs(SimTK::AbstractMeasure& m) \
{ assert(isA(m)); return static_cast<MH&>(m); } \
const Implementation& getImpl() const \
{ return SimTK_DYNAMIC_CAST_DEBUG<const Implementation&> \
Implementation& updImpl() \
{ return SimTK_DYNAMIC_CAST_DEBUG<Implementation&> \
This is the base class for all Measure handle classes.
Definition: Measure.h:151
Implementation & updImpl()
Definition: Measure.h:241
const Implementation & getImpl() const
Definition: Measure.h:240

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.

Enumeration Type Documentation

enum Operation