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

osg::DepthFirstStateAction Class Reference

#include <OSGDepthFirstStateAction.h>

Inheritance diagram for osg::DepthFirstStateAction:

osg::NewActionBase List of all members.

Types

typedef NewActionTypes::PriorityType PriorityType
typedef NewActionTypes::PriorityTypeTraits PriorityTypeTraits
typedef NewActionTypes::Functor Functor
typedef NewActionTypes::FunctorArgumentType FunctorArgumentType
*typedef NewActionTypes::ResultE ResultE

Statistics

const StatCollectorgetStatistics (void) const
StatCollectorgetStatistics (void)
void setStatistics (StatCollector *pStatistics)
*static StatElemDesc< StatIntElemstatNodesEnter
static StatElemDesc< StatIntElemstatNodesLeave

Types

typedef ExtendActorStore::iterator ExtendActorStoreIt
typedef ExtendActorStore::const_iterator ExtendActorStoreConstIt
typedef std::vector< BasicActorBase * > BasicActorStore
typedef BasicActorStore::iterator BasicActorStoreIt
typedef BasicActorStore::const_iterator BasicActorStoreConstIt
*typedef std::vector< ExtendActorBase * > ExtendActorStore

Types

typedef ActorBase::ActorBaseState ActorBaseState
typedef std::list< ActorBaseState * > StateStore
typedef StateStore::iterator StateStoreIt
typedef StateStore::const_iterator StateStoreConstIt
typedef std::list< StateRefCountStateRefCountStore
typedef StateRefCountStore::iterator StateRefCountStoreIt
typedef StateRefCountStore::const_iterator StateRefCountStoreConstIt
typedef std::deque< NodeStackEntryNodeStack
*typedef NewActionBase Inherited

Public Member Functions

Destructor
*virtual ~DepthFirstStateAction (void)
Apply
*virtual ResultE apply (NodePtr pRoot)
Generic Actor Management
*UInt32 addActor (ActorBase *pActor)
void subActor (ActorBase *pActor)
UInt32 findActor (ActorBase *pActor) const
UInt32 getNumActors (void) const
Extend Actor Management
*UInt32 addExtendActor (ExtendActorBase *pActor)
UInt32 addExtendActor (ExtendActorBase *pActor, UInt32 pos)
void subExtendActor (UInt32 pos)
UInt32 findExtendActor (ExtendActorBase *pActor) const
UInt32 getNumExtendActors (void) const
Basic Actor Management
*UInt32 addBasicActor (BasicActorBase *pActor)
UInt32 addBasicActor (BasicActorBase *pActor, UInt32 pos)
void subBasicActor (UInt32 pos)
UInt32 findBasicActor (BasicActorBase *pActor) const
UInt32 getNumBasicActors (void) const
Traversal Mask
*UInt32 getTravMask (void) const
void setTravMask (UInt32 travMask)
Generic Actor Management
*UInt32 addActor (ActorBase *pActor)
void subActor (ActorBase *pActor)
UInt32 findActor (ActorBase *pActor) const
UInt32 getNumActors (void) const
Extend Actor Management
*UInt32 addExtendActor (ExtendActorBase *pActor)
UInt32 addExtendActor (ExtendActorBase *pActor, UInt32 pos)
void subExtendActor (UInt32 pos)
UInt32 findExtendActor (ExtendActorBase *pActor) const
UInt32 getNumExtendActors (void) const
Basic Actor Management
*UInt32 addBasicActor (BasicActorBase *pActor)
UInt32 addBasicActor (BasicActorBase *pActor, UInt32 pos)
void subBasicActor (UInt32 pos)
UInt32 findBasicActor (BasicActorBase *pActor) const
UInt32 getNumBasicActors (void) const
Traversal Mask
*UInt32 getTravMask (void) const
void setTravMask (UInt32 travMask)

Static Public Member Functions

Create
*static DepthFirstStateActioncreate (void)

Static Public Attributes

