H3D::DependentSFNode< NodeType, FieldRefs, DynamicCast > Class Template Reference
[Field template modifiers.]

DependentSFNode are modified TypedSFNode fields where the field dirty status is dependent on fields in the node it contains. More...

#include <H3D/DependentNodeFields.h>

Inheritance diagram for H3D::DependentSFNode< NodeType, FieldRefs, DynamicCast >:

Inheritance graph

List of all members.

Public Member Functions

 DependentSFNode ()
 Constructor. Default value of value is NULL.
 ~DependentSFNode ()
 Destructor.


Detailed Description

template<class NodeType, class FieldRefs = void, bool DynamicCast = false>
class H3D::DependentSFNode< NodeType, FieldRefs, DynamicCast >

DependentSFNode are modified TypedSFNode fields where the field dirty status is dependent on fields in the node it contains.

E.g. if we have a Coordinate node, a TypedSFNode< Coordinate > would only generate an event to fields it is routed to if the Coordinate node itself is changed. If the points in the Coordinate nodes point field are changed however no event is generated. With a DependentSFNode you can specify that the field is dependent on e.g. the 'point' field of the Node and then the field will generate an event when the point field in the Coordinate node generates an event.

Usage:
If the member variable is declared in the class we want to use as NodeType we can specify it as
 DependentSFNode< FieldRef< Coordinate, SFVec3f, &Coordinate::point > >
If we want to make it dependent on several fields in the node we can do that by creating a list of FieldRef with the pair template e.g.
 DependentSFNode< pair< FieldRef< Coordinate, SFVec3f, &Coordinate::point >, 
                  pair< FieldRef< Coordinate, SFVec3f, &Coordinate::field2 >, 
                        FieldRef< Coordinate, SFVec3f, &Coordinate::field3 > > > 
If the member variable is declared in a super class of the node we want to use as NodeType we have to use another syntax. The NodeType is the specified separately from the FieldRef templates and the NodeType in the FieldRef must be the super class the field is declared in. E.g.
 DependentSFNode< Shape, FieldRef< X3DShapeNode, SFVec3f, &Shape::bboxSize > >
As above, if we want to be dependent on several fields we can use the pair template,
  DependentSFNode< Shape, pair< FieldRef< X3DShapeNode, SFVec3f, &Shape::bboxSize >, 
                                FieldRef< X3DShapeNode, SFVec3f, &Shape::bboxCenter > > >, 
In the example above the Node that is set in the field must always be of the type that is specified in the FieldRef. But if you e.g. have a MFChild field and want to be dependent on the displayList field of the children nodes that have one(i.e. inherits from H3DDisplayListObject then you can specify that as
 struct H3DAPI_API MFChild :
 public DependentMFNode< X3DChildNode,
                         FieldRef< H3DDisplayListObject,
                         H3DDisplayListObject::DisplayList,
                         &H3DDisplayListObject::displayList >,
                         true >
It is the last parameter set to true that will ignore all Nodes that are not of H3DDisplayListObject.
The documentation for this class was generated from the following file:

Generated on Fri Nov 7 10:29:44 2008 for H3D API by  doxygen 1.5.7