Simbody
Classes | Public Member Functions | Friends

SimTK::AbstractMeasure Class Reference

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

#include <Measure.h>

Inheritance diagram for SimTK::AbstractMeasure:

List of all members.

Classes

class  Implementation
 The abstract parent of all Measure Implementation classes. More...
class  SetHandle

Public Member Functions

 AbstractMeasure (Implementation *g=0)
 Provide an Implementation for this AbstractMeasure and bump its reference count.
 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).
 AbstractMeasure (const AbstractMeasure &)
 Shallow copy constructor copies the pointer from the source Implementation object and bumps its reference count.
AbstractMeasureoperator= (const AbstractMeasure &source)
 Shallow assignment operator results in this handle referencing the same Implementation object as does the source.
 ~AbstractMeasure ()
 Destructor decrements the Implementation's reference count and deletes the object if the count goes to zero.
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.
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.
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.
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.
bool isSameMeasure (const AbstractMeasure &other) const
 There can be multiple handles on the same Measure.
bool isEmptyHandle () const
bool isInSubsystem () const
 Test whether this Measure object has been adopted by a Subsystem.
const SubsystemgetSubsystem () const
 Return a reference to the Subsystem that owns this Measure.
MeasureIndex getSubsystemMeasureIndex () const
 Return the MeasureIndex by which this Measure is known to the Subsystem that owns it.
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

SimTK::AbstractMeasure::AbstractMeasure ( Implementation g = 0) [inline, explicit]

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.

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).

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

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

SimTK::AbstractMeasure::~AbstractMeasure ( ) [inline]

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


Member Function Documentation

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
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.

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.

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.
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.
bool SimTK::AbstractMeasure::isSameMeasure ( const AbstractMeasure other) const [inline]

There can be multiple handles on the same Measure.

bool SimTK::AbstractMeasure::isEmptyHandle ( ) const [inline]
bool SimTK::AbstractMeasure::isInSubsystem ( ) const [inline]

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

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.

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.

const Implementation& SimTK::AbstractMeasure::getImpl ( ) const [inline]
Implementation& SimTK::AbstractMeasure::updImpl ( ) [inline]
bool SimTK::AbstractMeasure::hasImpl ( ) const [inline]
int SimTK::AbstractMeasure::getRefCount ( ) const [inline]

Friends And Related Function Documentation

friend class Implementation [friend]

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines