/usr/include/OTB-5.8/otbMacro.h is in libotb-dev 5.8.0+dfsg-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 | /*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
/**
* otbMacro.h defines standard system-wide macros, constants, and other
* parameters. One of its most important functions is to define macros used
* to interface to instance variables in a standard fashion.
*/
#ifndef otbMacro_h
#define otbMacro_h
#include "itkMacro.h"
#include "itkObject.h"
#include "otbConfigure.h"
/**
* \namespace otb
* \brief The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
*
* There are several nested namespaces within this one.
*/
namespace otb
{
} // end namespace otb - this is here for documentation purposes
/** This macro is used to print debug (or other information). They are
* also used to catch errors, etc. Example usage looks like:
* itkDebugMacro(<< "this is debug info" << this->SomeVariable); */
#define otbDebugMacro(x) itkDebugMacro(x)
/* { if ( this->GetDebug() && *::itk::Object::GetGlobalWarningDisplay()) \
{ std::ostringstream itkmsg; \
itkmsg << "Debug: In " __FILE__ ", line " << __LINE__ << "\n" \
<< this->GetNameOfClass() << " (" << this << "): " x \
<< "\n\n"; \
::itk::OutputWindowDisplayDebugText(itkmsg.str().c_str()); } \
}*/
#define otbMsgDebugMacro(x) \
{ \
if (this->GetDebug() && ::itk::Object::GetGlobalWarningDisplay()) \
{ \
std::ostringstream itkmsg; \
itkmsg << " Msg Debug: " x << "\n"; \
::itk::OutputWindowDisplayDebugText(itkmsg.str().c_str()); \
} \
}
#ifndef NDEBUG
#define otbGenericMsgDebugMacro(x) \
{ \
if (::itk::Object::GetGlobalWarningDisplay()) \
{ \
std::ostringstream itkmsg; \
itkmsg << " Generic Msg Debug: " x << "\n"; \
::itk::OutputWindowDisplayDebugText(itkmsg.str().c_str()); \
} \
}
#else
#define otbGenericMsgDebugMacro(x)
#endif
#define otbGenericMsgTestingMacro(x) \
{ \
std::cout x << std::endl; \
}
#ifdef OTB_SHOW_ALL_MSG_DEBUG
#define otbMsgDevMacro(x) \
{ \
{ \
std::ostringstream itkmsg; \
itkmsg << " Msg Dev: (" << __FILE__ << ":" << __LINE__ << ") " x << "\n"; \
::itk::OutputWindowDisplayDebugText(itkmsg.str().c_str()); \
} \
}
#else
#define otbMsgDevMacro(x)
#endif
/** This macro is used to print warning information (i.e., unusual circumstance
* but not necessarily fatal.) Example usage looks like:
* itkWarningMacro(<< "this is warning info" << this->SomeVariable); */
#define otbWarningMacro(x) \
{ \
if (itk::Object::GetGlobalWarningDisplay()) \
{ \
std::ostringstream itkmsg; \
itkmsg << "WARNING: In " __FILE__ ", line " << __LINE__ << "\n" \
<< this->GetNameOfClass() << " (" << this << "): " x \
<< "\n\n"; \
itk::OutputWindowDisplayWarningText(itkmsg.str().c_str()); \
} \
}
#define otbGenericWarningMacro(x) \
{ \
if (itk::Object::GetGlobalWarningDisplay()) \
{ \
std::ostringstream itkmsg; \
itkmsg << "WARNING: In " __FILE__ ", line " << __LINE__ << ": " x <<"\n";\
itk::OutputWindowDisplayWarningText(itkmsg.str().c_str()); \
} \
}
/** This macro is used to control condition. It use ONLY by the OTB developers
*
*/
#define otbControlConditionTestMacro(condition, message) \
{ \
if ((condition)) itkGenericExceptionMacro(<< message); \
}
/** Set built-in type. Creates member Set"name"() (e.g., SetVisibility()); */
#define otbSetObjectMemberMacro(object, name, type) \
virtual void Set ## name (const type _arg) \
{ \
itkDebugMacro("setting member " # name " to " << _arg); \
this->m_ ## object->Set ## name(_arg); \
this->Modified(); \
}
/** Get built-in type. Creates member Get"name"() (e.g., GetVisibility()); */
#define otbGetObjectMemberMacro(object, name, type) \
virtual type Get ## name () \
{ \
itkDebugMacro("returning " << # name " of " << this->m_ ## object->Get ## name()); \
return this->m_ ## object->Get ## name(); \
}
/** Get built-in type. Creates member Get"name"() (e.g., GetVisibility());
* This is the "const" form of the itkGetMacro. It should be used unless
* the member can be changed through the "Get" access routine. */
#define otbGetObjectMemberConstMacro(object, name, type) \
virtual type Get ## name () const \
{ \
itkDebugMacro("returning " << # name " of " << this->m_ ## object->Get ## name()); \
return this->m_ ## object->Get ## name(); \
}
/** Get built-in type. Creates member Get"name"() (e.g., GetVisibility());
* This is the "const" form of the itkGetMacro. It should be used unless
* the member can be changed through the "Get" access routine.
* This versions returns a const reference to the variable. */
#define otbGetObjectMemberConstReferenceMacro(object, name, type) \
virtual const type &Get ## name () const \
{ \
itkDebugMacro("returning " << # name " of " << this->m_ ## object->Get ## name()); \
return this->m_ ## object->Get ## name(); \
}
/** Testing macro. This macro doesn't throw a exception if the called command
* generate a itk::ExceptionObject object. For alls others use cases, the macro
* generate a exception. */
#define otbTestingCheckValidCommand(command) \
{ \
try \
{ \
command; \
} \
catch (const std::exception&) { \
throw; } \
catch (...) \
{ \
std::ostringstream message; \
message << "otb::ERROR Unknown error while running " << # command << " (catch(...) )"; \
::itk::ExceptionObject e_(__FILE__, __LINE__, message.str().c_str(), ITK_LOCATION); \
throw e_; \
} \
std::cout << " Checking valid command " << # command " ok." << std::endl; \
}
#define otbGenericExceptionMacro(T, x) \
{ \
std::ostringstream message; \
message << "otb::ERROR: " x; \
T e_(__FILE__, __LINE__, message.str(),ITK_LOCATION); \
throw e_;\
}
#define otbTestingCheckNotValidCommand(command) \
{ \
int result(1); \
try \
{ \
command; \
} \
catch (std::bad_alloc& err) { \
throw err; } \
catch (itk::ExceptionObject&) { std::cout << "Checking not valid Command " << # command " ok." << std::endl; \
result = 0; } \
catch (const std::exception& stde) { \
throw stde; } \
catch (...) \
{ \
std::ostringstream message; \
message << "otb::ERROR Unknown error while running " << # command << " (catch(...) )"; \
::itk::ExceptionObject e_(__FILE__, __LINE__, message.str().c_str(), ITK_LOCATION); \
throw e_; \
} \
if (result == 1) \
{ \
std::ostringstream message; \
message << "otb::ERROR: " << # command << " should be throwing an exception."; \
::itk::ExceptionObject e_(__FILE__, __LINE__, message.str().c_str(), ITK_LOCATION); \
throw e_; \
} \
}
# define otbUnusedMacro(x) do { (void)sizeof(x); } while(0)
//
// Unused variable warnings in Debug/Release management.
// see http://stackoverflow.com/questions/2290509/debug-vs-ndebug#2290616
#ifdef OTB_DEBUG
# define otbUseInDebug( name ) name
# define otbUseInRelease( name )
#else // NDEBUG
# define otbUseInDebug( name )
# define otbUseInRelease( name ) name
#endif // NDEBUG
#endif //end of otbMacro.h
|