[Moose-dev] Re: MooseModel copy/deepCopy?
Stéphane Ducasse
stephane.ducasse at univ-savoie.fr
Sun Jul 20 17:46:19 MEST 2008
I do not have the code at hand so I cannot really check.
Now if a model does not copy well itself (which I imagine) then we
have to check carefully and implement the
postCopy method on the complete famix and moose entities so that we
get a deepcopy instead of a shallow copy
(have a look at my lectures, there are some slides on using postCopy
in the hook and templates,
mathieu knows what I'm talking about so ask him.
The point of postcopy is that by default copy does a shallow copy and
send a postCopy mesage.
You can redefine the postCopy to implement a deep recursive copy but
this can be complex on
a graph like moose.
An alternate solution is to build a model walker and specialize it to
perform copy (the copier could be
clever and be based on the metadescription). May be I would go for
this solution.
stef
On Jul 20, 20
08, at 4:03 PM, Hani Abdeen wrote:
> Hi,
>
> How can I have a duplication of a mooseModel (for example the model
> that represents Mondrian namespace)? exactly like if I imported agin
> the namespace Mondrian:
> there is no entity in the duplication that has pointers to entities in
> the original model.
>
> For example, the accesses of a method 'mtd1' into the duplication
> should not point to classes into the original model.
>
> bests,
> hani
> _______________________________________________
> Moose-dev mailing list
> Moose-dev at iam.unibe.ch
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
More information about the Moose-dev
mailing list