Statistics
*static StatElemDesc< StatIntElemstatStateClones
static StatElemDesc< StatIntElemstatStateRestores

Protected Member Functions

Constructors
DepthFirstStateAction (void)
Events
*virtual void addExtendEvent (ExtendActorBase *pActor, UInt32 actorIndex)
virtual void subExtendEvent (ExtendActorBase *pActor, UInt32 actorIndex)
virtual void addBasicEvent (BasicActorBase *pActor, UInt32 actorIndex)
virtual void subBasicEvent (BasicActorBase *pActor, UInt32 actorIndex)
virtual void startEvent (void)
virtual void stopEvent (void)
virtual void beginEditStateEvent (ActorBase *pActor, UInt32 actorId)
virtual void endEditStateEvent (ActorBase *pActor, UInt32 actorId)
ChildrenList/ExtraChildrenList Access
*bool getChildrenListEnabled (void) const
void setChildrenListEnabled (bool enabled)
const ChildrenListgetChildrenList (void) const
ChildrenListgetChildrenList (void)
const ExtraChildrenListgetExtraChildrenList (void) const
ExtraChildrenListgetExtraChildrenList (void)
MultiPass Setup
*UInt32 getNumPasses (void) const
void setNumPasses (UInt32 numPasses)
Actor Access
*ExtendActorStoreConstIt beginExtend (void) const
ExtendActorStoreIt beginExtend (void)
ExtendActorStoreConstIt endExtend (void) const
ExtendActorStoreIt endExtend (void)
BasicActorStoreConstIt beginBasic (void) const
BasicActorStoreIt beginBasic (void)
BasicActorStoreConstIt endBasic (void) const
BasicActorStoreIt endBasic (void)
ResultE startActors (void)
ResultE stopActors (void)
ChildrenList/ExtraChildrenList Access
*bool getChildrenListEnabled (void) const
void setChildrenListEnabled (bool enabled)
const ChildrenListgetChildrenList (void) const
ChildrenListgetChildrenList (void)
const ExtraChildrenListgetExtraChildrenList (void) const
ExtraChildrenListgetExtraChildrenList (void)
MultiPass Setup
*UInt32 getNumPasses (void) const
void setNumPasses (UInt32 numPasses)
Actor Access
*ExtendActorStoreConstIt beginExtend (void) const
ExtendActorStoreIt beginExtend (void)
ExtendActorStoreConstIt endExtend (void) const
ExtendActorStoreIt endExtend (void)
BasicActorStoreConstIt beginBasic (void) const
BasicActorStoreIt beginBasic (void)
BasicActorStoreConstIt endBasic (void) const
BasicActorStoreIt endBasic (void)
ResultE startActors (void)
ResultE stopActors (void)

Private Member Functions

Helper Methods
*ResultE traverseEnter (void)
ResultE traverseEnterLeave (void)
void pushChildren (const NodePtr &pNode, ResultE result)
ResultE enterNode (const NodePtr &pNode, UInt32 pass)
ResultE leaveNode (const NodePtr &pNode, UInt32 pass)
StateRefCountStoreIt cloneState (void)
StateRefCountStoreIt getState (void)
void setState (StateRefCountStoreIt itStateRefCount)
void incRefCount (StateRefCountStoreIt itStateRefCount, Int32 inc=1)
void decRefCount (StateRefCountStoreIt itStateRefCount, Int32 dec=1)

Private Attributes

NodeStack _nodeStack
StateRefCountStore _stateRefCountStore
StateStore _stateStore
StateRefCountStoreIt _itInitialState
StateRefCountStoreIt _itActiveState
bool _stateClonedFlag
ExtendActorStore _extendEnterActors
ExtendActorStore _extendLeaveActors
BasicActorStore _basicEnterActors
BasicActorStore _basicLeaveActors

Friends

Friends
class osg::ExtendActorBase
class osg::BasicActorBase
Friends
class osg::ExtendActorBase
class osg::BasicActorBase

