|
| 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) |
|
| 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 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) |
|
template<class T>
#define OpenSim_DECLARE_LIST_OUTPUT |
( |
|
oname, |
|
|
|
T, |
|
|
|
func, |
|
|
|
ostage |
|
) |
| |
|
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.
class MyComponent : public Component {
public:
double getData(const SimTK::State& s, const std::string& requestedChannel) const;
...
protected:
void extendFinalizeFromProperties() {
Super::extendFinalizeFromProperties();
for (const auto& name : getChannelsToAdd()) {
updOutput("data").addChannel(name);
}
}
};
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_.
template<class T>
#define OpenSim_DECLARE_OUTPUT |
( |
|
oname, |
|
|
|
T, |
|
|
|
func, |
|
|
|
ostage |
|
) |
| |
|
related |
Create an output for a member function of this component.
The following must be true about componentMemberFunction, the function that returns the output:
- It is a member function of your component.
- The member function is const.
- It takes only one argument, which is
const SimTK::State&
.
- The function returns the computed quantity by value (e.g.,
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:
class MyComponent : public Component {
public:
...
};
- Warning
- The fourth requirement above can be lifted if the function returns a quantity that is stored in the provided SimTK::State (as a state variable, cache variable, etc.); in this case, your function's return type should be
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!
- See also
- Component::constructOutput()