#include <Functor.h>
Inheritance diagram for O_SESSAME::Functor:
[legend]List of all members.
Detailed Description
Abstract class to hold the pointer to an force calculating functor.
A Function Object, or Functor (the two terms are synonymous) is simply any object that can be called as if it is a function. It is used to define a call-back function that evaluates any algorithm that takes the defined inputs and returns a vector of values. Examples of usage include evaluating a disturbance force or torque given the current time, orbit state, and attitude state. The returned vector will then be the 3 forces (or torques).
- Examples:
- The simplest functor is a placeholder that can be set to just return a vector of zeros:
Vector NullFunctor(const ssfTime& _pSSFTime, const OrbitState& _pOrbitState, const AttitudeState& _pAttitudeState)
{
return Vector(3);
}
This isn't very useful, but may be necessary for filling out a parameter list such as for
- See also:
- Integrator that requests a Functor call-back function. The Functor object is created as follows:
SpecificFunctor AttitudeForcesFunctor(&NullFunctor);
SpecificFunctor is used since it is only a function that was used, and not a member function of a class. For that case, an ObjectFunctor is required which stores the type (or class) of the function as well as the pointer to the function itself.
- An ObjectFunctor may be assigned from an Environment object (pEarthEnv) where the function is GetForces: To review, we are creating an ObjectFunctor that will hold a call-back function to the Environment class (hence the template argument ). The function, OrbitForcesFunctor, needs a pointer to the instance of the class we are using (pEarthEnv), and the reference to the function (&Environment::GetForces). The & is required to specify that it is a reference, and the Environment:: defines the scope of the function GetForces. It is also important to note that the GetForces function conforms to the ObjectFunctor interface. (
- See also:
- Environment::GetForces).
- Todo:
- make Functors for variety of function types
Definition at line 63 of file Functor.h.
Member Function Documentation
Generated on Wed Aug 6 12:59:29 2003 for Open-Sessame Framework by
1.3