Classes

class  NodeStackEntry
class  StateRefCount

Detailed Description

Definition at line 63 of file OSGDepthFirstStateAction.h.


Member Typedef Documentation

typedef ActorBase::ActorBaseState osg::DepthFirstStateAction::ActorBaseState [private]
 

Definition at line 137 of file OSGDepthFirstStateAction.h.

typedef std::list<ActorBaseState *> osg::DepthFirstStateAction::StateStore [private]
 

Definition at line 164 of file OSGDepthFirstStateAction.h.

typedef StateStore::iterator osg::DepthFirstStateAction::StateStoreIt [private]
 

Definition at line 165 of file OSGDepthFirstStateAction.h.

typedef StateStore::const_iterator osg::DepthFirstStateAction::StateStoreConstIt [private]
 

Definition at line 166 of file OSGDepthFirstStateAction.h.

typedef std::list<StateRefCount> osg::DepthFirstStateAction::StateRefCountStore [private]
 

Definition at line 191 of file OSGDepthFirstStateAction.h.

typedef StateRefCountStore::iterator osg::DepthFirstStateAction::StateRefCountStoreIt [private]
 

Definition at line 192 of file OSGDepthFirstStateAction.h.

typedef StateRefCountStore::const_iterator osg::DepthFirstStateAction::StateRefCountStoreConstIt [private]
 

Definition at line 193 of file OSGDepthFirstStateAction.h.

typedef std::deque<NodeStackEntry> osg::DepthFirstStateAction::NodeStack [private]
 

Definition at line 218 of file OSGDepthFirstStateAction.h.

typedef NewActionTypes::PriorityType osg::NewActionBase::PriorityType [inherited]
 

Definition at line 72 of file OSGNewActionBase.h.

typedef NewActionTypes::PriorityTypeTraits osg::NewActionBase::PriorityTypeTraits [inherited]
 

Definition at line 73 of file OSGNewActionBase.h.

typedef NewActionTypes::Functor osg::NewActionBase::Functor [inherited]
 

Definition at line 74 of file OSGNewActionBase.h.

typedef NewActionTypes::FunctorArgumentType osg::NewActionBase::FunctorArgumentType [inherited]
 

Definition at line 75 of file OSGNewActionBase.h.

typedef ExtendActorStore::iterator osg::NewActionBase::ExtendActorStoreIt [protected, inherited]
 

Definition at line 156 of file OSGNewActionBase.h.

typedef ExtendActorStore::const_iterator osg::NewActionBase::ExtendActorStoreConstIt [protected, inherited]
 

Definition at line 157 of file OSGNewActionBase.h.

typedef std::vector<BasicActorBase *> osg::NewActionBase::BasicActorStore [protected, inherited]
 

Definition at line 159 of file OSGNewActionBase.h.

typedef BasicActorStore::iterator osg::NewActionBase::BasicActorStoreIt [protected, inherited]
 

Definition at line 160 of file OSGNewActionBase.h.

typedef BasicActorStore::const_iterator osg::NewActionBase::BasicActorStoreConstIt [protected, inherited]
 

Definition at line 161 of file OSGNewActionBase.h.


Constructor & Destructor Documentation

DepthFirstStateAction::~DepthFirstStateAction void   )  [virtual]
 

Destructor.

Definition at line 71 of file OSGDepthFirstStateAction.cpp.

00072 {
00073 }

DepthFirstStateAction::DepthFirstStateAction void   )  [protected]
 

Default constructor.

Definition at line 154 of file OSGDepthFirstStateAction.cpp.

Referenced by create().

00155     : Inherited          (     ),
00156       _nodeStack         (     ),
00157       _stateRefCountStore(     ),
00158 #ifndef OSG_NEWACTION_STATESLOTINTERFACE
00159       _stateStore        (     ),
00160 #endif
00161       _itInitialState    (     ),
00162       _itActiveState     (     ),
00163       _stateClonedFlag   (false),
00164       _extendEnterActors (     ),
00165       _extendLeaveActors (     ),
00166       _basicEnterActors  (     ),
00167       _basicLeaveActors  (     )
00168 {
00169 }


