Hello Michael,
On 05/09/2014 08:58 AM, Michael Raab wrote:
seems not to solve the problem. All sharetypes in my test case are still
copied.
sorry about that, there was a silly typo in the condition to decide if a
type should be shared or cloned :(
Attached is an updated patch.
Cheers,
Carsten
diff --git a/Source/Base/FieldContainer/Base/OSGFieldContainer.cpp b/Source/Base/FieldContainer/Base/OSGFieldContainer.cpp
index 84d658e..357795b 100644
--- a/Source/Base/FieldContainer/Base/OSGFieldContainer.cpp
+++ b/Source/Base/FieldContainer/Base/OSGFieldContainer.cpp
@@ -844,7 +844,7 @@ FieldContainerTransitPtr deepClone(
GetFieldHandlePtr srcField = src ->getField (i);
EditFieldHandlePtr dstField = fcClone->editField(i);
- if(dstField == NULL || dstField->isValid() == false ||
+ if(dstField == NULL || dstField->isValid() == false ||
srcField == NULL || srcField->isValid() == false)
{
continue;
@@ -856,11 +856,60 @@ FieldContainerTransitPtr deepClone(
}
else
{
- dstField->cloneValues(srcField,
- shareTypes,
- ignoreTypes,
- shareGroupIds,
- ignoreGroupIds);
+ // get type info for values stored in field
+ const DataType &contentType = srcField->getType().getContentType();
+
+ // check if it's a "pointer to FC" type (needed, because
+ // AttachmentMap also passes the above isPointerType() check)
+ const PointerType *pointerType =
+ dynamic_cast<const PointerType *>(&contentType);
+
+ // punt, share if it is something that is not "pointer to FC"
+ if(pointerType == NULL)
+ {
+ dstField->shareValues(srcField);
+ continue;
+ }
+
+ // get type info for pointed-to FC type
+ const ReflexiveContainerType *rcType =
+ dynamic_cast<const ReflexiveContainerType *>(
+ &pointerType->getContentType());
+
+ // punt, share if it is something that is not derived from RC
+ if(rcType == NULL)
+ {
+ dstField->shareValues(srcField);
+ continue;
+ }
+
+ // check if type should be ignored
+ if(!TypePredicates::typeInGroupIds(
+ ignoreGroupIds.begin(),
+ ignoreGroupIds.end (), *rcType) &&
+ !TypePredicates::typeDerivedFrom(
+ ignoreTypes.begin(),
+ ignoreTypes.end (), *rcType) )
+ {
+ // check if type should by shared
+ if(TypePredicates::typeInGroupIds(
+ shareGroupIds.begin(),
+ shareGroupIds.end (), *rcType) ||
+ TypePredicates::typeDerivedFrom(
+ shareTypes.begin(),
+ shareTypes.end (), *rcType) )
+ {
+ dstField->shareValues(srcField);
+ }
+ else
+ {
+ dstField->cloneValues(srcField,
+ shareTypes,
+ ignoreTypes,
+ shareGroupIds,
+ ignoreGroupIds);
+ }
+ }
}
}
------------------------------------------------------------------------------
Is your legacy SCM system holding you back? Join Perforce May 7 to find out:
• 3 signs your SCM is hindering your productivity
• Requirements for releasing software faster
• Expert tips and advice for migrating your SCM now
http://p.sf.net/sfu/perforce
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users