version 3.3

VRS::TimeCt< R, S, T > Class Template Reference

Behavior Node for VRSTime-Dependent Constraints for Object Parameters. More...

#include <vrs/sg/timect.h>

Inheritance diagram for VRS::TimeCt< R, S, T >:

VRS::LeafBehavior VRS::BehaviorNode VRS::SharedObj VRS::Visitable

List of all members.

Public Types

enum  SyncMode { SM_DoNothing, SM_Restore, SM_LastMode }
typedef void(R::* SetMethod )(S)
typedef T(R::* GetMethod )() const

Public Member Functions

 VRS_SERIALIZABLE_CLASS_ENUM (SyncMode)
 TimeCt (R *object, SetMethod setM, GetMethod getM, TimeMap< T > *timeMap, SyncMode mode=SM_DoNothing)
void setObject (R *obj, SetMethod setM, GetMethod getM)
R * getObject () const
void setMap (TimeMap< T > *timeMap)
TimeMap< T > * getMap () const
void setDeactivateMode (SyncMode mode)
SyncMode getDeactivateMode () const
virtual void activate (int hint=BehaviorNode::NoHint)
virtual void deactivate (int hint=BehaviorNode::NoHint)
virtual
BehaviorNode::InvalidationHint 
handle (Event *e)
 VRS_TYPEINFO (TimeCt, LeafBehavior)


Detailed Description

template<class R, typename S, typename T>
class VRS::TimeCt< R, S, T >

Behavior Node for VRSTime-Dependent Constraints for Object Parameters.

Member Typedef Documentation

template<class R, typename S, typename T>
typedef void(R::* VRS::TimeCt< R, S, T >::SetMethod)(S)

template<class R, typename S, typename T>
typedef T(R::* VRS::TimeCt< R, S, T >::GetMethod)() const


Member Enumeration Documentation

template<class R, typename S, typename T>
enum VRS::TimeCt::SyncMode

Enumerator:
SM_DoNothing 
SM_Restore 
SM_LastMode 


Constructor & Destructor Documentation

template<class R, typename S, typename T>
VRS::TimeCt< R, S, T >::TimeCt ( R *  object,
SetMethod  setM,
GetMethod  getM,
TimeMap< T > *  timeMap,
SyncMode  mode = SM_DoNothing 
)

An `TimeCt' node applies a time-dependent mapping to an attribute of a shared object. The attribute is accessed by a set-method

  • void R::setM(S param)

and a get-method

  • T R::getM() const

Most VRS shapes and attributes conform to these conventions.

There are three template parameters:

  • R = the class of the shared object whose attribute is constrained;
  • T = the type of the parameter mapping;
  • S = the argument type of the set-method.

Examples: To constrain the outer radius of an `Torus' object, we would declare the constraint by

  • TimeCt<Torus, double, double>

because the outer radius is of type `double' and the set-method is defined as `TorussetOuterRadius(double)'.

To constrain the center of an `Sphere' we would declare the constraint by

  • TimeCt<Sphere, const Vector&, Vector>

because the center is of type 'Vector' and the set-method is defined as `SpheresetCenter(const Vector&)'.


Member Function Documentation

template<class R, typename S, typename T>
VRS::TimeCt< R, S, T >::VRS_SERIALIZABLE_CLASS_ENUM ( SyncMode   ) 

template<class R, typename S, typename T>
void VRS::TimeCt< R, S, T >::setObject ( R *  obj,
SetMethod  setM,
GetMethod  getM 
)

template<class R, typename S, typename T>
R* VRS::TimeCt< R, S, T >::getObject (  )  const

Sets/gets the object to be constrained. If no object is given, the constraint has no effect.

template<class R, typename S, typename T>
void VRS::TimeCt< R, S, T >::setMap ( TimeMap< T > *  timeMap  ) 

template<class R, typename S, typename T>
TimeMap<T>* VRS::TimeCt< R, S, T >::getMap (  )  const

Sets/gets the mapping applied to the attribute. It must be possible to convert the parameter type T to a value of type S. Normally S is equivalent to T. Sometimes, S differs slightly because the set-method expects a parameter of type `const T&'. This is why `TimeCt' needs S and T.

template<class R, typename S, typename T>
void VRS::TimeCt< R, S, T >::setDeactivateMode ( SyncMode  mode  ) 

template<class R, typename S, typename T>
SyncMode VRS::TimeCt< R, S, T >::getDeactivateMode (  )  const

If the constraint is deactivated, the constraint node can either restore the original value, or just do nothing.

template<class R, typename S, typename T>
virtual void VRS::TimeCt< R, S, T >::activate ( int  hint = BehaviorNode::NoHint  )  [virtual]

Reimplemented from VRS::BehaviorNode.

template<class R, typename S, typename T>
virtual void VRS::TimeCt< R, S, T >::deactivate ( int  hint = BehaviorNode::NoHint  )  [virtual]

`activate' inquires the current value of the attribute if the deactivation mode is set to `Restore'. `deactivate' restores this original value in that case.

Reimplemented from VRS::BehaviorNode.

template<class R, typename S, typename T>
virtual BehaviorNode::InvalidationHint VRS::TimeCt< R, S, T >::handle ( Event e  )  [virtual]

A constraint node can handle `TimeEvent's. `handle' evaluates time events if the node is activated. Other event types are ignored. If a time event is received, it calls the mapping for the moment of the time event. The result of the mapping is used as argument to the set-method in order to configure the constrained object.

Implements VRS::BehaviorNode.

template<class R, typename S, typename T>
VRS::TimeCt< R, S, T >::VRS_TYPEINFO ( TimeCt< R, S, T >  ,
LeafBehavior   
)


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

Generated on Wed May 23 06:00:28 2012 by Doxygen 1.5.6
© 2001-2010 Hasso-Plattner-Institut | Impressum | Contact