Skip to content

Commit

Permalink
BUG: Add missing const 'GetDataObject' function signature
Browse files Browse the repository at this point in the history
  • Loading branch information
hjmjohnson authored and dzenanz committed Dec 14, 2019
1 parent 5b4eaa2 commit c7fd5bd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Modules/Core/Common/include/itkDataObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ class ITKCommon_EXPORT DataObjectError : public ExceptionObject
DataObject *
GetDataObject() noexcept;

const DataObject *
GetDataObject() const noexcept;

protected:
/** Print exception information. This method can be overridden by
* specific exception subtypes. The default is to print out the
Expand Down
7 changes: 7 additions & 0 deletions Modules/Core/Common/src/itkDataObject.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ DataObjectError ::GetDataObject() noexcept
return m_DataObject;
}

const DataObject *
DataObjectError ::GetDataObject() const noexcept
{
return m_DataObject;
}


void
DataObjectError ::PrintSelf(std::ostream & os, Indent indent) const
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ itkJoinSeriesImageFilterTest(int, char *[])
catch (const itk::ExceptionObject & err)
{
std::cout << err << std::endl;
auto * errp = dynamic_cast<itk::DataObjectError *>(&err);
const auto * const errp = dynamic_cast<const itk::DataObjectError * const>(&err);
if (errp)
{
errp->GetDataObject()->Print(std::cout);
Expand Down

0 comments on commit c7fd5bd

Please sign in to comment.