Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

OSGDepthFirstAction.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002  *                                OpenSG                                     *
00003  *                                                                           *
00004  *                                                                           *
00005  *             Copyright (C) 2000-2002 by the OpenSG Forum                   *
00006  *                                                                           *
00007  *                            www.opensg.org                                 *
00008  *                                                                           *
00009  *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de          *
00010  *                                                                           *
00011 \*---------------------------------------------------------------------------*/
00012 /*---------------------------------------------------------------------------*\
00013  *                                License                                    *
00014  *                                                                           *
00015  * This library is free software; you can redistribute it and/or modify it   *
00016  * under the terms of the GNU Library General Public License as published    *
00017  * by the Free Software Foundation, version 2.                               *
00018  *                                                                           *
00019  * This library is distributed in the hope that it will be useful, but       *
00020  * WITHOUT ANY WARRANTY; without even the implied warranty of                *
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
00022  * Library General Public License for more details.                          *
00023  *                                                                           *
00024  * You should have received a copy of the GNU Library General Public         *
00025  * License along with this library; if not, write to the Free Software       *
00026  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
00027  *                                                                           *
00028 \*---------------------------------------------------------------------------*/
00029 /*---------------------------------------------------------------------------*\
00030  *                                Changes                                    *
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 //    Includes
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     /*==== PUBLIC ===========================================================*/
00064   public:
00065     /*-----------------------------------------------------------------------*/
00069     virtual ~DepthFirstAction(void);
00070 
00072     /*-----------------------------------------------------------------------*/
00076     static DepthFirstAction *create(void);
00077 
00079     /*-----------------------------------------------------------------------*/
00083     virtual ResultE apply(NodePtr pRoot);
00084 
00086     /*==== PROTECTED ========================================================*/
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     /*==== PRIVATE ==========================================================*/
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 /* _OSGDEPTHFIRSTACTION_H_ */

Generated on Thu Aug 25 04:02:47 2005 for OpenSG by  doxygen 1.4.3