Member Function Documentation

DepthFirstStateAction * DepthFirstStateAction::create void   )  [static]
 

Create new instance.

Definition at line 83 of file OSGDepthFirstStateAction.cpp.

References DepthFirstStateAction().

00084 {
00085     return new DepthFirstStateAction();
00086 }

DepthFirstStateAction::ResultE DepthFirstStateAction::apply NodePtr  pRoot  )  [virtual]
 

Implements osg::NewActionBase.

Definition at line 93 of file OSGDepthFirstStateAction.cpp.

References _basicLeaveActors, _extendLeaveActors, _itActiveState, _itInitialState, _nodeStack, _stateClonedFlag, _stateRefCountStore, _stateStore, cloneState(), osg::NewActionTypes::Continue, decRefCount(), getState(), incRefCount(), osg::NewActionTypes::Quit, osg::NewActionBase::ResultE, setState(), osg::NewActionBase::startActors(), startEvent(), osg::NewActionBase::stopActors(), stopEvent(), traverseEnter(), and traverseEnterLeave().

00094 {
00095     ResultE result = NewActionTypes::Continue;
00096 
00097     startEvent();
00098 
00099     result = startActors();
00100 
00101     if(result & NewActionTypes::Quit)
00102         return result;
00103 
00104     _itInitialState = getState  ();
00105     _itActiveState  = cloneState();
00106 
00107     // gained refs: active, root
00108     incRefCount(_itActiveState, 2);
00109 
00110     _nodeStack.push_back(NodeStackEntry(pRoot, _itActiveState, 1));
00111 
00112     if((_extendLeaveActors.empty() == true) &&
00113        (_basicLeaveActors .empty() == true)    )
00114     {
00115         result = traverseEnter();
00116     }
00117     else
00118     {
00119         result = traverseEnterLeave();
00120     }
00121 
00122     setState(_itInitialState);
00123 
00124     // lost refs: active, current node
00125     decRefCount(_itActiveState, 2);
00126 
00127     _itActiveState   = _itInitialState;
00128     _stateClonedFlag = true;
00129 
00130     _nodeStack         .clear();
00131 #ifndef OSG_NEWACTION_STATESLOTINTERFACE
00132     _stateStore        .clear();
00133 #endif
00134     _stateRefCountStore.clear();
00135 
00136     if(result & NewActionTypes::Quit)
00137         return result;
00138 
00139     result = stopActors();
00140 
00141     stopEvent();
00142 
00143     return result;
00144 }

void DepthFirstStateAction::addExtendEvent ExtendActorBase pActor,
UInt32  actorIndex
[protected, virtual]
 

Inserts the extend actor into an internal data structure, depending on whether the enter node flag and leave node flag are set. This avoids making the destinction everytime the actors are called.

Implements osg::NewActionBase.

Definition at line 181 of file OSGDepthFirstStateAction.cpp.

References _extendEnterActors, _extendLeaveActors, osg::NewActionBase::beginExtend(), osg::ActorBase::getEnterNodeFlag(), and osg::ActorBase::getLeaveNodeFlag().

00182 {
00183     ExtendActorStoreIt itActors  = beginExtend();
00184     ExtendActorStoreIt endActors = beginExtend() + actorIndex;
00185 
00186     ExtendActorStoreIt itEnter   = _extendEnterActors.begin();
00187     ExtendActorStoreIt itLeave   = _extendLeaveActors.begin();
00188 
00189     for(; itActors != endActors; ++itActors)
00190     {
00191         if((*itActors)->getEnterNodeFlag() == true)
00192             ++itEnter;
00193 
00194         if((*itActors)->getLeaveNodeFlag() == true)
00195             ++itLeave;
00196     }
00197 
00198     if(pActor->getEnterNodeFlag() == true)
00199         _extendEnterActors.insert(itEnter, pActor);
00200 
00201     if(pActor->getLeaveNodeFlag() == true)
00202         _extendLeaveActors.insert(itLeave, pActor);
00203 }

