#include <OSGPriorityAction.h>
Inheritance diagram for osg::PriorityAction:

Definition at line 64 of file OSGPriorityAction.h.
|
|
Definition at line 132 of file OSGPriorityAction.h. |
|
|
Definition at line 159 of file OSGPriorityAction.h. |
|
|
Definition at line 160 of file OSGPriorityAction.h. |
|
|
Definition at line 161 of file OSGPriorityAction.h. |
|
|
Definition at line 191 of file OSGPriorityAction.h. |
|
|
Definition at line 192 of file OSGPriorityAction.h. |
|
|
Definition at line 193 of file OSGPriorityAction.h. |
|
|
Definition at line 225 of file OSGPriorityAction.h. |
|
|
Definition at line 226 of file OSGPriorityAction.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. |
|
|
Definition at line 156 of file OSGNewActionBase.h. |
|
|
Definition at line 157 of file OSGNewActionBase.h. |
|
|
Definition at line 159 of file OSGNewActionBase.h. |
|
|
Definition at line 160 of file OSGNewActionBase.h. |
|
|
Definition at line 161 of file OSGNewActionBase.h. |
|
|
Definition at line 68 of file OSGPriorityAction.cpp.
|
|
|
Definition at line 148 of file OSGPriorityAction.cpp. Referenced by create(). 00149 : Inherited ( ), 00150 _extendEnterActors ( ), 00151 _basicEnterActors ( ), 00152 _nodePrioQueue ( ), 00153 _nodePrioQueueComp ( ), 00154 _stateClonedFlag (false), 00155 #ifndef OSG_NEWACTION_STATESLOTINTERFACE 00156 _stateStore ( ), 00157 #endif 00158 _stateRefCountStore( ), 00159 _itInitialState ( ), 00160 _itActiveState ( ) 00161 { 00162 }
|
|
|
Create new instance. Definition at line 80 of file OSGPriorityAction.cpp. References PriorityAction(). 00081 { 00082 return new PriorityAction(); 00083 }
|
|
|
Apply the action to the node pRoot, i.e. traverse the graph below it. Implements osg::NewActionBase. Definition at line 93 of file OSGPriorityAction.cpp. References _itActiveState, _itInitialState, _stateClonedFlag, _stateRefCountStore, _stateStore, cloneState(), osg::NewActionTypes::Continue, decRefCount(), getState(), incRefCount(), NodeQueueEntry, pqClear(), pqPush(), osg::NewActionTypes::Quit, osg::NewActionBase::ResultE, setState(), osg::NewActionBase::startActors(), startEvent(), osg::NewActionBase::stopActors(), stopEvent(), and traverseEnter(). 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 pqPush(NodeQueueEntry(pRoot, PriorityTypeTraits::getZeroElement(), 00111 1, _itActiveState )); 00112 00113 result = traverseEnter(); 00114 00115 setState(_itInitialState); 00116 00117 // lost refs: active, current node 00118 decRefCount(_itActiveState, 2); 00119 00120 _itActiveState = _itInitialState; 00121 _stateClonedFlag = true; 00122 00123 pqClear(); 00124 #ifndef OSG_NEWACTION_STATESLOTINTERFACE 00125 _stateStore .clear(); 00126 #endif 00127 _stateRefCountStore.clear(); 00128 00129 if(result & NewActionTypes::Quit) 00130 { 00131 stopActors(); 00132 stopEvent (); 00133 } 00134 else 00135 { 00136 result = stopActors(); 00137 stopEvent(); 00138 } 00139 00140 return result; 00141 }
|
|
||||||||||||
|
Inserts the extend actor into an internal data structure, depending on whether the enter node flag is set. This avoids making the destinction everytime the actors are called. Implements osg::NewActionBase. Definition at line 174 of file OSGPriorityAction.cpp. References _extendEnterActors, osg::NewActionBase::beginExtend(), and osg::ActorBase::getEnterNodeFlag(). 00175 { 00176 ExtendActorStoreIt itActors = beginExtend(); 00177 ExtendActorStoreIt endActors = beginExtend() + actorIndex; 00178 00179 ExtendActorStoreIt itEnter = _extendEnterActors.begin(); 00180 00181 if(pActor->getEnterNodeFlag() == true) 00182 { 00183 for(; itActors != endActors; ++itActors) 00184 { 00185 if((*itActors)->getEnterNodeFlag() == true) 00186 ++itEnter; 00187 } 00188 00189 _extendEnterActors.insert(itEnter, pActor); 00190 } 00191 }
|
|
||||||||||||
|
Removes the extend actor from the internal data structures. Implements osg::NewActionBase. Definition at line 197 of file OSGPriorityAction.cpp. References _extendEnterActors. 00198 { 00199 ExtendActorStoreIt itEnter = _extendEnterActors.begin(); 00200 ExtendActorStoreIt endEnter = _extendEnterActors.end (); 00201 00202 for(; itEnter != endEnter; ++itEnter) 00203 { 00204 if(*itEnter == pActor) 00205 { 00206 _extendEnterActors.erase(itEnter); 00207 00208 break; 00209 } 00210 } 00211 }
|
|
||||||||||||
|
Inserts the basic actor into an internal data structure, depending on whether the enter node flag is set. This avoids making the destinction everytime the actors are called. Implements osg::NewActionBase. Definition at line 219 of file OSGPriorityAction.cpp. References _basicEnterActors, osg::NewActionBase::beginBasic(), and osg::ActorBase::getEnterNodeFlag(). 00220 { 00221 BasicActorStoreIt itActors = beginBasic(); 00222 BasicActorStoreIt endActors = beginBasic() + actorIndex; 00223 00224 BasicActorStoreIt itEnter = _basicEnterActors.begin(); 00225 00226 if(pActor->getEnterNodeFlag() == true) 00227 { 00228 for(; itActors != endActors; ++itActors) 00229 { 00230 if((*itActors)->getEnterNodeFlag() == true) 00231 ++itEnter; 00232 } 00233 00234 _basicEnterActors.insert(itEnter, pActor); 00235 } 00236 }
|
|
||||||||||||
|
Removes the extend actor from the internal data structures. Implements osg::NewActionBase. Definition at line 242 of file OSGPriorityAction.cpp. References _basicEnterActors. 00243 { 00244 BasicActorStoreIt itEnter = _basicEnterActors.begin(); 00245 BasicActorStoreIt endEnter = _basicEnterActors.end (); 00246 00247 for(; itEnter != endEnter; ++itEnter) 00248 { 00249 if(*itEnter == pActor) 00250 { 00251 _basicEnterActors.erase(itEnter); 00252 00253 break; 00254 } 00255 } 00256 }
|
|
|
Inserts the extend actor into an internal data structure, depending on whether the enter node flag is set. This avoids making the destinction everytime the actors are called. Reimplemented from osg::NewActionBase. Definition at line 259 of file OSGPriorityAction.cpp. References osg::StatCollector::getElem(), osg::NewActionBase::getStatistics(), osg::StatElem::reset(), statStateClones, and statStateRestores. Referenced by apply(). 00260 { 00261 Inherited::startEvent(); 00262 00263 #ifdef OSG_NEWACTION_STATISTICS 00264 getStatistics()->getElem(statStateClones )->reset(); 00265 getStatistics()->getElem(statStateRestores)->reset(); 00266 #endif /* OSG_NEWACTION_STATISTICS */ 00267 }
|
|
|
Inserts the extend actor into an internal data structure, depending on whether the enter node flag is set. This avoids making the destinction everytime the actors are called. Reimplemented from osg::NewActionBase. Definition at line 270 of file OSGPriorityAction.cpp. Referenced by apply().
|
|
||||||||||||
|
Creates a copy of the state of the attached actors and activates the copy. Implements osg::NewActionBase. Definition at line 279 of file OSGPriorityAction.cpp. References _itActiveState, _stateClonedFlag, cloneState(), decRefCount(), osg::StatCollector::getElem(), osg::NewActionBase::getStatistics(), incRefCount(), and statStateClones. 00280 { 00281 if(_stateClonedFlag == false) 00282 { 00283 #ifdef OSG_NEWACTION_STATISTICS 00284 getStatistics()->getElem(statStateClones)->inc(); 00285 #endif /* OSG_NEWACTION_STATISTICS */ 00286 00287 _stateClonedFlag = true; 00288 00289 StateRefCountStoreIt itClonedState = cloneState(); 00290 00291 // gained refs: active and current node 00292 incRefCount(itClonedState, 2); 00293 00294 // lost refs: active and current node 00295 decRefCount(_itActiveState, 2); 00296 00297 _itActiveState = itClonedState; 00298 } 00299 }
|
|
||||||||||||
|
Does nothing. Implements osg::NewActionBase. Definition at line 305 of file OSGPriorityAction.cpp.
|
|
|
Drives the traversal of the graph by activating the proper state for the nodes and calling the enterNode method of the actors. Definition at line 319 of file OSGPriorityAction.cpp. References _itActiveState, _stateClonedFlag, osg::NewActionTypes::Continue, decRefCount(), enqueueChildren(), enterNode(), osg::NewActionBase::getChildrenList(), osg::StatCollector::getElem(), osg::PriorityAction::NodeQueueEntry::getNode(), osg::NewActionBase::getNumPasses(), osg::PriorityAction::NodeQueueEntry::getPassCount(), osg::PriorityAction::NodeQueueEntry::getPriority(), osg::PriorityAction::NodeQueueEntry::getStateRefCount(), osg::NewActionBase::getStatistics(), incRefCount(), NodeQueueEntry, pqEmpty(), pqPop(), pqPush(), pqTop(), osg::NewActionTypes::Quit, osg::NewActionBase::ResultE, osg::ChildrenList::setParentNode(), setState(), osg::NewActionBase::statNodesEnter, and statStateRestores. Referenced by apply(). 00320 { 00321 ResultE result = NewActionTypes::Continue; 00322 NodePtr pNode; 00323 PriorityType nodePrio; 00324 UInt32 nodePass; 00325 UInt32 multiPasses; 00326 StateRefCountStoreIt itStateRefCount; 00327 00328 while((pqEmpty() == false) && !(result & NewActionTypes::Quit)) 00329 { 00330 pNode = pqTop().getNode (); 00331 nodePrio = pqTop().getPriority (); 00332 nodePass = pqTop().getPassCount (); 00333 itStateRefCount = pqTop().getStateRefCount(); 00334 00335 if(itStateRefCount != _itActiveState) 00336 { 00337 #ifdef OSG_NEWACTION_STATISTICS 00338 getStatistics()->getElem(statStateRestores)->inc(); 00339 #endif /* OSG_NEWACTION_STATISTICS */ 00340 00341 setState(itStateRefCount); 00342 00343 // gained refs: active 00344 incRefCount(itStateRefCount); 00345 00346 // lost refs: active 00347 decRefCount(_itActiveState); 00348 00349 _itActiveState = itStateRefCount; 00350 } 00351 00352 _stateClonedFlag = false; 00353 00354 getChildrenList().setParentNode(pNode); 00355 00356 #ifdef OSG_NEWACTION_STATISTICS 00357 getStatistics()->getElem(statNodesEnter)->inc(); 00358 #endif /* OSG_NEWACTION_STATISTICS */ 00359 00360 result = enterNode (pNode, nodePass - 1); 00361 multiPasses = getNumPasses( ); 00362 00363 pqPop(); 00364 00365 // only initial pass (nodePass == 1) can request multiPasses 00366 if((nodePass == 1) && (multiPasses > 1)) 00367 { 00368 for(; multiPasses > 1; --multiPasses) 00369 { 00370 // gained refs: additional pass 00371 incRefCount(_itActiveState); 00372 00373 pqPush(NodeQueueEntry(pNode, nodePrio, 00374 multiPasses, _itActiveState)); 00375 } 00376 } 00377 00378 enqueueChildren(pNode, result); 00379 } 00380 00381 return result; 00382 }
|
|
||||||||||||
|
Inserts the active children and extra children into the internal priority queue. Definition at line 389 of file OSGPriorityAction.cpp. References _itActiveState, osg::NewActionTypes::Break, osg::ExtraChildrenList::clear(), decRefCount(), osg::ExtraChildrenList::getActive(), osg::ChildrenList::getActive(), osg::ExtraChildrenList::getChild(), osg::ChildrenList::getChild(), osg::NewActionBase::getChildrenList(), osg::NewActionBase::getChildrenListEnabled(), osg::NewActionBase::getExtraChildrenList(), osg::ExtraChildrenList::getPriority(), osg::ChildrenList::getPriority(), osg::ExtraChildrenList::getSize(), osg::ChildrenList::getSize(), osg::NewActionBase::getTravMask(), incRefCount(), NodeQueueEntry, osg::NullFC, pqPush(), osg::NewActionTypes::Quit, osg::NewActionBase::setChildrenListEnabled(), osg::NewActionBase::setNumPasses(), and osg::NewActionTypes::Skip. Referenced by traverseEnter(). 00390 { 00391 if(result & (NewActionTypes::Skip | 00392 NewActionTypes::Break | 00393 NewActionTypes::Quit )) 00394 { 00395 setChildrenListEnabled(false); 00396 setNumPasses (1 ); 00397 00398 getExtraChildrenList().clear(); 00399 00400 // lost refs: current node 00401 decRefCount(_itActiveState); 00402 00403 return; 00404 } 00405 00406 ChildrenList &cl = getChildrenList (); 00407 ExtraChildrenList &ecl = getExtraChildrenList(); 00408 00409 if(getChildrenListEnabled() == true) 00410 { 00411 for(UInt32 i = 0, size = cl.getSize(); i < size; ++i) 00412 { 00413 if(( cl.getActive(i) == true ) && 00414 ( cl.getChild (i) != NullFC) && 00415 ((cl.getChild (i)->getTravMask() & getTravMask()) != 0 ) ) 00416 { 00417 // gained refs: child 00418 incRefCount(_itActiveState); 00419 00420 pqPush(NodeQueueEntry(cl.getChild(i), cl.getPriority(i), 00421 1, _itActiveState )); 00422 } 00423 } 00424 } 00425 else 00426 { 00427 MFNodePtr::const_iterator itChildren = pNode->getMFChildren()->begin(); 00428 MFNodePtr::const_iterator endChildren = pNode->getMFChildren()->end (); 00429 00430 for(; itChildren != endChildren; ++itChildren) 00431 { 00432 if(( *itChildren != NullFC) && 00433 (((*itChildren)->getTravMask() & getTravMask()) != 0 ) ) 00434 { 00435 // gained refs: child 00436 incRefCount(_itActiveState); 00437 00438 pqPush( 00439 NodeQueueEntry(*itChildren, 00440 PriorityTypeTraits::getZeroElement(), 00441 1, _itActiveState )); 00442 } 00443 } 00444 } 00445 00446 for(UInt32 i = 0, size = ecl.getSize(); i < size; ++i) 00447 { 00448 if(( ecl.getActive(i) == true ) && 00449 ( ecl.getChild (i) != NullFC) && 00450 ((ecl.getChild (i)->getTravMask() & getTravMask()) != 0 ) ) 00451 { 00452 // gained refs: extra child 00453 incRefCount(_itActiveState); 00454 00455 pqPush(NodeQueueEntry(ecl.getChild(i), ecl.getPriority(i), 00456 1, _itActiveState )); 00457 } 00458 } 00459 00460 setChildrenListEnabled(false); 00461 ecl.clear ( ); 00462 setNumPasses (1 ); 00463 00464 // lost refs: current node 00465 decRefCount(_itActiveState); 00466 }
|
|
||||||||||||
|
Calls the enterNode method of the attached actors. Definition at line 315 of file OSGPriorityAction.inl. References _extendEnterActors, osg::NewActionBase::beginBasic(), osg::NewActionTypes::Break, osg::NewActionTypes::Continue, osg::NewActionBase::endBasic(), osg::NewActionTypes::Quit, and osg::NewActionBase::ResultE. Referenced by traverseEnter(). 00316 { 00317 FunctorArgumentType funcArg(NULL, pNode, pass); 00318 ResultE result = NewActionTypes::Continue; 00319 00320 ExtendActorStoreIt itExtend = _extendEnterActors.begin(); 00321 ExtendActorStoreIt endItExtend = _extendEnterActors.end (); 00322 00323 for(; (itExtend != endItExtend ) && 00324 !(result & (NewActionTypes::Break | NewActionTypes::Quit)); 00325 ++itExtend ) 00326 { 00327 funcArg.setActor(*itExtend); 00328 00329 result = static_cast<ResultE>(result | (*itExtend)->enterNode(funcArg)); 00330 } 00331 00332 BasicActorStoreIt itBasic = beginBasic (); 00333 BasicActorStoreIt endItBasic = endBasic (); 00334 00335 for(; (itBasic != endItBasic ) && 00336 !(result & (NewActionTypes::Break | NewActionTypes::Quit)); 00337 ++itBasic ) 00338 { 00339 funcArg.setActor(*itBasic); 00340 00341 result = static_cast<ResultE>(result | (*itBasic)->enterNode(funcArg)); 00342 } 00343 00344 return result; 00345 }
|
|
|
Creates a copy of the state currently used by the attached actors. Definition at line 351 of file OSGPriorityAction.inl. References _basicEnterActors, _extendEnterActors, _stateRefCountStore, _stateStore, osg::NewActionBase::endBasic(), osg::NewActionBase::endExtend(), and StateRefCount. Referenced by apply(), and beginEditStateEvent(). 00352 { 00353 #ifdef OSG_NEWACTION_STATESLOTINTERFACE 00354 00355 UInt32 stateSlot; 00356 StateRefCountStoreIt itStateRefCount = --(_stateRefCountStore.end()); 00357 00358 ExtendActorStoreIt itExtend = _extendEnterActors.begin(); 00359 ExtendActorStoreIt endExtend = _extendEnterActors.end (); 00360 00361 for(; itExtend != endExtend; ++itExtend) 00362 { 00363 stateSlot = (*itExtend)->createStateClone(); 00364 } 00365 00366 BasicActorStoreIt itBasic = _basicEnterActors.begin(); 00367 BasicActorStoreIt endBasic = _basicEnterActors.end (); 00368 00369 for(; itBasic != endBasic; ++itBasic) 00370 { 00371 stateSlot = (*itBasic)->createStateClone(); 00372 } 00373 00374 _stateRefCountStore.push_back(StateRefCount |