diff --git a/modules/base/src/invalid_handle.hh b/modules/base/src/invalid_handle.hh index fdb56203edf1b126aad19d06be3e0b070c2a29bd..9f6861dd9b3d8169257140b019dc0212e7cf6367 100644 --- a/modules/base/src/invalid_handle.hh +++ b/modules/base/src/invalid_handle.hh @@ -37,7 +37,7 @@ public: template <typename H> inline void CheckHandleValidity(const H& handle) { - if (!handle.IsValid()) + if (!handle.Impl()) throw InvalidHandle(); } diff --git a/modules/mol/base/pymod/export_atom.cc b/modules/mol/base/pymod/export_atom.cc index 23828236e4a43096e10a0765d0347e0b0c5a9ea7..ec7b4fbc5feca02132c7f7bd300fc8b4c59e726b 100644 --- a/modules/mol/base/pymod/export_atom.cc +++ b/modules/mol/base/pymod/export_atom.cc @@ -40,7 +40,6 @@ void export_Atom() return_value_policy<copy_const_reference>()) .def("GetQualifiedName", &AtomBase::GetQualifiedName) .add_property("qualified_name", &AtomBase::GetQualifiedName) - .def("IsValid", &AtomBase::IsValid) .def(self_ns::str(self)) .def("GetIndex", &AtomBase::GetIndex) .add_property("pos", @@ -83,7 +82,8 @@ void export_Atom() .add_property("residue",&AtomHandle::GetResidue) .def("GetBondList", &AtomHandle::GetBondList) .def("GetBondCount", &AtomHandle::GetBondCount) - .add_property("valid", &AtomHandle::IsValid) + .add_property("valid", &AtomHandle::IsValid) + .def("IsValid", &AtomHandle::IsValid) .def("GetEntity", &AtomHandle::GetEntity) .def("GetHandle", &AtomHandle::GetHandle) .add_property("handle", &AtomHandle::GetHandle) diff --git a/modules/mol/base/pymod/export_atom_view.cc b/modules/mol/base/pymod/export_atom_view.cc index d8bc4a0eeb9e4aaf72a7d083d2b03d3e375767f2..c33156370b0ce52fea3682d703d697c68341d2c0 100644 --- a/modules/mol/base/pymod/export_atom_view.cc +++ b/modules/mol/base/pymod/export_atom_view.cc @@ -41,6 +41,7 @@ void export_AtomView() .add_property("valid", &AtomView::IsValid) .def("GetBondList", &AtomView::GetBondList) .def("GetHashCode", &AtomView::GetHashCode) + .def("IsValid", &AtomView::IsValid) .def("__hash__", &AtomView::GetHashCode) .add_property("hash_code", &AtomView::GetHashCode) .def("GetBondPartners", &AtomView::GetBondPartners) diff --git a/modules/mol/base/pymod/export_chain.cc b/modules/mol/base/pymod/export_chain.cc index ad473535b85d64e00e3a37bb32e08acaada3443c..391fc4df8123fbed4a5adca79231ce6ba7552fc6 100644 --- a/modules/mol/base/pymod/export_chain.cc +++ b/modules/mol/base/pymod/export_chain.cc @@ -47,7 +47,6 @@ void export_Chain() chain_base .def("GetName", &ChainBase::GetName) .add_property("name", &ChainBase::GetName) - .def("IsValid", &ChainBase::IsValid) .def(self_ns::str(self)) ; generic_prop_def<ChainBase>(chain_base); @@ -81,6 +80,7 @@ void export_Chain() .def("InSequence", &ChainHandle::InSequence) .def("Select", select_string, arg("flags")=0) .def("Select", select_query, arg("flags")=0) + .def("IsValid", &ChainHandle::IsValid) .def("GetMass", &ChainHandle::GetMass) .def("GetCenterOfMass", &ChainHandle::GetCenterOfMass) .def("GetCenterOfAtoms", &ChainHandle::GetCenterOfAtoms) diff --git a/modules/mol/base/pymod/export_chain_view.cc b/modules/mol/base/pymod/export_chain_view.cc index 117e4ce837fba5e8111d1ff0ebf473559b1340f9..3835eed753bc498a319dbedf2408f5af7054d475 100644 --- a/modules/mol/base/pymod/export_chain_view.cc +++ b/modules/mol/base/pymod/export_chain_view.cc @@ -98,7 +98,8 @@ void export_ChainView() .add_property("mass", &ChainView::GetMass) .add_property("center_of_mass", &ChainView::GetCenterOfMass) .add_property("center_of_atoms", &ChainView::GetCenterOfAtoms) - .add_property("valid", &ChainView::IsValid) + .add_property("valid", &ChainView::IsValid) + .def("IsValid", &ChainView::IsValid) .add_property("in_sequence", &ChainView::InSequence) .def("GetGeometricStart", geom_start<ChainView>) .def("GetGeometricEnd", geom_end<ChainView>) diff --git a/modules/mol/base/pymod/export_entity.cc b/modules/mol/base/pymod/export_entity.cc index b8fcff8a959679f64573b905cb9880737d703549..4f80a09494a0e8527087cf6f54c0ebdfe62cdc40 100644 --- a/modules/mol/base/pymod/export_entity.cc +++ b/modules/mol/base/pymod/export_entity.cc @@ -71,7 +71,6 @@ void export_Entity() { class_<EntityBase> ent_base("EntityBase", no_init); ent_base - .def("IsValid", &EntityBase::IsValid) .def(self_ns::str(self)) .def("GetName", &EntityBase::GetName, return_value_policy<copy_const_reference>()) @@ -93,6 +92,7 @@ void export_Entity() .def("GetCenterOfAtoms", &EntityHandle::GetCenterOfAtoms) .def("GetGeometricCenter", geom_center<EntityHandle>) .add_property("geometric_center", geom_center<EntityHandle>) + .def("IsValid", &EntityHandle::IsValid) .add_property("geometric_end", geom_end<EntityHandle>) .add_property("geometric_start", geom_start<EntityHandle>) .def("GetGeometricStart", geom_start<EntityHandle>) diff --git a/modules/mol/base/pymod/export_entity_view.cc b/modules/mol/base/pymod/export_entity_view.cc index 4eadd54cdcb121c0507ffd2a4f0bdfb06f43f6d3..422eb77d146adf30561ec0ed51202f005203c1eb 100644 --- a/modules/mol/base/pymod/export_entity_view.cc +++ b/modules/mol/base/pymod/export_entity_view.cc @@ -111,6 +111,7 @@ void export_EntityView() .def("RemoveResidue", &EntityView::RemoveResidue) .def("RemoveAtom", &EntityView::RemoveAtom) .def("CreateEmptyView", &EntityView::CreateEmptyView) + .def("IsValid", &EntityView::IsValid) .def("CreateFullView", &EntityView::CreateFullView) .def("AddAllInclusiveBonds", &EntityView::AddAllInclusiveBonds) .add_property("chain_count", &EntityView::GetChainCount) diff --git a/modules/mol/base/pymod/export_residue.cc b/modules/mol/base/pymod/export_residue.cc index 66892c8de2dae95f99a73714b2a0ff3b4dfb6e20..715404555f075791f484f7d5c326f798278cbcd5 100644 --- a/modules/mol/base/pymod/export_residue.cc +++ b/modules/mol/base/pymod/export_residue.cc @@ -101,7 +101,6 @@ void export_Residue() .def("GetPhiTorsion", &ResidueBase::GetPhiTorsion) .def("GetPsiTorsion", &ResidueBase::GetPsiTorsion) .def("GetOmegaTorsion", &ResidueBase::GetOmegaTorsion) - .def("IsValid", &ResidueBase::IsValid) .def(self_ns::str(self)) .def("GetOneLetterCode", &ResidueBase::GetOneLetterCode) .def("SetOneLetterCode", &ResidueBase::SetOneLetterCode) @@ -160,6 +159,7 @@ void export_Residue() .def("FindAtom", &ResidueHandle::FindAtom, args("atom_name")) .def("FindTorsion", &ResidueHandle::FindTorsion) .def("GetAtomCount", &ResidueHandle::GetAtomCount) + .def("IsValid", &ResidueHandle::IsValid) .def("GetBondCount", &ResidueHandle::GetBondCount) .add_property("atom_count", &ResidueHandle::GetAtomCount) .add_property("index", &ResidueHandle::GetIndex) diff --git a/modules/mol/base/pymod/export_residue_view.cc b/modules/mol/base/pymod/export_residue_view.cc index f8dbd089628879641e24731629afe92a108e4403..81b66c1452871726670b039afb3d364bbe5bddfc 100644 --- a/modules/mol/base/pymod/export_residue_view.cc +++ b/modules/mol/base/pymod/export_residue_view.cc @@ -70,6 +70,7 @@ void export_ResidueView() .add_property("entity", &ResidueView::GetEntity) .add_property("index", &ResidueView::GetIndex) .def("RemoveAtoms", &ResidueView::RemoveAtom) + .def("IsValid", &ResidueView::IsValid) .add_property("handle", &ResidueView::GetHandle) .def("GetHandle", &ResidueView::GetHandle) .def("Select", select_string, arg("flags")=0) diff --git a/modules/mol/base/src/atom_base.cc b/modules/mol/base/src/atom_base.cc index a8719ab960b8e367aca7be53590d025f182de08b..ee41fbf1f743933bbe67f0b6d33a2b0acc2fc4dc 100644 --- a/modules/mol/base/src/atom_base.cc +++ b/modules/mol/base/src/atom_base.cc @@ -85,16 +85,6 @@ const impl::AtomImplPtr& AtomBase::Impl() const return impl_; } -bool AtomBase::IsValid() const -{ - return (impl_.get()!=0); -} - -AtomBase::operator bool() const -{ - return (impl_.get()!=0); -} - String AtomBase::GetQualifiedName() const { this->CheckValidity(); @@ -109,7 +99,7 @@ void AtomBase::CheckValidity() const std::ostream& operator<<(std::ostream& os, const AtomBase& atom) { - if (atom.IsValid()) { + if (atom.Impl()) { os << atom.GetQualifiedName(); } else { os << "invalid atom"; diff --git a/modules/mol/base/src/atom_base.hh b/modules/mol/base/src/atom_base.hh index 189c5830a07d693a91939b01232345c3126650f5..55581c8a1684f787c3512e8a17c344654f2367af 100644 --- a/modules/mol/base/src/atom_base.hh +++ b/modules/mol/base/src/atom_base.hh @@ -77,21 +77,7 @@ public: std::vector<String> GetAltGroupNames() const; //@} - - /// \name Handle validity - //@{ - /// \brief check validity of handle - /// - /// check, whether the bond handle points to a valid atom. - /// \note It is an error to use any method other than #IsValid, Impl and - /// #operator bool() when the handle is invalid. An InvalidHandle - /// exception will be thrown. - operator bool() const; - /// \brief check validity of handle - /// \sa #operator bool() - bool IsValid() const; - //@} - + /// \brief Get qualified name for atom. /// /// The qualified name consists of the atom name as well as a unique residue diff --git a/modules/mol/base/src/atom_handle.hh b/modules/mol/base/src/atom_handle.hh index 6ea9094c0db51dab69bc7c46b8a5913c2402404b..04a7eea9464d0141caab2c7af45e3912d525cd3a 100644 --- a/modules/mol/base/src/atom_handle.hh +++ b/modules/mol/base/src/atom_handle.hh @@ -40,6 +40,20 @@ public: AtomHandle(const impl::AtomImplPtr& impl); public: + + /// \name Handle validity + //@{ + /// \brief check validity of handle + /// + /// check, whether the bond handle points to a valid atom. + /// \note It is an error to use any method other than #IsValid, Impl and + /// #operator bool() when the handle is invalid. An InvalidHandle + /// exception will be thrown. + operator bool() const { return this->IsValid(); } + /// \brief check validity of handle + /// \sa #operator bool() + bool IsValid() const { return Impl().get()!=0; } + //@} ResidueHandle GetResidue() const; EntityHandle GetEntity() const; diff --git a/modules/mol/base/src/atom_view.hh b/modules/mol/base/src/atom_view.hh index a9e2d9937986b83b3b10d6e547afe2b90c1c6e53..770f415501a2dce93d3e607141fa79ec2aab9722 100644 --- a/modules/mol/base/src/atom_view.hh +++ b/modules/mol/base/src/atom_view.hh @@ -35,6 +35,20 @@ class DLLEXPORT_OST_MOL AtomView : public AtomBase { friend class EntityView; public: + + /// \name View validity + //@{ + /// \brief check validity of view + /// + /// check, whether the atom view points to a valid atom. + /// \note It is an error to use any method other than #IsValid, Impl and + /// #operator bool() when the handle is invalid. An InvalidHandle + /// exception will be thrown. + operator bool() const { return this->IsValid(); } + /// \brief check validity of handle + /// \sa #operator bool() + bool IsValid() const { return data_.get()!=0; } + //@} // constructors AtomView(); AtomView(const ResidueView& residue_view, diff --git a/modules/mol/base/src/chain_base.cc b/modules/mol/base/src/chain_base.cc index aef8bc19a61c5aef1edbbbe0801bedfa138be472..3fd191bb98bb30e27fbf1cbeefe3ca007a9a3c19 100644 --- a/modules/mol/base/src/chain_base.cc +++ b/modules/mol/base/src/chain_base.cc @@ -44,14 +44,6 @@ String ChainBase::GetName() const { return impl_->GetName(); } -ChainBase::operator bool() const { - return impl_.get()!=0; -} - -bool ChainBase::IsValid() const { - return impl_.get()!=0; -} - void ChainBase::CheckValidity() const { if (!impl_) throw InvalidHandle(); @@ -59,7 +51,7 @@ void ChainBase::CheckValidity() const { std::ostream& operator<<(std::ostream& os, const ChainBase& chain) { - if (chain.IsValid()) { + if (chain.Impl()) { os << chain.GetName(); } else { os << "invalid chain"; diff --git a/modules/mol/base/src/chain_base.hh b/modules/mol/base/src/chain_base.hh index 68e0d4bf84bcaa96046a4bb11de5c4b2d72e97a4..6d4e1317aae946e21c52cedac6a8c3c8eb7272f4 100644 --- a/modules/mol/base/src/chain_base.hh +++ b/modules/mol/base/src/chain_base.hh @@ -44,19 +44,6 @@ public: // constructors public: friend class ConstGenericPropContainer<ChainBase>; String GetName() const; - /// \name Handle validity - //@{ - /// \brief check validity of handle - /// - /// check, whether the chain handle points to a valid handle. - /// \note It is an error to use any method other than #IsValid, #Impl() and - /// #operator bool() when the handle is invalid. An InvalidHandle - /// exception will be thrown. - operator bool() const; - /// \brief check validity of handle - /// \sa #operator bool() - bool IsValid() const; - //@} const impl::ChainImplPtr& Impl() const { return impl_; diff --git a/modules/mol/base/src/chain_handle.hh b/modules/mol/base/src/chain_handle.hh index 514188612bd03e31fea1556dfa4856924223f046..57f52ce75e71e5f7859e83e191d3d5be119575b1 100644 --- a/modules/mol/base/src/chain_handle.hh +++ b/modules/mol/base/src/chain_handle.hh @@ -57,6 +57,20 @@ public: ChainHandle(const impl::ChainImplPtr& impl); + /// \name Handle validity + //@{ + /// \brief check validity of handle + /// + /// check, whether the chain handle points to a valid handle. + /// \note It is an error to use any method other than #IsValid, #Impl() and + /// #operator bool() when the handle is invalid. An InvalidHandle + /// exception will be thrown. + operator bool() const { return this->IsValid(); } + /// \brief check validity of handle + /// \sa #operator bool() + bool IsValid() const { return Impl().get()!=0; } + //@} + /// \brief Get parent entity. EntityHandle GetEntity() const; diff --git a/modules/mol/base/src/chain_view.hh b/modules/mol/base/src/chain_view.hh index 800d1fc82434898e2cd1bd436e8df4dfb1f5be8b..d2552a65c25f8be3079aad36f6f901877e7448cb 100644 --- a/modules/mol/base/src/chain_view.hh +++ b/modules/mol/base/src/chain_view.hh @@ -44,6 +44,21 @@ public: ChainView(const EntityView& entity, const ChainHandle& chain); public: + + /// \name Handle validity + //@{ + /// \brief check validity of handle + /// + /// check, whether the chain handle points to a valid handle. + /// \note It is an error to use any method other than #IsValid, #Impl() and + /// #operator bool() when the handle is invalid. An InvalidHandle + /// exception will be thrown. + operator bool() const { return this->IsValid(); } + /// \brief check validity of handle + /// \sa #operator bool() + bool IsValid() const { return data_.get()!=0; } + //@} + /// \brief Get parent entity view EntityView GetEntity() const; diff --git a/modules/mol/base/src/entity_base.cc b/modules/mol/base/src/entity_base.cc index 16ea851d9344aa560dd64fc8d65b2cd7366a77b1..5cd4f9fc7dabf1a6d1be1a1ba003ba1608277d8f 100644 --- a/modules/mol/base/src/entity_base.cc +++ b/modules/mol/base/src/entity_base.cc @@ -46,14 +46,6 @@ const GenericPropContainerImpl* EntityBase::GpImpl() const return Impl().get(); } -bool EntityBase::IsValid() const { - return impl_.get()!=0; -} - -EntityBase::operator bool() const { - return impl_.get()!=0; -} - void EntityBase::CheckValidity() const { if (!impl_) throw InvalidHandle(); @@ -71,7 +63,7 @@ void EntityBase::SetName(const String& ent_name) { DLLEXPORT_OST_MOL std::ostream& operator<<(std::ostream& os, const EntityBase& ent) { - if (ent.IsValid()) { + if (ent.Impl()) { os << "entity"; } else { os << "invalid"; diff --git a/modules/mol/base/src/entity_base.hh b/modules/mol/base/src/entity_base.hh index 9c4fe8922e0da646364a8c71053acfc5522ac904..d68e7df2625505e774fb6c11c0f8693547160b68 100644 --- a/modules/mol/base/src/entity_base.hh +++ b/modules/mol/base/src/entity_base.hh @@ -34,20 +34,6 @@ public: EntityBase(const impl::EntityImplPtr& impl); EntityBase(); - /// \name Handle validity - //@{ - /// \brief check validity of handle - /// - /// check, whether the entity handle points to a valid entity. - /// \note It is an error to use any method other than #IsValid, #Impl and - /// #operator bool() when the handle is invalid. An InvalidHandle - /// exception will be thrown. - operator bool() const; - /// \brief check validity of handle - /// \sa #operator bool() - bool IsValid() const; - //@} - ///\brief Get entity name. /// /// \sa EntityBase::SetName diff --git a/modules/mol/base/src/entity_handle.hh b/modules/mol/base/src/entity_handle.hh index d67d9c754d20d22ddb67ec156315388fef76be6d..7114f54c83627556901779ea7329f3927365d77b 100644 --- a/modules/mol/base/src/entity_handle.hh +++ b/modules/mol/base/src/entity_handle.hh @@ -64,6 +64,20 @@ public: /// default ctor. creates invalid handle. EntityHandle(); + + /// \name Handle validity + //@{ + /// \brief check validity of handle + /// + /// check, whether the entity handle points to a valid entity. + /// \note It is an error to use any method other than #IsValid, #Impl and + /// #operator bool() when the handle is invalid. An InvalidHandle + /// exception will be thrown. + operator bool() const { return this->IsValid(); } + /// \brief check validity of handle + /// \sa #operator bool() + bool IsValid() const { return Impl().get()!=0; } + //@} /// \brief copy entity, effectively duplicating the whole data structure /// /// Alternative atom positions are not handled at all! diff --git a/modules/mol/base/src/entity_view.cc b/modules/mol/base/src/entity_view.cc index 945230d2f2779b172c02bc4ffc341fb2d3c96a73..8517e548b1b850fc90977d5ae22c2e471ca21cc1 100644 --- a/modules/mol/base/src/entity_view.cc +++ b/modules/mol/base/src/entity_view.cc @@ -265,6 +265,7 @@ ResidueView EntityView::FindResidue(const ResidueHandle& residue) const { AtomView EntityView::FindAtom(const AtomHandle& atom) const { + this->CheckValidity(); return data_->ViewForHandle(atom); } diff --git a/modules/mol/base/src/entity_view.hh b/modules/mol/base/src/entity_view.hh index e9566a1c2f3c756fbf003031ad4a0d6f01df05b2..ab65d98f7187156878a3d8bc8141a54f22d2b685 100644 --- a/modules/mol/base/src/entity_view.hh +++ b/modules/mol/base/src/entity_view.hh @@ -95,7 +95,20 @@ public: /// \param flags An ORed together list of ViewAddFlag EntityView(const EntityHandle& entity, ViewAddFlags flags=0); - + + /// \name View validity + //@{ + /// \brief check validity of handle + /// + /// check, whether the entity view points to a valid entity. + /// \note It is an error to use any method other than #IsValid, #Impl and + /// #operator bool() when the handle is invalid. An InvalidHandle + /// exception will be thrown. + operator bool() const { return this->IsValid(); } + /// \brief check validity of handle + /// \sa #operator bool() + bool IsValid() const { return data_.get()!=0; } + //@} /// \brief Get entity's mass Real GetMass() const; diff --git a/modules/mol/base/src/residue_base.cc b/modules/mol/base/src/residue_base.cc index 2ddf33c2e52af2443e6c3527c9771f44005a4159..f2074c8d352a575cb0fa1142ac35acfd9d448e88 100644 --- a/modules/mol/base/src/residue_base.cc +++ b/modules/mol/base/src/residue_base.cc @@ -65,14 +65,6 @@ String ResidueBase::GetQualifiedName() const { return impl_->GetQualifiedName(); } -ResidueBase::operator bool() const { - return impl_.get()!=0; -} - -bool ResidueBase::IsValid() const { - return impl_.get()!=0; -} - bool ResidueBase::IsPeptideLinking() const { return this->GetChemClass().IsPeptideLinking(); @@ -142,7 +134,7 @@ void ResidueBase::CheckValidity() const } std::ostream& operator<<(std::ostream& os, const ResidueBase& residue) { - if (residue.IsValid()) { + if (residue.Impl()) { os << residue.GetQualifiedName(); } else { os << "invalid residue"; diff --git a/modules/mol/base/src/residue_base.hh b/modules/mol/base/src/residue_base.hh index 363ff875c7022eeb2f845913f228dbde8880f8cd..5b0b556d383c8f49b3ea3819e54f0a71cb283bbd 100644 --- a/modules/mol/base/src/residue_base.hh +++ b/modules/mol/base/src/residue_base.hh @@ -77,20 +77,7 @@ public: /// residue name and residue number String GetQualifiedName() const; - /// \name Handle validity - //@{ - /// \brief check validity of handle - /// - /// check, whether the residue handle points to a valid residue. - /// \note It is an error to use any method other than #IsValid, #Impl and - /// #operator bool() when the handle is invalid. An InvalidHandle - /// exception will be thrown. - operator bool() const; - /// \brief check validity of handle - /// \sa #operator bool() - bool IsValid() const; - //@} - + /// \brief whether the residue can form peptide bonds bool IsPeptideLinking() const; diff --git a/modules/mol/base/src/residue_handle.hh b/modules/mol/base/src/residue_handle.hh index 3dc7e85def436e2327f6058c6cd5d7ca645c46fb..f280509cc410a5951cc1ad776966905e37e7d7e0 100644 --- a/modules/mol/base/src/residue_handle.hh +++ b/modules/mol/base/src/residue_handle.hh @@ -56,6 +56,19 @@ class DLLEXPORT_OST_MOL ResidueHandle : public ResidueBase { public: ResidueHandle(); + /// \name Handle validity + //@{ + /// \brief check validity of handle + /// + /// check, whether the residue handle points to a valid residue. + /// \note It is an error to use any method other than #IsValid, #Impl and + /// #operator bool() when the handle is invalid. An InvalidHandle + /// exception will be thrown. + operator bool() const { return this->IsValid(); } + /// \brief check validity of handle + /// \sa #operator bool() + bool IsValid() const { return Impl().get()!=0; } + //@} ResidueHandle(const impl::ResidueImplPtr& impl) : ResidueBase(impl) {} EntityHandle GetEntity() const; diff --git a/modules/mol/base/src/residue_view.hh b/modules/mol/base/src/residue_view.hh index d771a95ce09a0ba448eaca0be2a391e53020ecdd..2f56f015cf3daacde5e214f6bfa2c24168c16cc9 100644 --- a/modules/mol/base/src/residue_view.hh +++ b/modules/mol/base/src/residue_view.hh @@ -53,6 +53,21 @@ public: const ResidueHandle& residue); public: + + /// \name Handle validity + //@{ + /// \brief check validity of view + /// + /// check, whether the residue view points to a valid residue. + /// \note It is an error to use any method other than #IsValid, #Impl and + /// #operator bool() when the handle is invalid. An InvalidHandle + /// exception will be thrown. + operator bool() const { return this->IsValid(); } + /// \brief check validity of handle + /// \sa #operator bool() + bool IsValid() const { return data_.get()!=0; } + //@} + /// \name internal //@{ /// \brief construct new view from view data and impl. diff --git a/modules/mol/base/src/torsion_handle.hh b/modules/mol/base/src/torsion_handle.hh index ff0d8be70f360f9113efb4422e9f60c38066d30f..44da2a44ce5ae14027947d32f4695b66b48329de 100644 --- a/modules/mol/base/src/torsion_handle.hh +++ b/modules/mol/base/src/torsion_handle.hh @@ -102,6 +102,10 @@ public: impl::TorsionImplP& Impl() { return impl_; } + + const impl::TorsionImplP& Impl() const { + return impl_; + } protected: void CheckValidity() const; private: