API  4.2
For C++ developers
OpenSim::AbstractOutput Class Referenceabstract

Output formalizes the access to a value of interest computed by the owning Component. More...

+ Inheritance diagram for OpenSim::AbstractOutput:

Public Member Functions

 AbstractOutput ()
 
 AbstractOutput (const std::string &name, SimTK::Stage dependsOnStage, bool isList)
 
 AbstractOutput (const AbstractOutput &other)=default
 
virtual ~AbstractOutput ()=default
 
const std::string & getName () const
 Output's name. More...
 
const SimTK::Stage & getDependsOnStage () const
 Output's dependence on System being realized to at least this System::Stage. More...
 
bool isListOutput () const
 Can this Output have more than one channel? More...
 
const ComponentgetOwner () const
 Output's owning Component. More...
 
std::string getPathName () const
 This returns <absolute-path-to-component>|<output-name>. More...
 
virtual void clearChannels ()=0
 Output Interface. More...
 
virtual void addChannel (const std::string &channelName)=0
 Add a channel to this Output. More...
 
virtual const AbstractChannelgetChannel (const std::string &name) const =0
 
virtual std::string getTypeName () const =0
 The name of the value type (e.g., double) produced by this output. More...
 
virtual std::string getValueAsString (const SimTK::State &state) const =0
 
virtual bool isCompatible (const AbstractOutput &) const =0
 
virtual void compatibleAssign (const AbstractOutput &)=0
 
AbstractOutputoperator= (const AbstractOutput &o)
 
virtual AbstractOutputclone () const =0
 
unsigned int getNumberOfSignificantDigits () const
 Specification for number of significant figures in string value. More...
 
void setNumberOfSignificantDigits (unsigned int numSigFigs)
 

Protected Member Functions

void setOwner (const Component &owner)
 

Protected Attributes

SimTK::ReferencePtr< const Component_owner
 

Detailed Description

Output formalizes the access to a value of interest computed by the owning Component.

The value is then exposed and easily accessible for use by other components (e.g. to satisfy an Input). The purpose of an Output is to bind a value of interest to a component's member function (generator), and provide a generic interface to the value, its type and label so it can be easily identified. It also specifies the realization (computational) stage at which the value is valid, so that a caller can provide adequate error handling.

For example, a Body can have its position transformation with respect to ground as an Output, which is only accessible when the model has been realized to the Position stage or beyond, in which case it depends on the Position stage. The validity of data flow can be checked prior to initiating a simulation.

An Output is intended to lightweight and adds no computational overhead if the output goes unused. When an Output's value is called upon, the overhead is a single redirect to the corresponding member function for the value.

An Output can either be a single-value Output or a list Output. A list Output is one that can have multiple Channels. The Channels are what get connected to Inputs.

Author
Ajay Seth

Constructor & Destructor Documentation

◆ AbstractOutput() [1/3]

OpenSim::AbstractOutput::AbstractOutput ( )
inline

◆ AbstractOutput() [2/3]

OpenSim::AbstractOutput::AbstractOutput ( const std::string &  name,
SimTK::Stage  dependsOnStage,
bool  isList 
)
inline

◆ AbstractOutput() [3/3]

OpenSim::AbstractOutput::AbstractOutput ( const AbstractOutput other)
default

◆ ~AbstractOutput()

virtual OpenSim::AbstractOutput::~AbstractOutput ( )
virtualdefault

Member Function Documentation

◆ addChannel()

virtual void OpenSim::AbstractOutput::addChannel ( const std::string &  channelName)
pure virtual

Add a channel to this Output.

This should be called within the component's extendFinalizeFromProperties() .

Implemented in OpenSim::Output< T >.

◆ clearChannels()

virtual void OpenSim::AbstractOutput::clearChannels ( )
pure virtual

Output Interface.

Remove all channels from this Output (for list Outputs).

Implemented in OpenSim::Output< T >.

◆ clone()

virtual AbstractOutput* OpenSim::AbstractOutput::clone ( ) const
pure virtual

Implemented in OpenSim::Output< T >.

◆ compatibleAssign()

virtual void OpenSim::AbstractOutput::compatibleAssign ( const AbstractOutput )
pure virtual

Implemented in OpenSim::Output< T >.

◆ getChannel()

virtual const AbstractChannel& OpenSim::AbstractOutput::getChannel ( const std::string &  name) const
pure virtual

◆ getDependsOnStage()

const SimTK::Stage& OpenSim::AbstractOutput::getDependsOnStage ( ) const
inline

Output's dependence on System being realized to at least this System::Stage.

◆ getName()

const std::string& OpenSim::AbstractOutput::getName ( ) const
inline

Output's name.

◆ getNumberOfSignificantDigits()

unsigned int OpenSim::AbstractOutput::getNumberOfSignificantDigits ( ) const
inline

Specification for number of significant figures in string value.

◆ getOwner()

const Component& OpenSim::AbstractOutput::getOwner ( ) const
inline

◆ getPathName()

std::string OpenSim::AbstractOutput::getPathName ( ) const

This returns <absolute-path-to-component>|<output-name>.

Referenced by OpenSim::analyze(), and OpenSim::Input< T >::connect().

◆ getTypeName()

virtual std::string OpenSim::AbstractOutput::getTypeName ( ) const
pure virtual

The name of the value type (e.g., double) produced by this output.

Implemented in OpenSim::Output< T >.

Referenced by OpenSim::Output< T >::compatibleAssign(), and OpenSim::Input< T >::connect().

◆ getValueAsString()

virtual std::string OpenSim::AbstractOutput::getValueAsString ( const SimTK::State &  state) const
pure virtual

Implemented in OpenSim::Output< T >.

◆ isCompatible()

virtual bool OpenSim::AbstractOutput::isCompatible ( const AbstractOutput ) const
pure virtual

Implemented in OpenSim::Output< T >.

◆ isListOutput()

bool OpenSim::AbstractOutput::isListOutput ( ) const
inline

Can this Output have more than one channel?

◆ operator=()

AbstractOutput& OpenSim::AbstractOutput::operator= ( const AbstractOutput o)
inline

◆ setNumberOfSignificantDigits()

void OpenSim::AbstractOutput::setNumberOfSignificantDigits ( unsigned int  numSigFigs)
inline

◆ setOwner()

void OpenSim::AbstractOutput::setOwner ( const Component owner)
inlineprotected

Member Data Documentation

◆ _owner

SimTK::ReferencePtr<const Component> OpenSim::AbstractOutput::_owner
protected

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