Measure.h File Reference

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

#include "SimTKcommon/basics.h"
#include "SimTKcommon/Simmatrix.h"

Go to the source code of this file.

Classes

class  Measure
 This is the base class for all Measure handle classes. More...
class  SetHandle
class  Measure_< T >
 This is the base handle class for all Measures whose value type is known. More...
class  Constant_< T >
 This creates a Measure whose value is a Topology-stage constant of any type T. More...
class  Sinusoid_< T >
 This measure produces a sinusoidal function of time: m(t) = a*sin(w*t+p) where a=amplitude in arbitrary units, w=frequency in rad/s, p=phase in rad. More...
class  Integrate_< T >
class  Minimum_< T >
 This Measure tracks the minimum value attained by its source operand since the last initialize() call. More...
class  SampleAndHold_< T >
 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(MH, PH)
 Every measure handle class "MH" derived directly or indirectly from the abstract measure handle class "Measure" should include this macro at the beginning of the "public" section of its declaration.
#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.

Functions

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

Detailed Description

This file declares the base class Measure 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 Documentation

#define SimTK_MEASURE_HANDLE_POSTSCRIPT ( MH,
PH   ) 
Value:
static bool isA(const Measure& m)                           \
    {   return dynamic_cast<const Implementation*>(&m.getImpl()) != 0; }  \
    static const MH& getAs(const Measure& m)                    \
    {   assert(isA(m)); return static_cast<const MH&>(m); }     \
    static MH& updAs(Measure& m)                                \
    {   assert(isA(m)); return static_cast<MH&>(m); }           \
    const Implementation& getImpl() const                                 \
    {   return dynamic_cast<const Implementation&>(Measure::getImpl());}  \
    Implementation& updImpl()                                             \
    {   return dynamic_cast<Implementation&>(Measure::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 Measure&)  generic handle to const MH (static)
   MH::updAs(Measure&)        generic handle to writable MH (static)
   MH::isA(Measure&)          test if generic handle is of type MH
   getImpl(const Measure::Implementation&)  
                              generic implementation to const MH::Implementation
   updImpl(Measure::Implementation&)
                              generic implementation to writable MH::Implementation
 

Type checking for the handle class conversions is done only in Debug builds.

#define SimTK_MEASURE_HANDLE_PREAMBLE ( MH,
PH   ) 
Value:
class Implementation;                                 \
    explicit MH(Implementation* imp=0) : PH(imp) {}           \
    MH(Subsystem& sub, Implementation* imp, const SetHandle& sh) : PH(sub,imp,sh) {}

Every measure handle class "MH" derived directly or indirectly from the abstract measure handle class "Measure" 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.


Generated by  doxygen 1.6.2