18 #ifndef itkExceptionObject_h
19 #define itkExceptionObject_h
22 #ifndef allow_inclusion_of_itkExceptionObject_h
23 # error "Do not include itkExceptionObject.h directly, include itkMacro.h instead."
53 static constexpr
const char *
const default_exception_message =
"Generic ExceptionObject";
60 unsigned int lineNumber = 0,
61 const
char * desc = "None",
62 const
char * loc = "Unknown");
64 unsigned int lineNumber = 0,
65 std::
string desc = "None",
66 std::
string loc = "Unknown");
98 Print(std::ostream & os) const;
104 SetLocation(const std::
string & s);
107 SetDescription(const std::
string & s);
110 SetLocation(const
char * s);
113 SetDescription(const
char * s);
119 GetDescription() const;
131 what() const noexcept override;
136 std::shared_ptr<const ExceptionData> m_ExceptionData{};
140 inline std::ostream &
230 this->SetDescription(
"Filter execution was aborted by an external request");
237 this->SetDescription(
"Filter execution was aborted by an external request");
244 this->SetDescription(
"Filter execution was aborted by an external request");
253 template <
typename TTarget,
typename TSource>
262 TTarget rval = dynamic_cast<TTarget>(x);
265 itkGenericExceptionMacro(
"Failed dynamic cast to " <<
typeid(TTarget).name()
266 <<
" object type = " << x->GetNameOfClass());
270 return static_cast<TTarget>(x);
275 #endif // itkExceptionObject_h