opensurgsim
Public Member Functions | List of all members
SurgSim::Physics::ComputationGroup Class Reference

Implements a mechanism to group and loop computations, the computations will be called in sequence repeatedly until one of the exit criteria is met. More...

#include <ComputationGroup.h>

Inheritance diagram for SurgSim::Physics::ComputationGroup:
SurgSim::Physics::Computation MockGroup

Public Member Functions

 ComputationGroup (bool copyState)
 Constructor.
 
 ~ComputationGroup ()
 Destructor.
 
 SURGSIM_CLASSNAME (SurgSim::Physics::ComputationGroup)
 
std::shared_ptr< PhysicsManagerStatedoUpdate (const double &dt, const std::shared_ptr< PhysicsManagerState > &state) override
 Override this function to implement the computations specific behavior.
 
virtual bool endIteration ()
 Override this function to implement a custom criterion to exit this computation, when this returns true the computation will exit and return the last state. More...
 
void addComputation (const std::shared_ptr< Computation > &computation)
 Adds a computation to this group, the computation will be appended at the end. More...
 
std::vector< std::shared_ptr< Computation > > getComputations () const
 
void setComputations (const std::vector< std::shared_ptr< Computation >> &val)
 
size_t getIterations ()
 
- Public Member Functions inherited from SurgSim::Physics::Computation
 Computation (bool doCopyState)
 Constructor. More...
 
virtual ~Computation ()
 Destructor.
 
std::shared_ptr< PhysicsManagerStateupdate (double dt, const std::shared_ptr< PhysicsManagerState > &state)
 Public Interface execute this objects computations, dt is the time from the last update call in seconds. More...
 
void setDoCopyState (bool val)
 Sets up whether the computation will copy the state of PhysicsManagerState before executing. More...
 
bool isCopyingState ()
 Query if this object is copying the PhysicsManagerState. More...
 
virtual std::string getClassName () const =0
 The class name for this class. More...
 
Framework::TimergetTimer ()
 Provides access to the update timer. More...
 

Additional Inherited Members

Detailed Description

Implements a mechanism to group and loop computations, the computations will be called in sequence repeatedly until one of the exit criteria is met.

That is either the endIteration() call, or shouldAbortLoop() in the

See also
PhysicsManagerState return true.

Member Function Documentation

§ addComputation()

void SurgSim::Physics::ComputationGroup::addComputation ( const std::shared_ptr< Computation > &  computation)

Adds a computation to this group, the computation will be appended at the end.

Parameters
computationthe computation to be added to this group

§ endIteration()

bool SurgSim::Physics::ComputationGroup::endIteration ( )
virtual

Override this function to implement a custom criterion to exit this computation, when this returns true the computation will exit and return the last state.

Note
the computation can also be stopped by calling setAbortLoop(true) on the physics state by any calculation
Returns
true to stop calculating.

§ getComputations()

std::vector< std::shared_ptr< Computation > > SurgSim::Physics::ComputationGroup::getComputations ( ) const
Returns
the computations used by this class

§ getIterations()

size_t SurgSim::Physics::ComputationGroup::getIterations ( )
Returns
the number of iterations that have passed

§ setComputations()

void SurgSim::Physics::ComputationGroup::setComputations ( const std::vector< std::shared_ptr< Computation >> &  val)
Parameters
valset the computations used by this class

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