osg::DepthFirstStateAction Class Reference

#include <OSGDepthFirstStateAction.h>

Inheritance diagram for osg::DepthFirstStateAction:

osg::NewActionBase

List of all members.

Statistics



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

Types



typedef NewActionBase Inherited
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
< NodeStackEntry
NodeStack
class StateRefCount
class NodeStackEntry

Public Types

Types


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

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)

Static Public Member Functions

Create


static DepthFirstStateActioncreate (void)

Static Public Attributes

Statistics


static StatElemDesc< StatIntElemstatStateClones
static StatElemDesc< StatIntElemstatStateRestores

Protected Types

Types


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

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)

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::ActorBase
class osg::ExtendActorBase
class osg::BasicActorBase

Classes

class  NodeStackEntry
class  StateRefCount


Detailed Description

Definition at line 63 of file OSGDepthFirstStateAction.h.


Member Typedef Documentation

Definition at line 136 of file OSGDepthFirstStateAction.h.

Definition at line 137 of file OSGDepthFirstStateAction.h.

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.

Definition at line 196 of file OSGDepthFirstStateAction.h.

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

Definition at line 197 of file OSGDepthFirstStateAction.h.

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

Definition at line 198 of file OSGDepthFirstStateAction.h.

Definition at line 223 of file OSGDepthFirstStateAction.h.

Definition at line 71 of file OSGNewActionBase.h.

Definition at line 72 of file OSGNewActionBase.h.

Definition at line 73 of file OSGNewActionBase.h.

Definition at line 74 of file OSGNewActionBase.h.

Definition at line 75 of file OSGNewActionBase.h.

typedef std::vector<ExtendActorBase *> osg::NewActionBase::ExtendActorStore [protected, inherited]

Definition at line 155 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(), NodeStackEntry, osg::NewActionTypes::Quit, 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(), osg::NewActionBase::startEvent(), 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.

References osg::NewActionBase::stopEvent().

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(), NodeStackEntry, pushChildren(), osg::NewActionTypes::Quit, 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(), NodeStackEntry, pushChildren(), osg::NewActionTypes::Quit, 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             // gained refs: active
00451             incRefCount(itStateRefCount);
00452 
00453             // lost refs: active
00454             decRefCount(_itActiveState);
00455 
00456             _itActiveState = itStateRefCount;
00457         }
00458 
00459         getChildrenList().setParentNode(pNode);
00460 
00461         if(nodePass > 0)
00462         {
00463             // positive pass -> enter node
00464             
00465 #ifdef OSG_NEWACTION_STATISTICS
00466             getStatistics()->getElem(statNodesEnter)->inc();
00467 #endif /* OSG_NEWACTION_STATISTICS */
00468             
00469             _stateClonedFlag = false;
00470 
00471             result      = enterNode   (pNode, static_cast<UInt32>(nodePass - 1));
00472             multiPasses = getNumPasses(                                        );
00473 
00474             // only initial pass (nodePass == 1) can request multiPass.
00475             if((nodePass == 1) && (multiPasses > 1))
00476             {
00477                 // remove current node from stack
00478                 _nodeStack.pop_back();
00479                 
00480                 for(; multiPasses > 1; -- multiPasses)
00481                 {
00482                     // gained refs: addtional passs
00483                     incRefCount(_itActiveState);
00484                     
00485                     _nodeStack.push_back(
00486                         NodeStackEntry(pNode, _itActiveState, multiPasses));
00487                 }
00488                 
00489                 // readd current node - with negative pass -> leave
00490                 _nodeStack.push_back(
00491                     NodeStackEntry(pNode, _itActiveState, -nodePass));
00492             }
00493             else
00494             {
00495                 // change current node passCount to negative -> leave
00496                 _nodeStack.back().setPassCount(-nodePass);
00497             }
00498             
00499             pushChildren(pNode, result);
00500         }
00501         else
00502         {
00503             // negative pass -> leave node
00504 
00505 #ifdef OSG_NEWACTION_STATISTICS
00506             getStatistics()->getElem(statNodesLeave)->inc();
00507 #endif /* OSG_NEWACTION_STATISTICS */
00508             
00509             _stateClonedFlag = true;
00510 
00511             result = leaveNode(pNode, static_cast<UInt32>(-nodePass - 1));
00512 
00513             _nodeStack.pop_back();
00514 
00515             // lost refs: current node
00516             decRefCount(_itActiveState);
00517         }
00518     }
00519 
00520     return result;
00521 }

void DepthFirstStateAction::pushChildren ( const NodePtr pNode,
ResultE  result 
) [private]

Definition at line 524 of file OSGDepthFirstStateAction.cpp.

