Skip to content

Commit

Permalink
STYLE: Remove redundant GetPrimaryOutput() calls from ProcessObject
Browse files Browse the repository at this point in the history
Let ProcessObject member functions just call `GetPrimaryOutput()` once, and
store the pointer in a local variable.
  • Loading branch information
N-Dekker authored and dzenanz committed Aug 2, 2023
1 parent 122daea commit 997aa16
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions Modules/Core/Common/src/itkProcessObject.cxx
Expand Up @@ -1177,9 +1177,9 @@ ProcessObject::IncrementProgress(float increment)
bool
ProcessObject::GetReleaseDataFlag() const
{
if (this->GetPrimaryOutput())
if (const auto primaryOutput = this->GetPrimaryOutput())
{
return this->GetPrimaryOutput()->GetReleaseDataFlag();
return primaryOutput->GetReleaseDataFlag();
}
return false;
}
Expand Down Expand Up @@ -1281,19 +1281,19 @@ ProcessObject::PrintSelf(std::ostream & os, Indent indent) const
void
ProcessObject::Update()
{
if (this->GetPrimaryOutput())
if (const auto primaryOutput = this->GetPrimaryOutput())
{
this->GetPrimaryOutput()->Update();
primaryOutput->Update();
}
}


void
ProcessObject::ResetPipeline()
{
if (this->GetPrimaryOutput())
if (const auto primaryOutput = this->GetPrimaryOutput())
{
this->GetPrimaryOutput()->ResetPipeline();
primaryOutput->ResetPipeline();
}
else
{
Expand Down Expand Up @@ -1827,10 +1827,10 @@ ProcessObject::UpdateLargestPossibleRegion()
{
this->UpdateOutputInformation();

if (this->GetPrimaryOutput())
if (const auto primaryOutput = this->GetPrimaryOutput())
{
this->GetPrimaryOutput()->SetRequestedRegionToLargestPossibleRegion();
this->GetPrimaryOutput()->Update();
primaryOutput->SetRequestedRegionToLargestPossibleRegion();
primaryOutput->Update();
}
}

Expand Down

0 comments on commit 997aa16

Please sign in to comment.