HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SIM_ConstraintIterator Class Reference

#include <SIM_ConstraintIterator.h>

Public Types

enum  IterationStyle { PRESENT_GROUP_AS_MULTIPLE, PRESENT_GROUP_AS_SINGLE }
 

Public Member Functions

 SIM_ConstraintIterator (SIM_Object &object, const SIM_DataFilter *relFilter, const SIM_DataFilter *currentFilter, const SIM_DataFilter *goalFilter, const SIM_Time &time, const IterationStyle style=PRESENT_GROUP_AS_MULTIPLE)
 
 ~SIM_ConstraintIterator ()
 
bool atEnd () const
 Test to see if the iterator is at the end. More...
 
void advance ()
 Advance the iterator to the next item. More...
 
void rewind ()
 Reset the iterator to the start of iteration. More...
 
SIM_ConstraintgetConstraint () const
 Get the constraint associated with the current item. More...
 
SIM_ConRelgetConRel () const
 Get the relationship associated with the current constraint. More...
 
const SIM_ConAnchorgetCurrentAnchor () const
 
const SIM_ConAnchorgetGoalAnchor () const
 

Static Public Member Functions

static void makeStateTransitions (SIM_Object &object, const SIM_Time &time)
 
static void initConstraints (SIM_Object &object, const SIM_Time &time)
 Call all constraints to set the valid state on them. More...
 

Detailed Description

Iterator for constraints.

This class simplifies the process of scanning the constraints associated with an object. Constraints are complicated to iterate: you have to scan over the SIM_Constraints, then over each SIM_Constraint's SIM_Relationships, then over the anchors within the relationship. This class hides that complexity.

The iterator is similar in principal to an STL iterator, but somewhat simpler. The classic STL loop for ( it = begin(); it != end(); ++it ) is done using for ( it.rewind(); !it.atEnd(); it.advance() )

The IterationStyle parameter in the SIM_ConstraintIterator's constructor affects how constraint anchors of the type SIM_ConAnchorObjPointGroupPos PRESENT_GROUP_AS_MULTIPLE: This will present each point in a group as a separate point anchor. That means that the iterator will point to the same anchor multiple times during a traversal. During each visit of this traversal, the anchor will pose as SIM_ConstraintIterator implements this iteration mode by using the members "reset", "nextPoint", and "atEnd" to manipulate the group anchor's "current point.

PRESENT_GROUP_AS_SINGLE: This will treat a group constraint as a single constraint. It will only be visited once during an iteration traversal. The client code will have to explicitly extract the individual points.

Definition at line 54 of file SIM_ConstraintIterator.h.

Member Enumeration Documentation

Enumerator
PRESENT_GROUP_AS_MULTIPLE 
PRESENT_GROUP_AS_SINGLE 

Definition at line 57 of file SIM_ConstraintIterator.h.

Constructor & Destructor Documentation

SIM_ConstraintIterator::SIM_ConstraintIterator ( SIM_Object object,
const SIM_DataFilter relFilter,
const SIM_DataFilter currentFilter,
const SIM_DataFilter goalFilter,
const SIM_Time time,
const IterationStyle  style = PRESENT_GROUP_AS_MULTIPLE 
)

Iterate over all constraint relationships on the given object, accepting only those whose relationships pass the given filter. (Note that relationships don't necessarily have any data "name", so filtering by name is meaningless.) The requirePinAnchor option forces the iteration to only include constraints that are pinned to this object.

SIM_ConstraintIterator::~SIM_ConstraintIterator ( )

Member Function Documentation

void SIM_ConstraintIterator::advance ( )

Advance the iterator to the next item.

bool SIM_ConstraintIterator::atEnd ( ) const

Test to see if the iterator is at the end.

SIM_ConRel* SIM_ConstraintIterator::getConRel ( ) const

Get the relationship associated with the current constraint.

SIM_Constraint* SIM_ConstraintIterator::getConstraint ( ) const

Get the constraint associated with the current item.

const SIM_ConAnchor* SIM_ConstraintIterator::getCurrentAnchor ( ) const
const SIM_ConAnchor* SIM_ConstraintIterator::getGoalAnchor ( ) const
static void SIM_ConstraintIterator::initConstraints ( SIM_Object object,
const SIM_Time time 
)
static

Call all constraints to set the valid state on them.

static void SIM_ConstraintIterator::makeStateTransitions ( SIM_Object object,
const SIM_Time time 
)
static

Call all constraints to make state transitions based on their most recent state data updates.

void SIM_ConstraintIterator::rewind ( )

Reset the iterator to the start of iteration.


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