References _itActiveState, _nodeStack, osg::NewActionTypes::Break, osg::ExtraChildrenList::clear(), osg::ExtraChildrenList::getActive(), osg::ChildrenList::getActive(), osg::ExtraChildrenList::getChild(), osg::ChildrenList::getChild(), osg::NewActionBase::getChildrenList(), osg::NewActionBase::getChildrenListEnabled(), osg::NewActionBase::getExtraChildrenList(), osg::ExtraChildrenList::getSize(), osg::ChildrenList::getSize(), osg::NewActionBase::getTravMask(), incRefCount(), NodeStackEntry, osg::NullFC, osg::NewActionTypes::Quit, osg::NewActionBase::setChildrenListEnabled(), osg::NewActionBase::setNumPasses(), and osg::NewActionTypes::Skip.

Referenced by traverseEnter(), and traverseEnterLeave().

00525 {
00526     if(result & (NewActionTypes::Skip  |
00527                  NewActionTypes::Break |
00528                  NewActionTypes::Quit   ))
00529     {
00530         setChildrenListEnabled(false);
00531         setNumPasses          (1    );
00532 
00533         getExtraChildrenList().clear();
00534 
00535         return;
00536     }
00537 
00538     ChildrenList      &cl  = getChildrenList     ();
00539     ExtraChildrenList &ecl = getExtraChildrenList();
00540 
00541     if(getChildrenListEnabled() == true)
00542     {
00543         for(UInt32 i = 0, size = cl.getSize(); i < size; ++i)
00544         {
00545             if(( cl.getActive(i)                                 == true  ) &&
00546                ( cl.getChild (i)                                 != NullFC) &&
00547                ((cl.getChild (i)->getTravMask() & getTravMask()) != 0     )   )
00548             {
00549                 // gained refs: child
00550                 incRefCount(_itActiveState);
00551 
00552                 _nodeStack.push_back(
00553                     NodeStackEntry(cl.getChild(i), _itActiveState, 1));
00554             }
00555         }
00556     }
00557     else
00558     {
00559         MFNodePtr::const_iterator itChildren  = pNode->getMFChildren()->begin();
00560         MFNodePtr::const_iterator endChildren = pNode->getMFChildren()->end  ();
00561 
00562         for(; itChildren != endChildren; ++itChildren)
00563         {
00564             if((  *itChildren                                  != NullFC) &&
00565                (((*itChildren)->getTravMask() & getTravMask()) != 0     )   )
00566             {
00567                 // gained refs: child
00568                 incRefCount(_itActiveState);
00569 
00570                 _nodeStack.push_back(
00571                     NodeStackEntry(*itChildren, _itActiveState, 1));
00572             }
00573         }
00574     }
00575 
00576     for(UInt32 i = 0, size = ecl.getSize(); i < size; ++i)
00577     {
00578         if(( ecl.getActive(i)                                 == true  ) &&
00579            ( ecl.getChild (i)                                 != NullFC) &&
00580            ((ecl.getChild (i)->getTravMask() & getTravMask()) != 0     )   )
00581         {
00582             // gained refs: extra child
00583             incRefCount(_itActiveState);
00584 
00585             _nodeStack.push_back(
00586                 NodeStackEntry(ecl.getChild(i), _itActiveState, 1));
00587         }
00588     }
00589 
00590     setChildrenListEnabled(false);
00591     ecl.clear             (     );
00592     setNumPasses          (1    );
00593 }

DepthFirstStateAction::ResultE osg::DepthFirstStateAction::enterNode ( const NodePtr pNode,
UInt32  pass 
) [inline, private]

Calls the enterNode method of the attached actors.

Definition at line 52 of file OSGDepthFirstStateAction.inl.

References _basicEnterActors, _extendEnterActors, osg::NewActionTypes::Break, osg::NewActionTypes::Continue, osg::NewActionBase::endBasic(), osg::NewActionBase::endExtend(), osg::NewActionTypes::Quit, and osg::NewActionTypes::FunctorArgumentType::setActor().

Referenced by traverseEnter(), and traverseEnterLeave().

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 }

DepthFirstStateAction::ResultE osg::DepthFirstStateAction::leaveNode ( const NodePtr pNode,
UInt32  pass 
) [inline, private]

Calls the leaveNode method of the attached actors.

Definition at line 88 of file OSGDepthFirstStateAction.inl.

References _basicLeaveActors, _extendLeaveActors, osg::NewActionTypes::Break, osg::NewActionTypes::Continue, osg::NewActionBase::endBasic(), osg::NewActionBase::endExtend(), osg::NewActionTypes::Quit, and osg::NewActionTypes::FunctorArgumentType::setActor().

Referenced by traverseEnterLeave().

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 }

DepthFirstStateAction::StateRefCountStoreIt osg::DepthFirstStateAction::cloneState ( void   )  [inline, private]

Creates a copy of the state currently used by the attached actors.

Definition at line 367 of file OSGDepthFirstStateAction.inl.

References _stateRefCountStore, _stateStore, osg::NewActionBase::beginBasic(), osg::NewActionBase::beginExtend(), osg::NewActionBase::endBasic(), osg::NewActionBase::endExtend(), and StateRefCount.

Referenced by apply(), and beginEditStateEvent().

