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
Branches
Tags
No related merge requests found
......@@ -104,12 +104,12 @@ String AtomBase::GetQualifiedName() const
bool AtomBase::IsValid() const
{
return Impl().get()!=0;
return Impl().get()!=0 && impl_->GetEntity();
}
void AtomBase::CheckValidity() const
{
if (! (impl_ && impl_->GetEntity()))
if (! IsValid())
throw InvalidHandle();
}
......
......@@ -54,11 +54,11 @@ String ChainBase::GetDescription() const {
bool ChainBase::IsValid() const
{
return Impl().get()!=0;
return Impl().get()!=0 && impl_->GetEntity();
}
void ChainBase::CheckValidity() const {
if (! (impl_ && impl_->GetEntity()))
if (! IsValid())
throw InvalidHandle();
}
......
......@@ -158,12 +158,12 @@ const impl::ResidueImplPtr& ResidueBase::Impl() const
bool ResidueBase::IsValid() const
{
return Impl().get()!=0;
return Impl().get()!=0 && impl_->GetEntity();
}
void ResidueBase::CheckValidity() const
{
if (! (impl_ && impl_->GetEntity()))
if (! IsValid())
throw InvalidHandle();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment