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

osg::DepthFirstAction Class Reference

#include <OSGDepthFirstAction.h>

Inheritance diagram for osg::DepthFirstAction:

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 std::deque< NodeStackEntryNodeStack
*typedef NewActionBase Inherited

Public Member Functions

Destructor
*virtual ~DepthFirstAction (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 DepthFirstActioncreate (void)

Protected Member Functions

Constructors
DepthFirstAction (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 beginEditStateEvent (ActorBase *pActor, UInt32 actorId)
virtual void endEditStateEvent (ActorBase *pActor, UInt32 actorId)
Events
virtual void startEvent (void)
virtual void stopEvent (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)

Private Attributes

NodeStack _nodeStack
ExtendActorStore _extendEnterActors
ExtendActorStore _extendLeaveActors
BasicActorStore _basicEnterActors
BasicActorStore _basicLeaveActors

Friends

Friends
class osg::ExtendActorBase
class osg::BasicActorBase

Classes

class  NodeStackEntry

Detailed Description

Definition at line 61 of file OSGDepthFirstAction.h.


Member Typedef Documentation

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

Definition at line 141 of file OSGDepthFirstAction.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

DepthFirstAction::~DepthFirstAction void   )  [virtual]
 

Destructor.

Definition at line 55 of file OSGDepthFirstAction.cpp.

00056 {
00057 }

DepthFirstAction::DepthFirstAction void   )  [protected]
 

Default constructor.

Definition at line 121 of file OSGDepthFirstAction.cpp.

Referenced by create().

00122     : Inherited         (),
00123       _nodeStack        (),
00124       _extendEnterActors(),
00125       _extendLeaveActors(),
00126       _basicEnterActors (),
00127       _basicLeaveActors ()
00128 {
00129 }


Member Function Documentation

DepthFirstAction * DepthFirstAction::create void   )  [static]
 

Create new instance.

Definition at line 67 of file OSGDepthFirstAction.cpp.

References DepthFirstAction().

00068 {
00069     return new DepthFirstAction();
00070 }

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

Apply the action to the node pRoot, i.e. traverse the graph below it.

Implements osg::NewActionBase.

Definition at line 80 of file OSGDepthFirstAction.cpp.

References _basicLeaveActors, _extendLeaveActors, _nodeStack, osg::NewActionTypes::Continue, osg::NewActionTypes::Quit, osg::NewActionBase::ResultE, osg::NewActionBase::startActors(), osg::NewActionBase::startEvent(), osg::NewActionBase::stopActors(), osg::NewActionBase::stopEvent(), traverseEnter(), and traverseEnterLeave().

00081 {
00082     ResultE result = NewActionTypes::Continue;
00083 
00084     startEvent();
00085 
00086     result = startActors();
00087 
00088     if(result & NewActionTypes::Quit)
00089         return result;
00090 
00091     _nodeStack.push_back(NodeStackEntry(pRoot, 1));
00092 
00093     if((_extendLeaveActors.empty() == true) &&
00094        (_basicLeaveActors .empty() == true)    )
00095     {
00096         result = traverseEnter();
00097     }
00098     else
00099     {
00100         result = traverseEnterLeave();
00101     }
00102 
00103     if(result & NewActionTypes::Quit)
00104         return result;
00105 
00106     result = stopActors();
00107 
00108     stopEvent();
00109 
00110     return result;
00111 }

void DepthFirstAction::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 141 of file OSGDepthFirstAction.cpp.

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

00142 {
00143     ExtendActorStoreIt itActors  = beginExtend();
00144     ExtendActorStoreIt endActors = beginExtend() + actorIndex;
00145 
00146     ExtendActorStoreIt itEnter   = _extendEnterActors.begin();
00147     ExtendActorStoreIt itLeave   = _extendLeaveActors.begin();
00148 
00149     for(; itActors != endActors; ++itActors)
00150     {
00151         if((*itActors)->getEnterNodeFlag() == true)
00152             ++itEnter;
00153 
00154         if((*itActors)->getLeaveNodeFlag() == true)
00155             ++itLeave;
00156     }
00157 
00158     if(pActor->getEnterNodeFlag() == true)
00159         _extendEnterActors.insert(itEnter, pActor);
00160 
00161     if(pActor->getLeaveNodeFlag() == true)
00162         _extendLeaveActors.insert(itLeave, pActor);
00163 }

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

Removes the extend actor from the internal data structures.

Implements osg::NewActionBase.

Definition at line 169 of file OSGDepthFirstAction.cpp.

References _extendEnterActors, and _extendLeaveActors.

00170 {
00171     ExtendActorStoreIt itEnter  = _extendEnterActors.begin();
00172     ExtendActorStoreIt endEnter = _extendEnterActors.end  ();
00173 
00174     ExtendActorStoreIt itLeave  = _extendLeaveActors.begin();
00175     ExtendActorStoreIt endLeave = _extendLeaveActors.end  ();
00176 
00177     for(; itEnter != endEnter; ++itEnter)
00178     {
00179         if(*itEnter == pActor)
00180         {
00181             _extendEnterActors.erase(itEnter);
00182 
00183             break;
00184         }
00185     }
00186 
00187     for(; itLeave != endLeave; ++itLeave)
00188     {
00189         if(*itLeave == pActor)
00190         {
00191             _extendLeaveActors.erase(itLeave);
00192 
00193             break;
00194         }
00195     }
00196 }

void DepthFirstAction::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 204 of file OSGDepthFirstAction.cpp.

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

00205 {
00206     BasicActorStoreIt itActors  = beginBasic();
00207     BasicActorStoreIt endActors = beginBasic() + actorIndex;
00208 
00209     BasicActorStoreIt itEnter   = _basicEnterActors.begin();
00210     BasicActorStoreIt itLeave   = _basicLeaveActors.begin();
00211 
00212     for(; itActors != endActors; ++itActors)
00213     {
00214         if((*itActors)->getEnterNodeFlag() == true)
00215             ++itEnter;
00216 
00217         if((*itActors)->getLeaveNodeFlag() == true)
00218             ++itLeave;
00219     }
00220 
00221     if(pActor->getEnterNodeFlag() == true)
00222         _basicEnterActors.insert(itEnter, pActor);
00223 
00224     if(pActor->getLeaveNodeFlag() == true)
00225         _basicLeaveActors.insert(itLeave, pActor);
00226 }

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

Removes the extend actor from the internal data structures.

Implements osg::NewActionBase.

Definition at line 232 of file OSGDepthFirstAction.cpp.

References _basicEnterActors, and _basicLeaveActors.

00233 {
00234     BasicActorStoreIt itEnter  = _basicEnterActors.begin();
00235     BasicActorStoreIt endEnter = _basicEnterActors.end  ();
00236 
00237     BasicActorStoreIt itLeave  = _basicLeaveActors.begin();
00238     BasicActorStoreIt endLeave = _basicLeaveActors.end  ();
00239 
00240     for(; itEnter != endEnter; ++itEnter)
00241     {
00242         if(*itEnter == pActor)
00243         {
00244             _basicEnterActors.erase(itEnter);
00245 
00246             break;
00247         }
00248     }
00249 
00250     for(; itLeave != endLeave; ++itLeave)
00251     {
00252         if(*itLeave == pActor)
00253         {
00254             _basicLeaveActors.erase(itLeave);
00255 
00256             break;
00257         }
00258     }
00259 }

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

Does nothing, DepthFirstAction never copies state.

Implements osg::NewActionBase.

Definition at line 265 of file OSGDepthFirstAction.cpp.

00266 {
00267 }

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

Does nothing, DepthFirstAction never copies state.

Implements osg::NewActionBase.

Definition at line 273 of file OSGDepthFirstAction.cpp.

00274 {
00275 }

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

Drives the traversal of the graph. It only calls the actors upon "entering" a node.

Definition at line 287 of file OSGDepthFirstAction.cpp.

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

Referenced by apply().

