API
4.0
For C++ developers
|
Public Member Functions | |
Output () | |
Output (const std::string &name, const std::function< void(const Component *comp, const SimTK::State &, const std::string &channel, T &)> &outputFunction, const SimTK::Stage &dependsOnStage, bool isList) | |
Convenience constructor Create a Component::Output bound to a specific method of the Component and valid at a given realization Stage. More... | |
Output (const Output &source) | |
Custom copy constructor is for setting the Channel's pointer back to this Output. More... | |
Output & | operator= (const Output &source) |
Custom copy assignment operator is for setting the Channel's pointer back to this Output. More... | |
virtual | ~Output () |
Output (Output &&)=delete | |
Output & | operator= (Output &&)=delete |
bool | isCompatible (const AbstractOutput &o) const override |
void | compatibleAssign (const AbstractOutput &o) override |
void | clearChannels () override |
Output Interface. More... | |
void | addChannel (const std::string &channelName) override |
Add a channel to this Output. More... | |
const AbstractChannel & | getChannel (const std::string &name) const override |
For a single-value output, name must be empty or must be the output's name. More... | |
const ChannelMap & | getChannels () const |
Use this to iterate through this Output's channels (even for single-value Channels). More... | |
const T & | getValue (const SimTK::State &state) const |
Return the Value of this output if the state is appropriately realized to a stage at or beyond the dependsOnStage, otherwise expect an Exception. More... | |
std::string | getTypeName () const override |
The name of the value type (e.g., double ) produced by this output. More... | |
std::string | getValueAsString (const SimTK::State &state) const override |
Output< T > * | clone () const override |
SimTK_DOWNCAST (Output, AbstractOutput) | |
Public Member Functions inherited from OpenSim::AbstractOutput | |
AbstractOutput () | |
AbstractOutput (const std::string &name, SimTK::Stage dependsOnStage, bool isList) | |
virtual | ~AbstractOutput () |
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 Component & | getOwner () const |
Output's owning Component. More... | |
std::string | getPathName () const |
This returns <absolute-path-to-component>|<output-name>. More... | |
AbstractOutput & | operator= (const AbstractOutput &o) |
unsigned int | getNumberOfSignificantDigits () const |
Specification for number of significant figures in string value. More... | |
void | setNumberOfSignificantDigits (unsigned int numSigFigs) |
Public Types | |
typedef std::map< std::string, Channel > | ChannelMap |
The container type that holds onto all of Channels in an Output. More... | |
Static Public Member Functions | |
static Output< T > * | safeDownCast (AbstractOutput *parent) |
For use in python/java/MATLAB bindings. More... | |
Related Functions | |
(Note that these are not member functions.) | |
Creating Outputs for your Component | |
Use these macros at the top of your component class declaration, near where you declare Property properties. | |
#define | OpenSim_DECLARE_OUTPUT(oname, T, func, ostage) |
Create an output for a member function of this component. More... | |
#define | OpenSim_DECLARE_LIST_OUTPUT(oname, T, func, ostage) |
Create a list output for a member function of this component. More... | |
#define | OpenSim_DECLARE_OUTPUT_FOR_STATE_VARIABLE(oname) |
Create an Output for a StateVariable in this component. More... | |
Nested Classes | |
class | Channel |
Additional Inherited Members | |
Protected Member Functions inherited from OpenSim::AbstractOutput | |
void | setOwner (const Component &owner) |
Protected Attributes inherited from OpenSim::AbstractOutput | |
SimTK::ReferencePtr< const Component > | _owner |
typedef std::map<std::string, Channel> OpenSim::Output< T >::ChannelMap |
The container type that holds onto all of Channels in an Output.
|
inline |
Referenced by OpenSim::Output< T >::clone().
|
inlineexplicit |
Convenience constructor Create a Component::Output bound to a specific method of the Component and valid at a given realization Stage.
|
inline |
|
inlinevirtual |
|
delete |
|
inlineoverridevirtual |
Add a channel to this Output.
This should be called within the component's extendFinalizeFromProperties() .
Implements OpenSim::AbstractOutput.
References OpenSim::AbstractOutput::isListOutput().
|
inlineoverridevirtual |
Output Interface.
Remove all channels from this Output (for list Outputs).
Implements OpenSim::AbstractOutput.
References OpenSim::AbstractOutput::isListOutput().
|
inlineoverridevirtual |
Implements OpenSim::AbstractOutput.
References OpenSim::Output< T >::Output().
|
inlineoverridevirtual |
Implements OpenSim::AbstractOutput.
References OpenSim::AbstractOutput::getTypeName(), OpenSim::Output< T >::getTypeName(), and SimTK_THROW2.
|
inlineoverridevirtual |
For a single-value output, name must be empty or must be the output's name.
Implements OpenSim::AbstractOutput.
References OpenSim::AbstractOutput::getName(), and OpenSim::AbstractOutput::isListOutput().
Referenced by OpenSim::Input< T >::finalizeConnection().
|
inline |
Use this to iterate through this Output's channels (even for single-value Channels).
|
inlineoverridevirtual |
The name of the value type (e.g., double
) produced by this output.
Implements OpenSim::AbstractOutput.
References OpenSim::Object_GetClassName< T >::name().
Referenced by OpenSim::Output< T >::compatibleAssign().
|
inline |
Return the Value of this output if the state is appropriately realized
to a stage at or beyond the dependsOnStage, otherwise expect an Exception.
References OpenSim::AbstractOutput::_owner, OpenSim::AbstractOutput::getDependsOnStage(), SimTK::State::getSystemStage(), and OpenSim::AbstractOutput::isListOutput().
Referenced by OpenSim::Output< T >::getValueAsString().
|
inlineoverridevirtual |
|
inlineoverridevirtual |
Implements OpenSim::AbstractOutput.
|
inline |
Custom copy assignment operator is for setting the Channel's pointer back to this Output.
References OpenSim::AbstractOutput::operator=().
|
delete |
|
inlinestatic |
For use in python/java/MATLAB bindings.
OpenSim::Output< T >::SimTK_DOWNCAST | ( | Output< T > | , |
AbstractOutput< T > | |||
) |
|
related |
Create a list output for a member function of this component.
A list output can have multiple values, or channels. The component must publish what channels its outputs have by calling AbstractOutput::addChannel() within
Component::extendFinalizeFromProperties(). The provided member function must take the name of the channel whose value is requested.
In this example, getChannelsToAdd()
is a placeholder for whatever way you determine your class' available channels. For example, TableSource_ uses the columns of its DataTable_.
|
related |
Create an output for a member function of this component.
The following must be true about componentMemberFunction, the function that returns the output:
const SimTK::State&
.double computeQuantity(const SimTK::State&) const
).You must also provide the stage on which the output depends.
Here's an example for using this macro:
const T&
(e.g, const double&
). If your function returns a const T&
but the quantity is NOT stored in the provided SimTK::State, the output value will be invalid!
|
related |
Create an Output for a StateVariable in this component.
The provided name is both the name of the output and of the state variable.
While this macro is a convenient way to construct an Output for a StateVariable, it is inefficient because it uses a string lookup at runtime. To create a more efficient Output, create a member variable that returns the state variable directly (see Coordinate::getValue() or Muscle::getActivation()) and then use the OpenSim_DECLARE_OUTPUT macro.