00368 {
00369 #ifdef OSG_NEWACTION_STATESLOTINTERFACE
00370 
00371     UInt32               stateSlot;
00372     StateRefCountStoreIt itStateRefCount = --(_stateRefCountStore.end());
00373 
00374     ExtendActorStoreIt   itExtend        =    beginExtend();
00375     ExtendActorStoreIt   endItExtend     =    endExtend  ();
00376 
00377     for(; itExtend != endItExtend; ++itExtend)
00378     {
00379         stateSlot = (*itExtend)->createStateClone();
00380     }
00381 
00382     BasicActorStoreIt itBasic    = beginBasic();
00383     BasicActorStoreIt endItBasic = endBasic  ();
00384 
00385     for(; itBasic != endItBasic; ++itBasic)
00386     {
00387         stateSlot = (*itBasic)->createStateClone();
00388     }
00389 
00390     _stateRefCountStore.push_back(StateRefCount(stateSlot));
00391 
00392     return ++itStateRefCount;
00393 
00394 #else  /* OSG_NEWACTION_STATESLOTINTERFACE */
00395 
00396     StateStoreIt         itState         = --(_stateStore        .end  ());
00397     StateRefCountStoreIt itStateRefCount = --(_stateRefCountStore.end  ());
00398 
00399     ExtendActorStoreIt   itExtend        =    beginExtend();
00400     ExtendActorStoreIt   endItExtend     =    endExtend  ();
00401 
00402     for(; itExtend != endItExtend; ++itExtend)
00403     {
00404         _stateStore.push_back((*itExtend)->createStateClone());
00405     }
00406 
00407     BasicActorStoreIt itBasic    = beginBasic();
00408     BasicActorStoreIt endItBasic = endBasic  ();
00409 
00410     for(; itBasic != endItBasic; ++itBasic)
00411     {
00412         _stateStore.push_back((*itBasic)->createStateClone());
00413     }
00414 
00415     _stateRefCountStore.push_back(StateRefCount(++itState));
00416 
00417     return ++itStateRefCount;
00418 
00419 #endif /* OSG_NEWACTION_STATESLOTINTERFACE */
00420 }

DepthFirstStateAction::StateRefCountStoreIt osg::DepthFirstStateAction::getState ( void   )  [inline, private]

Stores the state currently used by the attached actors.

Definition at line 426 of file OSGDepthFirstStateAction.inl.

References _stateRefCountStore, _stateStore, osg::NewActionBase::beginBasic(), osg::NewActionBase::beginExtend(), osg::NewActionBase::endBasic(), osg::NewActionBase::endExtend(), and StateRefCount.

Referenced by apply().

00427 {
00428 #ifdef OSG_NEWACTION_STATESLOTINTERFACE
00429 
00430     UInt32               stateSlot;
00431     StateRefCountStoreIt itStateRefCount = --(_stateRefCountStore.end  ());
00432 
00433     ExtendActorStoreIt   itExtend        =    beginExtend();
00434     ExtendActorStoreIt   endItExtend     =    endExtend  ();
00435 
00436     for(; itExtend != endItExtend; ++itExtend)
00437     {
00438         stateSlot = (*itExtend)->getSlotMap().size();
00439 
00440         (*itExtend)->getSlotMap().push_back((*itExtend)->getState());
00441     }
00442 
00443     BasicActorStoreIt itBasic    = beginBasic();
00444     BasicActorStoreIt endItBasic = endBasic  ();
00445 
00446     for(; itBasic != endItBasic; ++itBasic)
00447     {
00448         stateSlot = (*itExtend)->getSlotMap().size();
00449 
00450         (*itExtend)->getSlotMap().push_back((*itExtend)->getState());
00451     }
00452 
00453     _stateRefCountStore.push_back(StateRefCount(stateSlot));
00454 
00455     return ++itStateRefCount;
00456 
00457 #else  /* OSG_NEWACTION_STATESLOTINTERFACE */
00458 
00459     StateStoreIt         itState         = --(_stateStore        .end  ());
00460     StateRefCountStoreIt itStateRefCount = --(_stateRefCountStore.end  ());
00461 
00462     ExtendActorStoreIt   itExtend        =    beginExtend();
00463     ExtendActorStoreIt   endItExtend     =    endExtend  ();
00464 
00465     for(; itExtend != endItExtend; ++itExtend)
00466     {
00467         _stateStore.push_back((*itExtend)->getState());
00468     }
00469 
00470     BasicActorStoreIt itBasic    = beginBasic();
00471     BasicActorStoreIt endItBasic = endBasic  ();
00472 
00473     for(; itBasic != endItBasic; ++itBasic)
00474     {
00475         _stateStore.push_back((*itBasic)->getState());
00476     }
00477 
00478     _stateRefCountStore.push_back(StateRefCount(++itState));
00479 
00480     return ++itStateRefCount;
00481 
00482 #endif /* OSG_NEWACTION_STATESLOTINTERFACE */
00483 }

