Changeset 1060 for branches/Carsten_PtrWork2/Source/System/FieldContainer/Fields/OSGMParentFCPointerField.inl
- Timestamp:
- 02/12/08 09:51:59 (9 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/Carsten_PtrWork2/Source/System/FieldContainer/Fields/OSGMParentFCPointerField.inl
r1046 r1060 596 596 AllocatorT >::getBinSize(void) const 597 597 { 598 FWARNING(("MParentFCPointerField<ObjectT, NamespaceI, AllocatorT>"599 "::getBinSize(void) const: Parent pointers should NOT be "600 "serialized/deserialized.\n"));601 602 598 return MFieldTraits::getBinSize(&(this->getRawStorage().front()), 603 599 this->getRawStorage().size () ); … … 609 605 NamespaceI, 610 606 AllocatorT >::copyToBin(BinaryDataHandler &pMem) const 611 { 612 FWARNING(("MParentFCPointerField<ObjectT, NamespaceI, AllocatorT>" 613 "::copyToBin(BinaryDataHandler &pMem): Parent pointers should " 614 "NOT be serialized/deserialized.\n")); 615 607 { 616 608 UInt32 n = this->getRawStorage().size(); 617 609 … … 630 622 AllocatorT >::copyFromBin(BinaryDataHandler &pMem) 631 623 { 632 FWARNING(("MParentFCPointerField<ObjectT, NamespaceI, AllocatorT>" 633 "::copyFromBin(BinaryDataHandler &pMem): Parent pointers should " 634 "NOT be serialized/deserialized.\n")); 635 636 UInt32 n; 637 638 pMem.getValue(n); 639 clear(); 640 641 #ifdef __hpux 642 StoredType tmpVal; 643 resize(n, tmpVal); 644 #else 645 resize(n); 646 #endif 647 648 if(n != 0) 624 UInt32 newSize; 625 626 pMem.getValue(newSize); 627 628 if(newSize > 0) 649 629 { 650 MFieldTraits::copyFromBin(pMem, &(this->editRawStorage()[0]), n);630 UInt32 oldSize = this->getRawStorage().size(); 651 631 652 StorageIter vI = this->editRawStorage().begin(); 653 StorageIter vE = this->editRawStorage().end (); 632 if(newSize > oldSize) 633 { 634 // [0, oldSize[ contains entries that are being replaced 635 this->editRawStorage().resize(newSize); 654 636 655 for(; vI != vE; ++vI) 637 StorageIter vI = this->editRawStorage().begin(); 638 StorageIter vE = this->editRawStorage().begin() + oldSize; 639 640 for(; vI != vE; ++vI) 641 { 642 ValueType pNewObj; 643 644 MFieldTraits::copyFromBin(pMem, pNewObj); 645 646 incRefCount(pNewObj); 647 decRefCount(*vI ); 648 649 *vI = pNewObj; 650 } 651 652 // [oldSize, newSize[ contains entries that are added 653 MFieldTraits::copyFromBin(pMem, &(*vI), newSize - oldSize); 654 655 vE = this->editRawStorage().end(); 656 657 for(; vI != vE; ++vI) 658 incRefCount(*vI); 659 } 660 else 656 661 { 657 incRefCount(vI->getPointer()); 662 // [0, newSize[ contains entries that are being replaced 663 StorageIter vI = this->editRawStorage().begin(); 664 StorageIter vE = this->editRawStorage().begin() + newSize; 665 666 for(; vI != vE; ++vI) 667 { 668 ValueType pNewObj; 669 670 MFieldTraits::copyFromBin(pMem, pNewObj); 671 672 incRefCount(pNewObj); 673 decRefCount(*vI ); 674 675 *vI = pNewObj; 676 } 677 678 // [newSize, oldSize[ contains entries that are being removed 679 vE = this->editRawStorage().end(); 680 681 for(; vI != vE; ++vI) 682 decRefCount(*vI); 683 684 this->editRawStorage().resize(newSize); 658 685 } 686 } 687 else 688 { 689 this->clear(); 659 690 } 660 691 }
