[great-users] Adding copy child objects to a parent overwrites on only one child
Gürkan Özhan
gurkanozhan at gmail.com
Fri Jan 8 11:11:14 CST 2010
Dear All,
I have a child object of type LSC, under a parent object of type
MSC. (Please see the attachment) In my attribute mapping code, I would
like to create a number of copies of the child object into the parent,
and in the following rule, want to delete the original child and
continue manipulating the new children. However, at the end of the
transformation run, I see only one child onder the parent having a
name that is the concatenation of the names of all the would be child
objects. I suspect that the child objects are created, but all are
overwritten on a single object.. Here is my code below:
FAMM::LSC newLsc = FAMM::LSC::LSC(FamLSC);
newLsc.name()=(std::string)FamLSC.name()+"_"+(std::string)FamFederateApplication.name();
FamMSC.GetChildObjects().insert(newLsc);
At the end of the transformation run, I get a single child LSC
object under the parent, named
CFFLSC_FwdObserverFd_BatteryRadioNetFd_BatteryFDCFd, which is a
concatenation of the original child + 3 copy children's names.
Alternatively I tried the CreateInstance solution;
FAMM::LSC newLsc = FamLSC.CreateInstance(FamMSC);
newLsc.name()=(std::string)FamLSC.name()+"_"+(std::string)FamFederateApplication.name();
which worked as I expected and created 3 child objects, however, since
these are Instances of the original child, when I delete the original
child in the next rule, I lose all of the children. I must not lose
the newly created children.
In the attachment, you can find an image of my rule.
Could you please help me to solve this issue?
Best regards,
Gurkan Ozhan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MSC-LSC.jpg
Type: image/jpeg
Size: 34982 bytes
Desc: not available
Url : http://list.isis.vanderbilt.edu/pipermail/great-users/attachments/20100108/f18d7697/attachment.jpg
More information about the great-users
mailing list