00288 {
00289     ResultE result = NewActionTypes::Continue;
00290     NodePtr pNode;
00291     Int32   nodePass;     // pass over the current node
00292     UInt32  multiPasses;  // requested passes over the current node
00293 
00294     while((_nodeStack.empty() == false) && !(result & NewActionTypes::Quit))
00295     {
00296         pNode    = _nodeStack.back().getNode     ();
00297         nodePass = _nodeStack.back().getPassCount();
00298 
00299         getChildrenList().setParentNode(pNode);
00300 
00301 #ifdef OSG_NEWACTION_STATISTICS
00302         getStatistics()->getElem(statNodesEnter)->inc();
00303 #endif /* OSG_NEWACTION_STATISTICS */
00304 
00305         result      = enterNode   (pNode, static_cast<UInt32>(nodePass - 1));
00306         multiPasses = getNumPasses(                                        );
00307 
00308         _nodeStack.pop_back();
00309 
00310         // only initial pass (nodePass == 1) can request multiPasses
00311         if((nodePass == 1) && (multiPasses > 1))
00312         {
00313             for(; multiPasses > 1; --multiPasses)
00314             {
00315                 _nodeStack.push_back(NodeStackEntry(pNode, multiPasses));
00316             }
00317         }
00318 
00319         pushChildren(pNode, result);
00320     }
00321 
00322     return result;
00323 }

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

Drives the traversal of the graph. It calls the actors upon "entering" and "leaving" a node.

Definition at line 330 of file OSGDepthFirstAction.cpp.

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

Referenced by apply().

00331 {
00332     ResultE result = NewActionTypes::Continue;
00333     NodePtr pNode;
00334     Int32   nodePass;     // pass over the current node
00335     UInt32  multiPasses;  // requested passes over the current node
00336 
00337     while((_nodeStack.empty() == false) && !(result & NewActionTypes::Quit))
00338     {
00339         pNode    = _nodeStack.back().getNode     ();
00340         nodePass = _nodeStack.back().getPassCount();
00341 
00342         getChildrenList().setParentNode(pNode);
00343 
00344         if(nodePass > 0)
00345         {
00346             // positive pass -> enter node
00347 
00348 #ifdef OSG_NEWACTION_STATISTICS
00349             getStatistics()->getElem(statNodesEnter)->inc();
00350 #endif /* OSG_NEWACTION_STATISTICS */
00351 
00352             result      = enterNode   (pNode, static_cast<UInt32>(nodePass - 1));
00353             multiPasses = getNumPasses(               );
00354 
00355             // only initial pass (nodePass == 1) can request multiPasses
00356             if((nodePass == 1) && (multiPasses > 1))
00357             {
00358                 // remove current node from stack
00359                 _nodeStack.pop_back();
00360 
00361                 for(; multiPasses > 1; --multiPasses)
00362                 {
00363                     _nodeStack.push_back(NodeStackEntry(pNode, multiPasses));
00364                 }
00365 
00366                 // readd current node - with negative pass -> leave
00367                 _nodeStack.push_back(NodeStackEntry(pNode, -nodePass));
00368             }
00369             else
00370             {
00371                 // change current node passCount to negative -> leave
00372                 _nodeStack.back().setPassCount(-nodePass);
00373             }
00374 
00375             pushChildren(pNode, result);
00376         }
00377         else
00378         {
00379             // negative pass -> leave node
00380 
00381 #ifdef OSG_NEWACTION_STATISTICS
00382             getStatistics()->getElem(statNodesLeave)->inc();
00383 #endif /* OSG_NEWACTION_STATISTICS */
00384 
00385             result = leaveNode(pNode, static_cast<UInt32>(-nodePass - 1));
00386 
00387             _nodeStack.pop_back();
00388         }
00389     }
00390 
00391     return result;
00392 }

void DepthFirstAction::pushChildren const NodePtr pNode,
ResultE  result
[private]
 

Pushes the active children and extra children of the traversed node onto the internal stack.

Definition at line 399 of file OSGDepthFirstAction.cpp.

References _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(), osg::NullFC, osg::NewActionTypes::Quit, osg::NewActionBase::setChildrenListEnabled(), osg::NewActionBase::setNumPasses(), and osg::NewActionTypes::Skip.

Referenced by traverseEnter(), and traverseEnterLeave().

00400 {
00401     if(result & (NewActionTypes::Skip  |
00402                  NewActionTypes::Break |
00403                  NewActionTypes::Quit   ))
00404     {
00405         setChildrenListEnabled(false);
00406         setNumPasses          (1    );
00407 
00408         getExtraChildrenList().clear();
00409 
00410         return;
00411     }
00412 
00413     ChildrenList      &cl  = getChildrenList     ();
00414     ExtraChildrenList &ecl = getExtraChildrenList();
00415 
00416     if(getChildrenListEnabled() == true)
00417     {
00418         for(UInt32 i = 0, size = cl.getSize(); i < size; ++i)
00419         {
00420             if(( cl.getActive(i)                                 == true  ) &&
00421                ( cl.getChild (i)                                 != NullFC) &&
00422                ((cl.getChild (i)->getTravMask() & getTravMask()) != 0     )   )
00423             {
00424                 _nodeStack.push_back(NodeStackEntry(cl.getChild(i), 1));
00425             }
00426         }
00427     }
00428     else
00429     {
00430         MFNodePtr::const_iterator itChildren  = pNode->getMFChildren()->begin();
00431         MFNodePtr::const_iterator endChildren = pNode->getMFChildren()->end  ();
00432 
00433         for(; itChildren != endChildren; ++itChildren)
00434         {
00435             if((  *itChildren                                  != NullFC) &&
00436                (((*itChildren)->getTravMask() & getTravMask()) != 0     )   )
00437             {
00438                 _nodeStack.push_back(NodeStackEntry(*itChildren, 1));
00439             }
00440         }
00441     }
00442 
00443     for(UInt32 i = 0, size = ecl.getSize(); i < size; ++i)
00444     {
00445         if(( ecl.getActive(i)                                 == true  ) &&
00446            ( ecl.getChild (i)                                 != NullFC) &&
00447            ((ecl.getChild (i)->getTravMask() & getTravMask()) != 0     )   )
00448         {
00449             _nodeStack.push_back(NodeStackEntry(ecl.getChild(i), 1));
00450         }
00451     }
00452 
00453     setChildrenListEnabled(false);
00454     setNumPasses          (1    );
00455     ecl.clear             (     );
00456 }

DepthFirstAction::ResultE osg::DepthFirstAction::enterNode const NodePtr pNode,
UInt32  pass
[inline, private]
 

Calls the enterNode method of the attached actors.

Definition at line 52 of file OSGDepthFirstAction.inl.

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

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 }

DepthFirstAction::ResultE osg::DepthFirstAction::leaveNode const NodePtr pNode,
UInt32  pass
[inline, private]
 

Calls the leaveNode method of the attached actors.

Definition at line 88 of file OSGDepthFirstAction.inl.

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

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 }

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

Referenced by osg::PriorityAction::beginEditStateEvent(), osg::DepthFirstStateAction::beginEditStateEvent(), osg::PriorityAction::startEvent(), osg::NewActionBase::startEvent(), osg::DepthFirstStateAction::startEvent(), osg::PriorityAction::traverseEnter(), osg::DepthFirstStateAction::traverseEnter(), traverseEnter(), osg::DepthFirstStateAction::traverseEnterLeave(), and traverseEnterLeave().

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.
Dev: The ActorBase class has three "visitor pattern" style methods, that will call the appropriate method of the action, e.g. assume pActor is actually derived from ExtendActorBase, then its addHelper method will call the addExtendActor method of the action passed as parameter.

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.

Dev: See NewActionBase::addActor(ActorBase *pActor) for an explanation of the mechanism used to discover the type of pActor.

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.

Dev: See NewActionBase::addActor(ActorBase *pActor) for an explanation of the mechanism used to discover the type of pActor.

I'm not sure if this is a useful thing to have ?? -carsten

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::A