[GME-commit]
GMESRC/GME/Mga MgaFolder.cpp,1.30,1.31 MgaFCO.h,1.23,1.24
MgaComplexOps.cpp,1.13,1.14
gme-commit at list.isis.vanderbilt.edu
gme-commit at list.isis.vanderbilt.edu
Tue Sep 13 20:36:50 CDT 2005
Update of /project/gme-repository/GMESRC/GME/Mga
In directory escher:/tmp/cvs-serv9219
Modified Files:
MgaFolder.cpp MgaFCO.h MgaComplexOps.cpp
Log Message:
Bugfix for copying secondary derived object with children.
JIRA entry: GME-114
CVS User: Zoltan Molnar, ISIS (zolmol)
Index: MgaComplexOps.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Mga/MgaComplexOps.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** MgaComplexOps.cpp 2 Sep 2005 21:46:53 -0000 1.13
--- MgaComplexOps.cpp 13 Sep 2005 19:36:48 -0000 1.14
***************
*** 947,951 ****
--- 947,959 ----
ObjTreeCopy(mgaproject, oldobj, nobjs[i], crealist); // copy
if(derdist) ObjTreeDist(nobjs[i], derdist);
+ // assigns a new relid to nobjs[i]
assignnewchild(nobjs[i]);
+ // derdist is >0 for previously secondary derived objects so if such an object
+ // was copied (and detached above by ObjTreeDist) then some of its children
+ // have become archetypes now, but their relid still reflects the secondary
+ // derived status
+ //
+ // we must assign a new relid for the children of nobjs[i]
+ if(derdist) newrelidforchildren(nobjs[i]);
metaref_type trole = METAREF_NULL;
if(targettype != DTID_FOLDER) {
Index: MgaFCO.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Mga/MgaFCO.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** MgaFCO.h 2 Sep 2005 21:46:53 -0000 1.23
--- MgaFCO.h 13 Sep 2005 19:36:48 -0000 1.24
***************
*** 358,361 ****
--- 358,362 ----
void assignnewchild(CoreObj &ss);
+ void newrelidforchildren(CoreObj &ss);
void inDeleteObject();
Index: MgaFolder.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Mga/MgaFolder.cpp,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** MgaFolder.cpp 16 May 2005 21:57:10 -0000 1.30
--- MgaFolder.cpp 13 Sep 2005 19:36:48 -0000 1.31
***************
*** 341,345 ****
--- 341,374 ----
}
}
+ void traversechildren( CoreObj& ss)
+ {
+ CoreObjs children = ss[ATTRID_PARENT+ATTRID_COLLECTION];
+ long candidate = ss[ATTRID_LASTRELID] + 1;
+ ITERATE_THROUGH(children) {
+ if((unsigned long)candidate < RELIDSPACE) { // simple case: no overflow yet.
+
+ CoreObj base = ITER[ATTRID_DERIVED];
+ if( !base)
+ {
+ ITER[ATTRID_RELID] = candidate++;
+ traversechildren( ITER );
+ } // else : still derived, no need for relid assignment
+ }
+ else ASSERT(0);
+ }
+ ss[ATTRID_LASTRELID] = candidate-1;
+ }
+
+ void FCO::newrelidforchildren(CoreObj &prnt) {
+ ASSERT(RELIDSPACE_OVERFLOWED%RELIDSPACE == 0);
+ // not tested for the cases when mgaversion<1, or manual relids:
+ if(mgaproject->mgaversion < 1) return;
+ if(mgaproject->preferences & MGAPREF_MANUAL_RELIDS) return;
+ // for all children of prnt if an object is not derived any more (it was a secondary derived)
+ // then assign a new relid in [1, RELIDSPACE) interval, because secondary derived objects
+ // had special relids (greater then RELIDSPACE) which now need to be modified back to regular relids
+ traversechildren( prnt);
+ }
HRESULT FCO::ContainerCreateFCO(IMgaMetaFCO *meta, CoreObj &fco) {
More information about the GME-commit
mailing list