Skip to content
Snippets Groups Projects
Unverified Commit c117aa66 authored by Xavier Robin's avatar Xavier Robin
Browse files

refactor: SCHWED-4345 use same logic for IsValid and CheckValidity

In both cases we check if we have a valid implementation AND if the
underlying entity is still there.
parent 3a8a2360
No related branches found
No related tags found
No related merge requests found
...@@ -104,12 +104,12 @@ String AtomBase::GetQualifiedName() const ...@@ -104,12 +104,12 @@ String AtomBase::GetQualifiedName() const
bool AtomBase::IsValid() const bool AtomBase::IsValid() const
{ {
return Impl().get()!=0; return Impl().get()!=0 && impl_->GetEntity();
} }
void AtomBase::CheckValidity() const void AtomBase::CheckValidity() const
{ {
if (! (impl_ && impl_->GetEntity())) if (! IsValid())
throw InvalidHandle(); throw InvalidHandle();
} }
......
...@@ -54,11 +54,11 @@ String ChainBase::GetDescription() const { ...@@ -54,11 +54,11 @@ String ChainBase::GetDescription() const {
bool ChainBase::IsValid() const bool ChainBase::IsValid() const
{ {
return Impl().get()!=0; return Impl().get()!=0 && impl_->GetEntity();
} }
void ChainBase::CheckValidity() const { void ChainBase::CheckValidity() const {
if (! (impl_ && impl_->GetEntity())) if (! IsValid())
throw InvalidHandle(); throw InvalidHandle();
} }
......
...@@ -158,12 +158,12 @@ const impl::ResidueImplPtr& ResidueBase::Impl() const ...@@ -158,12 +158,12 @@ const impl::ResidueImplPtr& ResidueBase::Impl() const
bool ResidueBase::IsValid() const bool ResidueBase::IsValid() const
{ {
return Impl().get()!=0; return Impl().get()!=0 && impl_->GetEntity();
} }
void ResidueBase::CheckValidity() const void ResidueBase::CheckValidity() const
{ {
if (! (impl_ && impl_->GetEntity())) if (! IsValid())
throw InvalidHandle(); throw InvalidHandle();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment