#include <OSGChangeList.h>
Inheritance diagram for OSG::ChangeList:

Public Types | |
| typedef std::vector< ContainerChangeEntry > | ChangeEntryStore |
| typedef std::list< std::vector< ContainerChangeEntry > > | ChangeEntryPool |
| typedef ChangeEntryPool::iterator | ChangeEntryPoolIt |
| typedef ChangeEntryStore::iterator | ChangeEntryStoreIt |
| typedef std::vector< ContainerChangeEntry * > | ChangedStore |
| typedef ChangedStore::iterator | ChangedStoreIt |
| typedef ChangedStore::const_iterator | ChangedStoreConstIt |
| typedef void(ContainerChangeEntry::*) | CommitFunction (void) |
Public Member Functions | |
General Fieldcontainer Declaration | |
| void | fillFromCurrentState (UInt32 uiFieldContainerId) |
Set | |
| void | commitChanges (void) |
| void | commitChangesAndClear (void) |
your_category | |
| void | applyAndClear (void) |
| void | applyNoClear (void) |
Container Access | |
| void | clear (void) |
Binary Access | |
| void | merge (ChangeList &pOther) |
your_operators | |
| ChangedStoreConstIt | begin (void) const |
| ChangedStoreConstIt | end (void) const |
| ChangedStoreConstIt | beginCreated (void) const |
| ChangedStoreConstIt | endCreated (void) const |
your_operators | |
| UInt32 | getNumCreated (void) const |
| UInt32 | getNumDestroyed (void) const |
Dump | |
| virtual void | dump (UInt32 uiIndent=0, const BitVector bvFlags=0) const |
| void | dumpListSizes (void) const |
| void | fillStatistic (StatCollector *pColl) const |
Reference Counting | |
| void | addRef (void) |
| void | subRef (void) |
| Int32 | getRefCount (void) |
Static Public Member Functions | |
Helper | |
| static ChangeList * | create (void) |
Static Public Attributes | |
dcast | |
| static StatElemDesc< StatIntElem > | statNChangedStoreSize |
| static StatElemDesc< StatIntElem > | statNCreatedStoreSize |
| static StatElemDesc< StatIntElem > | statNUnCommittedStoreSize |
| static StatElemDesc< StatIntElem > | statNPoolSize |
Protected Member Functions | |
Constructors | |
| ChangeList (void) | |
Destructor | |
| virtual | ~ChangeList (void) |
Get | |
| void | addAddRefd (const UInt32 uiContainerId) |
| void | addSubRefd (const UInt32 uiContainerId, bool ignoreLevel=false) |
| void | addCreated (const UInt32 uiContainerId) |
Set | |
| ContainerChangeEntry * | getNewEntry (void) |
| ContainerChangeEntry * | getNewCreatedEntry (void) |
Set | |
| void | addUncommited (ContainerChangeEntry *pEntry) |
Assignment | |
| void | incSubRefLevel (void) |
| void | decSubRefLevel (void) |
Member | |
| ContainerChangeEntry * | createNewEntry (void) |
| void | doApply (bool bClear) |
| void | doClear (void) |
| void | clearPool (void) |
| template<CommitFunction func> | |
| void | doCommitChanges (void) |
Sync | |
| void | setAspect (UInt32 uiAspectId) |
Protected Attributes | |
Type information | |
| ChangeEntryPool | _entryPool |
| ChangeEntryPoolIt | _currentPoolElement |
| ChangeEntryStoreIt | _currentEntry |
| ChangedStore | _changedStore |
| ChangedStore | _createdStore |
| ChangedStore | _uncommitedChanges |
| ChangedStore | _workStore |
| UInt32 | _uiAspect |
| Int32 | _iSubRefLevel |
| bool | _bExternal |
Private Types | |
| typedef MemoryObject | Inherited |
Private Member Functions | |
| ChangeList (const ChangeList &source) | |
| prohibit default function (move to 'public' if needed) | |
| void | operator= (const ChangeList &source) |
| prohibit default function (move to 'public' if needed) | |
Friends | |
| class | PThreadBase |
| class | SprocBase |
| class | WinThreadBase |
| class | FieldContainer |
Definition at line 121 of file OSGChangeList.h.
| typedef std::vector<ContainerChangeEntry> OSG::ChangeList::ChangeEntryStore |
Definition at line 127 of file OSGChangeList.h.
| typedef std::list< std::vector<ContainerChangeEntry> > OSG::ChangeList::ChangeEntryPool |
Definition at line 128 of file OSGChangeList.h.
| typedef ChangeEntryPool ::iterator OSG::ChangeList::ChangeEntryPoolIt |
Definition at line 130 of file OSGChangeList.h.
| typedef ChangeEntryStore::iterator OSG::ChangeList::ChangeEntryStoreIt |
Definition at line 131 of file OSGChangeList.h.
| typedef std::vector<ContainerChangeEntry *> OSG::ChangeList::ChangedStore |
Definition at line 133 of file OSGChangeList.h.
| typedef ChangedStore::iterator OSG::ChangeList::ChangedStoreIt |
Definition at line 134 of file OSGChangeList.h.
| typedef ChangedStore::const_iterator OSG::ChangeList::ChangedStoreConstIt |
Definition at line 135 of file OSGChangeList.h.
| typedef void(ContainerChangeEntry::*) OSG::ChangeList::CommitFunction(void) |
Definition at line 233 of file OSGChangeList.h.
typedef MemoryObject OSG::ChangeList::Inherited [private] |
Definition at line 354 of file OSGChangeList.h.
| ChangeList::ChangeList | ( | void | ) | [protected] |
Definition at line 207 of file OSGChangeList.cpp.
References _currentEntry, _currentPoolElement, and _entryPool.
00207 : 00208 Inherited ( ), 00209 _entryPool ( ), 00210 _currentPoolElement( ), 00211 _currentEntry ( ), 00212 _changedStore ( ), 00213 _createdStore ( ), 00214 _uncommitedChanges ( ), 00215 _workStore ( ), 00216 _uiAspect ( 0), 00217 _iSubRefLevel ( 0), 00218 _bExternal (false ) 00219 { 00220 _entryPool.push_back(ChangeEntryStore()); 00221 00222 _currentPoolElement = _entryPool.begin(); 00223 00224 _currentPoolElement->resize(32); 00225 00226 _currentEntry = _currentPoolElement->begin(); 00227 }
| ChangeList::~ChangeList | ( | void | ) | [protected, virtual] |
| OSG::ChangeList::ChangeList | ( | const ChangeList & | source | ) | [private] |
| void ChangeList::fillFromCurrentState | ( | UInt32 | uiFieldContainerId | ) |
Definition at line 630 of file OSGChangeList.cpp.
References OSG::FieldBits::AllFields, OSG::ContainerChangeEntry::Change, clear(), getNewEntry(), NullFC, OSG::ContainerChangeEntry::pFieldFlags, OSG::SingletonHolder< SingletonT >::the(), OSG::ContainerChangeEntry::uiContainerId, OSG::ContainerChangeEntry::uiEntryDesc, and OSG::ContainerChangeEntry::whichField.
00631 { 00632 this->clear(); 00633 00634 UInt32 uiNumContainers = 00635 FieldContainerFactory::the()->getNumContainers(); 00636 00637 if(uiNumContainers <= uiFieldContainerId) 00638 { 00639 return; 00640 } 00641 00642 for(UInt32 i = uiFieldContainerId; i < uiNumContainers; ++i) 00643 { 00644 FieldContainerPtr pContainer = 00645 FieldContainerFactory::the()->getContainer(i); 00646 00647 if(pContainer != NullFC) 00648 { 00649 this->addCreated(i); 00650 00651 for(UInt32 j = 0; j < pContainer->getRefCount(); ++j) 00652 this->addAddRefd(i); 00653 00654 ContainerChangeEntry *pEntry = this->getNewEntry(); 00655 00656 pEntry->uiEntryDesc = ContainerChangeEntry::Change; 00657 pEntry->pFieldFlags = pContainer->getFieldFlags(); 00658 pEntry->uiContainerId = i; 00659 pEntry->whichField = FieldBits::AllFields; 00660 } 00661 } 00662 }
| ChangeList * ChangeList::create | ( | void | ) | [static] |
Definition at line 193 of file OSGChangeList.cpp.
References _bExternal, _uiAspect, and OSG::Thread::getCurrentAspect().
Referenced by OSG::ClusterWindow::frameInit().
00194 { 00195 ChangeList *returnValue = new ChangeList; 00196 00197 returnValue->_uiAspect = Thread::getCurrentAspect(); 00198 00199 returnValue->_bExternal = true; 00200 00201 return returnValue; 00202 }
| void ChangeList::commitChanges | ( | void | ) |
Definition at line 349 of file OSGChangeList.cpp.
Referenced by OSG::commitChanges(), OSG::HDRStage::setupStageData(), and OSG::SimpleSceneManager::update().
| void ChangeList::commitChangesAndClear | ( | void | ) |
Definition at line 354 of file OSGChangeList.cpp.
References clear().
Referenced by OSG::commitChangesAndClear().
00355 { 00356 doCommitChanges<&ContainerChangeEntry::commitChanges>(); 00357 clear(); 00358 }
| void OSG::ChangeList::applyAndClear | ( | void | ) | [inline] |
| void OSG::ChangeList::applyNoClear | ( | void | ) | [inline] |
Definition at line 112 of file OSGChangeList.inl.
References doApply().
00113 { 00114 doApply(false); 00115 }
| void OSG::ChangeList::clear | ( | void | ) | [inline] |
Definition at line 118 of file OSGChangeList.inl.
References _uiAspect, clearPool(), doClear(), and OSG::Thread::getCurrentAspect().
Referenced by OSG::clearChangeList(), clearInitChanges(), commitChangesAndClear(), fillFromCurrentState(), and OSG::ClusterWindow::frameInit().
00119 { 00120 #ifdef OSG_MT_CPTR_ASPECT 00121 if(_uiAspect != Thread::getCurrentAspect()) 00122 { 00123 fprintf(stderr, "ChangeList::clear aspects don't match %d %d\n", 00124 _uiAspect, Thread::getCurrentAspect()); 00125 00126 return; 00127 } 00128 #endif 00129 00130 doClear (); 00131 clearPool(); 00132 }
| void ChangeList::merge | ( | ChangeList & | pOther | ) |
Definition at line 587 of file OSGChangeList.cpp.
References _changedStore, _createdStore, OSG::ContainerChangeEntry::AddReference, OSG::ContainerChangeEntry::Change, OSG::ContainerChangeEntry::Create, OSG::ContainerChangeEntry::DepSubReference, getNewCreatedEntry(), getNewEntry(), OSG::ContainerChangeEntry::pFieldFlags, OSG::ContainerChangeEntry::SubReference, OSG::ContainerChangeEntry::uiContainerId, OSG::ContainerChangeEntry::uiEntryDesc, and OSG::ContainerChangeEntry::whichField.
Referenced by OSG::ClusterWindow::frameInit().
00588 { 00589 ChangedStoreConstIt cIt = other._createdStore.begin(); 00590 ChangedStoreConstIt cEnd = other._createdStore.end (); 00591 00592 while(cIt != cEnd) 00593 { 00594 ContainerChangeEntry *pEntry = getNewCreatedEntry(); 00595 00596 pEntry->uiEntryDesc = ContainerChangeEntry::Create; 00597 pEntry->uiContainerId = (*cIt)->uiContainerId; 00598 00599 ++cIt; 00600 } 00601 00602 cIt = other._changedStore.begin(); 00603 cEnd = other._changedStore.end (); 00604 00605 while(cIt != cEnd) 00606 { 00607 if((*cIt)->uiEntryDesc == ContainerChangeEntry::AddReference || 00608 (*cIt)->uiEntryDesc == ContainerChangeEntry::SubReference || 00609 (*cIt)->uiEntryDesc == ContainerChangeEntry::DepSubReference ) 00610 { 00611 ContainerChangeEntry *pEntry = getNewEntry(); 00612 00613 pEntry->uiEntryDesc = (*cIt)->uiEntryDesc; 00614 pEntry->uiContainerId = (*cIt)->uiContainerId; 00615 } 00616 else if((*cIt)->uiEntryDesc == ContainerChangeEntry::Change) 00617 { 00618 ContainerChangeEntry *pEntry = getNewEntry(); 00619 00620 pEntry->uiEntryDesc = ContainerChangeEntry::Change; 00621 pEntry->pFieldFlags = (*cIt)->pFieldFlags; 00622 pEntry->uiContainerId = (*cIt)->uiContainerId; 00623 pEntry->whichField = (*cIt)->whichField; 00624 } 00625 00626 ++cIt; 00627 } 00628 }
| ChangeList::ChangedStoreConstIt OSG::ChangeList::begin | ( | void | ) | const [inline] |
Definition at line 141 of file OSGChangeList.inl.
References _changedStore.
Referenced by OSG::RemoteAspect::sendSync().
00142 { 00143 return _changedStore.begin(); 00144 }
| ChangeList::ChangedStoreConstIt OSG::ChangeList::end | ( | void | ) | const [inline] |
Definition at line 147 of file OSGChangeList.inl.
References _changedStore.
Referenced by OSG::RemoteAspect::sendSync().
00148 { 00149 return _changedStore.end(); 00150 }
| ChangeList::ChangedStoreConstIt OSG::ChangeList::beginCreated | ( | void | ) | const [inline] |
Definition at line 153 of file OSGChangeList.inl.
References _createdStore.
Referenced by OSG::SortLastWindow::buildGroups(), and OSG::RemoteAspect::sendSync().
00154 { 00155 return _createdStore.begin(); 00156 }
| ChangeList::ChangedStoreConstIt OSG::ChangeList::endCreated | ( | void | ) | const [inline] |
Definition at line 159 of file OSGChangeList.inl.
References _createdStore.
Referenced by OSG::SortLastWindow::buildGroups(), and OSG::RemoteAspect::sendSync().
00160 { 00161 return _createdStore.end(); 00162 }
| UInt32 OSG::ChangeList::getNumCreated | ( | void | ) | const [inline] |
Definition at line 165 of file OSGChangeList.inl.
References _changedStore.
Referenced by OSG::BalancedMultiWindow::createLoadGroups().
00166 { 00167 return _changedStore.size(); 00168 }
| UInt32 OSG::ChangeList::getNumDestroyed | ( | void | ) | const [inline] |
Definition at line 171 of file OSGChangeList.inl.
Referenced by OSG::BalancedMultiWindow::createLoadGroups().
| void ChangeList::dump | ( | UInt32 | uiIndent = 0, |
|
| const BitVector | bvFlags = 0 | |||
| ) | const [virtual] |
Definition at line 673 of file OSGChangeList.cpp.
References _changedStore, _createdStore, _uncommitedChanges, and OSG::SingletonHolder< SingletonT >::the().
Referenced by doCommitChanges().
00675 { 00676 ChangedStoreConstIt cIt = _createdStore.begin(); 00677 ChangedStoreConstIt cEnd = _createdStore.end (); 00678 00679 fprintf(stderr, "CL created dump\n"); 00680 00681 while(cIt != cEnd) 00682 { 00683 for(UInt32 i = 0; i < uiIndent + 4; ++i) 00684 { 00685 fprintf(stderr, " "); 00686 } 00687 00688 fprintf(stderr, "CE : %u %u\n", 00689 (*cIt)->uiEntryDesc, 00690 (*cIt)->uiContainerId); 00691 00692 ++cIt; 00693 } 00694 00695 cIt = _changedStore.begin(); 00696 cEnd = _changedStore.end (); 00697 00698 fprintf(stderr, "CL changed dump\n"); 00699 00700 while(cIt != cEnd) 00701 { 00702 for(UInt32 i = 0; i < uiIndent + 4; ++i) 00703 { 00704 fprintf(stderr, " "); 00705 } 00706 00707 FieldContainerPtr pTmp = 00708 FieldContainerFactory::the()->getContainer((*cIt)->uiContainerId); 00709 00710 std::string szTmp("Unknown"); 00711 00712 if(pTmp != NULL) 00713 { 00714 szTmp.assign(pTmp->getType().getCName()); 00715 } 00716 00717 BitVector tmpChanges = 0xDEADBEEF; 00718 00719 if((*cIt)->bvUncommittedChanges != NULL) 00720 { 00721 tmpChanges = *((*cIt)->bvUncommittedChanges); 00722 } 00723 00724 fprintf(stderr, "CE : %u %u 0x%016llx 0x%016llx (%p|%p) | %s\n", 00725 (*cIt)->uiEntryDesc, 00726 (*cIt)->uiContainerId, 00727 tmpChanges, 00728 (*cIt)->whichField, 00729 (*cIt), 00730 (*cIt)->bvUncommittedChanges, 00731 szTmp.c_str()); 00732 00733 ++cIt; 00734 } 00735 00736 cIt = _uncommitedChanges.begin(); 00737 cEnd = _uncommitedChanges.end (); 00738 00739 fprintf(stderr, "CL uncommited dump\n"); 00740 00741 while(cIt != cEnd) 00742 { 00743 for(UInt32 i = 0; i < uiIndent + 4; ++i) 00744 { 00745 fprintf(stderr, " "); 00746 } 00747 00748 BitVector tmpChanges = 0xDEADBEEF; 00749 00750 if((*cIt)->bvUncommittedChanges != NULL) 00751 { 00752 tmpChanges = *((*cIt)->bvUncommittedChanges); 00753 } 00754 00755 00756 FieldContainerPtr pTmp = 00757 FieldContainerFactory::the()->getContainer((*cIt)->uiContainerId); 00758 00759 std::string szTmp("Unknown"); 00760 00761 if(pTmp != NULL) 00762 { 00763 szTmp.assign(pTmp->getType().getCName()); 00764 } 00765 00766 fprintf(stderr, "CE : %u %u 0x%016llx 0x%016llx (%p|%p) | %s\n", 00767 (*cIt)->uiEntryDesc, 00768 (*cIt)->uiContainerId, 00769 tmpChanges, 00770 (*cIt)->whichField, 00771 (*cIt), 00772 (*cIt)->bvUncommittedChanges, 00773 szTmp.c_str()); 00774 00775 ++cIt; 00776 } 00777 00778 cIt = _workStore.begin(); 00779 cEnd = _workStore.end (); 00780 00781 fprintf(stderr, "CL workstore dump\n"); 00782 00783 while(cIt != cEnd) 00784 { 00785 for(UInt32 i = 0; i < uiIndent + 4; ++i) 00786 { 00787 fprintf(stderr, " "); 00788 } 00789 00790 BitVector tmpChanges = 0xDEADBEEF; 00791 00792 if((*cIt)->bvUncommittedChanges != NULL) 00793 { 00794 tmpChanges = *((*cIt)->bvUncommittedChanges); 00795 } 00796 00797 fprintf(stderr, "CE : %u %u 0x%016llx 0x%016llx\n", 00798 (*cIt)->uiEntryDesc, 00799 (*cIt)->uiContainerId, 00800 tmpChanges, 00801 (*cIt)->whichField); 00802 00803 ++cIt; 00804 } 00805 }
| void ChangeList::dumpListSizes | ( | void | ) | const |
Definition at line 807 of file OSGChangeList.cpp.
References _changedStore, _createdStore, _entryPool, and _uncommitedChanges.
00808 { 00809 fprintf(stderr, "CL : CH_S : %d | CR_S : %d | UC_S : %d | P_S %d\n", 00810 _changedStore.size(), 00811 _createdStore.size(), 00812 _uncommitedChanges.size(), 00813 _entryPool.size() * 32 ); 00814 }
| void ChangeList::fillStatistic | ( | StatCollector * | pColl | ) | const |
Definition at line 816 of file OSGChangeList.cpp.
References _changedStore, _createdStore, _entryPool, _uncommitedChanges, OSG::StatCollector::getElem(), size, statNChangedStoreSize, statNCreatedStoreSize, statNPoolSize, and statNUnCommittedStoreSize.
Referenced by OSG::SimpleSceneManager::update().
00817 { 00818 if(pColl == NULL) 00819 return; 00820 00821 pColl->getElem(statNChangedStoreSize )->set(_changedStore .size()); 00822 pColl->getElem(statNCreatedStoreSize )->set(_createdStore .size()); 00823 pColl->getElem(statNUnCommittedStoreSize)->set(_uncommitedChanges.size()); 00824 pColl->getElem(statNPoolSize )->set(_entryPool.size() * 32 ); 00825 00826 }
| void ChangeList::addAddRefd | ( | const UInt32 | uiContainerId | ) | [protected] |
Definition at line 66 of file OSGChangeList.cpp.
References OSG::ContainerChangeEntry::AddReference, getNewEntry(), OSG::ContainerChangeEntry::uiContainerId, and OSG::ContainerChangeEntry::uiEntryDesc.
Referenced by OSG::FieldContainer::addReference().
00067 { 00068 #ifdef OSG_ENABLE_VALGRIND_CHECKS 00069 VALGRIND_CHECK_VALUE_IS_DEFINED(uiContainerId); 00070 #endif 00071 00072 #ifndef SILENT 00073 fprintf(stderr, "Add AddRef %u\n", 00074 uiContainerId); 00075 #endif 00076 00077 ContainerChangeEntry *pEntry = getNewEntry(); 00078 00079 pEntry->uiEntryDesc = ContainerChangeEntry::AddReference; 00080 pEntry->uiContainerId = uiContainerId; 00081 }
| void ChangeList::addSubRefd | ( | const UInt32 | uiContainerId, | |
| bool | ignoreLevel = false | |||
| ) | [protected] |
Definition at line 83 of file OSGChangeList.cpp.
References _iSubRefLevel, OSG::ContainerChangeEntry::DepSubReference, getNewEntry(), OSG::ContainerChangeEntry::SubReference, OSG::ContainerChangeEntry::uiContainerId, and OSG::ContainerChangeEntry::uiEntryDesc.
Referenced by OSG::FieldContainer::subReference(), OSG::FieldContainer::subReferenceLocalVar(), and OSG::FieldContainer::subReferenceUnresolved().
00085 { 00086 #ifdef OSG_ENABLE_VALGRIND_CHECKS 00087 VALGRIND_CHECK_VALUE_IS_DEFINED(uiContainerId); 00088 #endif 00089 00090 #ifndef SILENT 00091 fprintf(stderr, "Add SubRef %u\n", uiContainerId); 00092 #endif 00093 00094 ContainerChangeEntry *pEntry = getNewEntry(); 00095 00096 if(_iSubRefLevel == 0 || ignoreLevel == true) 00097 { 00098 pEntry->uiEntryDesc = ContainerChangeEntry::SubReference; 00099 } 00100 else 00101 { 00102 pEntry->uiEntryDesc = ContainerChangeEntry::DepSubReference; 00103 } 00104 00105 pEntry->uiContainerId = uiContainerId; 00106 }
| void ChangeList::addCreated | ( | const UInt32 | uiContainerId | ) | [protected] |
Definition at line 108 of file OSGChangeList.cpp.
References OSG::ContainerChangeEntry::Create, getNewCreatedEntry(), OSG::ContainerChangeEntry::uiContainerId, and OSG::ContainerChangeEntry::uiEntryDesc.
Referenced by OSG::FieldContainer::newPtr().
00109 { 00110 #ifdef OSG_ENABLE_VALGRIND_CHECKS 00111 VALGRIND_CHECK_VALUE_IS_DEFINED(uiContainerId); 00112 #endif 00113 00114 #ifndef SILENT 00115 fprintf(stderr, "Add Create %u\n", 00116 uiContainerId); 00117 #endif 00118 00119 ContainerChangeEntry *pEntry = getNewCreatedEntry(); 00120 00121 pEntry->uiEntryDesc = ContainerChangeEntry::Create; 00122 pEntry->uiContainerId = uiContainerId; 00123 }
| ContainerChangeEntry * ChangeList::getNewEntry | ( | void | ) | [protected] |
Definition at line 268 of file OSGChangeList.cpp.
References _changedStore, OSG::ContainerChangeEntry::clear(), and createNewEntry().
Referenced by addAddRefd(), addSubRefd(), OSG::PointerFuncs::endEdit(), fillFromCurrentState(), merge(), and OSG::FieldContainer::registerChangedContainer().
00269 { 00270 ContainerChangeEntry *returnValue = createNewEntry(); 00271 returnValue->clear(); 00272 00273 _changedStore.push_back(returnValue); 00274 00275 return returnValue; 00276 }
| ContainerChangeEntry * ChangeList::getNewCreatedEntry | ( | void | ) | [protected] |
Definition at line 279 of file OSGChangeList.cpp.
References _createdStore, OSG::ContainerChangeEntry::clear(), and createNewEntry().
Referenced by addCreated(), and merge().
00280 { 00281 ContainerChangeEntry *returnValue = createNewEntry(); 00282 returnValue->clear(); 00283 00284 _createdStore.push_back(returnValue); 00285 00286 return returnValue; 00287 }
| void ChangeList::addUncommited | ( | ContainerChangeEntry * | pEntry | ) | [protected] |
Definition at line 125 of file OSGChangeList.cpp.
References _uncommitedChanges, OSG_ASSERT, and OSG::ContainerChangeEntry::uiContainerId.
Referenced by OSG::FieldContainer::registerChangedContainer().
00126 { 00127 #ifndef SILENT 00128 fprintf(stderr, "Added changed %d\n", pEntry->uiContainerId); 00129 #endif 00130 OSG_ASSERT(NULL != pEntry); 00131 _uncommitedChanges.push_back(pEntry); 00132 }
| void OSG::ChangeList::incSubRefLevel | ( | void | ) | [inline, protected] |
Definition at line 177 of file OSGChangeList.inl.
References _iSubRefLevel.
Referenced by OSG::FieldContainer::subReference(), and OSG::FieldContainer::subReferenceLocalVar().
00178 { 00179 ++_iSubRefLevel; 00180 }
| void OSG::ChangeList::decSubRefLevel | ( | void | ) | [inline, protected] |
Definition at line 183 of file OSGChangeList.inl.
References _iSubRefLevel.
Referenced by OSG::FieldContainer::subReference(), and OSG::FieldContainer::subReferenceLocalVar().
00184 { 00185 --_iSubRefLevel; 00186 }
| ContainerChangeEntry * ChangeList::createNewEntry | ( | void | ) | [protected] |
Definition at line 239 of file OSGChangeList.cpp.
References _currentEntry, _currentPoolElement, and _entryPool.
Referenced by getNewCreatedEntry(), and getNewEntry().
00240 { 00241 if(_currentEntry == _currentPoolElement->end()) 00242 { 00243 ++_currentPoolElement; 00244 00245 if(_currentPoolElement == _entryPool.end()) 00246 { 00247 _entryPool.push_back(ChangeEntryStore()); 00248 00249 _currentPoolElement = _entryPool.end(); 00250 --_currentPoolElement; 00251 00252 _currentPoolElement->resize(32); 00253 } 00254 00255 _currentEntry = _currentPoolElement->begin(); 00256 } 00257 00258 ContainerChangeEntry *returnValue = &(*_currentEntry); 00259 00260 ++_currentEntry; 00261 00262 return returnValue; 00263 }
| void ChangeList::doApply | ( | bool | bClear | ) | [protected] |
Definition at line 361 of file OSGChangeList.cpp.
References _changedStore, _createdStore, _uiAspect, OSG::ContainerChangeEntry::AddReference, OSG::ContainerChangeEntry::Change, OSG::Thread::getCurrentAspect(), OSG::ThreadManager::getNumAspects(), OSG::ContainerChangeEntry::SubReference, and OSG::SingletonHolder< SingletonT >::the().
Referenced by applyAndClear(), and applyNoClear().
00362 { 00363 #ifdef OSG_MT_CPTR_ASPECT 00364 FieldContainerPtr pSrc = NULL; 00365 FieldContainerPtr pDst = NULL; 00366 00367 ChangedStoreConstIt ccIt = _createdStore.begin(); 00368 ChangedStoreConstIt ccEnd = _createdStore.end (); 00369 00370 00371 while(ccIt != ccEnd) 00372 { 00373 AspectStoreP pHandler = 00374 FieldContainerFactory::the()->getContainerHandler( 00375 (*ccIt)->uiContainerId); 00376 00377 if(pHandler == NULL) 00378 { 00379 #ifndef SILENT_CPTR 00380 fprintf(stderr, "Strange handler nil %d %p\n", 00381 (*ccIt)->uiContainerId, 00382 pHandler); 00383 00384 #endif 00385 ++ccIt; 00386 continue; 00387 } 00388 00389 pSrc = pHandler->getPtr(_uiAspect ); 00390 pDst = pHandler->getPtr(Thread::getCurrentAspect()); 00391 00392 if(pSrc == NULL) 00393 { 00394 #ifndef SILENT_CPTR 00395 fprintf(stderr, "Strange src nil %d %p\n", 00396 (*ccIt)->uiContainerId, 00397 pSrc); 00398 00399 #endif 00400 ++ccIt; 00401 continue; 00402 } 00403 00404 if(pDst == NULL) 00405 { 00406 pDst = pSrc->getType().createAspectCopy((*ccIt)->uiContainerId); 00407 00408 #ifndef SILENT_CPTR 00409 fprintf(stderr, "Setup store for %d %p \n", 00410 (*ccIt)->uiContainerId, 00411 pDst); 00412 #endif 00413 00414 if(pDst != NULL) 00415 pDst->setupAspectStore(pHandler); 00416 00417 #ifndef SILENT_CPTR 00418 pHandler->dump(); 00419 #endif 00420 } 00421 00422 ++ccIt; 00423 } 00424 00425 00426 ChangedStoreIt cIt = _changedStore.begin(); 00427 ChangedStoreConstIt cEnd = _changedStore.end (); 00428 00429 #ifndef SILENT_CPTR 00430 fprintf(stderr, "CL apply %u -> %u\n", 00431 _uiAspect, 00432 Thread::getCurrentAspect()); 00433 #endif 00434 00435 BitVector syncMode = 0; 00436 00437 AspectOffsetStore oOffsets; 00438 00439 while(cIt != cEnd) 00440 { 00441 AspectStoreP pHandler = 00442 FieldContainerFactory::the()->getContainerHandler( 00443 (*cIt)->uiContainerId); 00444 00445 if(pHandler == NULL) 00446 { 00447 ++cIt; 00448 continue; 00449 } 00450 00451 pSrc = pHandler->getPtr(_uiAspect ); 00452 pDst = pHandler->getPtr(Thread::getCurrentAspect()); 00453 00454 00455 #ifndef SILENT_CPTR 00456 fprintf(stderr, "process changes for %d %p %s %p %s\n", 00457 (*cIt)->uiContainerId, 00458 pSrc, 00459 pSrc != NULL ? pSrc->getType().getCName() : "null", 00460 pDst, 00461 pDst != NULL ? pSrc->getType().getCName() : "null"); 00462 #endif 00463 00464 if(pDst == NULL && pSrc != NULL) 00465 { 00466 pDst = pSrc->getType().createAspectCopy((*cIt)->uiContainerId); 00467 00468 if(pDst != NULL) 00469 pDst->setupAspectStore(pHandler); 00470 00471 #ifndef SILENT_CPTR 00472 pHandler->dump(); 00473 #endif 00474 } 00475 00476 #ifndef SILENT_CPTR 00477 fprintf(stderr, "Xprocess changes for %d %p %s %p %s | %d %d %p\n", 00478 (*cIt)->uiContainerId, 00479 pSrc, 00480 pSrc != NULL ? pSrc->getType().getCName() : "null", 00481 pDst, 00482 pDst != NULL ? pSrc->getType().getCName() : "null", 00483 _uiAspect, 00484 Thread::getCurrentAspect(), 00485 pHandler); 00486 #endif 00487 00488 if((*cIt)->uiEntryDesc == ContainerChangeEntry::Change) 00489 { 00490 if(pSrc != NULL && pDst != NULL) // be safe for now 00491 { 00492 pHandler->fillOffsetArray(oOffsets, pDst); 00493 00494 #ifndef SILENT_CPTR 00495 for(UInt32 i = 0; i < ThreadManager::getNumAspects(); ++i) 00496 { 00497 fprintf(stderr, "offset %d %d\n", i, oOffsets[i]); 00498 } 00499 #endif 00500 00501 UInt32 uiSInfo = 00502 /*uiSyncInfo*/ 0 | 00503 (_uiAspect << 24) | 00504 (Thread::getCurrentAspect() << 16); 00505 00506 00507 pDst->execSyncV(*pSrc, 00508 (*cIt)->whichField, 00509 oOffsets, 00510 syncMode, 00511 uiSInfo); 00512 00513 if(bClear == true) 00514 { 00515 pSrc->clearChangeEntry(*cIt); 00516 } 00517 } 00518 } 00519 else if((*cIt)->uiEntryDesc == ContainerChangeEntry::AddReference) 00520 { 00521 #ifndef SILENT_CPTR 00522 fprintf(stderr, "Execute add Ref for %d %s\n", 00523 (*cIt)->uiContainerId, pDst->getType().getCName()); 00524 #endif 00525 00526 if(pDst != NULL) 00527 pDst->addReference(); 00528 } 00529 else if((*cIt)->uiEntryDesc == ContainerChangeEntry::SubReference)// || 00530 // (*cIt)->uiEntryDesc == ContainerChangeEntry::DepSubReference) 00531 { 00532 #ifndef SILENT_CPTR 00533 fprintf(stderr, "Execute sub Ref for %d %s\n", 00534 (*cIt)->uiContainerId, pDst->getType().getCName()); 00535 #endif 00536 00537 if(pDst != NULL) 00538 pDst->subReference(); 00539 } 00540 00541 ++cIt; 00542 } 00543 #endif 00544 }
| void ChangeList::doClear | ( |