Ticket #84: cloneTree_01.diff
| File cloneTree_01.diff, 124.6 kB (added by cneumann, 2 years ago) |
|---|
-
Source/System/FieldContainer/Base/OSGFieldContainer.cpp
old new 194 194 callChangedFunctors(0); 195 195 } 196 196 197 /*-------------------------------------------------------------------------*/ 198 /* Cloning */ 197 199 198 void OSG::splitShareString(const std::string &shareString, 199 std::vector<std::string> &shareList ) 200 /*! Fills \a types with the type objects corresponding to the types named in 201 \a typeNames. This is a helper function for deepClone. 202 The elements of \a typeNames must be names of FieldContainer types, if a 203 type name is not found there is no type object inserted into \a types, i.e. 204 \a types may be shorter than \a typeNames. 205 206 \param[in] typeNames FieldContainer type names. 207 \param[out] types Type objects corresponding to \a typeNames. 208 */ 209 void 210 OSG::appendTypesVector(const std::vector<std::string> &typeNames, 211 std::vector<const FieldContainerType *> &types ) 200 212 { 201 shareList.clear();213 const FieldContainerType *pType; 202 214 203 // parse comma separated names. 204 std::string::const_iterator nextComma; 205 std::string::const_iterator curPos = shareString.begin(); 215 std::vector<std::string>::const_iterator namesIt = typeNames.begin(); 216 std::vector<std::string>::const_iterator namesEnd = typeNames.end(); 206 217 207 while(curPos < shareString.end())218 for(; namesIt != namesEnd; ++namesIt) 208 219 { 209 nextComma = std::find(curPos, shareString.end(), ',');220 pType = FieldContainerFactory::the()->findType(namesIt->c_str()); 210 221 211 // strip leading spaces212 curPos = std::find_if(curPos,213 nextComma,214 std::not1(std::ptr_fun(isspace))); 222 if(pType) 223 types.push_back(pType); 224 } 225 } 215 226 216 shareList.push_back(std::string(curPos, nextComma)); 227 /*! Fills \a groupIds with the group ids of the groups in \a groupNames. 228 This is a helper function for deepClone. 229 The elements of \a groupNames must be names of groups, if a group name is 230 not found there is no group id inserted into \a groupIds, i.e. 231 \a groupIds may be shorter than \a groupNames. 217 232 218 curPos = ++nextComma; 233 \param[in] groupNames Names of groups. 234 \param[out] groupIds Ids of the groups in \a groupNames. 235 */ 236 void 237 OSG::appendGroupsVector(const std::vector<std::string> &groupNames, 238 std::vector<UInt16> &groupIds ) 239 { 240 UInt16 groupId; 241 242 std::vector<std::string>::const_iterator namesIt = groupNames.begin(); 243 std::vector<std::string>::const_iterator namesEnd = groupNames.end(); 244 245 for(; namesIt != namesEnd; ++namesIt) 246 { 247 groupId = FieldContainerFactory::the()->findGroupId(namesIt->c_str()); 248 249 if(groupId != 0) 250 groupIds.push_back(groupId); 219 251 } 220 252 } 221 253 222 void OSG::fillGroupShareList(const std::vector<UInt16 > &shareGroupIds, 223 std::vector<std::string> &shareList ) 254 /*! Fills \a types with the type objects corresponding to the types named in 255 \a typesString. This is a helper function for deepClone. 256 \a typesString is a comma separated string of FieldContainer type names. 257 258 \param[in] typesString String of comma separated FieldContainer type names. 259 \param[out] types Type objects corresponding to elements of \a typesString. 260 */ 261 void 262 OSG::appendTypesString(const std::string &typesString, 263 std::vector<const FieldContainerType *> &types ) 224 264 { 225 shareList.clear (); 226 shareList.reserve(shareGroupIds.size()); 265 const FieldContainerType *pType; 266 string_token_iterator tokenIt(typesString, ", "); 267 string_token_iterator tokenEnd; 227 268 228 for( UInt32 i = 0; i < shareGroupIds.size(); ++i)269 for(; tokenIt != tokenEnd; ++tokenIt) 229 270 { 230 const Char8 *name = 231 FieldContainerFactory::the()->findGroupName(shareGroupIds[i]); 271 pType = FieldContainerFactory::the()->findType((*tokenIt).c_str()); 232 272 233 if( name != NULL)234 shareList.push_back(name);273 if(pType) 274 types.push_back(pType); 235 275 } 236 276 } 237 277 238 // deep clone of a fieldcontainer. 239 FieldContainerPtr OSG::deepClone( FieldContainerPtrConstArg src, 240 const std::vector<std::string> &share) 278 /*! Creates a deep copy of \a src, i.e. all fields of \a src are copied, if 279 they contain pointers to other FieldContainers these are cloned as well. 280 The remaining parameters allow the selection of certain types that are 281 either not cloned at all or are shared between \a src and the copy. 282 283 \param[in] src FieldContainer to clone. 284 \param[in] shareTypeNames Names of types that should be shared 285 instead of cloned. 286 \param[in] ignoreTypeNames Names of types that should be ignored. 287 \param[in] shareGroupNames Names of type groups that should be shared 288 instead of cloned. 289 \param[in] ignoreGroupNames Names of type groups that should be ignored. 290 \return deep copy of \a src. 291 */ 292 OSG_SYSTEM_DLLMAPPING 293 FieldContainerPtr 294 OSG::deepClone( FieldContainerPtrConstArg src, 295 const std::vector<std::string> &shareTypeNames, 296 const std::vector<std::string> &ignoreTypeNames, 297 const std::vector<std::string> &shareGroupNames, 298 const std::vector<std::string> &ignoreGroupNames) 241 299 { 300 std::vector<const FieldContainerType *> shareTypes; 301 std::vector<const FieldContainerType *> ignoreTypes; 302 std::vector<UInt16> shareGroupIds; 303 std::vector<UInt16> ignoreGroupIds; 304 305 appendTypesVector (shareTypeNames, shareTypes ); 306 appendTypesVector (ignoreTypeNames, ignoreTypes ); 307 appendGroupsVector(shareGroupNames, shareGroupIds ); 308 appendGroupsVector(ignoreGroupNames, ignoreGroupIds); 309 310 return OSG::deepClone(src, shareTypes, ignoreTypes, 311 shareGroupIds, ignoreGroupIds); 312 } 313 314 /*! Creates a deep copy of \a src, i.e. all fields of \a src are copied, if 315 they contain pointers to other FieldContainers these are cloned as well. 316 The remaining parameters allow the selection of certain types that are 317 either not cloned at all or are shared between \a src and the copy. 318 319 \param[in] src FieldContainer to clone. 320 \param[in] shareGroupIds Type groups that should be shared instead 321 of cloned. 322 \param[in] ignoreGroupIds Type groups that should be ignored. 323 \return deep copy of \a src. 324 */ 325 FieldContainerPtr 326 OSG::deepClone( FieldContainerPtrConstArg src, 327 const std::vector<UInt16> &shareGroupIds, 328 const std::vector<UInt16> &ignoreGroupIds) 329 { 330 std::vector<const FieldContainerType *> shareTypes; 331 std::vector<const FieldContainerType *> ignoreTypes; 332 333 return OSG::deepClone(src, shareTypes, ignoreTypes, 334 shareGroupIds, ignoreGroupIds); 335 } 336 337 /*! Creates a deep copy of \a src, i.e. all fields of \a src are copied, if 338 they contain pointers to other FieldContainers these are cloned as well. 339 The remaining parameters allow the selection of certain types that are 340 either not cloned at all or are shared between \a src and the copy. 341 342 \param[in] src FieldContainer to clone. 343 \param[in] shareTypesString Comma separated string of type names that 344 should be shared instead of cloned. 345 \param[in] ignoreTypesString Comma separated string of type names that 346 should be ignored. 347 \return deep copy of \a src. 348 */ 349 FieldContainerPtr 350 OSG::deepClone( FieldContainerPtrConstArg src, 351 const std::string &shareTypesString, 352 const std::string &ignoreTypesString) 353 { 354 std::vector<const FieldContainerType *> shareTypes; 355 std::vector<const FieldContainerType *> ignoreTypes; 356 std::vector<UInt16> shareGroupIds; 357 std::vector<UInt16> ignoreGroupIds; 358 359 appendTypesString(shareTypesString, shareTypes); 360 appendTypesString(ignoreTypesString, ignoreTypes); 361 362 return OSG::deepClone(src, shareTypes, ignoreTypes, 363 shareGroupIds, ignoreGroupIds); 364 } 365 366 /*! Creates a deep copy of \a src, i.e. all fields of \a src are copied, if 367 they contain pointers to other FieldContainers these are cloned as well. 368 The remaining parameters allow the selection of certain types that are 369 either not cloned at all or are shared between \a src and the copy. 370 371 \param[in] src FieldContainer to clone. 372 \param[in] shareTypes Types that should be shared instead of cloned. 373 \param[in] ignoreTypes Types that should be ignored. 374 \param[in] shareGroupIds Type groups that should be shared instead 375 of cloned. 376 \param[in] ignoreGroupIds Type groups that should be ignored. 377 \return deep copy of \a src. 378 */ 379 FieldContainerPtr 380 OSG::deepClone( 381 FieldContainerPtrConstArg src, 382 const std::vector<const FieldContainerType *> &shareTypes, 383 const std::vector<const FieldContainerType *> &ignoreTypes, 384 const std::vector<UInt16> &shareGroupIds, 385 const std::vector<UInt16> &ignoreGroupIds) 386 { 242 387 if(src == NullFC) 243 388 return NullFC; 244 389 245 const FieldContainerType &type = src->getType(); 390 const FieldContainerType &fcType = src->getType(); 391 FieldContainerPtr fcClone = fcType.createContainer(); 246 392 247 //FDEBUG(("deepClone: fieldcontainertype = %s\n", type.getCName())); 393 UInt32 fCount = osgMin(fcType .getNumFieldDescs(), 394 fcClone->getType().getNumFieldDescs() ); 248 395 249 FieldContainerPtr dst = 250 FieldContainerFactory::the()->createContainer( 251 type.getName().str()); 252 253 // UInt32 fcount = type.getNumFieldDescs(); 254 UInt32 fcount = osgMin( type .getNumFieldDescs(), 255 dst->getType().getNumFieldDescs()); 256 257 for(UInt32 i = 1;i <= fcount;++i) 396 for(UInt32 i = 1; i <= fCount; ++i) 258 397 { 259 const FieldDescriptionBase *f desc = type.getFieldDesc(i);398 const FieldDescriptionBase *fDesc = fcType.getFieldDesc(i); 260 399 261 if(f desc->isInternal())400 if(fDesc->isInternal()) 262 401 continue; 263 402 264 BitVector mask = fdesc->getFieldMask(); 403 const UInt32 fieldId = fDesc ->getFieldId(); 404 const Field *srcField = src ->getField (i); 405 Field *dstField = fcClone->editField(i); 265 406 266 const Field * srcField = src->getField (i);267 268 Field * dstField = dst->editField(i);269 const Field *cdstField = dst->getField (i);270 271 407 if(dstField != NULL) 272 408 { 273 f desc->copyValues(srcField, dstField);409 fDesc->copyValues(srcField, dstField); 274 410 } 275 411 else 276 412 { 277 fdesc->cloneValuesV(srcField, mask, share, dst); 413 fDesc->cloneValuesV(srcField, fieldId, fcClone, 414 shareTypes, ignoreTypes, 415 shareGroupIds, ignoreGroupIds); 278 416 } 279 417 } 280 418 281 return dst;419 return fcClone; 282 420 } 283 421 284 FieldContainerPtr OSG::deepClone(285 FieldContainerPtrConstArg src,286 const std::vector<UInt16> &shareGroupIds)287 {288 std::vector<std::string> share;289 290 fillGroupShareList(shareGroupIds, share);291 292 return OSG::deepClone(src, share);293 }294 295 // shareString is a comma separated FieldContainer type list296 // e.g. "Material, Geometry"297 FieldContainerPtr OSG::deepClone( FieldContainerPtrConstArg src,298 const std::string &shareString)299 {300 std::vector<std::string> share;301 302 splitShareString(shareString, share);303 304 return OSG::deepClone(src, share);305 }306 307 422 /*-------------------------------------------------------------------------*/ 308 423 /* cvs id's */ 309 424 -
Source/System/FieldContainer/Base/OSGAttachmentContainer.h
old new 206 206 typedef RefPtr<AttachmentContainerPtr> AttachmentContainerRefPtr; 207 207 208 208 OSG_SYSTEM_DLLMAPPING 209 void deepCloneAttachments( AttachmentContainerPtrConstArg src, 210 AttachmentContainerPtrArg dst, 211 const std::vector<std::string> &share ); 209 void 210 cloneAttachments( 211 AttachmentContainerPtrConstArg src, 212 AttachmentContainerPtrArg dst, 213 const std::vector<std::string> &cloneTypeNames, 214 const std::vector<std::string> &ignoreTypeNames = 215 std::vector<std::string>(), 216 const std::vector<std::string> &cloneGroupNames = 217 std::vector<std::string>(), 218 const std::vector<std::string> &ignoreGroupNames = 219 std::vector<std::string>() ); 212 220 213 221 OSG_SYSTEM_DLLMAPPING 214 void deepCloneAttachments( AttachmentContainerPtrConstArg src, 215 AttachmentContainerPtrArg dst, 216 const std::vector<UInt16> &shareGroupIds ); 222 void 223 cloneAttachments( 224 AttachmentContainerPtrConstArg src, 225 AttachmentContainerPtrArg dst, 226 const std::vector<UInt16> &cloneGroupIds, 227 const std::vector<UInt16> &ignoreGroupIds = 228 std::vector<UInt16>() ); 217 229 218 230 OSG_SYSTEM_DLLMAPPING 219 void deepCloneAttachments( AttachmentContainerPtrConstArg src, 220 AttachmentContainerPtrArg dst, 221 const std::string &shareString=""); 231 void 232 cloneAttachments( 233 AttachmentContainerPtrConstArg src, 234 AttachmentContainerPtrArg dst, 235 const std::string &cloneTypesString, 236 const std::string &ignoreTypesString = 237 std::string() ); 222 238 239 OSG_SYSTEM_DLLMAPPING 240 void 241 cloneAttachments( 242 AttachmentContainerPtrConstArg src, 243 AttachmentContainerPtrArg dst, 244 const std::vector<const FieldContainerType *> &cloneTypes = 245 std::vector<const FieldContainerType *>(), 246 const std::vector<const FieldContainerType *> &ignoreTypes = 247 std::vector<const FieldContainerType *>(), 248 const std::vector<UInt16> &cloneGroupIds = 249 std::vector<UInt16>(), 250 const std::vector<UInt16> &ignoreGroupIds = 251 std::vector<UInt16>() ); 223 252 253 OSG_SYSTEM_DLLMAPPING 254 void 255 deepCloneAttachments( 256 AttachmentContainerPtrConstArg src, 257 AttachmentContainerPtrArg dst, 258 const std::vector<std::string> &cloneTypeNames, 259 const std::vector<std::string> &ignoreTypeNames = 260 std::vector<std::string>(), 261 const std::vector<std::string> &cloneGroupNames = 262 std::vector<std::string>(), 263 const std::vector<std::string> &ignoreGroupNames = 264 std::vector<std::string>() ); 224 265 266 OSG_SYSTEM_DLLMAPPING 267 void 268 deepCloneAttachments( 269 AttachmentContainerPtrConstArg src, 270 AttachmentContainerPtrArg dst, 271 const std::vector<UInt16> &cloneGroupIds, 272 const std::vector<UInt16> &ignoreGroupIds = 273 std::vector<UInt16>() ); 274 275 OSG_SYSTEM_DLLMAPPING 276 void 277 deepCloneAttachments( 278 AttachmentContainerPtrConstArg src, 279 AttachmentContainerPtrArg dst, 280 const std::string &cloneTypesString, 281 const std::string &ignoreTypesString = 282 std::string() ); 283 284 OSG_SYSTEM_DLLMAPPING 285 void 286 deepCloneAttachments( 287 AttachmentContainerPtrConstArg src, 288 AttachmentContainerPtrArg dst, 289 const std::vector<const FieldContainerType *> &shareTypes = 290 std::vector<const FieldContainerType *>(), 291 const std::vector<const FieldContainerType *> &ignoreTypes = 292 std::vector<const FieldContainerType *>(), 293 const std::vector<UInt16> &shareGroupIds = 294 std::vector<UInt16>(), 295 const std::vector<UInt16> &ignoreGroupIds = 296 std::vector<UInt16>() ); 297 225 298 OSG_END_NAMESPACE 226 299 227 300 #define OSGATTACHMENTCONTAINER_HEADER_CVSID "@(#)$Id$" -
Source/System/FieldContainer/Base/OSGFieldDescriptionBase.h
old new 223 223 virtual void pushSizeToStream (const Field *pField, 224 224 OutStream &str ) const = 0; 225 225 226 227 228 229 226 /*! \} */ 230 227 /*---------------------------------------------------------------------*/ 231 228 /*! \name Set from Field */ … … 234 231 virtual void copyValues (const Field *pSrc, 235 232 Field *pDst ) const = 0; 236 233 234 virtual void cloneValuesV( 235 const Field *pSrc, 236 const UInt32 fieldId, 237 FieldContainerPtrConstArg pDst, 238 const std::vector<const FieldContainerType*> &shareTypes, 239 const std::vector<const FieldContainerType*> &ignoreTypes, 240 const std::vector<UInt16> &shareGroupIds, 241 const std::vector<UInt16> &ignoreGroupIds) const = 0; 237 242 238 virtual void cloneValuesV(const Field *pSrc, 239 ConstFieldMaskArg whichField, 240 const StringVector &share, 241 FieldContainerPtrConstArg pDst) const = 0; 243 virtual void shareValuesV( 244 const Field *pSrc, 245 const UInt32 fieldId, 246 FieldContainerPtrConstArg pDst, 247 const std::vector<const FieldContainerType*> &cloneTypes, 248 const std::vector<const FieldContainerType*> &ignoreTypes, 249 const std::vector<UInt16> &cloneGroupIds, 250 const std::vector<UInt16> &ignoreGroupIds) const = 0; 242 251 243 virtual void shareValuesV(const Field *pSrc,244 ConstFieldMaskArg whichField,245 FieldContainerPtrConstArg pDst) const = 0;246 247 252 /*! \} */ 248 253 /*---------------------------------------------------------------------*/ 249 254 /*! \name your_category */ -
Source/System/FieldContainer/Base/OSGFieldContainer.h
old new 71 71 /*! \{ */ 72 72 73 73 typedef FieldContainerParent Inherited; 74 74 75 75 typedef FieldContainerType TypeObject; 76 76 77 77 typedef PointerBuilder<FieldContainer>::ObjPtr ObjPtr; … … 97 97 /*! \name Get Class Type Information */ 98 98 /*! \{ */ 99 99 100 static OSG_SYSTEM_DLLMAPPING TypeObject &getClassType (void); 100 static OSG_SYSTEM_DLLMAPPING TypeObject &getClassType (void); 101 101 static OSG_SYSTEM_DLLMAPPING UInt32 getClassTypeId (void); 102 102 static OSG_SYSTEM_DLLMAPPING UInt16 getClassGroupId(void); 103 103 … … 106 106 /*! \name General Fieldcontainer Declaration */ 107 107 /*! \{ */ 108 108 109 OSG_SYSTEM_DLLMAPPING 109 OSG_SYSTEM_DLLMAPPING 110 110 virtual TypeObject &getType(void); 111 111 112 112 OSG_SYSTEM_DLLMAPPING 113 113 virtual const TypeObject &getType(void) const; 114 114 … … 117 117 /*! \name Get */ 118 118 /*! \{ */ 119 119 120 OSG_SYSTEM_DLLMAPPING 121 virtual void copyFromBin(BinaryDataHandler &pMem, 120 OSG_SYSTEM_DLLMAPPING 121 virtual void copyFromBin(BinaryDataHandler &pMem, 122 122 ConstFieldMaskArg whichField); 123 123 124 124 /*---------------------------------------------------------------------*/ … … 137 137 /*! \name Set */ 138 138 /*! \{ */ 139 139 140 virtual void changed (ConstFieldMaskArg whichField, 140 virtual void changed (ConstFieldMaskArg whichField, 141 141 UInt32 origin ); 142 142 143 143 void callChangedFunctors(ConstFieldMaskArg whichField); … … 148 148 /*! \{ */ 149 149 150 150 OSG_SYSTEM_DLLMAPPING 151 virtual void pushToField ( FieldContainerPtrConstArg pNewElement, 151 virtual void pushToField ( FieldContainerPtrConstArg pNewElement, 152 152 const UInt32 uiFieldId ); 153 153 154 154 OSG_SYSTEM_DLLMAPPING 155 virtual void insertIntoMField(const UInt32 uiIndex, 156 FieldContainerPtrConstArg pNewElement, 155 virtual void insertIntoMField(const UInt32 uiIndex, 156 FieldContainerPtrConstArg pNewElement, 157 157 const UInt32 uiFieldId ); 158 158 159 159 OSG_SYSTEM_DLLMAPPING 160 160 virtual void replaceInMField (const UInt32 uiIndex, 161 FieldContainerPtrConstArg pNewElement, 161 FieldContainerPtrConstArg pNewElement, 162 162 const UInt32 uiFieldId ); 163 163 164 164 OSG_SYSTEM_DLLMAPPING 165 165 virtual void replaceInMField ( FieldContainerPtrConstArg pOldElement, 166 FieldContainerPtrConstArg pNewElement, 166 FieldContainerPtrConstArg pNewElement, 167 167 const UInt32 uiFieldId ); 168 168 169 169 OSG_SYSTEM_DLLMAPPING 170 virtual void removeFromMField(const UInt32 uiIndex, 170 virtual void removeFromMField(const UInt32 uiIndex, 171 171 const UInt32 uiFieldId ); 172 172 173 173 OSG_SYSTEM_DLLMAPPING 174 virtual void removeFromMField( FieldContainerPtrConstArg pElement, 174 virtual void removeFromMField( FieldContainerPtrConstArg pElement, 175 175 const UInt32 uiFieldId ); 176 176 177 177 OSG_SYSTEM_DLLMAPPING … … 201 201 /*---------------------------------------------------------------------*/ 202 202 /*! \name Field Flags */ 203 203 /*! \{ */ 204 204 205 205 const FieldFlags *getFieldFlags(void); 206 206 207 207 /*! \} */ … … 223 223 /*! \{ */ 224 224 225 225 OSG_SYSTEM_DLLMAPPING 226 virtual void dump( UInt32 uiIndent = 0, 226 virtual void dump( UInt32 uiIndent = 0, 227 227 const BitVector bvFlags = 0) const; 228 228 229 229 /*! \} */ … … 261 261 /*! \name Constructors */ 262 262 /*! \{ */ 263 263 264 OSG_SYSTEM_DLLMAPPING 264 OSG_SYSTEM_DLLMAPPING 265 265 FieldContainer(void); 266 266 267 OSG_SYSTEM_DLLMAPPING 267 OSG_SYSTEM_DLLMAPPING 268 268 FieldContainer(const FieldContainer &source); 269 269 270 270 /*! \} */ … … 272 272 /*! \name Destructor */ 273 273 /*! \{ */ 274 274 275 OSG_SYSTEM_DLLMAPPING 275 OSG_SYSTEM_DLLMAPPING 276 276 virtual ~FieldContainer(void); 277 277 278 278 /*! \} */ … … 295 295 /*! \{ */ 296 296 297 297 #ifdef OSG_MT_FIELDCONTAINERPTR 298 OSG_SYSTEM_DLLMAPPING 298 OSG_SYSTEM_DLLMAPPING 299 299 virtual void execSyncV( FieldContainer &oFrom, 300 300 ConstFieldMaskArg whichField, 301 301 ConstFieldMaskArg syncMode , 302 302 const UInt32 uiSyncInfo, 303 303 UInt32 uiCopyOffset) = 0; 304 304 305 OSG_SYSTEM_DLLMAPPING 305 OSG_SYSTEM_DLLMAPPING 306 306 void execSync ( FieldContainer *pFrom, 307 307 ConstFieldMaskArg whichField, 308 308 ConstFieldMaskArg syncMode , … … 310 310 UInt32 uiCopyOffset); 311 311 #endif 312 312 #ifdef OSG_MT_CPTR_ASPECT 313 OSG_SYSTEM_DLLMAPPING 313 OSG_SYSTEM_DLLMAPPING 314 314 virtual void execSyncV( FieldContainer &oFrom, 315 315 ConstFieldMaskArg whichField, 316 316 AspectOffsetStore &oOffsets, 317 317 ConstFieldMaskArg syncMode , 318 318 const UInt32 uiSyncInfo) = 0; 319 319 320 OSG_SYSTEM_DLLMAPPING 320 OSG_SYSTEM_DLLMAPPING 321 321 void execSync ( FieldContainer *pFrom, 322 322 ConstFieldMaskArg whichField, 323 323 AspectOffsetStore &oOffsets, … … 331 331 /*! \{ */ 332 332 333 333 #if 0 334 OSG_SYSTEM_DLLMAPPING 335 virtual void execBeginEditV(ConstFieldMaskArg whichField, 334 OSG_SYSTEM_DLLMAPPING 335 virtual void execBeginEditV(ConstFieldMaskArg whichField, 336 336 UInt32 uiAspect, 337 337 UInt32 uiContainerSize) = 0; 338 338 339 OSG_SYSTEM_DLLMAPPING 340 void execBeginEdit (ConstFieldMaskArg whichField, 339 OSG_SYSTEM_DLLMAPPING 340 void execBeginEdit (ConstFieldMaskArg whichField, 341 341 UInt32 uiAspect, 342 342 UInt32 uiContainerSize); 343 343 #endif … … 347 347 /*! \name MT Construction */ 348 348 /*! \{ */ 349 349 350 OSG_SYSTEM_DLLMAPPING 350 OSG_SYSTEM_DLLMAPPING 351 351 void onCreateAspect(const FieldContainer *createAspect, 352 352 const FieldContainer *source = NULL); 353 OSG_SYSTEM_DLLMAPPING 353 OSG_SYSTEM_DLLMAPPING 354 354 void onCreate (const FieldContainer *source = NULL); 355 355 356 356 OSG_SYSTEM_DLLMAPPING 357 357 virtual void onDestroy ( UInt32 uiContainerId ); 358 358 359 OSG_SYSTEM_DLLMAPPING 359 OSG_SYSTEM_DLLMAPPING 360 360 virtual bool deregister ( UInt32 uiContainerId ); 361 361 362 362 #ifdef OSG_MT_CPTR_ASPECT … … 373 373 374 374 OSG_SYSTEM_DLLMAPPING 375 375 void registerChangedContainer (void); 376 376 377 377 OSG_SYSTEM_DLLMAPPING 378 378 virtual void registerChangedContainerV(void); 379 379 … … 423 423 }; 424 424 425 425 OSG_SYSTEM_DLLMAPPING 426 FieldContainerPtr deepClone( FieldContainerPtrConstArg src, 427 const std::vector<std::string> &share ); 426 void 427 appendTypesVector (const std::vector<std::string> &typeNames, 428 std::vector<const FieldContainerType *> &types ); 428 429 429 430 OSG_SYSTEM_DLLMAPPING 430 FieldContainerPtr deepClone( FieldContainerPtrConstArg src, 431 const std::vector<UInt16> &shareGroupIds ); 431 void 432 appendGroupsVector(const std::vector<std::string> &groupNames, 433 std::vector<UInt16> &groupIds ); 432 434 433 435 OSG_SYSTEM_DLLMAPPING 434 FieldContainerPtr deepClone( FieldContainerPtrConstArg src, 435 const std::string &shareString = ""); 436 void 437 appendTypesString (const std::string &typesString, 438 std::vector<const FieldContainerType *> &types ); 436 439 440 OSG_SYSTEM_DLLMAPPING 441 FieldContainerPtr 442 deepClone( FieldContainerPtrConstArg src, 443 const std::vector<std::string> &shareTypeNames, 444 const std::vector<std::string> &ignoreTypeNames = 445 std::vector<std::string>(), 446 const std::vector<std::string> &shareGroupNames = 447 std::vector<std::string>(), 448 const std::vector<std::string> &ignoreGroupNames = 449 std::vector<std::string>() ); 437 450 438 451 OSG_SYSTEM_DLLMAPPING 439 void splitShareString (const std::string &shareString, 440 std::vector<std::string> &shareList ); 452 FieldContainerPtr 453 deepClone( FieldContainerPtrConstArg src, 454 const std::vector<UInt16> &shareGroupIds, 455 const std::vector<UInt16> &ignoreGroupIds = 456 std::vector<UInt16>() ); 441 457 442 458 OSG_SYSTEM_DLLMAPPING 443 void fillGroupShareList(const std::vector<UInt16 > &shareGroupIds, 444 std::vector<std::string> &shareList ); 459 FieldContainerPtr 460 deepClone( FieldContainerPtrConstArg src, 461 const std::string &shareTypesString, 462 const std::string &ignoreTypesString = 463 std::string() ); 445 464 465 OSG_SYSTEM_DLLMAPPING 466 FieldContainerPtr 467 deepClone( FieldContainerPtrConstArg src, 468 const std::vector<const FieldContainerType *> &shareTypes = 469 std::vector<const FieldContainerType *>(), 470 const std::vector<const FieldContainerType *> &ignoreTypes = 471 std::vector<const FieldContainerType *>(), 472 const std::vector<UInt16> &shareGroupIds = 473 std::vector<UInt16>(), 474 const std::vector<UInt16> &ignoreGroupIds = 475 std::vector<UInt16>() ); 476 446 477 OSG_END_NAMESPACE 447 478 448 479 #define OSGFIELDCONTAINER_HEADER_CVSID "@(#)$Id$" -
Source/System/FieldContainer/Base/OSGAttachmentContainer.cpp
old new 90 90 OSG_ABSTR_FIELD_CONTAINER_DEF(AttachmentContainer) 91 91 92 92 /*-------------------------------------------------------------------------*/ 93 /* Comparison*/93 /* Cloning */ 94 94 95 /*! Adds the attachments of \a src to \a dst, overwriting existing attachments 96 of the same type and binding. By default attachments are shared, only if 97 an attachment's type name is in \a cloneTypeNames or if it belongs to a 98 group in \a cloneGroupNames it is cloned. If an attachment's type is in 99 \a ignoreTypeNames or belongs to a group in \a ignoreGroupNames it is 100 ignored altogether. 95 101 96 /** Deep clone of attachements. */ 97 void OSG::deepCloneAttachments( 102 \param[in] src AttachmentContainer whose attachments are cloned. 103 \param[out] dst AttachmentContainer where cloned attachments are added. 104 \param[in] cloneTypeNames List of type names that are cloned. 105 \param[in] ignoreTypeNames List of type names that are ignored. 106 \param[in] cloneGroupNames List of group names that are cloned. 107 \param[in] ignoreGroupNames LIst of group names that are ignored. 108 */ 109 void 110 OSG::cloneAttachments( 98 111 AttachmentContainerPtrConstArg src, 99 112 AttachmentContainerPtrArg dst, 100 const std::vector<std::string> &share) 113 const std::vector<std::string> &cloneTypeNames, 114 const std::vector<std::string> &ignoreTypeNames, 115 const std::vector<std::string> &cloneGroupNames, 116 const std::vector<std::string> &ignoreGroupNames) 101 117 { 102 const FieldContainerType &type = dst->getType(); 118 std::vector<const FieldContainerType *> cloneTypes; 119 std::vector<const FieldContainerType *> ignoreTypes; 120 std::vector<UInt16> cloneGroupIds; 121 std::vector<UInt16> ignoreGroupIds; 103 122 104 const FieldDescriptionBase *fdesc = type.getFieldDesc("attachments"); 123 appendTypesVector (cloneTypeNames, cloneTypes ); 124 appendTypesVector (ignoreTypeNames, ignoreTypes ); 125 appendGroupsVector(cloneGroupNames, cloneGroupIds ); 126 appendGroupsVector(ignoreGroupNames, ignoreGroupIds); 105 127 106 const Field *srcField = src->getField("attachments"); 128 OSG::cloneAttachments(src, dst, cloneTypes, ignoreTypes, 129 cloneGroupIds, ignoreGroupIds); 130 } 107 131 108 BitVector mask = fdesc->getFieldMask(); 132 /*! Adds the attachments of \a src to \a dst, overwriting existing attachments 133 of the same type and binding. By default attachments are shared, only if 134 an attachment belongs to a group in \a cloneGroupIds it is cloned. If the 135 attachment belongs to a group in \a ignoreGroupIds it is ignored altogether. 109 136 110 fdesc->cloneValuesV(srcField, mask, share, dst); 137 \param[in] src AttachmentContainer whose attachments are cloned. 138 \param[out] dst AttachmentContainer where cloned attachments are added. 139 \param[in] cloneGroupIds List of group ids, whose members are cloned. 140 \param[in] ignoreGroupIds List of group ids, whose members are ignored. 141 */ 142 void 143 OSG::cloneAttachments( 144 AttachmentContainerPtrConstArg src, 145 AttachmentContainerPtrArg dst, 146 const std::vector<UInt16> &cloneGroupIds, 147 const std::vector<UInt16> &ignoreGroupIds) 148 { 149 std::vector<const FieldContainerType *> cloneTypes; 150 std::vector<const FieldContainerType *> ignoreTypes; 151 152 OSG::cloneAttachments(src, dst, cloneTypes, ignoreTypes, 153 cloneGroupIds, ignoreGroupIds); 111 154 } 112 155 113 void OSG::deepCloneAttachments( 156 /*! Adds the attachments of \a src to \a dst, overwriting existing attachments 157 of the same type and binding. By default attachments are shared, only if 158 an attachment's type is in the comma separated string of type names 159 \a cloneTypesString it is cloned. If the type is in the comma separated 160 string of type names \a ignoreTypesString the attachment is ignored 161 altog
