NotifyCollapseEnumProc Class Reference
 
 
 
NotifyCollapseEnumProc Class Reference

#include <modstack.h>

Inheritance diagram for NotifyCollapseEnumProc:
GeomPipelineEnumProc InterfaceServer MaxHeapOperators

Class Description

See also:
Class GeomPipelineEnumProc, Class BaseObject, Class Object, Class IDerivedObject.

Description:
Whenever the modifier stack is collapsed the code has to notify all objects in the stack with a Pre and a Post notification. In order to do this, this class can be used in conjunction with the method EnumGeomPipleine(). In the constructor one can specify, if it is a pre- or post- collapse notification. In case it is a post collapse the object that represents the result of the collapse has to be provided as well. The INode pointer to the beginning of the pipeline that was collapsed has to be provided in both cases.

All methods of this class are implemented by the System.

Public Member Functions

  NotifyCollapseEnumProc (bool preCollapse, INode *n, Object *collapsedObj=NULL)
virtual PipeEnumResult  proc (ReferenceTarget *object, IDerivedObject *derObj, int index)

Constructor & Destructor Documentation

NotifyCollapseEnumProc ( bool  preCollapse,
INode n,
Object collapsedObj = NULL 
) [inline]
Remarks:
Constructor. The private data members are initialized by the passed parameters.
Parameters:
bool preCollapse

Indicates if this is a pre- collapse or a post- collapse. Pass true for pre and false for post.

INode *n

Points to the node at the beginning of the pipeline that was collapsed.

Object *collapsedObj = NULL

If this is a post- collapse then points to the object which is the result of the collapse.
Sample Code:
The following code fragment shows using this constructor and then the EnumGeomPipeline with this object:

NotifyCollapseEnumProc PreNCEP(true,node);

EnumGeomPipeline(&PreNCEP,node);
: bPreCollapse(preCollapse), node(n), collapsedObject(collapsedObj) {}

Member Function Documentation

virtual PipeEnumResult proc ( ReferenceTarget object,
IDerivedObject derObj,
int  index 
) [inline, virtual]
Remarks:
This is the implementation of the EnumGeomPipeline callback method proc() which calls BaseObject::NotifyPreCollapse or BaseObject::NotifyPostCollapse as required.

Implements GeomPipelineEnumProc.

                                                                                               {
                if(object->ClassID() == Class_ID(BASENODE_CLASS_ID,0))
                        return PIPE_ENUM_CONTINUE;

                if(bPreCollapse)
                        ((BaseObject *) object)->NotifyPreCollapse(node, derObj, index);
                else
                        ((BaseObject *) object)->NotifyPostCollapse(node, collapsedObject, derObj, index);

                return PIPE_ENUM_CONTINUE;
        }