void osg::DepthFirstStateAction::setState ( StateRefCountStoreIt  itStateRefCount  )  [inline, private]

Sets the state to use for the attached actors.

Definition at line 489 of file OSGDepthFirstStateAction.inl.

References osg::NewActionBase::beginBasic(), osg::NewActionBase::beginExtend(), osg::NewActionBase::endBasic(), and osg::NewActionBase::endExtend().

Referenced by apply(), traverseEnter(), and traverseEnterLeave().

00490 {
00491 #ifdef OSG_NEWACTION_STATESLOTINTERFACE
00492 
00493     UInt32             stateSlot   = itStateRefCount->getStateSlot();
00494 
00495     ExtendActorStoreIt   itExtend        =    beginExtend();
00496     ExtendActorStoreIt   endItExtend     =    endExtend  ();
00497 
00498     for(; itExtend != endItExtend; ++itExtend, ++itState)
00499     {
00500         (*itExtend)->setState((*itExtend)->getSlotMap()[stateSlot]);
00501     }
00502 
00503     BasicActorStoreIt itBasic    = beginBasic();
00504     BasicActorStoreIt endItBasic = endBasic  ();
00505 
00506     for(; itBasic != endItBasic; ++itBasic, ++itState)
00507     {
00508         (*itBasic)->setState((*itBasic)->getSlotMap()[stateSlot]);
00509     }
00510 
00511 #else  /* OSG_NEWACTION_STATESLOTINTERFACE */
00512 
00513     StateStoreIt       itState     = itStateRefCount->getState();
00514 
00515     ExtendActorStoreIt itExtend    = beginExtend();
00516     ExtendActorStoreIt endItExtend = endExtend  ();
00517 
00518     for(; itExtend != endItExtend; ++itExtend, ++itState)
00519     {
00520         (*itExtend)->setState(*itState);
00521     }
00522 
00523     BasicActorStoreIt itBasic    = beginBasic();
00524     BasicActorStoreIt endItBasic = endBasic  ();
00525 
00526     for(; itBasic != endItBasic; ++itBasic, ++itState)
00527     {
00528         (*itBasic)->setState(*itState);
00529     }
00530 
00531 #endif /* OSG_NEWACTION_STATESLOTINTERFACE */
00532 }

void osg::DepthFirstStateAction::incRefCount ( StateRefCountStoreIt  itStateRefCount,
Int32  inc = 1 
) [inline, private]

Increment the ref count by inc.

Definition at line 538 of file OSGDepthFirstStateAction.inl.

Referenced by apply(), beginEditStateEvent(), pushChildren(), traverseEnter(), and traverseEnterLeave().

00539 {
00540     itStateRefCount->incRefCount(inc);
00541 }

void osg::DepthFirstStateAction::decRefCount ( StateRefCountStoreIt  itStateRefCount,
Int32  dec = 1 
) [inline, private]

Decrement the ref count by dec. If it reaches 0 the state is delete.

Definition at line 547 of file OSGDepthFirstStateAction.inl.

References _stateRefCountStore, _stateStore, osg::NewActionBase::beginBasic(), osg::NewActionBase::beginExtend(), osg::NewActionBase::endBasic(), and osg::NewActionBase::endExtend().

Referenced by apply(), beginEditStateEvent(), traverseEnter(), and traverseEnterLeave().

00548 {
00549 #ifdef OSG_NEWACTION_STATESLOTINTERFACE
00550 
00551     itStateRefCount->decRefCount(dec);
00552 
00553     if(itStateRefCount->getRefCount() <= 0)
00554     {
00555         UInt32             stateSlot   = itStateRefCount->getStateSlot();
00556 
00557         ExtendActorStoreIt itExtend    = beginExtend();
00558         ExtendActorStoreIt endItExtend = endExtend  ();
00559 
00560         for(; itExtend != endExtend; ++itExtend)
00561         {
00562             delete (*itExtend)->getSlotMap()[stateSlot];
00563 
00564             //(*itExtend)->destroyStateClone(stateSlot);
00565         }
00566 
00567         BasicActorStoreIt itBasic    = beginBasic();
00568         BasicActorStoreIt endItBasic = endBasic  ();
00569 
00570         for(; itBasic != endBasic; ++itBasic)
00571         {
00572             delete (*itBasic)->getSlotMap()[stateSlot];
00573 
00574             //(*itBasic)->destroyStateClone(stateSlot);
00575         }
00576 
00577         _stateRefCountStore.erase(itStateRefCount);
00578     }
00579 
00580 #else /* OSG_NEWACTION_STATESLOTINTERFACE */
00581 
00582     itStateRefCount->decRefCount(dec);
00583 
00584     if(itStateRefCount->getRefCount() <= 0)
00585     {
00586         StateStoreIt       itState     = itStateRefCount->getState();
00587 
00588         ExtendActorStoreIt itExtend    = beginExtend();
00589         ExtendActorStoreIt endItExtend = endExtend  ();
00590 
00591         for(; itExtend != endItExtend; ++itExtend)
00592         {
00593             delete *itState;
00594 
00595             //(*itExtend)->destroyStateClone(*itState);
00596 
00597             itState = _stateStore.erase(itState);
00598         }
00599 
00600         BasicActorStoreIt itBasic    = beginBasic();
00601         BasicActorStoreIt endItBasic = endBasic  ();
00602 
00603         for(; itBasic != endItBasic; ++itBasic)
00604         {
00605             delete *itState;
00606 
00607             //(*itBasic)->destroyStateClone(*itState);
00608 
00609             itState = _stateStore.erase(itState);
00610         }
00611 
00612         _stateRefCountStore.erase(itStateRefCount);
00613     }
00614 
00615 #endif /* OSG_NEWACTION_STATESLOTINTERFACE */
00616 }

