From 2539ad6faf5eef26587e91936bfa7b1aebac3457 Mon Sep 17 00:00:00 2001 From: Ansgar Philippsen <ansgar.philippsen@gmail.com> Date: Fri, 27 Jul 2012 15:04:26 +0200 Subject: [PATCH] small fixes to entity impl deep copy code and tests --- modules/mol/base/src/impl/chain_impl.hh | 4 +++- modules/mol/base/src/impl/entity_impl.cc | 4 ++-- modules/mol/base/src/impl/entity_impl.hh | 4 +++- modules/mol/base/src/view_op.cc | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/modules/mol/base/src/impl/chain_impl.hh b/modules/mol/base/src/impl/chain_impl.hh index 018c3b9e1..a2c607ec4 100644 --- a/modules/mol/base/src/impl/chain_impl.hh +++ b/modules/mol/base/src/impl/chain_impl.hh @@ -105,7 +105,9 @@ public: /// \brief append new residue with exactly the same parameters as res, but /// no atoms and bonds - ResidueImplPtr AppendResidue(const ResidueImplPtr& res, bool deep=true); + // force deep to be set explicitely, because it is better than implicit + // (and since we are on the impl level interface consistency isn't that critical) + ResidueImplPtr AppendResidue(const ResidueImplPtr& res, bool deep); ResidueImplPtr InsertResidueBefore(int index, const ResNum& n, const ResidueKey& k); diff --git a/modules/mol/base/src/impl/entity_impl.cc b/modules/mol/base/src/impl/entity_impl.cc index 8b81293fb..4b4cb3a7a 100644 --- a/modules/mol/base/src/impl/entity_impl.cc +++ b/modules/mol/base/src/impl/entity_impl.cc @@ -145,13 +145,13 @@ void EntityImpl::ReplicateHierarchy(EntityImplPtr dest) for (ChainImplList::const_iterator i=chain_list_.begin(), e1=chain_list_.end(); i!=e1; ++i) { ChainImplPtr src_chain=*i; - ChainImplPtr dst_chain=dest->InsertChain(src_chain); + ChainImplPtr dst_chain=dest->InsertChain(src_chain,false); // copy generic properties dst_chain->Assign(*src_chain.get()); for (ResidueImplList::iterator j=src_chain->GetResidueList().begin(), e2=src_chain->GetResidueList().end(); j!=e2; ++j) { ResidueImplPtr src_res=*j; - ResidueImplPtr dst_res=dst_chain->AppendResidue(src_res); + ResidueImplPtr dst_res=dst_chain->AppendResidue(src_res, false); for (AtomImplList::iterator k=src_res->GetAtomList().begin(), e3=src_res->GetAtomList().end(); k!=e3; ++k) { AtomImplPtr src_atom=*k; diff --git a/modules/mol/base/src/impl/entity_impl.hh b/modules/mol/base/src/impl/entity_impl.hh index a5f5cd805..c95bef408 100644 --- a/modules/mol/base/src/impl/entity_impl.hh +++ b/modules/mol/base/src/impl/entity_impl.hh @@ -109,7 +109,9 @@ public: /// \brief insert a new chain based on parameters of the given chain /// /// The chain will have no residues and atoms - ChainImplPtr InsertChain(const ChainImplPtr& chain, bool deep=false); + // force deep to be set explicitely, because it is better than implicit + // (and since we are on the impl level interface consistency isn't that critical) + ChainImplPtr InsertChain(const ChainImplPtr& chain, bool deep); ConnectorImplP Connect(const AtomImplPtr& first, const AtomImplPtr& second, Real len, Real theta, Real phi, unsigned char bond_order); diff --git a/modules/mol/base/src/view_op.cc b/modules/mol/base/src/view_op.cc index 6e4227e74..6b8aebad8 100644 --- a/modules/mol/base/src/view_op.cc +++ b/modules/mol/base/src/view_op.cc @@ -296,7 +296,7 @@ public: virtual bool VisitResidue(const ResidueHandle& res) { - res_=chain_->AppendResidue(res.Impl()); + res_=chain_->AppendResidue(res.Impl(),false); return true; } -- GitLab