OTB  9.0.0
Orfeo Toolbox
otbWrapperMacros.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2022 Centre National d'Etudes Spatiales (CNES)
3  *
4  * This file is part of Orfeo Toolbox
5  *
6  * https://www.orfeo-toolbox.org/
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 #ifndef otbWrapperMacros_h
22 #define otbWrapperMacros_h
23 
24 
25 #define otbAppLogFATAL(x) \
26  { \
27  std::ostringstream msg; \
28  msg << "" x << std::endl; \
29  this->GetLogger()->Fatal(msg.str()); \
30  { \
31  std::ostringstream message; \
32  message << "otb::ApplicationException " x; \
33  ::otb::ApplicationException e_(__FILE__, __LINE__, message.str(), ITK_LOCATION); \
34  throw e_; /* Explicit naming to work around Intel compiler bug. */ \
35  } \
36  }
37 
38 #define otbAppLogCRITICAL(x) \
39  { \
40  std::ostringstream msg; \
41  msg << "" x << std::endl; \
42  this->GetLogger()->Write(itk::LoggerBase::CRITICAL, msg.str()); \
43  }
44 
45 #define otbAppLogWARNING(x) \
46  { \
47  std::ostringstream msg; \
48  msg << "" x << std::endl; \
49  this->GetLogger()->Write(itk::LoggerBase::WARNING, msg.str()); \
50  }
51 
52 #define otbAppLogINFO(x) \
53  { \
54  std::ostringstream msg; \
55  msg << "" x << std::endl; \
56  this->GetLogger()->Write(itk::LoggerBase::INFO, msg.str()); \
57  }
58 
59 #define otbAppLogDEBUG(x) \
60  { \
61  std::ostringstream msg; \
62  msg << "" x << std::endl; \
63  this->GetLogger()->Write(itk::LoggerBase::DEBUG, msg.str()); \
64  }
65 
66 #endif