- Timestamp:
- 04/22/08 04:54:20 (5 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Source/System/FieldContainer/Misc/OSGContainerCollectionBase.cpp
r1178 r1184 46 46 ** ** 47 47 ** Do not change this file, changes should be done in the derived ** 48 ** class Container Pool!48 ** class ContainerCollection! 49 49 ** ** 50 50 ***************************************************************************** … … 52 52 53 53 54 #define OSG_COMPILECONTAINER POOLINST54 #define OSG_COMPILECONTAINERCOLLECTIONINST 55 55 56 56 #include <cstdlib> … … 64 64 #include <OSGFieldContainer.h> // Containers Class 65 65 66 #include "OSGContainer PoolBase.h"67 #include "OSGContainer Pool.h"66 #include "OSGContainerCollectionBase.h" 67 #include "OSGContainerCollection.h" 68 68 69 69 #include "boost/bind.hpp" … … 75 75 \***************************************************************************/ 76 76 77 /*! \class OSG::Container Pool77 /*! \class OSG::ContainerCollection 78 78 79 79 */ … … 83 83 \***************************************************************************/ 84 84 85 /*! \var std::string Container PoolBase::_sfName86 The name of the container pool. Can be used to identify pools.85 /*! \var std::string ContainerCollectionBase::_sfName 86 The name of the container collection. Can be used to identify collections. 87 87 */ 88 88 89 /*! \var FieldContainerPtr Container PoolBase::_mfContainers90 A list of containers held in the pool.89 /*! \var FieldContainerPtr ContainerCollectionBase::_mfContainers 90 A list of containers held in the collection. 91 91 */ 92 92 93 93 94 void Container PoolBase::classDescInserter(TypeObject &oType)94 void ContainerCollectionBase::classDescInserter(TypeObject &oType) 95 95 { 96 96 FieldDescriptionBase *pDesc = NULL; … … 100 100 SFString::getClassType(), 101 101 "name", 102 "The name of the container pool. Can be used to identify pools.\n",102 "The name of the container collection. Can be used to identify collections.\n", 103 103 NameFieldId, NameFieldMask, 104 104 false, 105 105 Field::SFDefaultFlags, 106 static_cast<FieldEditMethodSig>(&Container PoolBase::editHandleName),107 static_cast<FieldGetMethodSig >(&Container PoolBase::getHandleName));106 static_cast<FieldEditMethodSig>(&ContainerCollectionBase::editHandleName), 107 static_cast<FieldGetMethodSig >(&ContainerCollectionBase::getHandleName)); 108 108 109 109 oType.addInitialDesc(pDesc); … … 112 112 MFUnrecFieldContainerPtr::getClassType(), 113 113 "containers", 114 "A list of containers held in the pool.\n",114 "A list of containers held in the collection.\n", 115 115 ContainersFieldId, ContainersFieldMask, 116 116 false, 117 117 Field::MFDefaultFlags, 118 static_cast<FieldEditMethodSig>(&Container PoolBase::editHandleContainers),119 static_cast<FieldGetMethodSig >(&Container PoolBase::getHandleContainers));118 static_cast<FieldEditMethodSig>(&ContainerCollectionBase::editHandleContainers), 119 static_cast<FieldGetMethodSig >(&ContainerCollectionBase::getHandleContainers)); 120 120 121 121 oType.addInitialDesc(pDesc); … … 123 123 124 124 125 Container PoolBase::TypeObject ContainerPoolBase::_type(126 Container PoolBase::getClassname(),125 ContainerCollectionBase::TypeObject ContainerCollectionBase::_type( 126 ContainerCollectionBase::getClassname(), 127 127 Inherited::getClassname(), 128 "Container Pool",128 "ContainerCollection", 129 129 0, 130 (PrototypeCreateF) &Container PoolBase::createEmptyLocal,131 Container Pool::initMethod,132 Container Pool::exitMethod,133 (InitalInsertDescFunc) &Container PoolBase::classDescInserter,130 (PrototypeCreateF) &ContainerCollectionBase::createEmptyLocal, 131 ContainerCollection::initMethod, 132 ContainerCollection::exitMethod, 133 (InitalInsertDescFunc) &ContainerCollectionBase::classDescInserter, 134 134 false, 135 135 0, … … 137 137 "\n" 138 138 "<FieldContainer\n" 139 "\tname=\"Container Pool\"\n"140 "\tparent=\" FieldContainerAttachment\"\n"139 "\tname=\"ContainerCollection\"\n" 140 "\tparent=\"Attachment\"\n" 141 141 "\tlibrary=\"System\"\n" 142 142 "\tstructure=\"concrete\"\n" … … 152 152 "\t\taccess=\"public\"\n" 153 153 "\t>\n" 154 "\tThe name of the container pool. Can be used to identify pools.\n"154 "\tThe name of the container collection. Can be used to identify collections.\n" 155 155 "\t</Field>\n" 156 156 "\t<Field\n" … … 161 161 " access=\"public\"\n" 162 162 "\t>\n" 163 " A list of containers held in the pool.\n"163 " A list of containers held in the collection.\n" 164 164 "\t</Field>\n" 165 165 "</FieldContainer>\n", … … 169 169 /*------------------------------ get -----------------------------------*/ 170 170 171 FieldContainerType &Container PoolBase::getType(void)171 FieldContainerType &ContainerCollectionBase::getType(void) 172 172 { 173 173 return _type; 174 174 } 175 175 176 const FieldContainerType &Container PoolBase::getType(void) const176 const FieldContainerType &ContainerCollectionBase::getType(void) const 177 177 { 178 178 return _type; 179 179 } 180 180 181 UInt32 Container PoolBase::getContainerSize(void) const182 { 183 return sizeof(Container Pool);181 UInt32 ContainerCollectionBase::getContainerSize(void) const 182 { 183 return sizeof(ContainerCollection); 184 184 } 185 185 … … 187 187 188 188 189 SFString *Container PoolBase::editSFName(void)189 SFString *ContainerCollectionBase::editSFName(void) 190 190 { 191 191 editSField(NameFieldMask); … … 194 194 } 195 195 196 const SFString *Container PoolBase::getSFName(void) const196 const SFString *ContainerCollectionBase::getSFName(void) const 197 197 { 198 198 return &_sfName; … … 200 200 201 201 #ifdef OSG_1_GET_COMPAT 202 SFString *Container PoolBase::getSFName (void)202 SFString *ContainerCollectionBase::getSFName (void) 203 203 { 204 204 return this->editSFName (); … … 206 206 #endif 207 207 208 //! Get the Container Pool::_mfContainers field.209 const MFUnrecFieldContainerPtr *Container PoolBase::getMFContainers(void) const208 //! Get the ContainerCollection::_mfContainers field. 209 const MFUnrecFieldContainerPtr *ContainerCollectionBase::getMFContainers(void) const 210 210 { 211 211 return &_mfContainers; … … 214 214 215 215 216 void Container PoolBase::pushToContainers(const FieldContainerPtr value)216 void ContainerCollectionBase::pushToContainers(const FieldContainerPtr value) 217 217 { 218 218 if(value == NullFC) … … 226 226 } 227 227 228 void Container PoolBase::assignContainers(const MFUnrecFieldContainerPtr &value)228 void ContainerCollectionBase::assignContainers(const MFUnrecFieldContainerPtr &value) 229 229 { 230 230 MFUnrecFieldContainerPtr::const_iterator elemIt = … … 233 233 value.end (); 234 234 235 static_cast<Container Pool*>(this)->clearContainers();235 static_cast<ContainerCollection *>(this)->clearContainers(); 236 236 237 237 while(elemIt != elemEnd) … … 243 243 } 244 244 245 void Container PoolBase::insertIntoContainers( UInt32 uiIndex,245 void ContainerCollectionBase::insertIntoContainers( UInt32 uiIndex, 246 246 const FieldContainerPtr value ) 247 247 { … … 260 260 } 261 261 262 void Container PoolBase::replaceInContainers( UInt32 uiIndex,262 void ContainerCollectionBase::replaceInContainers( UInt32 uiIndex, 263 263 const FieldContainerPtr value ) 264 264 { … … 280 280 } 281 281 282 void Container PoolBase::replaceInContainers(const FieldContainerPtr pOldElem,282 void ContainerCollectionBase::replaceInContainers(const FieldContainerPtr pOldElem, 283 283 const FieldContainerPtr pNewElem) 284 284 { … … 303 303 } 304 304 305 void Container PoolBase::removeFromContainers(UInt32 uiIndex)305 void ContainerCollectionBase::removeFromContainers(UInt32 uiIndex) 306 306 { 307 307 if(uiIndex < _mfContainers.size()) … … 319 319 } 320 320 321 void Container PoolBase::removeFromContainers(const FieldContainerPtr value)321 void ContainerCollectionBase::removeFromContainers(const FieldContainerPtr value) 322 322 { 323 323 Int32 iElemIdx = _mfContainers.findIndex(value); … … 336 336 } 337 337 } 338 void Container PoolBase::clearContainers(void)338 void ContainerCollectionBase::clearContainers(void) 339 339 { 340 340 editMField(ContainersFieldMask, _mfContainers); … … 348 348 /*------------------------------ access -----------------------------------*/ 349 349 350 UInt32 Container PoolBase::getBinSize(ConstFieldMaskArg whichField)350 UInt32 ContainerCollectionBase::getBinSize(ConstFieldMaskArg whichField) 351 351 { 352 352 UInt32 returnValue = Inherited::getBinSize(whichField); … … 364 364 } 365 365 366 void Container PoolBase::copyToBin(BinaryDataHandler &pMem,366 void ContainerCollectionBase::copyToBin(BinaryDataHandler &pMem, 367 367 ConstFieldMaskArg whichField) 368 368 { … … 379 379 } 380 380 381 void Container PoolBase::copyFromBin(BinaryDataHandler &pMem,381 void ContainerCollectionBase::copyFromBin(BinaryDataHandler &pMem, 382 382 ConstFieldMaskArg whichField) 383 383 { … … 395 395 396 396 //! create a new instance of the class 397 Container PoolTransitPtr ContainerPoolBase::create(void)398 { 399 Container PoolTransitPtr fc;397 ContainerCollectionTransitPtr ContainerCollectionBase::create(void) 398 { 399 ContainerCollectionTransitPtr fc; 400 400 401 401 if(getClassType().getPrototype() != NullFC) … … 404 404 getClassType().getPrototype()-> shallowCopy(); 405 405 406 fc = dynamic_pointer_cast<Container Pool>(tmpPtr);406 fc = dynamic_pointer_cast<ContainerCollection>(tmpPtr); 407 407 } 408 408 … … 411 411 412 412 //! create a new instance of the class 413 Container PoolTransitPtr ContainerPoolBase::createLocal(BitVector bFlags)414 { 415 Container PoolTransitPtr fc;413 ContainerCollectionTransitPtr ContainerCollectionBase::createLocal(BitVector bFlags) 414 { 415 ContainerCollectionTransitPtr fc; 416 416 417 417 if(getClassType().getPrototype() != NullFC) … … 420 420 getClassType().getPrototype()-> shallowCopyLocal(bFlags); 421 421 422 fc = dynamic_pointer_cast<Container Pool>(tmpPtr);422 fc = dynamic_pointer_cast<ContainerCollection>(tmpPtr); 423 423 } 424 424 … … 427 427 428 428 //! create an empty new instance of the class, do not copy the prototype 429 Container PoolPtr ContainerPoolBase::createEmpty(void)430 { 431 Container PoolPtr returnValue;432 433 newPtr<Container Pool>(returnValue, Thread::getCurrentLocalFlags());429 ContainerCollectionPtr ContainerCollectionBase::createEmpty(void) 430 { 431 ContainerCollectionPtr returnValue; 432 433 newPtr<ContainerCollection>(returnValue, Thread::getCurrentLocalFlags()); 434 434 435 435 returnValue->_pFieldFlags->_bNamespaceMask &= … … 439 439 } 440 440 441 Container PoolPtr ContainerPoolBase::createEmptyLocal(BitVector bFlags)442 { 443 Container PoolPtr returnValue;444 445 newPtr<Container Pool>(returnValue, bFlags);441 ContainerCollectionPtr ContainerCollectionBase::createEmptyLocal(BitVector bFlags) 442 { 443 ContainerCollectionPtr returnValue; 444 445 newPtr<ContainerCollection>(returnValue, bFlags); 446 446 447 447 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags; … … 450 450 } 451 451 452 FieldContainerTransitPtr Container PoolBase::shallowCopy(void) const453 { 454 Container PoolPtr tmpPtr;452 FieldContainerTransitPtr ContainerCollectionBase::shallowCopy(void) const 453 { 454 ContainerCollectionPtr tmpPtr; 455 455 456 456 newPtr(tmpPtr, 457 dynamic_cast<const Container Pool*>(this),457 dynamic_cast<const ContainerCollection *>(this), 458 458 Thread::getCurrentLocalFlags()); 459 459 … … 465 465 } 466 466 467 FieldContainerTransitPtr Container PoolBase::shallowCopyLocal(467 FieldContainerTransitPtr ContainerCollectionBase::shallowCopyLocal( 468 468 BitVector bFlags) const 469 469 { 470 Container PoolPtr tmpPtr;471 472 newPtr(tmpPtr, dynamic_cast<const Container Pool*>(this), bFlags);470 ContainerCollectionPtr tmpPtr; 471 472 newPtr(tmpPtr, dynamic_cast<const ContainerCollection *>(this), bFlags); 473 473 474 474 FieldContainerTransitPtr returnValue(tmpPtr); … … 483 483 /*------------------------- constructors ----------------------------------*/ 484 484 485 Container PoolBase::ContainerPoolBase(void) :485 ContainerCollectionBase::ContainerCollectionBase(void) : 486 486 Inherited(), 487 487 _sfName (), … … 490 490 } 491 491 492 Container PoolBase::ContainerPoolBase(const ContainerPoolBase &source) :492 ContainerCollectionBase::ContainerCollectionBase(const ContainerCollectionBase &source) : 493 493 Inherited(source), 494 494 _sfName (source._sfName ), … … 500 500 /*-------------------------- destructors ----------------------------------*/ 501 501 502 Container PoolBase::~ContainerPoolBase(void)503 { 504 } 505 506 void Container PoolBase::onCreate(const ContainerPool*source)502 ContainerCollectionBase::~ContainerCollectionBase(void) 503 { 504 } 505 506 void ContainerCollectionBase::onCreate(const ContainerCollection *source) 507 507 { 508 508 Inherited::onCreate(source); … … 525 525 } 526 526 527 GetFieldHandlePtr Container PoolBase::getHandleName (void) const527 GetFieldHandlePtr ContainerCollectionBase::getHandleName (void) const 528 528 { 529 529 SFString::GetHandlePtr returnValue( … … 535 535 } 536 536 537 EditFieldHandlePtr Container PoolBase::editHandleName (void)537 EditFieldHandlePtr ContainerCollectionBase::editHandleName (void) 538 538 { 539 539 SFString::EditHandlePtr returnValue( … … 547 547 } 548 548 549 GetFieldHandlePtr Container PoolBase::getHandleContainers (void) const549 GetFieldHandlePtr ContainerCollectionBase::getHandleContainers (void) const 550 550 { 551 551 MFUnrecFieldContainerPtr::GetHandlePtr returnValue( … … 557 557 } 558 558 559 EditFieldHandlePtr Container PoolBase::editHandleContainers (void)559 EditFieldHandlePtr ContainerCollectionBase::editHandleContainers (void) 560 560 { 561 561 MFUnrecFieldContainerPtr::EditHandlePtr returnValue( … … 564 564 this->getType().getFieldDesc(ContainersFieldId))); 565 565 566 returnValue->setAddMethod(boost::bind(&Container Pool::pushToContainers,567 static_cast<Container Pool*>(this), _1));566 returnValue->setAddMethod(boost::bind(&ContainerCollection::pushToContainers, 567 static_cast<ContainerCollection *>(this), _1)); 568 568 569 569 editMField(ContainersFieldMask, _mfContainers); … … 574 574 575 575 #ifdef OSG_MT_CPTR_ASPECT 576 void Container PoolBase::execSyncV( FieldContainer &oFrom,576 void ContainerCollectionBase::execSyncV( FieldContainer &oFrom, 577 577 ConstFieldMaskArg whichField, 578 578 AspectOffsetStore &oOffsets, … … 580 580 const UInt32 uiSyncInfo) 581 581 { 582 this->execSync(static_cast<Container PoolBase *>(&oFrom),582 this->execSync(static_cast<ContainerCollectionBase *>(&oFrom), 583 583 whichField, 584 584 oOffsets, … … 590 590 591 591 #ifdef OSG_MT_CPTR_ASPECT 592 FieldContainerPtr Container PoolBase::createAspectCopy(void) const593 { 594 Container PoolPtr returnValue;592 FieldContainerPtr ContainerCollectionBase::createAspectCopy(void) const 593 { 594 ContainerCollectionPtr returnValue; 595 595 596 596 newAspectCopy(returnValue, 597 dynamic_cast<const Container Pool*>(this));597 dynamic_cast<const ContainerCollection *>(this)); 598 598 599 599 return returnValue; … … 601 601 #endif 602 602 603 void Container PoolBase::resolveLinks(void)603 void ContainerCollectionBase::resolveLinks(void) 604 604 { 605 605 Inherited::resolveLinks(); 606 606 607 607 608 static_cast<Container Pool*>(this)->clearContainers();608 static_cast<ContainerCollection *>(this)->clearContainers(); 609 609 } 610 610 611 611 612 612 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV) 613 DataType FieldTraits<Container PoolPtr>::_type("ContainerPoolPtr", "FieldContainerAttachmentPtr");613 DataType FieldTraits<ContainerCollectionPtr>::_type("ContainerCollectionPtr", "AttachmentPtr"); 614 614 #endif 615 615 616 OSG_FIELDTRAITS_GETTYPE(Container PoolPtr)616 OSG_FIELDTRAITS_GETTYPE(ContainerCollectionPtr) 617 617 618 618 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField, 619 Container PoolPtr,619 ContainerCollectionPtr, 620 620 0); 621 621 622 622 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField, 623 Container PoolPtr,623 ContainerCollectionPtr, 624 624 0); 625 625