void DepthFirstStateAction::subExtendEvent ExtendActorBase pActor,
UInt32  actorIndex
[protected, virtual]
 

Removes the extend actor from the internal data structures.

Implements osg::NewActionBase.

Definition at line 209 of file OSGDepthFirstStateAction.cpp.

References _extendEnterActors, and _extendLeaveActors.

00210 {
00211     ExtendActorStoreIt itEnter  = _extendEnterActors.begin();
00212     ExtendActorStoreIt endEnter = _extendEnterActors.end  ();
00213 
00214     ExtendActorStoreIt itLeave  = _extendLeaveActors.begin();
00215     ExtendActorStoreIt endLeave = _extendLeaveActors.end  ();
00216 
00217     for(; itEnter != endEnter; ++itEnter)
00218     {
00219         if(*itEnter == pActor)
00220         {
00221             _extendEnterActors.erase(itEnter);
00222 
00223             break;
00224         }
00225     }
00226 
00227     for(; itLeave != endLeave; ++itLeave)
00228     {
00229         if(*itLeave == pActor)
00230         {
00231             _extendLeaveActors.erase(itLeave);
00232 
00233             break;
00234         }
00235     }
00236 }

void DepthFirstStateAction::addBasicEvent BasicActorBase pActor,
UInt32  actorIndex
[protected, virtual]
 

Inserts the basic actor into an internal data structure, depending on whether the enter node flag and leave node flag are set. This avoids making the destinction everytime the actors are called.

Implements osg::NewActionBase.

Definition at line 244 of file OSGDepthFirstStateAction.cpp.

References _basicEnterActors, _basicLeaveActors, osg::NewActionBase::beginBasic(), osg::ActorBase::getEnterNodeFlag(), and osg::ActorBase::getLeaveNodeFlag().

00245 {
00246     BasicActorStoreIt itActors  = beginBasic();
00247     BasicActorStoreIt endActors = beginBasic() + actorIndex;
00248 
00249     BasicActorStoreIt itEnter   = _basicEnterActors.begin();
00250     BasicActorStoreIt itLeave   = _basicLeaveActors.begin();
00251 
00252     for(; itActors != endActors; ++itActors)
00253     {
00254         if((*itActors)->getEnterNodeFlag() == true)
00255             ++itEnter;
00256 
00257         if((*itActors)->getLeaveNodeFlag() == true)
00258             ++itLeave;
00259     }
00260 
00261     if(pActor->getEnterNodeFlag() == true)
00262         _basicEnterActors.insert(itEnter, pActor);
00263 
00264     if(pActor->getLeaveNodeFlag() == true)
00265         _basicLeaveActors.insert(itLeave, pActor);
00266 }

void DepthFirstStateAction::subBasicEvent BasicActorBase pActor,
UInt32  actorIndex
[protected, virtual]
 

Removes the extend actor from the internal data structures.

Implements osg::NewActionBase.

Definition at line 272 of file OSGDepthFirstStateAction.cpp.

References _basicEnterActors, and _basicLeaveActors.

00273 {
00274     BasicActorStoreIt itEnter  = _basicEnterActors.begin();
00275     BasicActorStoreIt endEnter = _basicEnterActors.end  ();
00276 
00277     BasicActorStoreIt itLeave  = _basicLeaveActors.begin();
00278     BasicActorStoreIt endLeave = _basicLeaveActors.end  ();
00279 
00280     for(; itEnter != endEnter; ++itEnter)
00281     {
00282         if(*itEnter == pActor)
00283         {
00284             _basicEnterActors.erase(itEnter);
00285 
00286             break;
00287         }
00288     }
00289 
00290     for(; itLeave != endLeave; ++itLeave)
00291     {
00292         if(*itLeave == pActor)
00293         {
00294             _basicLeaveActors.erase(itLeave);
00295 
00296             break;
00297         }
00298     }
00299 }

