32 #include "itkObject.h"
33 #include "itkThreadSupport.h"
34 #include "otbConfigure.h"
86 #define OTB_DISABLE_DYNAMIC_MT this->DynamicMultiThreadingOff();
99 #define otbFileContext(x) << "file " __FILE__ ", line " << __LINE__ << ", " x
101 #define otbClassContext(x) << this->GetNameOfClass() << " (" << this << "): " x
104 #define otbLogMacro(level, msg) \
106 std::ostringstream itkmsg; \
107 itkmsg msg << "\n"; \
108 otb::Logger::Instance()->level(itkmsg.str().c_str()); \
113 #define otbDebugMacro(x) otbLogMacro(Debug, otbFileContext(otbClassContext(x)))
114 #define otbMsgDebugMacro(x) otbLogMacro(Debug, otbFileContext(x))
115 #define otbGenericMsgDebugMacro(x) otbLogMacro(Debug, x)
116 #define otbMsgDevMacro(x) otbLogMacro(Debug, otbFileContext(x))
117 #define otbWarningMacro(x) otbLogMacro(Warning, otbFileContext(otbClassContext(x)))
118 #define otbGenericWarningMacro(x) otbLogMacro(Warning, otbFileContext(x))
119 #define otbGenericMsgTestingMAcro(x) otbLogMacro(Info, "[testing] " << x)
124 #define otbControlConditionTestMacro(condition, message) \
127 itkGenericExceptionMacro(<< message); \
131 #define otbSetObjectMemberMacro(object, name, type) \
132 virtual void Set##name(const type _arg) \
134 itkDebugMacro("setting member " #name " to " << _arg); \
135 this->m_##object->Set##name(_arg); \
141 #define otbGetObjectMemberMacro(object, name, type) \
142 virtual type Get##name() \
144 itkDebugMacro("returning " << #name " of " << this->m_##object->Get##name()); \
145 return this->m_##object->Get##name(); \
152 #define otbGetObjectMemberConstMacro(object, name, type) \
153 virtual type Get##name() const \
155 itkDebugMacro("returning " << #name " of " << this->m_##object->Get##name()); \
156 return this->m_##object->Get##name(); \
164 #define otbGetObjectMemberConstReferenceMacro(object, name, type) \
165 virtual const type& Get##name() const \
167 itkDebugMacro("returning " << #name " of " << this->m_##object->Get##name()); \
168 return this->m_##object->Get##name(); \
175 #define otbTestingCheckValidCommand(command) \
181 catch (const std::exception&) \
187 std::ostringstream message; \
188 message << "otb::ERROR Unknown error while running " << #command << " (catch(...) )"; \
189 ::itk::ExceptionObject e_(__FILE__, __LINE__, message.str(), ITK_LOCATION); \
192 std::cout << " Checking valid command " << #command " ok." << std::endl; \
196 #define otbGenericExceptionMacro(T, x) \
198 std::ostringstream message; \
199 message << "otb::ERROR: " x; \
200 T e_(__FILE__, __LINE__, message.str(), ITK_LOCATION); \
204 #define otbTestingCheckNotValidCommand(command) \
211 catch (std::bad_alloc & err) \
215 catch (itk::ExceptionObject&) \
217 std::cout << "Checking not valid Command " << #command " ok." << std::endl; \
220 catch (const std::exception& stde) \
226 std::ostringstream message; \
227 message << "otb::ERROR Unknown error while running " << #command << " (catch(...) )"; \
228 ::itk::ExceptionObject e_(__FILE__, __LINE__, message.str(), ITK_LOCATION); \
233 std::ostringstream message; \
234 message << "otb::ERROR: " << #command << " should be throwing an exception."; \
235 ::itk::ExceptionObject e_(__FILE__, __LINE__, message.str(), ITK_LOCATION); \
240 #define otbUnusedMacro(x) \
250 #define otbUseInDebug(name) name
251 #define otbUseInRelease(name)
253 #define otbUseInDebug(name)
254 #define otbUseInRelease(name) name
259 #ifndef __has_attribute
260 # define __has_attribute(attr) 0
263 #if __has_cpp_attribute(fallthrough)
264 # define OTB_FALLTHROUGH [[fallthrough]]
265 #elif __has_attribute(fallthrough)
266 # define OTB_FALLTHROUGH __attribute__((fallthrough))
268 # define OTB_FALLTHROUGH
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.