[Insight-developers] itkWarningMacroStatic
Brad Davis
brad.davis at kitware.com
Wed May 14 08:58:28 EDT 2008
All,
I'd like to propose the addition of itkWarningMacroStatic that can
take the place of itkWarningMacro when no "this" is available (e.g.,
in a static function). One immediate use is for defining an
itkLegacyBodyMacroStatic macro for deprecating static functions.
The macro would be similar to itkWarningMacro except that it will not
output "this->GetNameOfClass()" or "this".
It warning macros will be defined as follows:
#ifdef ITK_LEAN_AND_MEAN
#define itkWarningMacro(x)
#define itkWarningMacroStatic(x)
#else
#define itkWarningMacro(x) \
{ if (::itk::Object::GetGlobalWarningDisplay()) \
{ ::itk::OStringStream itkmsg; \
itkmsg << "WARNING: In " __FILE__ ", line " << __LINE__ << "\n" \
<< this->GetNameOfClass() << " (" << this << "): " x \
<< "\n\n"; \
::itk::OutputWindowDisplayWarningText(itkmsg.str().c_str());} \
}
#define itkWarningMacroStatic(x) \
{ if (::itk::Object::GetGlobalWarningDisplay()) \
{ ::itk::OStringStream itkmsg; \
itkmsg << "WARNING: In " __FILE__ ", line " << __LINE__ << "\n" \
x \
<< "\n\n"; \
::itk::OutputWindowDisplayWarningText(itkmsg.str().c_str());} \
}
#endif
Any comments, suggestions for improvement, etc?
Best,
Brad
More information about the Insight-developers
mailing list