void DepthFirstStateAction::startEvent void   )  [protected, virtual]
 

Inserts the extend actor into an internal data structure, depending on whether the enter node flag and leave node flag are set. This avoids making the destinction everytime the actors are called.

Reimplemented from osg::NewActionBase.

Definition at line 302 of file OSGDepthFirstStateAction.cpp.

References osg::StatCollector::getElem(), osg::NewActionBase::getStatistics(), osg::StatElem::reset(), statStateClones, and statStateRestores.

Referenced by apply().

00303 {
00304     Inherited::startEvent();
00305 
00306 #ifdef OSG_NEWACTION_STATISTICS
00307     getStatistics()->getElem(statStateClones  )->reset();
00308     getStatistics()->getElem(statStateRestores)->reset();
00309 #endif /* OSG_NEWACTION_STATISTICS */
00310 }

void DepthFirstStateAction::stopEvent void   )  [protected, virtual]
 

Inserts the extend actor into an internal data structure, depending on whether the enter node flag and leave node flag are set. This avoids making the destinction everytime the actors are called.

Reimplemented from osg::NewActionBase.

Definition at line 313 of file OSGDepthFirstStateAction.cpp.

Referenced by apply().

00314 {
00315     Inherited::stopEvent();
00316 }

void DepthFirstStateAction::beginEditStateEvent ActorBase pActor,
UInt32  actorId
[protected, virtual]
 

Creates a copy of the state of the attached actors and activates the copy.

Implements osg::NewActionBase.

Definition at line 323 of file OSGDepthFirstStateAction.cpp.

References _itActiveState, _nodeStack, _stateClonedFlag, cloneState(), decRefCount(), osg::StatCollector::getElem(), osg::NewActionBase::getStatistics(), incRefCount(), and statStateClones.

00324 {
00325     if(_stateClonedFlag == false)
00326     {
00327 #ifdef OSG_NEWACTION_STATISTICS
00328         getStatistics()->getElem(statStateClones)->inc();
00329 #endif /* OSG_NEWACTION_STATISTICS */
00330 
00331         _stateClonedFlag = true;
00332 
00333         StateRefCountStoreIt itClonedState = cloneState();
00334 
00335         // gained refs: active and current node
00336         incRefCount(itClonedState, 2);
00337 
00338         // lost refs: active and current node
00339         decRefCount(_itActiveState, 2);
00340 
00341         _nodeStack.back().setStateRefCount(itClonedState);
00342 
00343         _itActiveState = itClonedState;
00344     }
00345 }

void DepthFirstStateAction::endEditStateEvent ActorBase pActor,
UInt32  actorId
[protected, virtual]
 

Does nothing.

Implements osg::NewActionBase.

Definition at line 351 of file OSGDepthFirstStateAction.cpp.

00352 {
00353 }

DepthFirstStateAction::ResultE DepthFirstStateAction::traverseEnter void   )  [private]
 

Definition at line 361 of file OSGDepthFirstStateAction.cpp.

References _itActiveState, _nodeStack, _stateClonedFlag, osg::NewActionTypes::Continue, decRefCount(), enterNode(), osg::NewActionBase::getChildrenList(), osg::StatCollector::getElem(), osg::NewActionBase::getNumPasses(), osg::NewActionBase::getStatistics(), incRefCount(), pushChildren(), osg::NewActionTypes::Quit, osg::NewActionBase::ResultE, osg::ChildrenList::setParentNode(), setState(), osg::NewActionBase::statNodesEnter, and statStateRestores.

Referenced by apply().