const StatCollector* osg::NewActionBase::getStatistics ( void   )  const [inline, inherited]

StatCollector* osg::NewActionBase::getStatistics ( void   )  [inline, inherited]

void osg::NewActionBase::setStatistics ( StatCollector pStatistics  )  [inline, inherited]

UInt32 NewActionBase::addActor ( ActorBase pActor  )  [inherited]

Add an actor to this action, it will be appended to the list of extend or basic actors. Returns the index at which the actor was added.

Warning:
Actions assume exclusive ownership of an actor, you can not add an actor to two actions at the same time.

Definition at line 144 of file OSGNewActionBase.cpp.

References osg::ActorBase::addHelper().

00145 {
00146     return pActor->addHelper(this);
00147 }

void NewActionBase::subActor ( ActorBase pActor  )  [inherited]

Remove an actor from this action. The actor may now be attached to another action.

Definition at line 159 of file OSGNewActionBase.cpp.

References osg::ActorBase::subHelper().

00160 {
00161     pActor->subHelper(this);
00162 }

UInt32 NewActionBase::findActor ( ActorBase pActor  )  const [inherited]

Return the index of an actor or TypeTraits<UInt32>::getMax() if the actor can not be found. Note that two actors may have the same index, if one is derived from ExtendActorBase and the other from BasicActorBase.

Definition at line 177 of file OSGNewActionBase.cpp.

References osg::ActorBase::findHelper().

00178 {
00179     return pActor->findHelper(this);
00180 }

UInt32 NewActionBase::getNumActors ( void   )  const [inherited]

Return the total number of actors attached to this action.

Definition at line 186 of file OSGNewActionBase.cpp.

References osg::NewActionBase::_basicActors, and osg::NewActionBase::_extendActors.

Referenced by osg::NewActionBase::addBasicActor(), and osg::NewActionBase::addExtendActor().

00187 {
00188     return _extendActors.size() + _basicActors.size();
00189 }

UInt32 NewActionBase::addExtendActor ( ExtendActorBase pActor  )  [inherited]

Add an extend actor to this action. Returns the index at which the actor was added.

Warning:
Actions assume exclusive ownership of an actor, you can not add an actor to two actions at the same time.

Definition at line 202 of file OSGNewActionBase.cpp.

References osg::NewActionBase::_extendActors.

Referenced by osg::ExtendActorBase::addHelper().

00203 {
00204     return addExtendActor(pActor, _extendActors.size());
00205 }

UInt32 NewActionBase::addExtendActor ( ExtendActorBase pActor,
UInt32  pos 
) [inherited]

Add an extend actor to this action before the index pos. Returns the index at which the actor was added, i.e. this should be pos.

Warning:
Actions assume exclusive ownership of an actor, you can not add an actor to two actions at the same time.

Definition at line 214 of file OSGNewActionBase.cpp.

References osg::NewActionBase::_extendActors, osg::ActorBase::addEvent(), and osg::NewActionBase::getNumActors().

00215 {
00216     UInt32 actorId = getNumActors();
00217 
00218     pActor       ->addEvent      (this,                        actorId);
00219     _extendActors. insert        (_extendActors.begin() + pos, pActor );
00220     this         ->addExtendEvent(pActor,                      pos    );
00221 
00222     return pos;
00223 }

void NewActionBase::subExtendActor ( UInt32  pos  )  [inherited]

Remove the extend actor at index pos. The actor may now be attached to another action.

Definition at line 230 of file OSGNewActionBase.cpp.

References osg::NewActionBase::_extendActors, osg::ActorBase::getActorId(), and osg::ActorBase::subEvent().

Referenced by osg::ExtendActorBase::subHelper().

00231 {
00232     ExtendActorStoreIt  itActor = _extendActors.begin() + pos;
00233     ExtendActorBase    *pActor  = *itActor;
00234 
00235     this  ->subExtendEvent(pActor, pos                 );
00236     pActor->subEvent      (this,   pActor->getActorId());
00237 
00238     _extendActors.erase(itActor);
00239 }

UInt32 NewActionBase::findExtendActor ( ExtendActorBase pActor  )  const [inherited]

