is there a fast way to copy attributes from one particle to another ?
Nope. See the FAQ :-) you can iterate through them to do the copying if you are careful.
On Mar 3, 2009, at 10:12 PM, Keren Lasker kerenl@salilab.org wrote:
> thanks, keren. > _______________________________________________ > IMP-dev mailing list > IMP-dev@salilab.org > https://salilab.org/mailman/listinfo/imp-dev
that is sad ..... can we just have something like xyzr copy constructor, that will create a new particle with xyzr attributes and ignores all hierarchies and states ? On Mar 3, 2009, at 10:24 PM, Daniel Russel wrote:
> Nope. See the FAQ :-) you can iterate through them to do the copying > if you are careful. > > > > On Mar 3, 2009, at 10:12 PM, Keren Lasker kerenl@salilab.org wrote: > >> thanks, keren. >> _______________________________________________ >> IMP-dev mailing list >> IMP-dev@salilab.org >> https://salilab.org/mailman/listinfo/imp-dev > _______________________________________________ > IMP-dev mailing list > IMP-dev@salilab.org > https://salilab.org/mailman/listinfo/imp-dev
It's one (long) line as it is.
On Mar 3, 2009, at 10:28 PM, Keren Lasker kerenl@salilab.org wrote:
> that is sad ..... > can we just have something like xyzr copy constructor, that will > create a new particle with xyzr attributes and ignores all > hierarchies and states ? > On Mar 3, 2009, at 10:24 PM, Daniel Russel wrote: > >> Nope. See the FAQ :-) you can iterate through them to do the >> copying if you are careful. >> >> >> >> On Mar 3, 2009, at 10:12 PM, Keren Lasker kerenl@salilab.org wrote: >> >>> thanks, keren. >>> _______________________________________________ >>> IMP-dev mailing list >>> IMP-dev@salilab.org >>> https://salilab.org/mailman/listinfo/imp-dev >> _______________________________________________ >> IMP-dev mailing list >> IMP-dev@salilab.org >> https://salilab.org/mailman/listinfo/imp-dev > > _______________________________________________ > IMP-dev mailing list > IMP-dev@salilab.org > https://salilab.org/mailman/listinfo/imp-dev
To make it easier with decorators which are more than one line, it might be worth adding a standard method MyDecorator::create_from(Particle *p, MyDecorator o) which copies all the copyable attributes from the other decorator to p. For XYZ and XYZR this doesn't really help since it is just XYZDecorator.create_from(Particle(m), d1) vs XYZDecorator.create(Particle(m), d1.get_coordinates()) but for a atom it saves a few gets and sets.
Not sure that this really solves much. Would such shorten people's code?
Duplicating a part of a molecular hierarchy definitely seems like a useful thing to have i.e. something like MolecularHierarchyDecorator copy(MolecularHierarchyDecorator d) which copies all the MDH, Atom and Residue traits, bonds and names.
On Mar 3, 2009, at 10:28 PM, Keren Lasker wrote:
> that is sad ..... > can we just have something like xyzr copy constructor, that will > create a new particle with xyzr attributes and ignores all > hierarchies and states ? > On Mar 3, 2009, at 10:24 PM, Daniel Russel wrote: > >> Nope. See the FAQ :-) you can iterate through them to do the >> copying if you are careful. >> >> >> >> On Mar 3, 2009, at 10:12 PM, Keren Lasker kerenl@salilab.org wrote: >> >>> thanks, keren. >>> _______________________________________________ >>> IMP-dev mailing list >>> IMP-dev@salilab.org >>> https://salilab.org/mailman/listinfo/imp-dev >> _______________________________________________ >> IMP-dev mailing list >> IMP-dev@salilab.org >> https://salilab.org/mailman/listinfo/imp-dev > > _______________________________________________ > IMP-dev mailing list > IMP-dev@salilab.org > https://salilab.org/mailman/listinfo/imp-dev
participants (2)
-
Daniel Russel
-
Keren Lasker