00362 {
00363     ResultE              result          = NewActionTypes::Continue;
00364     NodePtr              pNode;
00365     Int32                nodePass;        // pass over current node
00366     UInt32               multiPasses;     // requested passes over current node
00367     StateRefCountStoreIt itStateRefCount; // state for current node
00368 
00369     while((_nodeStack.empty() == false) && !(result & NewActionTypes::Quit))
00370     {
00371         pNode           = _nodeStack.back().getNode         ();
00372         nodePass        = _nodeStack.back().getPassCount    ();
00373         itStateRefCount = _nodeStack.back().getStateRefCount();
00374 
00375 #ifdef OSG_NEWACTION_STATISTICS
00376         getStatistics()->getElem(statNodesEnter)->inc();
00377 #endif /* OSG_NEWACTION_STATISTICS */
00378 
00379         if(itStateRefCount != _itActiveState)
00380         {
00381 #ifdef OSG_NEWACTION_STATISTICS
00382             getStatistics()->getElem(statStateRestores)->inc();
00383 #endif /* OSG_NEWACTION_STATISTICS */
00384 
00385             setState(itStateRefCount);
00386 
00387             // gained refs: active
00388             incRefCount(itStateRefCount);
00389 
00390             // lost refs: active
00391             decRefCount(_itActiveState);
00392 
00393             _itActiveState = itStateRefCount;
00394         }
00395 
00396         _stateClonedFlag = false;
00397 
00398         getChildrenList().setParentNode(pNode);
00399 
00400         result      = enterNode   (pNode, static_cast<UInt32>(nodePass - 1));
00401         multiPasses = getNumPasses(                                        );
00402 
00403         _nodeStack.pop_back();
00404 
00405         // only initial pass (nodePass == 1) can request multiPasses
00406         if((nodePass == 1) && (multiPasses > 1))
00407         {
00408             for(; multiPasses > 1; --multiPasses)
00409             {
00410                 // gained refs: additional pass
00411                 incRefCount(_itActiveState);
00412                 
00413                 _nodeStack.push_back(
00414                     NodeStackEntry(pNode, _itActiveState, multiPasses));
00415             }
00416         }
00417         
00418         pushChildren(pNode, result);
00419 
00420         // lost refs: current node
00421         decRefCount(_itActiveState);
00422     }
00423 
00424     return result;
00425 }

DepthFirstStateAction::ResultE DepthFirstStateAction::traverseEnterLeave void   )  [private]
 

Definition at line 428 of file OSGDepthFirstStateAction.cpp.

References _itActiveState, _nodeStack, _stateClonedFlag, osg::NewActionTypes::Continue, decRefCount(), enterNode(), osg::NewActionBase::getChildrenList(), osg::StatCollector::getElem(), osg::NewActionBase::getNumPasses(), osg::NewActionBase::getStatistics(), incRefCount(), leaveNode(), pushChildren(), osg::NewActionTypes::Quit, osg::NewActionBase::ResultE, osg::ChildrenList::setParentNode(), setState(), osg::NewActionBase::statNodesEnter, osg::NewActionBase::statNodesLeave, and statStateRestores.

Referenced by apply().

00429 {
00430     ResultE              result          = NewActionTypes::Continue;
00431     Int32                nodePass;        // pass over current node
00432     UInt32               multiPasses;     // requested passes over current node
00433     NodePtr              pNode;
00434     StateRefCountStoreIt itStateRefCount;
00435 
00436     while((_nodeStack.empty() == false) && !(result & NewActionTypes::Quit))
00437     {
00438         pNode           = _nodeStack.back().getNode         ();
00439         nodePass        = _nodeStack.back().getPassCount    ();
00440         itStateRefCount = _nodeStack.back().getStateRefCount();
00441 
00442         if(itStateRefCount != _itActiveState)
00443         {
00444 #ifdef OSG_NEWACTION_STATISTICS
00445             getStatistics()->getElem(statStateRestores)->inc();
00446 #endif /* OSG_NEWACTION_STATISTICS */
00447 
00448             setState(itStateRefCount);
00449 
00450