Simbody  3.7
SimTK::AbstractMeasure Class Reference

This is the base class for all Measure handle classes. More...

+ Inheritance diagram for SimTK::AbstractMeasure:

Classes

class  Implementation
 The abstract parent of all Measure Implementation classes. More...
 
class  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...
 

Public Member Functions

 AbstractMeasure (Implementation *g=0)
 Provide an Implementation for this AbstractMeasure and bump its reference count. More...
 
 AbstractMeasure (Subsystem &, Implementation *g, const SetHandle &)
 Construct this handle with a given Implementation object (whose reference count will be bumped) and then let the given Subsystem adopt this Measure (which will again bump the Implementation's reference count, leaving us with two new handles). More...
 
 AbstractMeasure (const AbstractMeasure &)
 Shallow copy constructor copies the pointer from the source Implementation object and bumps its reference count. More...
 
AbstractMeasureoperator= (const AbstractMeasure &source)
 Shallow assignment operator results in this handle referencing the same Implementation object as does the source. More...
 
 ~AbstractMeasure ()
 Destructor decrements the Implementation's reference count and deletes the object if the count goes to zero. More...
 
AbstractMeasureshallowAssign (const AbstractMeasure &)
 Shallow assignment operator destructs the current Implementation object (meaning its reference count is decremented and the object actually deleted only if the count goes to zero), then copies the Implementation pointer from the source and bumps its reference count. More...
 
AbstractMeasuredeepAssign (const AbstractMeasure &source)
 Deep assignment clones the Implementation object pointed to by the source handle, so that this handle ends up pointing to a new Measure object similar to the original but not yet contained in any Subsystem. More...
 
int getNumTimeDerivatives () const
 Every Measure can produce a value, and some can provide one or more total derivatives with respect to time of that value. More...
 
Stage getDependsOnStage (int derivOrder=0) const
 At what Stage can we expect the value of this AbstractMeasure or one of its time derivatives to be available? Users of Measures will typically impose restrictions on the levels they will accept. More...
 
bool isSameMeasure (const AbstractMeasure &other) const
 There can be multiple handles on the same Measure. More...
 
bool isEmptyHandle () const
 
bool isInSubsystem () const
 Test whether this Measure object has been adopted by a Subsystem. More...
 
const SubsystemgetSubsystem () const
 Return a reference to the Subsystem that owns this Measure. More...
 
bool isSameSubsystem (const Subsystem &) const
 Is getSubsystem() the same as the passed-in Subsystem? More...
 
MeasureIndex getSubsystemMeasureIndex () const
 Return the MeasureIndex by which this Measure is known to the Subsystem that owns it. More...
 
const ImplementationgetImpl () const
 
ImplementationupdImpl ()
 
bool hasImpl () const
 
int getRefCount () const
 

Friends

class Implementation
 

Detailed Description

This is the base class for all Measure handle classes.

This class is not templatized, and represents a Measure generically without knowledge of its value type. This is useful for most of the basic operations that are performed on measures, such as realization, adoption by a Subsystem, and other bookkeeping tasks. For most user purposes, the still-generic derived class Measure_<T> is a more useful handle since its value, of known type T, can be obtained. All the built-in concrete Measure types derive from Measure_<T> rather than AbstractMeasure. The various concrete Measures, built in or otherwise, may set restrictions on the kinds of types that are allowable as the template argument.

Note that handles always consist of exactly one pointer, and handle classes are always concrete (meaning they have no virtual methods).

Constructor & Destructor Documentation

◆ AbstractMeasure() [1/3]

SimTK::AbstractMeasure::AbstractMeasure ( Implementation g = 0)
inlineexplicit

Provide an Implementation for this AbstractMeasure and bump its reference count.

This is also the default constructor for the base class producing an empty handle.

◆ AbstractMeasure() [2/3]

SimTK::AbstractMeasure::AbstractMeasure ( Subsystem sub,
Implementation g,
const SetHandle  
)
inline

Construct this handle with a given Implementation object (whose reference count will be bumped) and then let the given Subsystem adopt this Measure (which will again bump the Implementation's reference count, leaving us with two new handles).

◆ AbstractMeasure() [3/3]

SimTK::AbstractMeasure::AbstractMeasure ( const AbstractMeasure src)
inline

Shallow copy constructor copies the pointer from the source Implementation object and bumps its reference count.

◆ ~AbstractMeasure()

SimTK::AbstractMeasure::~AbstractMeasure ( )
inline

Destructor decrements the Implementation's reference count and deletes the object if the count goes to zero.

Member Function Documentation

◆ operator=()

AbstractMeasure& SimTK::AbstractMeasure::operator= ( const AbstractMeasure source)
inline

Shallow assignment operator results in this handle referencing the same Implementation object as does the source.

See also
shallowAssign for more details

◆ shallowAssign()

AbstractMeasure & SimTK::AbstractMeasure::shallowAssign ( const AbstractMeasure src)
inline

Shallow assignment operator destructs the current Implementation object (meaning its reference count is decremented and the object actually deleted only if the count goes to zero), then copies the Implementation pointer from the source and bumps its reference count.

This is what the copy assignment operator= does for this class.

◆ deepAssign()

AbstractMeasure & SimTK::AbstractMeasure::deepAssign ( const AbstractMeasure source)
inline

Deep assignment clones the Implementation object pointed to by the source handle, so that this handle ends up pointing to a new Measure object similar to the original but not yet contained in any Subsystem.

◆ getNumTimeDerivatives()

int SimTK::AbstractMeasure::getNumTimeDerivatives ( ) const
inline

Every Measure can produce a value, and some can provide one or more total derivatives with respect to time of that value.

This method reports how many are available: 1 -> first derivative d/dt is available, 2 -> first and second derivative d^2/dt^2 are available, etc. We interpret the "0th derivative" to be the Measure's value.

Returns
The maximum available derivative order.

◆ getDependsOnStage()

Stage SimTK::AbstractMeasure::getDependsOnStage ( int  derivOrder = 0) const
inline

At what Stage can we expect the value of this AbstractMeasure or one of its time derivatives to be available? Users of Measures will typically impose restrictions on the levels they will accept.

Parameters
[in]derivOrderWhich derivative level is to be checked: 0 -> the value, 1 -> the 1st time derivative, etc. Must not be higher than the value returned by getNumTimeDerivatives().
Returns
The Stage after which this value is available.

◆ isSameMeasure()

bool SimTK::AbstractMeasure::isSameMeasure ( const AbstractMeasure other) const
inline

There can be multiple handles on the same Measure.

◆ isEmptyHandle()

bool SimTK::AbstractMeasure::isEmptyHandle ( ) const
inline

◆ isInSubsystem()

bool SimTK::AbstractMeasure::isInSubsystem ( ) const
inline

Test whether this Measure object has been adopted by a Subsystem.

◆ getSubsystem()

const Subsystem & SimTK::AbstractMeasure::getSubsystem ( ) const
inline

Return a reference to the Subsystem that owns this Measure.

Will throw an exception if the Measure is not currently owned by any Subsystem.

◆ isSameSubsystem()

bool SimTK::AbstractMeasure::isSameSubsystem ( const Subsystem other) const
inline

Is getSubsystem() the same as the passed-in Subsystem?

◆ getSubsystemMeasureIndex()

MeasureIndex SimTK::AbstractMeasure::getSubsystemMeasureIndex ( ) const
inline

Return the MeasureIndex by which this Measure is known to the Subsystem that owns it.

Will throw an exception if the Measure is not currently owned by any Subsystem.

◆ getImpl()

const Implementation& SimTK::AbstractMeasure::getImpl ( ) const
inline

◆ updImpl()

Implementation& SimTK::AbstractMeasure::updImpl ( )
inline

◆ hasImpl()

bool SimTK::AbstractMeasure::hasImpl ( ) const
inline

◆ getRefCount()

int SimTK::AbstractMeasure::getRefCount ( ) const
inline

Friends And Related Function Documentation

◆ Implementation

friend class Implementation
friend

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