00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #ifndef _OSGDEPTHFIRSTACTION_H_
00040 #define _OSGDEPTHFIRSTACTION_H_
00041 #ifdef __sgi
00042 #pragma once
00043 #endif
00044
00045
00046
00047
00048
00049 #include <OSGConfig.h>
00050 #include <OSGSystemDef.h>
00051
00052 #include "OSGNewActionBase.h"
00053
00054 #include <deque>
00055
00056 OSG_BEGIN_NAMESPACE
00057
00058 class ExtendActorBase;
00059 class BasicActorBase;
00060
00061 class OSG_SYSTEMLIB_DLLMAPPING DepthFirstAction : public NewActionBase
00062 {
00063
00064 public:
00065
00069 virtual ~DepthFirstAction(void);
00070
00072
00076 static DepthFirstAction *create(void);
00077
00079
00083 virtual ResultE apply(NodePtr pRoot);
00084
00086
00087 protected:
00088
00092 DepthFirstAction(void);
00093
00095
00099 virtual void addExtendEvent (ExtendActorBase *pActor,
00100 UInt32 actorIndex);
00101 virtual void subExtendEvent (ExtendActorBase *pActor,
00102 UInt32 actorIndex);
00103
00104 virtual void addBasicEvent (BasicActorBase *pActor,
00105 UInt32 actorIndex);
00106 virtual void subBasicEvent (BasicActorBase *pActor,
00107 UInt32 actorIndex);
00108
00109 virtual void beginEditStateEvent(ActorBase *pActor,
00110 UInt32 actorId );
00111 virtual void endEditStateEvent (ActorBase *pActor,
00112 UInt32 actorId );
00113
00115
00116 private:
00117
00121 typedef NewActionBase Inherited;
00122
00123 class NodeStackEntry
00124 {
00125 public:
00126 inline NodeStackEntry( void );
00127 inline NodeStackEntry(const NodeStackEntry &source );
00128 inline NodeStackEntry(const NodePtr &pNode, Int32 passCount);
00129
00130 inline NodePtr getNode ( void ) const;
00131 inline void setNode (const NodePtr &pNode );
00132
00133 inline Int32 getPassCount( void ) const;
00134 inline void setPassCount( Int32 passCount);
00135
00136 private:
00137 NodePtr _pNode;
00138 Int32 _passCount;
00139 };
00140
00141 typedef std::deque<NodeStackEntry> NodeStack;
00142
00144
00148 ResultE traverseEnter ( void );
00149 ResultE traverseEnterLeave( void );
00150
00151 void pushChildren (const NodePtr &pNode, ResultE result);
00152
00153 inline ResultE enterNode (const NodePtr &pNode, UInt32 pass );
00154 inline ResultE leaveNode (const NodePtr &pNode, UInt32 pass );
00155
00157
00158
00159 NodeStack _nodeStack;
00160
00161 ExtendActorStore _extendEnterActors;
00162 ExtendActorStore _extendLeaveActors;
00163
00164 BasicActorStore _basicEnterActors;
00165 BasicActorStore _basicLeaveActors;
00166 };
00167
00168 OSG_END_NAMESPACE
00169
00170 #include "OSGDepthFirstAction.inl"
00171
00172 #define OSGDEPTHFIRSTACTION_HEADER_CVSID "@(#)$Id: OSGDepthFirstAction.h,v 1.3 2004/09/17 14:09:42 neumannc Exp $"
00173
00174 #endif