Return the index of the extend actor or TypeTraits<UInt32>::getMax() if the actor is not found. The return value may be used as the pos argument to the addExtendActor and subExtendActor methods.

Definition at line 247 of file OSGNewActionBase.cpp.

References osg::NewActionBase::_extendActors.

Referenced by osg::ExtendActorBase::findHelper(), and osg::ExtendActorBase::subHelper().

00248 {
00249     ExtendActorStoreConstIt itActors  = _extendActors.begin();
00250     ExtendActorStoreConstIt endActors = _extendActors.end  ();
00251 
00252     UInt32             pos       = 0;
00253     bool               found     = false;
00254 
00255     for(; (itActors != endActors) && !found; ++itActors, ++pos)
00256     {
00257         if(*itActors == pActor)
00258         {
00259             found = true;
00260             break;
00261         }
00262     }
00263 
00264     return (found ? pos : TypeTraits<UInt32>::getMax());
00265 }

UInt32 NewActionBase::getNumExtendActors ( void   )  const [inherited]

Return the number of extend actors attached to the action.

Definition at line 271 of file OSGNewActionBase.cpp.

References osg::NewActionBase::_extendActors.

00272 {
00273     return _extendActors.size();
00274 }

UInt32 NewActionBase::addBasicActor ( BasicActorBase pActor  )  [inherited]

Add an basic actor to this action. Returns the index at which the actor was added.

Warning:
Actions assume exclusive ownership of an actor, you can not add an actor to two actions at the same time.

Definition at line 287 of file OSGNewActionBase.cpp.

References osg::NewActionBase::_basicActors.

Referenced by osg::BasicActorBase::addHelper().

00288 {
00289     return addBasicActor(pActor, _basicActors.size());
00290 }

UInt32 NewActionBase::addBasicActor ( BasicActorBase pActor,
UInt32  pos 
) [inherited]

Add an basic actor to this action before the index pos. Returns the index at which the actor was added, i.e. this should be pos.

Warning:
Actions assume exclusive ownership of an actor, you can not add an actor to two actions at the same time.

Definition at line 299 of file OSGNewActionBase.cpp.

References osg::NewActionBase::_basicActors, osg::ActorBase::addEvent(), and osg::NewActionBase::getNumActors().

00300 {
00301     UInt32 actorId = getNumActors();
00302 
00303     pActor      ->addEvent     (this,                       actorId);
00304     _basicActors. insert       (_basicActors.begin() + pos, pActor );
00305     this        ->addBasicEvent(pActor,                     pos    );
00306 
00307     return pos;
00308 }

void NewActionBase::subBasicActor ( UInt32  pos  )  [inherited]

Remove the basic actor at index pos. The actor may now be attached to another action.

Definition at line 315 of file OSGNewActionBase.cpp.

References osg::NewActionBase::_basicActors, osg::ActorBase::getActorId(), and osg::ActorBase::subEvent().

Referenced by osg::BasicActorBase::subHelper().

00316 {
00317     BasicActorStoreIt  itActor = _basicActors.begin() + pos;
00318     BasicActorBase    *pActor  = *itActor;
00319 
00320     this  ->subBasicEvent(pActor, pos                 );
00321     pActor->subEvent     (this,   pActor->getActorId());
00322 
00323     _basicActors.erase(itActor);
00324 }

UInt32 NewActionBase::findBasicActor ( BasicActorBase pActor  )  const [inherited]

Return the index of the basic actor or TypeTraits<UInt32>::getMax() if the actor is not found. The return value may be used as the pos argument to the addBasicActor and subBasicActor methods.

Definition at line 332 of file OSGNewActionBase.cpp.

References osg::NewActionBase::_basicActors.

Referenced by osg::BasicActorBase::findHelper(), and osg::BasicActorBase::subHelper().

00333 {
00334     BasicActorStoreConstIt itActors  = _basicActors.begin();
00335     BasicActorStoreConstIt endActors = _basicActors.end  ();
00336 
00337     UInt32            pos       = 0;
00338     bool              found     = false;
00339 
00340     for(; (itActors != endActors) && !found; ++itActors, ++pos)
00341     {
00342         if(*itActors == pActor)
00343         {
00344             found = true;
00345             break;
00346         }
00347     }
00348 
00349     return (found ? pos : TypeTraits<UInt32>::getMax());
00350 }

UInt32 NewActionBase::getNumBasicActors ( void   )  const [inherited]

Return the number of basic actors attached to the action.

Definition at line 356 of file OSGNewActionBase.cpp.

References osg::NewActionBase::_basicActors.

00357 {
00358     return _basicActors.size();
00359 }

UInt32 osg::NewActionBase::getTravMask ( void   )  const [inline, inherited]

Return the traversal mask of this action. The action will only traverse a node if the bitwise AND of its traversal mask with the actions is nonzero.

Definition at line 76 of file OSGNewActionBase.inl.

References osg::NewActionBase::_travMask.

Referenced by osg::PriorityAction::enqueueChildren(), pushChildren(), and osg::DepthFirstAction::pushChildren().

