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

OSGDepthFirstAction.inl

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 #include "OSGExtendActorBase.h"
00040 #include "OSGBasicActorBase.h"
00041 
00042 OSG_BEGIN_NAMESPACE
00043 
00044 //----------------------------------------------------------------------------
00045 //    Helper Methods
00046 //----------------------------------------------------------------------------
00047 
00051 inline DepthFirstAction::ResultE
00052 DepthFirstAction::enterNode(const NodePtr &pNode, UInt32 pass)
00053 {
00054     FunctorArgumentType funcArg(NULL, pNode, pass);
00055     ResultE             result    = NewActionTypes::Continue;
00056 
00057     ExtendActorStoreIt  itExtend  = _extendEnterActors.begin();
00058     ExtendActorStoreIt  endExtend = _extendEnterActors.end  ();
00059 
00060     for(;  (itExtend != endExtend                                    )  &&
00061           !(result   &  (NewActionTypes::Break | NewActionTypes::Quit));
00062         ++itExtend                                                         )
00063     {
00064         funcArg.setActor(*itExtend);
00065         
00066         result = static_cast<ResultE>(result | (*itExtend)->enterNode(funcArg));
00067     }
00068 
00069     BasicActorStoreIt   itBasic   = _basicEnterActors.begin();
00070     BasicActorStoreIt   endBasic  = _basicEnterActors.end  ();
00071 
00072     for(;  (itBasic != endBasic                                     )  &&
00073           !(result  &  (NewActionTypes::Break | NewActionTypes::Quit));
00074         ++itBasic                                                        )
00075     {
00076         funcArg.setActor(*itBasic);
00077         
00078         result = static_cast<ResultE>(result | (*itBasic)->enterNode(funcArg));
00079     }
00080 
00081     return result;
00082 }
00083 
00087 inline DepthFirstAction::ResultE
00088 DepthFirstAction::leaveNode(const NodePtr &pNode, UInt32 pass)
00089 {
00090     FunctorArgumentType funcArg(NULL, pNode, pass);
00091     ResultE             result    = NewActionTypes::Continue;
00092 
00093     ExtendActorStoreIt  itExtend  = _extendLeaveActors.begin();
00094     ExtendActorStoreIt  endExtend = _extendLeaveActors.end  ();
00095 
00096     for(;  (itExtend != endExtend                                    )  &&
00097           !(result   &  (NewActionTypes::Break | NewActionTypes::Quit));
00098         ++itExtend                                                         )
00099     {
00100         funcArg.setActor(*itExtend);
00101 
00102         result = static_cast<ResultE>(result | (*itExtend)->leaveNode(funcArg));
00103     }
00104 
00105     BasicActorStoreIt  itBasic   = _basicLeaveActors.begin();
00106     BasicActorStoreIt  endBasic  = _basicLeaveActors.end  ();
00107 
00108     for(;  (itBasic != endBasic                                     )  &&
00109           !(result  &  (NewActionTypes::Break | NewActionTypes::Quit));
00110         ++itBasic                                                         )
00111     {
00112         funcArg.setActor(*itBasic);
00113 
00114         result = static_cast<ResultE>(result | (*itBasic)->leaveNode(funcArg));
00115     }
00116 
00117     return result;
00118 }
00119 
00120 //----------------------------------------------------------------------------
00121 //    Types
00122 //----------------------------------------------------------------------------
00123 
00124 inline
00125 DepthFirstAction::NodeStackEntry::NodeStackEntry(void)
00126     : _pNode    (NullFC),
00127       _passCount(1     )
00128 {
00129 }
00130 
00131 inline
00132 DepthFirstAction::NodeStackEntry::NodeStackEntry(const NodeStackEntry &source)
00133     : _pNode    (source._pNode    ),
00134       _passCount(source._passCount)
00135 {
00136 }
00137 
00138 inline
00139 DepthFirstAction::NodeStackEntry::NodeStackEntry(
00140     const NodePtr &pNode, Int32 passCount)
00141 
00142     : _pNode    (pNode    ),
00143       _passCount(passCount)
00144 {
00145 }
00146 
00147 inline NodePtr
00148 DepthFirstAction::NodeStackEntry::getNode(void) const
00149 {
00150     return _pNode;
00151 }
00152 
00153 inline void
00154 DepthFirstAction::NodeStackEntry::setNode(const NodePtr &pNode)
00155 {
00156     _pNode = pNode;
00157 }
00158 
00159 inline Int32
00160 DepthFirstAction::NodeStackEntry::getPassCount(void) const
00161 {
00162     return _passCount;
00163 }
00164 
00165 inline void
00166 DepthFirstAction::NodeStackEntry::setPassCount(Int32 passCount)
00167 {
00168     _passCount = passCount;
00169 }
00170 
00171 OSG_END_NAMESPACE
00172 
00173 #define OSGDEPTHFIRSTACTION_INLINE_CVSID "@(#)$Id: OSGDepthFirstAction.inl,v 1.3 2004/09/17 14:09:42 neumannc Exp $"

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