00077 {
00078     return _travMask;
00079 }

void osg::NewActionBase::setTravMask ( UInt32  travMask  )  [inline, inherited]

Set the actions traversal maks. The action will only traverse a node if the bitwise AND of its traversal mask with the actions is nonzero.

Definition at line 86 of file OSGNewActionBase.inl.

References osg::NewActionBase::_travMask.

00087 {
00088     _travMask = travMask;
00089 }

bool osg::NewActionBase::getChildrenListEnabled ( void   )  const [inline, protected, inherited]

Return if the children list is enabled.

Definition at line 99 of file OSGNewActionBase.inl.

References osg::NewActionBase::_childrenListEnabled.

Referenced by osg::PriorityAction::enqueueChildren(), osg::ActorBase::getChildrenListEnabled(), pushChildren(), and osg::DepthFirstAction::pushChildren().

00100 {
00101     return _childrenListEnabled;
00102 }

void osg::NewActionBase::setChildrenListEnabled ( bool  enabled  )  [inline, protected, inherited]

Enable or disable the children list.

Definition at line 115 of file OSGNewActionBase.inl.

References osg::NewActionBase::_childrenList, osg::NewActionBase::_childrenListEnabled, and osg::ChildrenList::reset().

Referenced by osg::PriorityAction::enqueueChildren(), pushChildren(), osg::DepthFirstAction::pushChildren(), and osg::ActorBase::setChildrenListEnabled().

00116 {
00117     if((enabled == true) && (_childrenListEnabled == false))
00118     {
00119         _childrenList.reset();
00120     }
00121 
00122     _childrenListEnabled = enabled;
00123 }

const ChildrenList & osg::NewActionBase::getChildrenList ( void   )  const [inline, protected, inherited]

ChildrenList & osg::NewActionBase::getChildrenList ( void   )  [inline, protected, inherited]

Return a reference to the children list.

Definition at line 148 of file OSGNewActionBase.inl.

References osg::NewActionBase::_childrenList.

00149 {
00150     return _childrenList;
00151 }

const ExtraChildrenList & osg::NewActionBase::getExtraChildrenList ( void   )  const [inline, protected, inherited]

ExtraChildrenList & osg::NewActionBase::getExtraChildrenList ( void   )  [inline, protected, inherited]

Return a reference to the children list.

Definition at line 176 of file OSGNewActionBase.inl.

References osg::NewActionBase::_extraChildrenList.

00177 {
00178     return _extraChildrenList;
00179 }

UInt32 osg::NewActionBase::getNumPasses ( void   )  const [inline, protected, inherited]

void osg::NewActionBase::setNumPasses ( UInt32  numPasses  )  [inline, protected, inherited]

NewActionBase::ExtendActorStoreConstIt osg::NewActionBase::beginExtend ( void   )  const [inline, protected, inherited]

Return a const iterator to the beginning of the extend actors.

Definition at line 205 of file OSGNewActionBase.inl.

References osg::NewActionBase::_extendActors.

Referenced by osg::PriorityAction::addExtendEvent(), addExtendEvent(), osg::DepthFirstAction::addExtendEvent(), cloneState(), decRefCount(), getState(), setState(), osg::NewActionBase::startActors(), and osg::NewActionBase::stopActors().

00206 {
00207     return _extendActors.begin();
00208 }

NewActionBase::ExtendActorStoreIt osg::NewActionBase::beginExtend ( void   )  [inline, protected, inherited]

Return an iterator to the beginning of the extend actors.

Definition at line 214 of file OSGNewActionBase.inl.

References osg::NewActionBase::_extendActors.

00215 {
00216     return _extendActors.begin();
00217 }

NewActionBase::ExtendActorStoreConstIt osg::NewActionBase::endExtend ( void   )  const [inline, protected, inherited]

NewActionBase::ExtendActorStoreIt osg::NewActionBase::endExtend ( void   )  [inline, protected, inherited]

Return an iterator to the end of the extend actors.

Definition at line 232 of file OSGNewActionBase.inl.

References osg::NewActionBase::_extendActors.

00233 {
00234     return _extendActors.end();
00235 }

NewActionBase::BasicActorStoreConstIt osg::NewActionBase::beginBasic ( void   )  const [inline, protected, inherited]

NewActionBase::BasicActorStoreIt osg::NewActionBase::beginBasic ( void   )  [inline, protected, inherited]

Return an iterator to the beginning of the basic actors.

Definition at line 250 of file OSGNewActionBase.inl.

References osg::NewActionBase::_basicActors.

00251 {
00252     return _basicActors.begin();
00253 }

NewActionBase::BasicActorStoreConstIt osg::NewActionBase::endBasic ( void   )  const [inline, protected, inherited]

NewActionBase::BasicActorStoreIt osg::NewActionBase::endBasic ( void   )  [inline, protected, inherited]

Return an iterator to the end of the basic actors.

Definition at line 268 of file OSGNewActionBase.inl.

References osg::NewActionBase::_basicActors.

00269 {
00270     return _basicActors.end();
00271 }

NewActionBase::ResultE NewActionBase::startActors ( void   )  [protected, inherited]

Return a const iterator to the beginning of the extend actors.

Definition at line 428 of file OSGNewActionBase.cpp.

References osg::NewActionBase::beginBasic(), osg::NewActionBase::beginExtend(), osg::NewActionTypes::Continue, osg::NewActionBase::endBasic(), osg::NewActionBase::endExtend(), and osg::NewActionTypes::Quit.

Referenced by osg::PriorityAction::apply(), apply(), and osg::DepthFirstAction::apply().

00429 {
00430     ResultE            result      = NewActionTypes::Continue;
00431 
00432     ExtendActorStoreIt itExtend    = beginExtend();
00433     ExtendActorStoreIt endItExtend = endExtend  ();
00434 
00435     for(; (itExtend != endItExtend         ) &&
00436          !(result   &  NewActionTypes::Quit);    ++itExtend)
00437     {
00438         result = (*itExtend)->start();
00439     }
00440 
00441     BasicActorStoreIt itBasic    = beginBasic();
00442     BasicActorStoreIt endItBasic = endBasic  ();
00443 
00444     for(;  (itBasic != endItBasic          ) &&
00445           !(result  &  NewActionTypes::Quit);    ++itBasic)
00446     {
00447         result = (*itBasic)->start();
00448     }
00449 
00450     return result;
00451 }

NewActionBase::ResultE NewActionBase::stopActors ( void   )  [protected, inherited]

Return a const iterator to the beginning of the extend actors.

Definition at line 454 of file OSGNewActionBase.cpp.

References osg::NewActionBase::beginBasic(), osg::NewActionBase::beginExtend(), osg::NewActionTypes::Continue, osg::NewActionBase::endBasic(), osg::NewActionBase::endExtend(), and osg::NewActionTypes::Quit.

Referenced by osg::PriorityAction::apply(), apply(), and osg::DepthFirstAction::apply().

00455 {
00456     ResultE            result      = NewActionTypes::Continue;
00457 
00458     ExtendActorStoreIt itExtend    = beginExtend();
00459     ExtendActorStoreIt endItExtend = endExtend  ();
00460 
00461     for(; (itExtend != endItExtend         ) &&
00462          !(result   &  NewActionTypes::Quit);    ++itExtend)
00463     {
00464         result = (*itExtend)->stop();
00465     }
00466 
00467     BasicActorStoreIt itBasic    = beginBasic();
00468     BasicActorStoreIt endItBasic = endBasic  ();
00469 
00470     for(;  (itBasic != endItBasic          ) &&
00471           !(result  &  NewActionTypes::Quit);    ++itBasic)
00472     {
00473         result = (*itBasic)->stop();
00474     }
00475 
00476     return result;
00477 }


Friends And Related Function Documentation

friend class StateRefCount [friend]

Definition at line 169 of file OSGDepthFirstStateAction.h.

Referenced by cloneState(), and getState().

friend class NodeStackEntry [friend]

Definition at line 171 of file OSGDepthFirstStateAction.h.

Referenced by apply(), pushChildren(), traverseEnter(), and traverseEnterLeave().

friend class osg::ActorBase [friend, inherited]

Definition at line 168 of file OSGNewActionBase.h.

friend class osg::ExtendActorBase [friend, inherited]

Definition at line 169 of file OSGNewActionBase.h.

friend class osg::BasicActorBase [friend, inherited]

Definition at line 170 of file OSGNewActionBase.h.


Member Data Documentation

Definition at line 72 of file OSGDepthFirstStateAction.h.

Referenced by beginEditStateEvent(), and startEvent().

Definition at line 73 of file OSGDepthFirstStateAction.h.

Referenced by startEvent(), traverseEnter(), and traverseEnterLeave().

Definition at line 249 of file OSGDepthFirstStateAction.h.

Referenced by apply(), cloneState(), decRefCount(), and getState().

Definition at line 252 of file OSGDepthFirstStateAction.h.

Referenced by apply(), cloneState(), decRefCount(), and getState().

Definition at line 255 of file OSGDepthFirstStateAction.h.

Referenced by apply().

Definition at line 260 of file OSGDepthFirstStateAction.h.

Referenced by addExtendEvent(), enterNode(), and subExtendEvent().

Definition at line 261 of file OSGDepthFirstStateAction.h.

Referenced by addExtendEvent(), apply(), leaveNode(), and subExtendEvent().

Definition at line 263 of file OSGDepthFirstStateAction.h.

Referenced by addBasicEvent(), enterNode(), and subBasicEvent().

Definition at line 264 of file OSGDepthFirstStateAction.h.

Referenced by addBasicEvent(), apply(), leaveNode(), and subBasicEvent().


The documentation for this class was generated from the following files:

Generated on Mon Mar 17 11:25:29 2008 for OpenSG by  doxygen 1.5.5